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
403909b598e4c735a1a1e47c429593eb54164b7e
Update SR test values in line with diffspike changes
peppy/osu-new,UselessToucan/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,ppy/osu
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Osu.Difficulty; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; [TestCase(6.7568168283591499d, "diffcalc-test")] [TestCase(1.0348244046058293d, "zero-length-sliders")] public void Test(double expected, string name) => base.Test(expected, name); [TestCase(8.4783236764532557d, "diffcalc-test")] [TestCase(1.2708532136987165d, "zero-length-sliders")] public void TestClockRateAdjusted(double expected, string name) => Test(expected, name, new OsuModDoubleTime()); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Osu.Difficulty; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; [TestCase(6.9311451172574934d, "diffcalc-test")] [TestCase(1.0736586907780401d, "zero-length-sliders")] public void Test(double expected, string name) => base.Test(expected, name); [TestCase(8.7212283220412345d, "diffcalc-test")] [TestCase(1.3212137158641493d, "zero-length-sliders")] public void TestClockRateAdjusted(double expected, string name) => Test(expected, name, new OsuModDoubleTime()); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } }
mit
C#
27f992efe1456aa3c1f61459742406d779e24b15
Fix not null constraint failed exception
06b/Dalian,06b/Dalian
src/Dalian/Models/Sites.cs
src/Dalian/Models/Sites.cs
using NPoco; using System; namespace Dalian.Models { [PrimaryKey("SiteId", AutoIncrement = false)] public class Sites { public string SiteId { get; set; } public string Name { get; set; } public string Url { get; set; } public string Note { get; set; } public string Source { get; set; } public DateTime DateTime { get; set; } public bool Active { get; set; } public string MetaTitle { get; set; } public string MetaDescription { get; set; } public string MetaKeywords { get; set; } public int Status { get; set; } public bool Bookmarklet { get; set; } public bool ReadItLater { get; set; } public bool Clipped { get; set; } public string ArchiveUrl { get; set; } public bool Highlight { get; set; } public bool PersonalHighlight { get; set; } } }
using NPoco; using System; namespace Dalian.Models { [PrimaryKey("SiteId")] public class Sites { public string SiteId { get; set; } public string Name { get; set; } public string Url { get; set; } public string Note { get; set; } public string Source { get; set; } public DateTime DateTime { get; set; } public bool Active { get; set; } public string MetaTitle { get; set; } public string MetaDescription { get; set; } public string MetaKeywords { get; set; } public int Status { get; set; } public bool Bookmarklet { get; set; } public bool ReadItLater { get; set; } public bool Clipped { get; set; } public string ArchiveUrl { get; set; } public bool Highlight { get; set; } public bool PersonalHighlight { get; set; } } }
mit
C#
b7c9df02a71b0b7ef93bba32c9b137e67a765df2
disable optimizations
eugenpodaru/resume,eugenpodaru/resume,eugenpodaru/resume
Resume/App_Start/BundleConfig.cs
Resume/App_Start/BundleConfig.cs
namespace Resume { using System.Web.Optimization; public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { // javascript bundles bundles.Add(new ScriptBundle("~/bundles/js") .Include("~/Content/Scripts/app/app.min.js")); //style sheet bundles bundles.Add(new StyleBundle("~/Content/Styles/css") .Include("~/Content/Styles/theme.min.css")); #if DEBUG // Set EnableOptimizations to false for debugging. For more information, // visit http://go.microsoft.com/fwlink/?LinkId=301862 BundleTable.EnableOptimizations = false; #else BundleTable.EnableOptimizations = false; #endif } } }
namespace Resume { using System.Web.Optimization; public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { // javascript bundles bundles.Add(new ScriptBundle("~/bundles/js") .Include("~/Content/Scripts/app/app.js")); //style sheet bundles bundles.Add(new StyleBundle("~/Content/Styles/css") .Include("~/Content/Styles/theme.min.css")); #if DEBUG // Set EnableOptimizations to false for debugging. For more information, // visit http://go.microsoft.com/fwlink/?LinkId=301862 BundleTable.EnableOptimizations = false; #else BundleTable.EnableOptimizations = true; #endif } } }
mit
C#
bfe4825cd6255fa2fb5121882e4061689bd0936a
Define ITaskPaneConnection interface as contravariant
NetOfficeFw/NetOffice
Source/Office/Tools/ITaskPane.cs
Source/Office/Tools/ITaskPane.cs
using System; using NetOffice; using NetOffice.Attributes; using NetOffice.Tools; namespace NetOffice.OfficeApi.Tools { /// <summary> /// Connection part for the <see cref="ITaskPane"/> objects representing custom task panes. /// </summary> /// <typeparam name="T">Office Host Application</typeparam> public interface ITaskPaneConnection<in T> where T : ICOMObject { /// <summary> /// Called after startup to set the application instance and custom arguments to the custom task pane. /// </summary> /// <param name="application">host application instance</param> /// <param name="parentPane">custom task pane definition </param> /// <param name="customArguments">custom arguments</param> void OnConnection(T application, NetOffice.OfficeApi._CustomTaskPane parentPane, object[] customArguments); } /// <summary> /// Office TaskPane UserControl classes can implement this interface in NetOffice Tools Addin (COMAddin) as a special service. /// NetOffice will call ITaskPane members automatically. /// </summary> public interface ITaskPane : OfficeApi.Tools.ITaskPaneConnection<ICOMObject> { /// <summary> /// Called when Microsoft Office application is shuting down. /// The method is not called in case of unexpected termination of process. /// </summary> void OnDisconnection(); /// <summary> /// Called when the user changes the dock position of the custom task pane. /// </summary> /// <param name="position">the current alignment for the instance</param> /// <remarks> /// This event is not fired when custom task pane size is changed. /// Use the <see cref="System.Windows.Forms.Control.Resize"/> event to listen for size changes. /// </remarks> void OnDockPositionChanged(NetOffice.OfficeApi.Enums.MsoCTPDockPosition position); /// <summary> /// Called when the user displays or closes the custom task pane. /// </summary> /// <param name="visible">the current visibility for the instance</param> /// <remarks> /// The <see cref="System.Windows.Forms.Control.VisibleChanged"/> event does not work as expected in a custom task pane scenarios. /// </remarks> void OnVisibleStateChanged(bool visible); } }
using System; using NetOffice; using NetOffice.Attributes; using NetOffice.Tools; namespace NetOffice.OfficeApi.Tools { /// <summary> /// Connection part for the <see cref="ITaskPane"/> objects representing custom task panes. /// </summary> /// <typeparam name="T">Office Host Application</typeparam> public interface ITaskPaneConnection<T> where T : ICOMObject { /// <summary> /// Called after startup to set the application instance and custom arguments to the custom task pane. /// </summary> /// <param name="application">host application instance</param> /// <param name="parentPane">custom task pane definition </param> /// <param name="customArguments">custom arguments</param> void OnConnection(T application, NetOffice.OfficeApi._CustomTaskPane parentPane, object[] customArguments); } /// <summary> /// Office TaskPane UserControl classes can implement this interface in NetOffice Tools Addin (COMAddin) as a special service. /// NetOffice will call ITaskPane members automatically. /// </summary> public interface ITaskPane : OfficeApi.Tools.ITaskPaneConnection<ICOMObject> { /// <summary> /// Called when Microsoft Office application is shuting down. /// The method is not called in case of unexpected termination of process. /// </summary> void OnDisconnection(); /// <summary> /// Called when the user changes the dock position of the custom task pane. /// </summary> /// <param name="position">the current alignment for the instance</param> /// <remarks> /// This event is not fired when custom task pane size is changed. /// Use the <see cref="System.Windows.Forms.Control.Resize"/> event to listen for size changes. /// </remarks> void OnDockPositionChanged(NetOffice.OfficeApi.Enums.MsoCTPDockPosition position); /// <summary> /// Called when the user displays or closes the custom task pane. /// </summary> /// <param name="visible">the current visibility for the instance</param> /// <remarks> /// The <see cref="System.Windows.Forms.Control.VisibleChanged"/> event does not work as expected in a custom task pane scenarios. /// </remarks> void OnVisibleStateChanged(bool visible); } }
mit
C#
2eb16bf3d71dfffb344cf3a799fb09080ec3a8c7
Remove check for bytes sent
ethanmoffat/EndlessClient
EOLib/Net/Communication/PacketSendService.cs
EOLib/Net/Communication/PacketSendService.cs
// Original Work Copyright (c) Ethan Moffat 2014-2016 // This file is subject to the GPL v2 License // For additional details, see the LICENSE file using System.Threading.Tasks; namespace EOLib.Net.Communication { public class PacketSendService : IPacketSendService { private readonly INetworkClientProvider _networkClientProvider; private readonly IPacketQueueProvider _packetQueueProvider; public PacketSendService(INetworkClientProvider networkClientProvider, IPacketQueueProvider packetQueueProvider) { _networkClientProvider = networkClientProvider; _packetQueueProvider = packetQueueProvider; } public void SendPacket(IPacket packet) { var bytes = Client.Send(packet); if (bytes == 0) throw new NoDataSentException(); } public async Task SendPacketAsync(IPacket packet) { var bytes = await Client.SendAsync(packet); if (bytes == 0) throw new NoDataSentException(); } public async Task<IPacket> SendRawPacketAndWaitAsync(IPacket packet) { var bytes = await Client.SendRawPacketAsync(packet); if (bytes == 0) throw new NoDataSentException(); var responsePacket = await _packetQueueProvider.PacketQueue.WaitForPacketAndDequeue(); if (responsePacket is EmptyPacket) throw new EmptyPacketReceivedException(); return responsePacket; } public async Task<IPacket> SendEncodedPacketAndWaitAsync(IPacket packet) { var bytes = await Client.SendAsync(packet); if (bytes == 0) throw new NoDataSentException(); var responsePacket = await _packetQueueProvider.PacketQueue.WaitForPacketAndDequeue(); if (responsePacket is EmptyPacket) throw new EmptyPacketReceivedException(); return responsePacket; } private INetworkClient Client { get { return _networkClientProvider.NetworkClient; } } } }
// Original Work Copyright (c) Ethan Moffat 2014-2016 // This file is subject to the GPL v2 License // For additional details, see the LICENSE file using System.Threading.Tasks; namespace EOLib.Net.Communication { public class PacketSendService : IPacketSendService { private readonly INetworkClientProvider _networkClientProvider; private readonly IPacketQueueProvider _packetQueueProvider; public PacketSendService(INetworkClientProvider networkClientProvider, IPacketQueueProvider packetQueueProvider) { _networkClientProvider = networkClientProvider; _packetQueueProvider = packetQueueProvider; } public void SendPacket(IPacket packet) { var bytes = Client.Send(packet); if (bytes == 0 || bytes != packet.Length) throw new NoDataSentException(); } public async Task SendPacketAsync(IPacket packet) { var bytes = await Client.SendAsync(packet); if (bytes == 0 || bytes != packet.Length) throw new NoDataSentException(); } public async Task<IPacket> SendRawPacketAndWaitAsync(IPacket packet) { var bytes = await Client.SendRawPacketAsync(packet); if (bytes == 0 || bytes != packet.Length) throw new NoDataSentException(); var responsePacket = await _packetQueueProvider.PacketQueue.WaitForPacketAndDequeue(); if (responsePacket is EmptyPacket) throw new EmptyPacketReceivedException(); return responsePacket; } public async Task<IPacket> SendEncodedPacketAndWaitAsync(IPacket packet) { var bytes = await Client.SendAsync(packet); if (bytes == 0 || bytes != packet.Length) throw new NoDataSentException(); var responsePacket = await _packetQueueProvider.PacketQueue.WaitForPacketAndDequeue(); if (responsePacket is EmptyPacket) throw new EmptyPacketReceivedException(); return responsePacket; } private INetworkClient Client { get { return _networkClientProvider.NetworkClient; } } } }
mit
C#
e092f589ba5d07a4dd2c46eb69ebe2dbe26e63ba
add SingleOrDefaultOrThrow XML doc
OlegKleyman/Omego.Extensions
core/Omego.Extensions/QueryableExtensions/SingleOrDefaultOrThrow.cs
core/Omego.Extensions/QueryableExtensions/SingleOrDefaultOrThrow.cs
namespace Omego.Extensions.QueryableExtensions { using System; using System.Linq; using System.Linq.Expressions; /// <summary> /// Contains extension methods for <see cref="IQueryable{T}" />. /// </summary> public static partial class Queryable { /// <summary> /// Returns a single element of an <see cref="IQueryable{T}" /> matching the given predicate or returns /// a requested default object of type <typeparamref name="T" /> or throws an exception specified /// for the <paramref name="multipleMatchesFoundException" /> parameter if multiple are found. /// </summary> /// <param name="queryable">The queryable to find the single element in.</param> /// <param name="predicate">The predicate to use to find a single match.</param> /// <param name="default">The object to return if no elements are found.</param> /// <param name="multipleMatchesFoundException">The exception to throw when multiple matches are found.</param> /// <typeparam name="T">The type of the object to return.</typeparam> /// <returns>An instance of <typeparamref name="T" />.</returns> public static T SingleOrDefaultOrThrow<T>( this IQueryable<T> queryable, Expression<Func<T, bool>> predicate, T @default, Exception multipleMatchesFoundException) { return queryable.SingleOrDefaultOrThrow(predicate, () => @default, multipleMatchesFoundException); } /// <summary> /// Returns a single element of an <see cref="IQueryable{T}" /> matching the given predicate or returns /// a requested default object of type <typeparamref name="T" /> or throws an exception specified /// for the <paramref name="multipleMatchesFoundException" /> parameter if multiple are found. /// </summary> /// <param name="queryable">The queryable to find the single element in.</param> /// <param name="predicate">The predicate to use to find a single match.</param> /// <param name="default"> /// The <see cref="Func{TResult}"/> of <typeparamref name="T"/> to retrieve the /// default object to return if no elements are found. /// </param> /// <param name="multipleMatchesFoundException">The exception to throw when multiple matches are found.</param> /// <typeparam name="T">The type of the object to return.</typeparam> /// <returns>An instance of <typeparamref name="T" />.</returns> public static T SingleOrDefaultOrThrow<T>( this IQueryable<T> queryable, Expression<Func<T, bool>> predicate, Func<T> @default, Exception multipleMatchesFoundException) => queryable.SingleElementOrThrowOnMultiple(predicate, multipleMatchesFoundException).ValueOr(@default); } }
namespace Omego.Extensions.QueryableExtensions { using System; using System.Linq; using System.Linq.Expressions; /// <summary> /// Contains extension methods for <see cref="IQueryable{T}" />. /// </summary> public static partial class Queryable { /// <summary> /// Returns a single element of an <see cref="IQueryable{T}" /> matching the given predicate or returns /// a requested default object of type <typeparamref name="T" /> or throws an exception specified /// for the <paramref name="multipleMatchesFoundException" /> parameter if multiple are found. /// </summary> /// <param name="queryable">The queryable to find the single element in.</param> /// <param name="predicate">The predicate to use to find a single match.</param> /// <param name="default">The object to return if no elements are found.</param> /// <param name="multipleMatchesFoundException">The exception to throw when multiple matches are found.</param> /// <typeparam name="T">The type of the object to return.</typeparam> /// <returns>An instance of <typeparamref name="T" />.</returns> public static T SingleOrDefaultOrThrow<T>( this IQueryable<T> queryable, Expression<Func<T, bool>> predicate, T @default, Exception multipleMatchesFoundException) { return queryable.SingleOrDefaultOrThrow(predicate, () => @default, multipleMatchesFoundException); } public static T SingleOrDefaultOrThrow<T>( this IQueryable<T> queryable, Expression<Func<T, bool>> predicate, Func<T> @default, Exception multipleMatchesFoundException) { return queryable.SingleElementOrThrowOnMultiple(predicate, multipleMatchesFoundException).ValueOr(@default); } } }
unlicense
C#
342ed89d998d96514d18398488cd342965d124e1
Add warning when GitVersion is used with SSH endpoint and NoFetch is disabled
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/Tools/GitVersion/GitVersionAttribute.cs
source/Nuke.Common/Tools/GitVersion/GitVersionAttribute.cs
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; using System.Reflection; using JetBrains.Annotations; using Nuke.Common.CI.AppVeyor; using Nuke.Common.CI.AzurePipelines; using Nuke.Common.CI.TeamCity; using Nuke.Common.Execution; using Nuke.Common.Git; using Nuke.Common.Tooling; using Nuke.Common.ValueInjection; using static Nuke.Common.ControlFlow; namespace Nuke.Common.Tools.GitVersion { /// <summary> /// Injects an instance of <see cref="GitVersion"/> based on the local repository. /// </summary> [PublicAPI] [UsedImplicitly(ImplicitUseKindFlags.Default)] public class GitVersionAttribute : ValueInjectionAttributeBase { public string Framework { get; set; } = "netcoreapp3.0"; public bool DisableOnUnix { get; set; } public bool UpdateAssemblyInfo { get; set; } public bool UpdateBuildNumber { get; set; } = true; public bool NoFetch { get; set; } public override object GetValue(MemberInfo member, object instance) { // TODO: https://github.com/GitTools/GitVersion/issues/1097 if (EnvironmentInfo.IsUnix && DisableOnUnix) { Logger.Warn($"{nameof(GitVersion)} is disabled on UNIX environment."); return null; } var repository = SuppressErrors(() => GitRepository.FromLocalDirectory(NukeBuild.RootDirectory)); AssertWarn(repository == null || repository.Protocol != GitProtocol.Ssh || NoFetch, $"{nameof(GitVersion)} does not support fetching SSH endpoints. Enable {nameof(NoFetch)} to skip fetching."); var gitVersion = GitVersionTasks.GitVersion(s => s .SetFramework(Framework) .SetNoFetch(NoFetch) .DisableLogOutput() .SetUpdateAssemblyInfo(UpdateAssemblyInfo)) .Result; if (UpdateBuildNumber) { AzurePipelines.Instance?.UpdateBuildNumber(gitVersion.FullSemVer); TeamCity.Instance?.SetBuildNumber(gitVersion.FullSemVer); AppVeyor.Instance?.UpdateBuildVersion($"{gitVersion.FullSemVer}.build.{AppVeyor.Instance.BuildNumber}"); } return gitVersion; } } }
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; using System.Reflection; using JetBrains.Annotations; using Nuke.Common.CI.AppVeyor; using Nuke.Common.CI.AzurePipelines; using Nuke.Common.CI.TeamCity; using Nuke.Common.Execution; using Nuke.Common.Tooling; using Nuke.Common.ValueInjection; namespace Nuke.Common.Tools.GitVersion { /// <summary> /// Injects an instance of <see cref="GitVersion"/> based on the local repository. /// </summary> [PublicAPI] [UsedImplicitly(ImplicitUseKindFlags.Default)] public class GitVersionAttribute : ValueInjectionAttributeBase { public string Framework { get; set; } = "netcoreapp3.0"; public bool DisableOnUnix { get; set; } public bool UpdateAssemblyInfo { get; set; } public bool UpdateBuildNumber { get; set; } = true; public bool NoFetch { get; set; } public override object GetValue(MemberInfo member, object instance) { // TODO: https://github.com/GitTools/GitVersion/issues/1097 if (EnvironmentInfo.IsUnix && DisableOnUnix) { Logger.Warn($"{nameof(GitVersion)} is disabled on UNIX environment."); return null; } var gitVersion = GitVersionTasks.GitVersion(s => s .SetFramework(Framework) .SetNoFetch(NoFetch) .DisableLogOutput() .SetUpdateAssemblyInfo(UpdateAssemblyInfo)) .Result; if (UpdateBuildNumber) { AzurePipelines.Instance?.UpdateBuildNumber(gitVersion.FullSemVer); TeamCity.Instance?.SetBuildNumber(gitVersion.FullSemVer); AppVeyor.Instance?.UpdateBuildVersion($"{gitVersion.FullSemVer}.build.{AppVeyor.Instance.BuildNumber}"); } return gitVersion; } } }
mit
C#
439fafd0939c1043f87dda30c76c2613181457e1
Use IMagickImage instead of IMagickImage<QuantumType>.
dlemstra/Magick.NET,dlemstra/Magick.NET
src/Magick.NET/Shared/Extensions/IMagickImageExtensions.cs
src/Magick.NET/Shared/Extensions/IMagickImageExtensions.cs
// Copyright 2013-2020 Dirk Lemstra <https://github.com/dlemstra/Magick.NET/> // // Licensed under the ImageMagick License (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // // https://www.imagemagick.org/script/license.php // // 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; #if Q8 using QuantumType = System.Byte; #elif Q16 using QuantumType = System.UInt16; #elif Q16HDRI using QuantumType = System.Single; #else #error Not implemented! #endif namespace ImageMagick { internal static class IMagickImageExtensions { internal static IntPtr GetInstance(this IMagickImage self) { if (self == null) return IntPtr.Zero; if (self is INativeInstance nativeInstance) return nativeInstance.Instance; throw new NotSupportedException(); } internal static MagickSettings GetSettings(this IMagickImage<QuantumType> self) { var settings = self?.Settings as MagickSettings; if (settings != null) return settings; throw new NotSupportedException(); } internal static IMagickErrorInfo CreateErrorInfo(this IMagickImage self) { if (self == null) return null; if (self is MagickImage image) return MagickImage.CreateErrorInfo(image); throw new NotSupportedException(); } internal static void SetNext(this IMagickImage self, IMagickImage next) { if (self is MagickImage image) image.SetNext(next); else throw new NotSupportedException(); } } }
// Copyright 2013-2020 Dirk Lemstra <https://github.com/dlemstra/Magick.NET/> // // Licensed under the ImageMagick License (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // // https://www.imagemagick.org/script/license.php // // 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; #if Q8 using QuantumType = System.Byte; #elif Q16 using QuantumType = System.UInt16; #elif Q16HDRI using QuantumType = System.Single; #else #error Not implemented! #endif namespace ImageMagick { internal static class IMagickImageExtensions { internal static IntPtr GetInstance(this IMagickImage<QuantumType> self) { if (self == null) return IntPtr.Zero; if (self is INativeInstance nativeInstance) return nativeInstance.Instance; throw new NotSupportedException(); } internal static MagickSettings GetSettings(this IMagickImage<QuantumType> self) { var settings = self?.Settings as MagickSettings; if (settings != null) return settings; throw new NotSupportedException(); } internal static IMagickErrorInfo CreateErrorInfo(this IMagickImage<QuantumType> self) { if (self == null) return null; if (self is MagickImage image) return MagickImage.CreateErrorInfo(image); throw new NotSupportedException(); } internal static void SetNext(this IMagickImage<QuantumType> self, IMagickImage<QuantumType> next) { if (self is MagickImage image) image.SetNext(next); else throw new NotSupportedException(); } } }
apache-2.0
C#
77e65aa1ffe117294e0ee90a1c4ded844bb60e05
Check if registered before trying.
ZocDoc/ServiceStack,ZocDoc/ServiceStack,ZocDoc/ServiceStack,ZocDoc/ServiceStack
src/ServiceStack/DependencyInjection/DependencyResolver.cs
src/ServiceStack/DependencyInjection/DependencyResolver.cs
using System; using System.Collections.Generic; using Autofac; using Autofac.Core; namespace ServiceStack.DependencyInjection { public class DependencyResolver : IDisposable { private readonly ILifetimeScope _lifetimeScope; public DependencyResolver(ILifetimeScope lifetimeScope) { _lifetimeScope = lifetimeScope; } public T Resolve<T>() { return _lifetimeScope.Resolve<T>(); } public object Resolve(Type type) { return _lifetimeScope.Resolve(type); } public T TryResolve<T>() { if (_lifetimeScope.IsRegistered<T>()) { try { return _lifetimeScope.Resolve<T>(); } catch (DependencyResolutionException unusedException) { return default(T); } } else { return default (T); } } public void Dispose() { _lifetimeScope.Dispose(); } } }
using System; using System.Collections.Generic; using Autofac; using Autofac.Core; namespace ServiceStack.DependencyInjection { public class DependencyResolver : IDisposable { private readonly ILifetimeScope _lifetimeScope; public DependencyResolver(ILifetimeScope lifetimeScope) { _lifetimeScope = lifetimeScope; } public T Resolve<T>() { return _lifetimeScope.Resolve<T>(); } public object Resolve(Type type) { return _lifetimeScope.Resolve(type); } public T TryResolve<T>() { try { return _lifetimeScope.Resolve<T>(); } catch (DependencyResolutionException unusedException) { return default(T); } } public void Dispose() { _lifetimeScope.Dispose(); } } }
bsd-3-clause
C#
68500dc9491b3fbdff3858f6d3bc32b624f09dea
Remove an extra "// Licensed under the Apache License Version 2.0."
chrsmith/google-cloud-powershell,marceloyuela/google-cloud-powershell,GoogleCloudPlatform/google-cloud-powershell,ILMTitan/google-cloud-powershell,marceloyuela/google-cloud-powershell,marceloyuela/google-cloud-powershell
Google.PowerShell/Properties/AssemblyInfo.cs
Google.PowerShell/Properties/AssemblyInfo.cs
// Copyright 2015-2016 Google Inc. All Rights Reserved. // Licensed under the Apache License Version 2.0. using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PowerShell tools for the Google Cloud Platform")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Google Inc.")] [assembly: AssemblyProduct("PowerShell tools for the Google Cloud Platform")] [assembly: AssemblyCopyright("Copyright 2015 Google Inc. All Rights Reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Allow the unit tests assembly to view internal values. [assembly: InternalsVisibleTo("Google.PowerShell.Tests")] // 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("d338c5d3-5fc3-408f-9f7f-d53e7b213505")] // 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")]
// Copyright 2015-2016 Google Inc. All Rights Reserved. // Licensed under the Apache License Version 2.0. // Licensed under the Apache License Version 2.0. using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PowerShell tools for the Google Cloud Platform")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Google Inc.")] [assembly: AssemblyProduct("PowerShell tools for the Google Cloud Platform")] [assembly: AssemblyCopyright("Copyright 2015 Google Inc. All Rights Reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Allow the unit tests assembly to view internal values. [assembly: InternalsVisibleTo("Google.PowerShell.Tests")] // 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("d338c5d3-5fc3-408f-9f7f-d53e7b213505")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
374dac57f2b3c4ea34a24929700119fa9a4eb52a
Change expanded card content height to 200
NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu,ppy/osu
osu.Game/Beatmaps/Drawables/Cards/ExpandedContentScrollContainer.cs
osu.Game/Beatmaps/Drawables/Cards/ExpandedContentScrollContainer.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Input.Events; using osu.Framework.Utils; using osu.Game.Graphics.Containers; namespace osu.Game.Beatmaps.Drawables.Cards { public class ExpandedContentScrollContainer : OsuScrollContainer { public const float HEIGHT = 200; public ExpandedContentScrollContainer() { ScrollbarVisible = false; } protected override void Update() { base.Update(); Height = Math.Min(Content.DrawHeight, HEIGHT); } private bool allowScroll => !Precision.AlmostEquals(DrawSize, Content.DrawSize); protected override bool OnDragStart(DragStartEvent e) { if (!allowScroll) return false; return base.OnDragStart(e); } protected override void OnDrag(DragEvent e) { if (!allowScroll) return; base.OnDrag(e); } protected override void OnDragEnd(DragEndEvent e) { if (!allowScroll) return; base.OnDragEnd(e); } protected override bool OnScroll(ScrollEvent e) { if (!allowScroll) return false; return base.OnScroll(e); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Input.Events; using osu.Framework.Utils; using osu.Game.Graphics.Containers; namespace osu.Game.Beatmaps.Drawables.Cards { public class ExpandedContentScrollContainer : OsuScrollContainer { public const float HEIGHT = 400; public ExpandedContentScrollContainer() { ScrollbarVisible = false; } protected override void Update() { base.Update(); Height = Math.Min(Content.DrawHeight, HEIGHT); } private bool allowScroll => !Precision.AlmostEquals(DrawSize, Content.DrawSize); protected override bool OnDragStart(DragStartEvent e) { if (!allowScroll) return false; return base.OnDragStart(e); } protected override void OnDrag(DragEvent e) { if (!allowScroll) return; base.OnDrag(e); } protected override void OnDragEnd(DragEndEvent e) { if (!allowScroll) return; base.OnDragEnd(e); } protected override bool OnScroll(ScrollEvent e) { if (!allowScroll) return false; return base.OnScroll(e); } } }
mit
C#
2c76c91e71b5f0c61dd582beec0786bfbc9457da
Bump copyright year
twcclegg/log4net,freedomvoice/log4net,freedomvoice/log4net,twcclegg/log4net,twcclegg/log4net,twcclegg/log4net,freedomvoice/log4net,freedomvoice/log4net
src/AssemblyVersionInfo.cs
src/AssemblyVersionInfo.cs
#region Apache License // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: System.Reflection.AssemblyVersion("1.2.11.0")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2")] #if !NETCF #if !SSCLI [assembly: System.Reflection.AssemblyFileVersion("1.2.11.0")] #endif #endif // // Shared assembly settings // [assembly: System.Reflection.AssemblyCompany("The Apache Software Foundation")] [assembly: System.Reflection.AssemblyCopyright("Copyright 2004-2013 The Apache Software Foundation.")] [assembly: System.Reflection.AssemblyTrademark("Apache and Apache log4net are trademarks of The Apache Software Foundation")]
#region Apache License // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to you under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: System.Reflection.AssemblyVersion("1.2.11.0")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2")] #if !NETCF #if !SSCLI [assembly: System.Reflection.AssemblyFileVersion("1.2.11.0")] #endif #endif // // Shared assembly settings // [assembly: System.Reflection.AssemblyCompany("The Apache Software Foundation")] [assembly: System.Reflection.AssemblyCopyright("Copyright 2004-2011 The Apache Software Foundation.")] [assembly: System.Reflection.AssemblyTrademark("Apache and Apache log4net are trademarks of The Apache Software Foundation")]
apache-2.0
C#
ff77aa78bd8faf34193205e630ba27eb08aeee4d
Bump to version 1.5
toehead2001/pdn-barcode
Barcode/Properties/AssemblyInfo.cs
Barcode/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Barcode Effect")] [assembly: AssemblyDescription("Barcode Generator")] [assembly: AssemblyConfiguration("Barcode|Code 39|POSTNET|UPC")] [assembly: AssemblyCompany("Sepcot & toe_head2001")] [assembly: AssemblyProduct("Barcode Effect")] [assembly: AssemblyCopyright("Copyright © 2018 Michael J. Sepcot & toe_head2001")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.5.0.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Barcode Effect")] [assembly: AssemblyDescription("Barcode Generator")] [assembly: AssemblyConfiguration("Barcode|Code 39|POSTNET|UPC")] [assembly: AssemblyCompany("Sepcot & toe_head2001")] [assembly: AssemblyProduct("Barcode Effect")] [assembly: AssemblyCopyright("Copyright © Michael J. Sepcot & toe_head2001")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.4.0.0")]
mit
C#
03b2b5f13e23c36b86ffda0ff2c9f57ca3a4724d
Enable Cross-Origin Requests
leonaascimento/Neblina
src/Neblina.Api/Startup.cs
src/Neblina.Api/Startup.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Neblina.Api.Persistence; using Neblina.Api.Core; namespace Neblina.Api { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddDbContext<Persistence.BankingContext>( options => options.UseSqlite("Data Source=banking.db")); services.AddCors(); services.AddMvc(); // Add application services. services.AddTransient<IUnitOfWork, UnitOfWork>(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseCors(builder => builder.AllowAnyOrigin() .AllowAnyHeader()); app.UseMvc(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Neblina.Api.Persistence; using Neblina.Api.Core; namespace Neblina.Api { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddDbContext<Persistence.BankingContext>( options => options.UseSqlite("Data Source=banking.db")); services.AddMvc(); // Add application services. services.AddTransient<IUnitOfWork, UnitOfWork>(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseMvc(); } } }
mit
C#
ce68566751b6c3b8aa63446c2ebbddd89a1a85a5
Change message in register success
leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net
Joinrpg/Views/Account/RegisterSuccess.cshtml
Joinrpg/Views/Account/RegisterSuccess.cshtml
@model dynamic @{ ViewBag.Title = "Регистрация успешна"; } <h2>@ViewBag.Title</h2> <p>Остался всего один клик! Проверьте свою почту, там лежит письмо от нас с просьбой подтвердить email.</p>
@model dynamic @{ ViewBag.Title = "Регистрация успешна"; } <h2>@ViewBag.Title</h2> <p>Остался всего один клик! Проверьте свою почту, там лежит письмо от нас с просьбой подтвердить email...</p>
mit
C#
aba85a9cc8718d68ea3971e24b77df09ffd5719a
Indent with 4 spaces
msarchet/Bundler,msarchet/Bundler
BundlerMiddleware/IFileResolver.cs
BundlerMiddleware/IFileResolver.cs
namespace BundlerMiddleware { using Microsoft.Owin; /// <summary> /// Used for resolving file paths to full paths /// </summary> public interface IFileResolver { /// <summary> /// Gets the full file path for the route /// </summary> /// <param name="context">Request Context</param> /// <param name="route">Route to resolve the path for</param> /// <returns>The full file path</returns> string GetFilePath(IOwinContext context, BundlerRoute route); } }
namespace BundlerMiddleware { using Microsoft.Owin; /// <summary> /// Used for resolving file paths to full paths /// </summary> public interface IFileResolver { /// <summary> /// Gets the full file path for the route /// </summary> /// <param name="context">Request Context</param> /// <param name="route">Route to resolve the path for</param> /// <returns>The full file path</returns> string GetFilePath(IOwinContext context, BundlerRoute route); } }
mit
C#
c3766763ca1f73ba8a5ae9b35104b235f2935e33
Update Program.cs
tvert/GitTest1
ConsoleApp1/ConsoleApp1/Program.cs
ConsoleApp1/ConsoleApp1/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { // Code amended in GitHub // Code amended #2 in GitHub } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { // Code amended in GitHub } } }
mit
C#
68d1935fc91c40fc2ce082e6a30f3e9801337935
Fix events
DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer
LmpClient/Systems/VesselFairingsSys/VesselFairingsSystem.cs
LmpClient/Systems/VesselFairingsSys/VesselFairingsSystem.cs
using LmpClient.Base; using LmpClient.Systems.TimeSync; using System; using System.Collections.Concurrent; namespace LmpClient.Systems.VesselFairingsSys { /// <summary> /// This class syncs the fairings between players /// </summary> public class VesselFairingsSystem : MessageSystem<VesselFairingsSystem, VesselFairingsMessageSender, VesselFairingsMessageHandler> { #region Fields & properties public ConcurrentDictionary<Guid, VesselFairingQueue> VesselFairings { get; } = new ConcurrentDictionary<Guid, VesselFairingQueue>(); private VesselFairingEvents VesselFairingEvents { get; } = new VesselFairingEvents(); #endregion #region Base overrides protected override bool ProcessMessagesInUnityThread => false; public override string SystemName { get; } = nameof(VesselFairingsSystem); protected override void OnEnabled() { base.OnEnabled(); GameEvents.onFairingsDeployed.Add(VesselFairingEvents.FairingsDeployed); SetupRoutine(new RoutineDefinition(1500, RoutineExecution.Update, ProcessVesselFairings)); } protected override void OnDisabled() { base.OnDisabled(); GameEvents.onFairingsDeployed.Remove(VesselFairingEvents.FairingsDeployed); VesselFairings.Clear(); } #endregion #region Update routines private void ProcessVesselFairings() { foreach (var keyVal in VesselFairings) { while (keyVal.Value.TryPeek(out var update) && update.GameTime <= TimeSyncSystem.UniversalTime) { keyVal.Value.TryDequeue(out update); update.ProcessFairing(); keyVal.Value.Recycle(update); } } } #endregion #region Public methods /// <summary> /// Removes a vessel from the system /// </summary> public void RemoveVessel(Guid vesselId) { VesselFairings.TryRemove(vesselId, out _); } #endregion } }
using LmpClient.Base; using LmpClient.Systems.TimeSync; using System; using System.Collections.Concurrent; namespace LmpClient.Systems.VesselFairingsSys { /// <summary> /// This class syncs the fairings between players /// </summary> public class VesselFairingsSystem : MessageSystem<VesselFairingsSystem, VesselFairingsMessageSender, VesselFairingsMessageHandler> { #region Fields & properties public ConcurrentDictionary<Guid, VesselFairingQueue> VesselFairings { get; } = new ConcurrentDictionary<Guid, VesselFairingQueue>(); private VesselFairingEvents VesselFairingEvents { get; } = new VesselFairingEvents(); #endregion #region Base overrides protected override bool ProcessMessagesInUnityThread => false; public override string SystemName { get; } = nameof(VesselFairingsSystem); protected override void OnEnabled() { base.OnEnabled(); GameEvents.onFairingsDeployed.Add(VesselFairingEvents.FairingsDeployed); SetupRoutine(new RoutineDefinition(1500, RoutineExecution.Update, ProcessVesselFairings)); } protected override void OnDisabled() { base.OnDisabled(); VesselFairings.Clear(); } #endregion #region Update routines private void ProcessVesselFairings() { foreach (var keyVal in VesselFairings) { while (keyVal.Value.TryPeek(out var update) && update.GameTime <= TimeSyncSystem.UniversalTime) { keyVal.Value.TryDequeue(out update); update.ProcessFairing(); keyVal.Value.Recycle(update); } } } #endregion #region Public methods /// <summary> /// Removes a vessel from the system /// </summary> public void RemoveVessel(Guid vesselId) { VesselFairings.TryRemove(vesselId, out _); } #endregion } }
mit
C#
c6979c1d636f8c2f2d30a2a01bba940c611e767e
Add --port option to samples
praeclarum/Ooui,praeclarum/Ooui,praeclarum/Ooui
Samples/Program.cs
Samples/Program.cs
using System; using Ooui; namespace Samples { class Program { static void Main (string[] args) { for (var i = 0; i < args.Length; i++) { var a = args[i]; switch (args[i]) { case "-p" when i + 1 < args.Length: case "--port" when i + 1 < args.Length: { int p; if (int.TryParse (args[i + 1], out p)) { UI.Port = p; } i++; } break; } } new ButtonSample ().Publish (); new TodoSample ().Publish (); Console.ReadLine (); } } }
using System; using Ooui; namespace Samples { class Program { static void Main (string[] args) { new ButtonSample ().Publish (); new TodoSample ().Publish (); Console.ReadLine (); } } }
mit
C#
b3e4170f3f006db2aa402667fcdb2762f517d860
Rename arguments to match base names
pieceofsummer/Hangfire.Console,pieceofsummer/Hangfire.Console
src/Hangfire.Console/Server/ConsoleServerFilter.cs
src/Hangfire.Console/Server/ConsoleServerFilter.cs
using Hangfire.Common; using Hangfire.Console.Serialization; using Hangfire.Console.Storage; using Hangfire.Server; using Hangfire.States; using System; namespace Hangfire.Console.Server { /// <summary> /// Server filter to initialize and cleanup console environment. /// </summary> internal class ConsoleServerFilter : IServerFilter { private readonly ConsoleOptions _options; public ConsoleServerFilter(ConsoleOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); _options = options; } public void OnPerforming(PerformingContext filterContext) { var state = filterContext.Connection.GetStateData(filterContext.BackgroundJob.Id); if (state == null) { // State for job not found? return; } if (!string.Equals(state.Name, ProcessingState.StateName, StringComparison.OrdinalIgnoreCase)) { // Not in Processing state? Something is really off... return; } var startedAt = JobHelper.DeserializeDateTime(state.Data["StartedAt"]); filterContext.Items["ConsoleContext"] = new ConsoleContext( new ConsoleId(filterContext.BackgroundJob.Id, startedAt), new ConsoleStorage(filterContext.Connection)); } public void OnPerformed(PerformedContext filterContext) { if (filterContext.Canceled) { // Processing was been cancelled by one of the job filters // There's nothing to do here, as processing hasn't started return; } ConsoleContext.FromPerformContext(filterContext)?.Expire(_options.ExpireIn); } } }
using Hangfire.Common; using Hangfire.Console.Serialization; using Hangfire.Console.Storage; using Hangfire.Server; using Hangfire.States; using System; namespace Hangfire.Console.Server { /// <summary> /// Server filter to initialize and cleanup console environment. /// </summary> internal class ConsoleServerFilter : IServerFilter { private readonly ConsoleOptions _options; public ConsoleServerFilter(ConsoleOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); _options = options; } public void OnPerforming(PerformingContext context) { var state = context.Connection.GetStateData(context.BackgroundJob.Id); if (state == null) { // State for job not found? return; } if (!string.Equals(state.Name, ProcessingState.StateName, StringComparison.OrdinalIgnoreCase)) { // Not in Processing state? Something is really off... return; } var startedAt = JobHelper.DeserializeDateTime(state.Data["StartedAt"]); context.Items["ConsoleContext"] = new ConsoleContext( new ConsoleId(context.BackgroundJob.Id, startedAt), new ConsoleStorage(context.Connection)); } public void OnPerformed(PerformedContext context) { if (context.Canceled) { // Processing was been cancelled by one of the job filters // There's nothing to do here, as processing hasn't started return; } ConsoleContext.FromPerformContext(context)?.Expire(_options.ExpireIn); } } }
mit
C#
7d54e7f025d1602f205171f6c0876a2056b26ec7
Correct assembly title.
Bitmapped/UmbIntranetRestrict,Bitmapped/UmbIntranetRestrict,Bitmapped/UmbIntranetRestrict
src/UmbIntranetRestrict/Properties/AssemblyInfo.cs
src/UmbIntranetRestrict/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("UmbIntranetRestrict")] [assembly: AssemblyDescription("Umbraco package to allow restricting access to Intranet pages.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Brian M. Powell")] [assembly: AssemblyProduct("UmbHttpStatusCode")] [assembly: AssemblyCopyright("Copyright 2016, Brian M. Powell")] [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("743ed641-efbf-40fb-8011-509d13258ecb")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.1.1.0")] [assembly: AssemblyFileVersion("2.1.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("UmbHttpStatusCode")] [assembly: AssemblyDescription("Umbraco package to allow restricting access to Intranet pages.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Brian M. Powell")] [assembly: AssemblyProduct("UmbHttpStatusCode")] [assembly: AssemblyCopyright("Copyright 2016, Brian M. Powell")] [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("743ed641-efbf-40fb-8011-509d13258ecb")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.1.1.0")] [assembly: AssemblyFileVersion("2.1.1.0")]
mit
C#
581544e1d641b44263172509bf5a6cec490c9f46
Fix TD mod not being ranked
smoogipooo/osu,DrabWeb/osu,NeoAdonis/osu,UselessToucan/osu,naoey/osu,ppy/osu,peppy/osu,NeoAdonis/osu,2yangk23/osu,UselessToucan/osu,peppy/osu,ppy/osu,EVAST9919/osu,naoey/osu,ZLima12/osu,peppy/osu-new,DrabWeb/osu,naoey/osu,EVAST9919/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,johnneijzen/osu,UselessToucan/osu,smoogipoo/osu,DrabWeb/osu,smoogipoo/osu,2yangk23/osu,ZLima12/osu,johnneijzen/osu
osu.Game.Rulesets.Osu/Mods/OsuModTouchDevice.cs
osu.Game.Rulesets.Osu/Mods/OsuModTouchDevice.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Osu.Mods { public class OsuModTouchDevice : Mod { public override string Name => "Touch Device"; public override string Acronym => "TD"; public override double ScoreMultiplier => 1; public override bool Ranked => true; } }
// 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.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Osu.Mods { public class OsuModTouchDevice : Mod { public override string Name => "Touch Device"; public override string Acronym => "TD"; public override double ScoreMultiplier => 1; } }
mit
C#
2f8f2fcee78ca0baf869c7f1592fce02e53ed46c
添加版本号。
RabbitTeam/RabbitHub
Components/Rabbit.Components.Data.Migrators/Properties/AssemblyInfo.cs
Components/Rabbit.Components.Data.Migrators/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // 有关程序集的常规信息通过以下 // 特性集控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Rabbit.Components.Data.Migrators")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Rabbit.Components.Data.Migrators")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("595f93f7-4028-4640-85b1-814d4f6f51f9")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.6")] [assembly: AssemblyFileVersion("1.0.0.6")]
using System.Reflection; using System.Runtime.InteropServices; // 有关程序集的常规信息通过以下 // 特性集控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Rabbit.Components.Data.Migrators")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Rabbit.Components.Data.Migrators")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("595f93f7-4028-4640-85b1-814d4f6f51f9")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.5")] [assembly: AssemblyFileVersion("1.0.0.5")]
apache-2.0
C#
87ec80fbb87a5cafff3748ad879fad8b7fd76a67
make healthcheck conform to IMetric so it can be serialized/handled by Serializer (which seems to have changed into something very rigid)
criteo-forks/metrics-net,criteo-forks/metrics-net,gturri/metrics-net,gturri/metrics-net
src/metrics/HealthCheck.cs
src/metrics/HealthCheck.cs
using System; using System.Text; using metrics.Core; namespace metrics { /// <summary> /// A template class for an encapsulated service health check /// </summary> public class HealthCheck { public static Result Healthy { get { return Result.Healthy; } } public static Result Unhealthy(string message) { return Result.Unhealthy(message); } public static Result Unhealthy(Exception error) { return Result.Unhealthy(error); } private readonly Func<Result> _check; public String Name { get; private set; } public HealthCheck(string name, Func<Result> check) { Name = name; _check = check; } public Result Execute() { try { return _check(); } catch (Exception e) { return Result.Unhealthy(e); } } public sealed class Result : IMetric { private static readonly Result _healthy = new Result(true, null, null); public static Result Healthy { get { return _healthy; } } public static Result Unhealthy(string errorMessage) { return new Result(false, errorMessage, null); } public static Result Unhealthy(Exception error) { return new Result(false, error.Message, error); } public string Message { get; private set; } public Exception Error { get; private set; } public bool IsHealthy { get; private set; } private Result(bool isHealthy, string message, Exception error) { IsHealthy = isHealthy; Message = message; Error = error; } public IMetric Copy { get { return new Result(IsHealthy, Message, Error); } } public void LogJson(StringBuilder sb) { sb.Append("{") .Append("\"is_healthy\": \"").Append(IsHealthy).Append("\",") .Append("\"message\":\"").Append(Message).Append("\",") .Append("\"error\":\"").Append(Error.Message).Append("\"") .Append("}"); } } } }
using System; namespace metrics { /// <summary> /// A template class for an encapsulated service health check /// </summary> public class HealthCheck { public static Result Healthy { get { return Result.Healthy; } } public static Result Unhealthy(string message) { return Result.Unhealthy(message); } public static Result Unhealthy(Exception error) { return Result.Unhealthy(error); } private readonly Func<Result> _check; public String Name { get; private set; } public HealthCheck(string name, Func<Result> check) { Name = name; _check = check; } public Result Execute() { try { return _check(); } catch (Exception e) { return Result.Unhealthy(e); } } public sealed class Result { private static readonly Result _healthy = new Result(true, null, null); public static Result Healthy { get { return _healthy; } } public static Result Unhealthy(string errorMessage) { return new Result(false, errorMessage, null); } public static Result Unhealthy(Exception error) { return new Result(false, error.Message, error); } public string Message { get; private set; } public Exception Error { get; private set; } public bool IsHealthy { get; private set; } private Result(bool isHealthy, string message, Exception error) { IsHealthy = isHealthy; Message = message; Error = error; } } } }
mit
C#
fe1819aa8586f4552c278e4161af71e6c46cf9f2
Update grid
GNOME/banshee,lamalex/Banshee,lamalex/Banshee,Dynalon/banshee-osx,petejohanson/banshee,mono-soc-2011/banshee,dufoli/banshee,allquixotic/banshee-gst-sharp-work,ixfalia/banshee,Dynalon/banshee-osx,mono-soc-2011/banshee,dufoli/banshee,directhex/banshee-hacks,stsundermann/banshee,Carbenium/banshee,petejohanson/banshee,ixfalia/banshee,stsundermann/banshee,dufoli/banshee,Dynalon/banshee-osx,ixfalia/banshee,GNOME/banshee,stsundermann/banshee,Carbenium/banshee,directhex/banshee-hacks,ixfalia/banshee,stsundermann/banshee,GNOME/banshee,ixfalia/banshee,Carbenium/banshee,Dynalon/banshee-osx,dufoli/banshee,arfbtwn/banshee,mono-soc-2011/banshee,Dynalon/banshee-osx,babycaseny/banshee,petejohanson/banshee,GNOME/banshee,allquixotic/banshee-gst-sharp-work,mono-soc-2011/banshee,lamalex/Banshee,lamalex/Banshee,Carbenium/banshee,babycaseny/banshee,Carbenium/banshee,allquixotic/banshee-gst-sharp-work,Carbenium/banshee,GNOME/banshee,GNOME/banshee,babycaseny/banshee,arfbtwn/banshee,arfbtwn/banshee,dufoli/banshee,allquixotic/banshee-gst-sharp-work,babycaseny/banshee,petejohanson/banshee,stsundermann/banshee,directhex/banshee-hacks,ixfalia/banshee,mono-soc-2011/banshee,directhex/banshee-hacks,GNOME/banshee,stsundermann/banshee,lamalex/Banshee,ixfalia/banshee,dufoli/banshee,directhex/banshee-hacks,arfbtwn/banshee,babycaseny/banshee,arfbtwn/banshee,arfbtwn/banshee,mono-soc-2011/banshee,babycaseny/banshee,arfbtwn/banshee,babycaseny/banshee,petejohanson/banshee,lamalex/Banshee,stsundermann/banshee,allquixotic/banshee-gst-sharp-work,stsundermann/banshee,Dynalon/banshee-osx,GNOME/banshee,petejohanson/banshee,mono-soc-2011/banshee,dufoli/banshee,ixfalia/banshee,arfbtwn/banshee,Dynalon/banshee-osx,babycaseny/banshee,directhex/banshee-hacks,Dynalon/banshee-osx,allquixotic/banshee-gst-sharp-work,dufoli/banshee
src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookGrid.cs
src/Extensions/Banshee.Audiobook/Banshee.Audiobook/AudiobookGrid.cs
// // AudiobookGrid.cs // // Author: // Gabriel Burt <gburt@novell.com> // // Copyright (C) 2009 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using Mono.Unix; using Gtk; using Hyena; using Hyena.Data; using Hyena.Data.Gui; using Banshee.Widgets; using Banshee.Sources; using Banshee.ServiceStack; using Banshee.Collection; using Banshee.Collection.Database; using Banshee.Collection.Gui; using Banshee.Gui; using Banshee.Gui.Widgets; using Banshee.Sources.Gui; using Banshee.Web; namespace Banshee.Audiobook { public class AudiobookGrid : SearchableListView<AlbumInfo> { private ColumnCellAlbum renderer; public AudiobookGrid () { renderer = new ColumnCellAlbum () { LayoutStyle = DataViewLayoutStyle.Grid, ImageSize = 150 }; var column_controller = new ColumnController (); column_controller.Add (new Column ("Album", renderer, 1.0)); LayoutStyle = DataViewLayoutStyle.Grid; ColumnController = column_controller; //RowActivated += OnRowActivated; } public override bool SelectOnRowFound { get { return true; } } protected override Gdk.Size OnMeasureChild () { return renderer.Measure (this); } protected override bool OnPopupMenu () { //ServiceManager.Get<InterfaceActionService> ().TrackActions["TrackContextMenuAction"].Activate (); return true; } } }
// // AudiobookGrid.cs // // Author: // Gabriel Burt <gburt@novell.com> // // Copyright (C) 2009 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using Mono.Unix; using Gtk; using Hyena; using Hyena.Data; using Hyena.Data.Gui; using Banshee.Widgets; using Banshee.Sources; using Banshee.ServiceStack; using Banshee.Collection; using Banshee.Collection.Database; using Banshee.Collection.Gui; using Banshee.Gui; using Banshee.Gui.Widgets; using Banshee.Sources.Gui; using Banshee.Web; namespace Banshee.Audiobook { public class AudiobookGrid : SearchableListView<AlbumInfo> { private ColumnCellAlbum renderer; public AudiobookGrid () { renderer = new ColumnCellAlbum () { LayoutStyle = DataViewLayoutStyle.Grid, ImageSize = 150 }; var column_controller = new ColumnController (); column_controller.Add (new Column ("Album", renderer, 1.0)); LayoutStyle = DataViewLayoutStyle.Grid; ColumnController = column_controller; //RowActivated += OnRowActivated; } protected override Gdk.Size OnMeasureChild () { return renderer.Measure (this); } } }
mit
C#
30dd5bd4ae08144da758b916f53e0f37779660a3
Disable NativeVarargsTest on Windows Nano Server. (#25284)
poizan42/coreclr,wtgodbe/coreclr,wtgodbe/coreclr,poizan42/coreclr,cshung/coreclr,krk/coreclr,poizan42/coreclr,krk/coreclr,cshung/coreclr,wtgodbe/coreclr,cshung/coreclr,poizan42/coreclr,cshung/coreclr,poizan42/coreclr,cshung/coreclr,krk/coreclr,krk/coreclr,krk/coreclr,krk/coreclr,cshung/coreclr,wtgodbe/coreclr,wtgodbe/coreclr,poizan42/coreclr,wtgodbe/coreclr
tests/src/Interop/IJW/NativeVarargs/NativeVarargsTest.cs
tests/src/Interop/IJW/NativeVarargs/NativeVarargsTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using TestLibrary; namespace NativeVarargsTest { class NativeVarargsTest { static int Main(string[] args) { if(Environment.OSVersion.Platform != PlatformID.Win32NT || TestLibrary.Utilities.IsWindows7 || TestLibrary.Utilities.IsWindowsNanoServer) { return 100; } // Use the same seed for consistency between runs. int seed = 42; try { Assembly ijwNativeDll = IjwHelper.LoadIjwAssembly("IjwNativeVarargs"); Type testType = ijwNativeDll.GetType("TestClass"); object testInstance = Activator.CreateInstance(testType); MethodInfo testMethod = testType.GetMethod("RunTests"); IEnumerable failedTests = (IEnumerable)testMethod.Invoke(testInstance, BindingFlags.DoNotWrapExceptions, null, new object[] {seed}, null); if (failedTests.OfType<object>().Any()) { Console.WriteLine("Failed Varargs tests:"); foreach (var failedTest in failedTests) { Console.WriteLine($"\t{failedTest}"); } return 102; } } catch (Exception ex) { Console.WriteLine(ex); return 101; } return 100; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using TestLibrary; namespace NativeVarargsTest { class NativeVarargsTest { static int Main(string[] args) { if(Environment.OSVersion.Platform != PlatformID.Win32NT || TestLibrary.Utilities.IsWindows7) { return 100; } // Use the same seed for consistency between runs. int seed = 42; try { Assembly ijwNativeDll = IjwHelper.LoadIjwAssembly("IjwNativeVarargs"); Type testType = ijwNativeDll.GetType("TestClass"); object testInstance = Activator.CreateInstance(testType); MethodInfo testMethod = testType.GetMethod("RunTests"); IEnumerable failedTests = (IEnumerable)testMethod.Invoke(testInstance, BindingFlags.DoNotWrapExceptions, null, new object[] {seed}, null); if (failedTests.OfType<object>().Any()) { Console.WriteLine("Failed Varargs tests:"); foreach (var failedTest in failedTests) { Console.WriteLine($"\t{failedTest}"); } return 102; } } catch (Exception ex) { Console.WriteLine(ex); return 101; } return 100; } } }
mit
C#
ffb3e6e188dc4fde35787770a962244f46408519
Destroy obstacles disabled at scene start
NitorInc/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare
Assets/Microgames/_Bosses/DarkRoom/Scripts/DarkRoomObstacleEnable.cs
Assets/Microgames/_Bosses/DarkRoom/Scripts/DarkRoomObstacleEnable.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; public class DarkRoomObstacleEnable : MonoBehaviour { [SerializeField] private float maxXDistance = 11f; void Start () { for (int i = 0; i < transform.childCount; i++) { var child = transform.GetChild(i); if (!child.gameObject.activeInHierarchy) Destroy(child.gameObject); } } void Update () { for (int i = 0; i < transform.childCount; i++) { var child = transform.GetChild(i); var shouldEnable = Mathf.Abs(MainCameraSingleton.instance.transform.position.x - child.position.x) <= maxXDistance; if (shouldEnable != child.gameObject.activeInHierarchy) child.gameObject.SetActive(shouldEnable); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class DarkRoomObstacleEnable : MonoBehaviour { [SerializeField] private float maxXDistance = 11f; void Start () { } void Update () { for (int i = 0; i < transform.childCount; i++) { var child = transform.GetChild(i); var shouldEnable = Mathf.Abs(MainCameraSingleton.instance.transform.position.x - child.position.x) <= maxXDistance; if (shouldEnable != child.gameObject.activeInHierarchy) child.gameObject.SetActive(shouldEnable); } } }
mit
C#
2622483066ccc78e1206421228b732877366f59b
Update A_Very_Big_Sum_CSharp.cs
leocabrallce/HackerRank,leocabrallce/HackerRank
Algorithms/A_Very_Big_Sum/A_Very_Big_Sum_CSharp.cs
Algorithms/A_Very_Big_Sum/A_Very_Big_Sum_CSharp.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] arr_temp = Console.ReadLine().Split(' '); long[] arr = Array.ConvertAll(arr_temp, Int64.Parse); long sum = arr.Sum(); Console.WriteLine(sum); } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] arr_temp = Console.ReadLine().Split(' '); long[] arr = Array.ConvertAll(arr_temp, Int64.Parse); long sum = arr.Sum(); Console.WriteLine(sum); } }
mit
C#
8335c224bf08cf21af7eafaaa87f8807407d9f7e
Update Viktor.cs
FireBuddy/adevade
AdEvade/AdEvade/Data/Spells/SpecialSpells/Viktor.cs
AdEvade/AdEvade/Data/Spells/SpecialSpells/Viktor.cs
using System; using EloBuddy; using EloBuddy.SDK; namespace AdEvade.Data.Spells.SpecialSpells { class Viktor : IChampionPlugin { static Viktor() { } public const string ChampionName = "Viktor"; public string GetChampionName() { return ChampionName; } public void LoadSpecialSpell(SpellData spellData) { if (spellData.SpellName == "ViktorDeathRay") { Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpellCast3; } } private static void Obj_AI_Base_OnProcessSpellCast3(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender != null && sender.Team != ObjectManager.Player.Team && args.SData.Name != null && args.SData.Name == "ViktorDeathRay") enemy.GetWaypoints(). { var End = enemy.GetWaypoints().Last(); var missileDist = End.To2D().Distance(args.Start.To2D()); var delay = missileDist / 1.5f + 600; spellData.SpellDelay = delay; SpellDetector.CreateSpellData(sender, args.Start, End, spellData); } } } }
using System; using EloBuddy; using EloBuddy.SDK; namespace AdEvade.Data.Spells.SpecialSpells { class Viktor : IChampionPlugin { static Viktor() { } public const string ChampionName = "Viktor"; public string GetChampionName() { return ChampionName; } public void LoadSpecialSpell(SpellData spellData) { if (spellData.SpellName == "ViktorDeathRay3") { GameObject.OnCreate += OnCreateObj_ViktorDeathRay3; } } private static void OnCreateObj_ViktorDeathRay3(GameObject obj, EventArgs args) { if (obj.GetType() != typeof(MissileClient) || !((MissileClient) obj).IsValidMissile()) return; MissileClient missile = (MissileClient)obj; SpellData spellData; if (missile.SpellCaster != null && missile.SpellCaster.Team != ObjectManager.Player.Team && missile.SData.Name != null && missile.SData.Name == "viktoreaugmissile" && SpellDetector.OnMissileSpells.TryGetValue("ViktorDeathRay3", out spellData) && missile.StartPosition != null && missile.EndPosition != null) { var missileDist = missile.EndPosition.To2D().Distance(missile.StartPosition.To2D()); var delay = missileDist / 1.5f + 600; spellData.SpellDelay = delay; SpellDetector.CreateSpellData(missile.SpellCaster, missile.StartPosition, missile.EndPosition, spellData); } } } }
mit
C#
4f3ff50656f632903d51462cbc8841e673d6f1c1
Increment version
markembling/MarkEmbling.PostcodesIO
MarkEmbling.PostcodesIO/Properties/AssemblyInfo.cs
MarkEmbling.PostcodesIO/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("MarkEmbling.PostcodesIO")] [assembly: AssemblyDescription("Library for interacting with the excellent Postcodes.io service.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Mark Embling")] [assembly: AssemblyProduct("MarkEmbling.PostcodesIO")] [assembly: AssemblyCopyright("Copyright © Mark Embling and contributors 2015-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("a31ab2d0-733e-4d9e-9e5f-fab2b40dc02e")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.4")] [assembly: AssemblyFileVersion("0.0.4")]
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("MarkEmbling.PostcodesIO")] [assembly: AssemblyDescription("Library for interacting with the excellent Postcodes.io service.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Mark Embling")] [assembly: AssemblyProduct("MarkEmbling.PostcodesIO")] [assembly: AssemblyCopyright("Copyright © Mark Embling and contributors 2015-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("a31ab2d0-733e-4d9e-9e5f-fab2b40dc02e")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.3")] [assembly: AssemblyFileVersion("0.0.3")]
mit
C#
f3690bb2fde6b00bef2a5fdf2e785f6b58f178cd
Disable listenForImageChanged in HoverImageWidget
jlewin/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl
MatterControlLib/CustomWidgets/HoverImageWidget.cs
MatterControlLib/CustomWidgets/HoverImageWidget.cs
/* Copyright (c) 2018, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using MatterHackers.Agg.Image; using MatterHackers.Agg.UI; namespace MatterHackers.MatterControl { public class HoverImageWidget : ImageWidget { private ImageBuffer hoverImage; private bool mouseInBounds = false; public HoverImageWidget(ImageBuffer normalImage, ImageBuffer hoverImage) : base(normalImage, listenForImageChanged: false) { this.hoverImage = hoverImage; } public override ImageBuffer Image { get => mouseInBounds ? hoverImage : base.Image; set => base.Image = value; } public override void OnMouseEnterBounds(MouseEventArgs mouseEvent) { mouseInBounds = true; base.OnMouseEnterBounds(mouseEvent); this.Invalidate(); } public override void OnMouseLeaveBounds(MouseEventArgs mouseEvent) { mouseInBounds = false; base.OnMouseLeaveBounds(mouseEvent); this.Invalidate(); } } }
/* Copyright (c) 2018, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using MatterHackers.Agg.Image; using MatterHackers.Agg.UI; namespace MatterHackers.MatterControl { public class HoverImageWidget : ImageWidget { private ImageBuffer hoverImage; private bool mouseInBounds = false; public HoverImageWidget(ImageBuffer normalImage, ImageBuffer hoverImage) : base(normalImage) { this.hoverImage = hoverImage; } public override ImageBuffer Image { get => (mouseInBounds) ? hoverImage : base.Image; set => base.Image = value; } public override void OnMouseEnterBounds(MouseEventArgs mouseEvent) { mouseInBounds = true; base.OnMouseEnterBounds(mouseEvent); this.Invalidate(); } public override void OnMouseLeaveBounds(MouseEventArgs mouseEvent) { mouseInBounds = false; base.OnMouseLeaveBounds(mouseEvent); this.Invalidate(); } } }
bsd-2-clause
C#
0588ca7317011a47d8d5670163e0530f921e69ac
Improve git-flow targets
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
build/Build.GitFlow.cs
build/Build.GitFlow.cs
// Copyright Matthias Koch, Sebastian Karasek 2018. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System.IO; using System.Linq; using Nuke.Common; using Nuke.Common.Utilities; using static Nuke.Common.ChangeLog.ChangelogTasks; using static Nuke.Common.ControlFlow; using static Nuke.Common.EnvironmentInfo; using static Nuke.Common.Tools.Git.GitTasks; partial class Build { Target Release => _ => _ .Executes(() => { if (!GitRepository.Branch.StartsWithOrdinalIgnoreCase("release")) { Assert(GitHasCleanWorkingCopy(), "GitHasCleanWorkingCopy()"); Git($"checkout -b release/{GitVersion.MajorMinorPatch} {DevelopBranch}"); } else { FinishReleaseOrHotfix(); } }); Target Hotfix => _ => _ .Executes(() => { if (!GitRepository.Branch.StartsWithOrdinalIgnoreCase("hotfix")) { Assert(GitHasCleanWorkingCopy(), "GitHasCleanWorkingCopy()"); Git($"checkout -b hotfix/{GitVersion.Major}.{GitVersion.Minor}.{GitVersion.Patch + 1} {MasterBranch}"); } else { FinishReleaseOrHotfix(); } }); void FinishReleaseOrHotfix() { FinalizeChangelog(ChangelogFile, GitVersion.MajorMinorPatch, GitRepository); Git($"add {ChangelogFile}"); Git($"commit -m \"Finalize {Path.GetFileName(ChangelogFile)} for {GitVersion.MajorMinorPatch}\""); Assert(GitHasCleanWorkingCopy(), "GitHasCleanWorkingCopy()"); Git($"checkout {MasterBranch}"); Git($"merge --no-ff --no-edit {GitRepository.Branch}"); Git($"tag {GitVersion.MajorMinorPatch}"); Git($"checkout {DevelopBranch}"); Git($"merge --no-ff --no-edit {GitRepository.Branch}"); Git($"branch -D {GitRepository.Branch}"); Git($"push origin {MasterBranch} {DevelopBranch} {GitVersion.MajorMinorPatch}"); } }
// Copyright Matthias Koch, Sebastian Karasek 2018. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System.IO; using System.Linq; using Nuke.Common; using Nuke.Common.Utilities; using static Nuke.Common.ChangeLog.ChangelogTasks; using static Nuke.Common.ControlFlow; using static Nuke.Common.EnvironmentInfo; using static Nuke.Common.Tools.Git.GitTasks; partial class Build { Target Release => _ => _ .Executes(() => { if (!GitRepository.Branch.StartsWithOrdinalIgnoreCase("release")) { Assert(GitHasCleanWorkingCopy(), "GitHasCleanWorkingCopy()"); Git($"checkout -b release/{GitVersion.MajorMinorPatch} {DevelopBranch}"); } else { ReleaseFrom($"release/{GitVersion.MajorMinorPatch}"); } }); Target Hotfix => _ => _ .Executes(() => { if (!GitRepository.Branch.StartsWithOrdinalIgnoreCase("hotfix")) { Assert(CommandLineArguments.Length == 3, "CommandLineArguments.Length == 3"); Assert(GitHasCleanWorkingCopy(), "GitHasCleanWorkingCopy()"); Git($"checkout -b hotfix/{CommandLineArguments.ElementAt(index: 2)} {MasterBranch}"); } else { ReleaseFrom(GitRepository.Branch); } }); void ReleaseFrom(string branch) { FinalizeChangelog(ChangelogFile, GitVersion.MajorMinorPatch, GitRepository); Git($"add {ChangelogFile}"); Git($"commit -m \"Finalize {Path.GetFileName(ChangelogFile)} for {GitVersion.MajorMinorPatch}\""); Assert(GitHasCleanWorkingCopy(), "GitHasCleanWorkingCopy()"); Git($"checkout {DevelopBranch}"); Git($"merge --no-ff --no-edit {branch}"); Git($"checkout {MasterBranch}"); Git($"merge --no-ff --no-edit {branch}"); Git($"tag {GitVersion.MajorMinorPatch}"); Git($"branch -D {branch}"); Git($"push origin {MasterBranch} {DevelopBranch} {GitVersion.MajorMinorPatch}"); } }
mit
C#
20745fbc6780c53bcf03a846bd563fc9f17e14e1
Fix controller in main menu
Nigh7Sh4de/shatterfall,Nigh7Sh4de/shatterfall
shatterfall/Assets/Scripts/selector.cs
shatterfall/Assets/Scripts/selector.cs
using UnityEngine; using System.Collections; using System.Collections.Generic; public class selector : MonoBehaviour { public static int option; public List<GameObject> uiChoices; private float ready = 0; private float READY_DELAY = 0.2f; public bool selectable; public GameObject howToPlay; public AudioClip selectSound; private AudioSource source; private float TOGGLE_THRESHOLD = 0.6f; // Use this for initialization void Start () { source = GetComponent<AudioSource>(); option = 0; transform.localScale = uiChoices [0].transform.localScale * 9f; selectable = true; howToPlay.SetActive (false); } void toggleInstructions() { if (!howToPlay.activeSelf) { selectable = false; howToPlay.SetActive(true); } else { howToPlay.SetActive(false); selectable = true; } } // Update is called once per frame void Update () { if (ready > 0) ready -= Time.deltaTime; if ((Input.GetKey (KeyCode.UpArrow) || (Input.GetAxis ("MoveVertical") > TOGGLE_THRESHOLD)) && ready <= 0 && selectable) { source.PlayOneShot (selectSound, 1F); ready = READY_DELAY; if (option == 0) { option = uiChoices.Count - 1; } else { option--; } } if ((Input.GetKey(KeyCode.DownArrow) || (Input.GetAxis("MoveVertical") < -TOGGLE_THRESHOLD)) && ready <= 0 && selectable) { source.PlayOneShot (selectSound, 1F); ready = READY_DELAY; if (option == uiChoices.Count - 1) { option = 0; } else { option++; } } transform.position = uiChoices [option].transform.position + new Vector3 (-uiChoices [option].transform.localScale.x * 0.55f, uiChoices [option].transform.localScale.x * 0.2f, 0); if ((Input.GetKeyDown (KeyCode.Space) || Input.GetAxis ("Jump") > 0)) { if (option < 3) { source.PlayOneShot (selectSound, 1F); Application.LoadLevel ("main"); } else { source.PlayOneShot (selectSound, 1F); toggleInstructions (); } } } }
using UnityEngine; using System.Collections; using System.Collections.Generic; public class selector : MonoBehaviour { public static int option; public List<GameObject> uiChoices; public bool ready; public bool selectable; public GameObject howToPlay; public AudioClip selectSound; private AudioSource source; // Use this for initialization void Start () { source = GetComponent<AudioSource>(); option = 0; transform.localScale = uiChoices [0].transform.localScale * 9f; selectable = true; howToPlay.SetActive (false); } void toggleInstructions() { if (!howToPlay.activeSelf) { selectable = false; howToPlay.SetActive(true); } else { howToPlay.SetActive(false); selectable = true; } } // Update is called once per frame void Update () { if (Input.GetAxis ("MoveVertical1") + Input.GetAxis ("MoveVertical2") + Input.GetAxis ("MoveVertical3") + Input.GetAxis ("MoveVertical4") == 0) ready = true; if ((Input.GetKeyDown (KeyCode.UpArrow) || Input.GetAxis ("MoveVertical") > 0) && ready && selectable) { source.PlayOneShot (selectSound, 1F); ready = false; if (option == 0) { option = uiChoices.Count - 1; } else { option--; } } if ((Input.GetKeyDown (KeyCode.DownArrow) || Input.GetAxis ("MoveVertical") < 0) && ready && selectable) { source.PlayOneShot (selectSound, 1F); ready = false; if (option == uiChoices.Count - 1) { option = 0; } else { option++; } } transform.position = uiChoices [option].transform.position + new Vector3 (-uiChoices [option].transform.localScale.x * 0.55f, uiChoices [option].transform.localScale.x * 0.2f, 0); if ((Input.GetKeyDown (KeyCode.Space) || Input.GetAxis ("Jump") > 0)) { if (option < 3) { source.PlayOneShot (selectSound, 1F); Application.LoadLevel ("main"); } else { source.PlayOneShot (selectSound, 1F); toggleInstructions (); } } } }
mit
C#
e4859a2517b29cee1d524ae14f16a08aeaa15412
add personId for admin patient info
SnapMD/connectedcare-sdk,dhawalharsora/connectedcare-sdk
SnapMD.VirtualCare.ApiModels/PatientAccountInfo.cs
SnapMD.VirtualCare.ApiModels/PatientAccountInfo.cs
#region Copyright // Copyright 2016 SnapMD, Inc. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using System; namespace SnapMD.VirtualCare.ApiModels { /// <summary> /// Represents patient details for administrator patient lists. /// </summary> public class PatientAccountInfo { public int PatientId { get; set; } public int? UserId { get; set; } public string ProfileImagePath { get; set; } public string FullName { get; set; } public string Phone { get; set; } public bool IsAuthorized { get; set; } public PatientAccountStatus Status { get; set; } public bool IsDependent { get; set; } public int? GuardianId { get; set; } public string Email { get; set; } public Guid PersonId { get; set; } } }
#region Copyright // Copyright 2016 SnapMD, Inc. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion namespace SnapMD.VirtualCare.ApiModels { /// <summary> /// Represents patient details for administrator patient lists. /// </summary> public class PatientAccountInfo { public int PatientId { get; set; } public int? UserId { get; set; } public string ProfileImagePath { get; set; } public string FullName { get; set; } public string Phone { get; set; } public bool IsAuthorized { get; set; } public PatientAccountStatus Status { get; set; } public bool IsDependent { get; set; } public int? GuardianId { get; set; } public string Email { get; set; } } }
apache-2.0
C#
22ac1cc3e8361ecabb3223f418eb58192e989aae
Fix WebInput.ToString() exception when args is null
LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC
WebScriptHook.Framework/Messages/Inputs/WebInput.cs
WebScriptHook.Framework/Messages/Inputs/WebInput.cs
using Newtonsoft.Json; using System.Text; namespace WebScriptHook.Framework.Messages.Inputs { /// <summary> /// This is the format of messages client is receiving from the remote server /// </summary> class WebInput { /// <summary> /// Gets the header of the request. /// Header is currently unused /// </summary> public char Header { get; set; } /// <summary> /// Gets the command of the request. /// Cmd is the command this input request is calling. It is the ID of the plugin /// the request wants to call /// </summary> public string Cmd { get; set; } /// <summary> /// Gets the arguments in this request. /// Arguments supplied to the plugin /// </summary> public object[] Args { get; set; } /// <summary> /// Gets the UID of this request. /// </summary> public string UID { get; private set; } [JsonConstructor] public WebInput(char Header, string Cmd, object[] Args, string UID) { this.Header = Header; this.Cmd = Cmd; this.Args = Args; this.UID = UID; } public override string ToString() { return "Header: " + Header + ", Cmd: " + Cmd + ", Args: [" + ((Args == null) ? "" : string.Join(",", Args)) + "], UID: " + UID; } } }
using Newtonsoft.Json; using System.Text; namespace WebScriptHook.Framework.Messages.Inputs { /// <summary> /// This is the format of messages client is receiving from the remote server /// </summary> class WebInput { /// <summary> /// Gets the header of the request. /// Header is currently unused /// </summary> public char Header { get; set; } /// <summary> /// Gets the command of the request. /// Cmd is the command this input request is calling. It is the ID of the plugin /// the request wants to call /// </summary> public string Cmd { get; set; } /// <summary> /// Gets the arguments in this request. /// Arguments supplied to the plugin /// </summary> public object[] Args { get; set; } /// <summary> /// Gets the UID of this request. /// </summary> public string UID { get; private set; } [JsonConstructor] public WebInput(char Header, string Cmd, object[] Args, string UID) { this.Header = Header; this.Cmd = Cmd; this.Args = Args; this.UID = UID; } public override string ToString() { return "Header: " + Header + ", Cmd: " + Cmd + ", Args: [" + string.Join(",", Args) + "], UID: " + UID; } } }
mit
C#
83b7a9035b40da9ab5117f4c08d55721d825cf54
Update CommonAssemblyInfo.cs
RazorGenerator/RazorGenerator,RazorGenerator/RazorGenerator
CommonAssemblyInfo.cs
CommonAssemblyInfo.cs
using System; using System.Reflection; [assembly: AssemblyVersion("2.0.0")] [assembly: AssemblyProduct("RazorGenerator")] [assembly: AssemblyCompany("RazorGenerator contributors")] [assembly: AssemblyInformationalVersion("2.4.8")]
using System; using System.Reflection; [assembly: AssemblyVersion("2.0.0")] [assembly: AssemblyProduct("RazorGenerator")] [assembly: AssemblyCompany("RazorGenerator contributors")] [assembly: AssemblyInformationalVersion("2.4.7")]
apache-2.0
C#
411740ae83854834db9eca3d98dcf32d765de896
Allow verb name to be optional.
nemec/clipr
clipr/VerbAttribute.cs
clipr/VerbAttribute.cs
using System; namespace clipr { /// <summary> /// Mark the property as a subcommand. (cf. 'svn checkout') /// </summary> [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)] public class VerbAttribute : Attribute { /// <summary> /// Name of the subcommand. If provided as an argument, it /// will trigger parsing of the subcommand. /// </summary> public string Name { get; set; } /// <summary> /// Description of the subcommand, suitable for help pages. /// </summary> public string Description { get; set; } /// <summary> /// Create a new subcommand. /// </summary> public VerbAttribute() { } /// <summary> /// Create a new subcommand. /// </summary> /// <param name="name"></param> public VerbAttribute(string name) { Name = name; } /// <summary> /// Create a new subcommand. /// </summary> /// <param name="name"></param> /// <param name="description"></param> public VerbAttribute(string name, string description) { Name = name; Description = description; } } }
using System; namespace clipr { /// <summary> /// Mark the property as a subcommand. (cf. 'svn checkout') /// </summary> [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)] public class VerbAttribute : Attribute { /// <summary> /// Name of the subcommand. If provided as an argument, it /// will trigger parsing of the subcommand. /// </summary> public string Name { get; private set; } /// <summary> /// Description of the subcommand, suitable for help pages. /// </summary> public string Description { get; private set; } /// <summary> /// Create a new subcommand. /// </summary> /// <param name="name"></param> public VerbAttribute(string name) { Name = name; } /// <summary> /// Create a new subcommand. /// </summary> /// <param name="name"></param> /// <param name="description"></param> public VerbAttribute(string name, string description) { Name = name; Description = description; } } }
mit
C#
41ae0f16038ddec0158d01b3b0663e4a4d98e162
add thread
yasokada/unity-150923-udpRs232c,yasokada/unity-150831-udpMonitor
Assets/udpMonitorScript.cs
Assets/udpMonitorScript.cs
using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Threading; public class udpMonitorScript : MonoBehaviour { Thread monThr; // monitor Thread public Toggle ToggleComm; void Start () { monThr = new Thread (new ThreadStart (FuncMonData)); monThr.Start (); } void Update () { } void Monitor() { Debug.Log ("start monitor"); while (ToggleComm.isOn) { Thread.Sleep(100); } Debug.Log ("end monitor"); } private void FuncMonData() { Debug.Log ("Start FuncMonData"); while (true) { while(ToggleComm.isOn == false) { Thread.Sleep(100); continue; } Monitor(); } } }
using UnityEngine; using System.Collections; using UnityEngine.UI; public class udpMonitorScript : MonoBehaviour { public Toggle ToggleComm; private bool preToggle = false; void Start () { } void Update () { if (preToggle != ToggleComm.isOn && ToggleComm.isOn) { preToggle = ToggleComm.isOn; } } }
mit
C#
8cc654362026ceba2858cbe5977043269652696b
include a timer for queries
ninianne98/CarrotCakeCMS,ninianne98/CarrotCakeCMS,ninianne98/CarrotCakeCMS
CarrotCMSData/CarrotCMS.cs
CarrotCMSData/CarrotCMS.cs
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Diagnostics; using System.Linq; using System.Net; /* * CarrotCake CMS * http://www.carrotware.com/ * * Copyright 2011, Samantha Copeland * Dual licensed under the MIT or GPL Version 2 licenses. * * Date: October 2011 */ namespace Carrotware.CMS.Data { public partial class CarrotCMSDataContext { #if DEBUG private static Stopwatch ThisWatch = new Stopwatch(); private static void Connection_StateChange(object sender, StateChangeEventArgs e) { if (e.OriginalState == ConnectionState.Closed && e.CurrentState == ConnectionState.Open) { ThisWatch.Reset(); ThisWatch.Start(); } else if (e.OriginalState == ConnectionState.Open && e.CurrentState == ConnectionState.Closed) { ThisWatch.Stop(); Debug.Write("--------------------------------------\r\n"); Debug.Write(string.Format("SQL took {0}ms \r\n", ThisWatch.ElapsedMilliseconds)); } } #endif private static string connString = ConfigurationManager.ConnectionStrings["CarrotwareCMSConnectionString"].ConnectionString; public static CarrotCMSDataContext GetDataContext() { return GetDataContext(connString); } public static CarrotCMSDataContext GetDataContext(string connection) { #if DEBUG CarrotCMSDataContext _db = new CarrotCMSDataContext(connection); if (Debugger.IsAttached) { string sKey = Guid.NewGuid().ToString(); _db.Connection.StateChange += Connection_StateChange; _db.Log = new DebugTextWriter(); } return _db; #endif return new CarrotCMSDataContext(connection); } public static CarrotCMSDataContext GetDataContext(IDbConnection connection) { #if DEBUG CarrotCMSDataContext _db = new CarrotCMSDataContext(connection); if (Debugger.IsAttached) { string sKey = Guid.NewGuid().ToString(); _db.Connection.StateChange += Connection_StateChange; _db.Log = new DebugTextWriter(); } return _db; #endif return new CarrotCMSDataContext(connection); } //public CarrotCMSDataContext() : // base(global::Carrotware.CMS.Data.Properties.Settings.Default.CarrotwareCMSConnectionString, mappingSource) { // OnCreated(); //} //public CarrotCMSDataContext() : // base(global::System.Configuration.ConfigurationManager.ConnectionStrings["CarrotwareCMSConnectionString"].ConnectionString, mappingSource) { // OnCreated(); //} } }
using System; using System.Configuration; using System.Data; /* * CarrotCake CMS * http://www.carrotware.com/ * * Copyright 2011, Samantha Copeland * Dual licensed under the MIT or GPL Version 2 licenses. * * Date: October 2011 */ namespace Carrotware.CMS.Data { public partial class CarrotCMSDataContext { private static string connString = ConfigurationManager.ConnectionStrings["CarrotwareCMSConnectionString"].ConnectionString; public static CarrotCMSDataContext GetDataContext() { return GetDataContext(connString); } public static CarrotCMSDataContext GetDataContext(string connection) { #if DEBUG CarrotCMSDataContext _db = new CarrotCMSDataContext(connection); _db.Log = new DebugTextWriter(); return _db; #endif return new CarrotCMSDataContext(connection); } public static CarrotCMSDataContext GetDataContext(IDbConnection connection) { #if DEBUG CarrotCMSDataContext _db = new CarrotCMSDataContext(connection); _db.Log = new DebugTextWriter(); return _db; #endif return new CarrotCMSDataContext(connection); } //public CarrotCMSDataContext() : // base(global::Carrotware.CMS.Data.Properties.Settings.Default.CarrotwareCMSConnectionString, mappingSource) { // OnCreated(); //} //public CarrotCMSDataContext() : // base(global::System.Configuration.ConfigurationManager.ConnectionStrings["CarrotwareCMSConnectionString"].ConnectionString, mappingSource) { // OnCreated(); //} } }
mit
C#
3adb6b3113ba452909cfe0c23c7dbe14757b1c69
исправить падение 'Serialization' assertion
vknet/vk,vknet/vk
VkNet.Tests/Utils/JsonConverter/DateTimeToStringFormatConverterTests.cs
VkNet.Tests/Utils/JsonConverter/DateTimeToStringFormatConverterTests.cs
using System; using System.Globalization; using Newtonsoft.Json; using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Utils; using VkNet.Utils.JsonConverter; namespace VkNet.Tests.Utils.JsonConverter { public class DateTimeToStringFormatConverterTests : BaseTest { [Test] public void Deserialize() { ReadJsonFile(nameof(JsonConverter), nameof(DateTimeToStringFormatConverter), nameof(Deserialize)); Url = "https://api.vk.com/method/friends.getRequests"; var result = Api.Call<MessagesSearchParams>("friends.getRequests", VkParameters.Empty); Assert.NotNull(result); Assert.That(result.Date, Is.EqualTo(new DateTime(2018, 11, 5))); } [Test] public void Serialization() { ReadJsonFile(nameof(JsonConverter), nameof(DateTimeToStringFormatConverter), nameof(Serialization)); var message = new MessagesSearchParams { Date = new DateTime(2018, 11, 5), Count = 20 }; var json = JsonConvert.SerializeObject(message, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore, Formatting = Formatting.Indented }); var result = JsonConvert.DeserializeObject<MessagesSearchParams>(json); Assert.NotNull(result); var compare = string.Compare(json, Json, CultureInfo.InvariantCulture, CompareOptions.IgnoreSymbols); Assert.IsTrue(compare == 0); } } }
using System; using System.Globalization; using Newtonsoft.Json; using NUnit.Framework; using VkNet.Model.RequestParams; using VkNet.Utils; using VkNet.Utils.JsonConverter; namespace VkNet.Tests.Utils.JsonConverter { public class DateTimeToStringFormatConverterTests : BaseTest { [Test] public void Deserialize() { ReadJsonFile(nameof(JsonConverter), nameof(DateTimeToStringFormatConverter), nameof(Deserialize)); Url = "https://api.vk.com/method/friends.getRequests"; var result = Api.Call<MessagesSearchParams>("friends.getRequests", VkParameters.Empty); Assert.NotNull(result); Assert.That(result.Date, Is.EqualTo(new DateTime(2018, 11, 5))); } [Test] public void Serialization() { ReadJsonFile(nameof(JsonConverter), nameof(DateTimeToStringFormatConverter), nameof(Serialization)); var message = new MessagesSearchParams { Date = new DateTime(2018, 11, 5) }; var json = JsonConvert.SerializeObject(message, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore, Formatting = Formatting.Indented }); var result = JsonConvert.DeserializeObject<MessagesSearchParams>(json); Assert.NotNull(result); var compare = string.Compare(json, Json, CultureInfo.InvariantCulture, CompareOptions.IgnoreSymbols); Assert.IsTrue(compare == 0); } } }
mit
C#
27f0ee8da311467aecd1f306c21bb363deca68ab
Update Program.cs
wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors
samples/DraggableDemo/Program.cs
samples/DraggableDemo/Program.cs
using System; using Avalonia; using Avalonia.Xaml.Interactions.Core; using Avalonia.Xaml.Interactivity; namespace DraggableDemo; class Program { public static void Main(string[] args) => BuildAvaloniaApp() .StartWithClassicDesktopLifetime(args); public static AppBuilder BuildAvaloniaApp() { GC.KeepAlive(typeof(Interaction).Assembly); GC.KeepAlive(typeof(ComparisonConditionType).Assembly); return AppBuilder.Configure<App>() .UsePlatformDetect() .With(new Win32PlatformOptions { UseCompositor = true }) .With(new X11PlatformOptions { UseCompositor = true }) .With(new AvaloniaNativePlatformOptions { UseCompositor = true }) .LogToTrace(); } }
using System; using Avalonia; using Avalonia.Xaml.Interactions.Core; using Avalonia.Xaml.Interactivity; namespace DraggableDemo; class Program { public static void Main(string[] args) => BuildAvaloniaApp() .StartWithClassicDesktopLifetime(args); public static AppBuilder BuildAvaloniaApp() { GC.KeepAlive(typeof(Interaction).Assembly); GC.KeepAlive(typeof(ComparisonConditionType).Assembly); return AppBuilder.Configure<App>() .UsePlatformDetect() .LogToTrace(); } }
mit
C#
45f61e5ba10881fadbb9b8ac3a1132451c832f9a
Fix indents.
Erikvl87/KNKVPlugin
KNKVPlugin/Converters/Converter.cs
KNKVPlugin/Converters/Converter.cs
using System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace KNKVPlugin.Converters { public class Converter { protected static JArray ParseArray(string json) { try { var jResponse = JArray.Parse(json); return jResponse; } catch (JsonReaderException e) { // No valid JSON was recieved. Throw the ugly html error that the service is returning. throw new ApplicationException(json, e); } } protected static JObject ParseObject(string json) { try { var jResponse = JObject.Parse(json); return jResponse; } catch (JsonReaderException e) { // No valid JSON was recieved. Throw the ugly html error that the service is returning. throw new ApplicationException(json, e); } } protected static T DeserializeObject<T>(string json) { try { var deserializedObject = JsonConvert.DeserializeObject<T>(json); return deserializedObject; } catch (JsonReaderException e) { // No valid JSON was recieved. Throw the ugly html error that the service is returning. throw new ApplicationException(json, e); } } } }
using System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace KNKVPlugin.Converters { public class Converter { protected static JArray ParseArray(string json) { try { var jResponse = JArray.Parse(json); return jResponse; } catch (JsonReaderException e) { // No valid JSON was recieved. Throw the ugly html error that the service is returning. throw new ApplicationException(json, e); } } protected static JObject ParseObject(string json) { try { var jResponse = JObject.Parse(json); return jResponse; } catch (JsonReaderException e) { // No valid JSON was recieved. Throw the ugly html error that the service is returning. throw new ApplicationException(json, e); } } protected static T DeserializeObject<T>(string json) { try { var deserializedObject = JsonConvert.DeserializeObject<T>(json); return deserializedObject; } catch (JsonReaderException e) { // No valid JSON was recieved. Throw the ugly html error that the service is returning. throw new ApplicationException(json, e); } } } }
mit
C#
7c72b2691e2acea6cd3860466dfc43243a91ec2e
Fix dat Mono build.
rob-somerville/riak-dotnet-client,rob-somerville/riak-dotnet-client,basho/riak-dotnet-client,basho/riak-dotnet-client
src/RiakClientTests/Client/DataTypeTests.cs
src/RiakClientTests/Client/DataTypeTests.cs
// <copyright file="DataTypeTests.cs" company="Basho Technologies, Inc."> // Copyright (c) 2011 - OJ Reeves & Jeremiah Peschka // Copyright (c) 2014 - Basho Technologies, Inc. // // This file is provided to you under the Apache License, // Version 2.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain // a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // </copyright> namespace RiakClientTests.Client { using System; using System.Collections.Generic; using System.Text; using Moq; using NUnit.Framework; using RiakClient; using RiakClient.Extensions; using RiakClient.Messages; using RiakClient.Models; using RiakClient.Models.Rest; [TestFixture] public class DataTypeTests : ClientTestBase { private readonly SerializeObjectToByteArray<string> Serializer = s => Encoding.UTF8.GetBytes(s); [Test] public void DtUpdateMapWithRecursiveDataWithoutContext_ThrowsException() { var nestedRemoves = new List<MapField> { new MapField { name = "field_name".ToRiakString(), type = MapField.MapFieldType.SET } }; var mapUpdateNested = new MapUpdate { map_op = new MapOp() }; mapUpdateNested.map_op.removes.AddRange(nestedRemoves); var map_op = new MapOp(); map_op.updates.Add(mapUpdateNested); var mapUpdate = new MapUpdate { map_op = new MapOp() }; mapUpdate.map_op.updates.Add(mapUpdateNested); var updates = new List<MapUpdate> { mapUpdate }; Assert.Throws<ArgumentNullException>( () => Client.DtUpdateMap( "bucketType", "bucket", "key", Serializer, (byte[])null, null, updates, null) ); } } }
// <copyright file="DataTypeTests.cs" company="Basho Technologies, Inc."> // Copyright (c) 2011 - OJ Reeves & Jeremiah Peschka // Copyright (c) 2014 - Basho Technologies, Inc. // // This file is provided to you under the Apache License, // Version 2.0 (the "License"); you may not use this file // except in compliance with the License. You may obtain // a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // </copyright> namespace RiakClientTests.Client { using System; using System.Collections.Generic; using System.Text; using Moq; using NUnit.Framework; using RiakClient; using RiakClient.Extensions; using RiakClient.Messages; using RiakClient.Models; using RiakClient.Models.Rest; [TestFixture] public class DataTypeTests : ClientTestBase { private readonly SerializeObjectToByteArray<string> Serializer = s => Encoding.UTF8.GetBytes(s); [Test] public void DtUpdateMapWithRecursiveDataWithoutContext_ThrowsException() { var riakObjectId = new RiakObjectId("foo", "bar"); var nestedRemoves = new List<MapField> { new MapField { name = "field_name".ToRiakString(), type = MapField.MapFieldType.SET } }; var mapUpdateNested = new MapUpdate { map_op = new MapOp() }; mapUpdateNested.map_op.removes.AddRange(nestedRemoves); var map_op = new MapOp(); map_op.updates.Add(mapUpdateNested); var mapUpdate = new MapUpdate { map_op = new MapOp() }; mapUpdate.map_op.updates.Add(mapUpdateNested); var updates = new List<MapUpdate> { mapUpdate }; Assert.Throws<ArgumentNullException>( () => Client.DtUpdateMap( "bucketType", "bucket", "key", Serializer, (byte[])null, null, updates, null) ); } } }
apache-2.0
C#
69a4015c1a9fb5bd2d8889247acc679c691d5182
Use named HttpClient from HttpClientFactory for default CreateHttpClient() method, to prevent any ambiguous from other HttpClient instances.
vinhch/BizwebSharp
src/BizwebSharp/Helper/HttpUtils.cs
src/BizwebSharp/Helper/HttpUtils.cs
using System.Net.Http; #if (NETSTANDARD2_0) using Microsoft.Extensions.DependencyInjection; #endif namespace BizwebSharp.Helper { internal static class HttpUtils { #if (NETSTANDARD2_0) private const string BIZWEB_NAMED_HTTPCLIENT_TYPE = "bizweb"; private const string NO_REDIRECT_HTTPCLIENT_TYPE = "no-redirect"; private static readonly ServiceCollection _currentServiceCollection = new ServiceCollection(); private static ServiceProvider _currentServiceProvider; private static IHttpClientFactory _currentHttpClientFactory; private static IHttpClientFactory CreateHttpClientFactory() { if (_currentServiceProvider == null) { _currentServiceCollection.AddHttpClient(BIZWEB_NAMED_HTTPCLIENT_TYPE); _currentServiceCollection.AddHttpClient(NO_REDIRECT_HTTPCLIENT_TYPE) .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { AllowAutoRedirect = false }); _currentServiceProvider = _currentServiceCollection.BuildServiceProvider(); } if (_currentHttpClientFactory == null) { _currentHttpClientFactory = _currentServiceProvider.GetService<IHttpClientFactory>(); } return _currentHttpClientFactory; } internal static HttpClient CreateHttpClient() => CreateHttpClientFactory().CreateClient(BIZWEB_NAMED_HTTPCLIENT_TYPE); internal static HttpClient CreateHttpClientNoRedirect() => CreateHttpClientFactory().CreateClient(NO_REDIRECT_HTTPCLIENT_TYPE); #else // HttpClient instance need to be singleton because of this https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/ private static readonly HttpClient _currentHttpClient = new HttpClient(); internal static HttpClient CreateHttpClient() => _currentHttpClient; private static readonly HttpClientHandler _httpClientHandlerNoRedirect = new HttpClientHandler { AllowAutoRedirect = false }; private static readonly HttpClient _httpClientNoRedirect = new HttpClient(_httpClientHandlerNoRedirect); internal static HttpClient CreateHttpClientNoRedirect() => _httpClientNoRedirect; #endif } }
using System.Net.Http; #if (NETSTANDARD2_0) using Microsoft.Extensions.DependencyInjection; #endif namespace BizwebSharp.Helper { internal static class HttpUtils { #if (NETSTANDARD2_0) private static readonly ServiceCollection _currentServiceCollection = new ServiceCollection(); private static ServiceProvider _currentServiceProvider; private static IHttpClientFactory _currentHttpClientFactory; private static IHttpClientFactory CreateHttpClientFactory() { if (_currentServiceProvider == null) { _currentServiceCollection.AddHttpClient(); _currentServiceCollection.AddHttpClient("no-redirect") .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { AllowAutoRedirect = false }); _currentServiceProvider = _currentServiceCollection.BuildServiceProvider(); } if (_currentHttpClientFactory == null) { _currentHttpClientFactory = _currentServiceProvider.GetService<IHttpClientFactory>(); } return _currentHttpClientFactory; } internal static HttpClient CreateHttpClient() => CreateHttpClientFactory().CreateClient(); internal static HttpClient CreateHttpClientNoRedirect() => CreateHttpClientFactory().CreateClient("no-redirect"); #else // HttpClient instance need to be singleton because of this https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/ private static readonly HttpClient _currentHttpClient = new HttpClient(); internal static HttpClient CreateHttpClient() => _currentHttpClient; private static readonly HttpClientHandler _httpClientHandlerNoRedirect = new HttpClientHandler { AllowAutoRedirect = false }; private static readonly HttpClient _httpClientNoRedirect = new HttpClient(_httpClientHandlerNoRedirect); internal static HttpClient CreateHttpClientNoRedirect() => _httpClientNoRedirect; #endif } }
mit
C#
58f1b42edef3ad93ef6c3c81a2ad604f7cfc7479
Improve test logging
pardeike/Harmony
HarmonyTests/TestTools.cs
HarmonyTests/TestTools.cs
using HarmonyLib; using NUnit.Framework; using System.Linq; namespace HarmonyLibTests { public static class TestTools { public static void Log(string str) { TestContext.WriteLine($" {str}"); } } public class TestLogger { [SetUp] public void BaseSetUp() { var args = TestContext.CurrentContext.Test.Arguments.Select(a => a.ToString()).ToArray().Join(); if (args.Length > 0) args = $"({args})"; TestContext.WriteLine($"### {TestContext.CurrentContext.Test.MethodName}({args})"); } [TearDown] public void BaseTearDown() { TestContext.WriteLine($"--- {TestContext.CurrentContext.Test.MethodName} "); } } }
using HarmonyLib; using NUnit.Framework; using System.Linq; namespace HarmonyLibTests { public static class TestTools { public static void Log(string str) { TestContext.Progress.WriteLine($" {str}"); } } public class TestLogger { [SetUp] public void BaseSetUp() { var args = TestContext.CurrentContext.Test.Arguments.Select(a => a.ToString()).ToArray().Join(); if (args.Length > 0) args = $"({args})"; TestContext.Progress.WriteLine($"### {TestContext.CurrentContext.Test.MethodName}({args})"); } [TearDown] public void BaseTearDown() { TestContext.Progress.WriteLine($"--- {TestContext.CurrentContext.Test.MethodName} "); } } }
mit
C#
b4bbf15aa00c6e6a74d1456e3d9af3a20a2f46c5
call blocking queue after task init
tsqllint/tsqllint,tsqllint/tsqllint
source/TSQLLint/Program.cs
source/TSQLLint/Program.cs
using System; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using TSQLLint.Infrastructure.Reporters; namespace TSQLLint { public class Program { [ExcludeFromCodeCoverage] public static void Main(string[] args) { try { var application = new Application(args, new ConsoleReporter()); application.Run(); Task.Run(() => { while (NonBlockingConsole.messageQueue.Count > 0) { } }).Wait(); } catch (Exception exception) { Console.WriteLine("TSQLLint encountered a problem."); Console.WriteLine(exception); } } } }
using System; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using TSQLLint.Infrastructure.Reporters; namespace TSQLLint { public class Program { [ExcludeFromCodeCoverage] public static void Main(string[] args) { try { System.Console.WriteLine("Running TSQLLint."); var builder = new ConfigurationBuilder() .SetBasePath(AppDomain.CurrentDomain.BaseDirectory) .AddJsonFile("appsettings.json"); var configuration = builder.Build(); var application = new Application(args, new ConsoleReporter()); application.Run(); Task.Run(() => { while (NonBlockingConsole.messageQueue.Count > 0) { } }).Wait(); } catch (Exception exception) { System.Console.WriteLine("TSQLLint encountered a problem."); System.Console.WriteLine(exception); } } } }
mit
C#
ee6c98466d9974311d529cc4940ddac077fd7667
Update ObservableResource.cs
Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
src/Core2D/ObservableResource.cs
src/Core2D/ObservableResource.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Immutable; using Core2D.Attributes; namespace Core2D { /// <summary> /// Observable resources base class. /// </summary> public abstract class ObservableResource : ObservableObject { private ImmutableArray<ObservableObject> _resources; /// <summary> /// Initializes a new instance of the <see cref="ObservableResource"/> class. /// </summary> public ObservableResource() : base() { Resources = ImmutableArray.Create<ObservableObject>(); } /// <summary> /// Gets or sets shape resources. /// </summary> [Content] public ImmutableArray<ObservableObject> Resources { get { return _resources; } set { Update(ref _resources, value); } } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Immutable; using Core2D.Attributes; namespace Core2D { /// <summary> /// Observable resources base class. /// </summary> public abstract class ObservableResource : ObservableObject { private ImmutableArray<ObservableObject> _resources; /// <summary> /// Initializes a new instance of the <see cref="ObservableResource"/> class. /// </summary> public ObservableResource() : base() => Resources = ImmutableArray.Create<ObservableObject>(); /// <summary> /// Gets or sets shape resources. /// </summary> [Content] public ImmutableArray<ObservableObject> Resources { get => _resources; set => Update(ref _resources, value); } } }
mit
C#
2d8956762a5cba8e688d24a5e3ac837eb416d30f
build 1.0.10.0
agileharbor/shopVisibleAccess
src/Global/GlobalAssemblyInfo.cs
src/Global/GlobalAssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; [ assembly : ComVisible( false ) ] [ assembly : AssemblyProduct( "ShopVisibleAccess" ) ] [ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ] [ assembly : AssemblyCopyright( "Copyright (C) 2014 Agile Harbor, LLC" ) ] [ assembly : AssemblyDescription( "ShopVisible webservices API wrapper." ) ] [ assembly : AssemblyTrademark( "" ) ] [ assembly : AssemblyCulture( "" ) ] [ assembly : CLSCompliant( false ) ] // 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.*")] // Keep in track with CA API version [ assembly : AssemblyVersion( "1.0.10.0" ) ]
using System; using System.Reflection; using System.Runtime.InteropServices; [ assembly : ComVisible( false ) ] [ assembly : AssemblyProduct( "ShopVisibleAccess" ) ] [ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ] [ assembly : AssemblyCopyright( "Copyright (C) 2014 Agile Harbor, LLC" ) ] [ assembly : AssemblyDescription( "ShopVisible webservices API wrapper." ) ] [ assembly : AssemblyTrademark( "" ) ] [ assembly : AssemblyCulture( "" ) ] [ assembly : CLSCompliant( false ) ] // 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.*")] // Keep in track with CA API version [ assembly : AssemblyVersion( "1.0.9.0" ) ]
bsd-3-clause
C#
74600a155ac034f271ffedf5b1395906f96c9f29
Remove explicit build addin dependency version
SotoiGhost/FacebookComponents,SotoiGhost/FacebookComponents
common.cake
common.cake
#tool nuget:?package=XamarinComponent&version=1.1.0.32 #addin nuget:?package=Cake.Xamarin.Build #addin nuget:?package=Cake.Xamarin #addin nuget:?package=Cake.XCode
#tool nuget:?package=XamarinComponent&version=1.1.0.32 #addin nuget:?package=Cake.Xamarin.Build&version=1.0.14.0 #addin nuget:?package=Cake.Xamarin #addin nuget:?package=Cake.XCode
mit
C#
d47486db7a12941463bf4356beebfa8a60d7be57
Add implicit conversion from JsonFilter<T> to T
tejacques/Polarize,tejacques/Polarize
src/Polarize/JsonFilter.cs
src/Polarize/JsonFilter.cs
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Polarize { [JsonConverter(typeof(JsonFilterSerializer))] public class JsonFilter { public object Value; public readonly string[] Fields; public readonly HashSet<string> FieldPrefixSet; public readonly HashSet<string> FieldSet; public static JsonFilter<T> Create<T>(T value, params string[] fields) { return new JsonFilter<T>(value, fields); } internal JsonFilter(object value, string[] fields) { Value = value; Array.Sort(fields); Fields = fields; FieldSet = new HashSet<string>(fields); FieldPrefixSet = new HashSet<string>( fields.SelectMany(field => { var splitFields = field.Split(StringSplits.Period); string[] fieldPaths = new string[splitFields.Length]; StringBuilder sb = new StringBuilder(splitFields[0]); fieldPaths[0] = sb.ToString(); for (int i = 1; i < splitFields.Length; i++) { sb.Append('.'); sb.Append(splitFields[i]); fieldPaths[i] = sb.ToString(); } return fieldPaths; })); } } [JsonConverter(typeof(JsonFilterSerializer))] public class JsonFilter<T> : JsonFilter { internal JsonFilter(T value, string[] fields) : base(value, fields) {} public static implicit operator JsonFilter<T>(T t) { return JsonFilter.Create(t); } public static implicit operator T(JsonFilter<T> jsf) { return (T)jsf.Value; } } }
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Polarize { [JsonConverter(typeof(JsonFilterSerializer))] public class JsonFilter { public object Value; public readonly string[] Fields; public readonly HashSet<string> FieldPrefixSet; public readonly HashSet<string> FieldSet; public static JsonFilter<T> Create<T>(T value, params string[] fields) { return new JsonFilter<T>(value, fields); } internal JsonFilter(object value, string[] fields) { Value = value; Array.Sort(fields); Fields = fields; FieldSet = new HashSet<string>(fields); FieldPrefixSet = new HashSet<string>( fields.SelectMany(field => { var splitFields = field.Split(StringSplits.Period); string[] fieldPaths = new string[splitFields.Length]; StringBuilder sb = new StringBuilder(splitFields[0]); fieldPaths[0] = sb.ToString(); for (int i = 1; i < splitFields.Length; i++) { sb.Append('.'); sb.Append(splitFields[i]); fieldPaths[i] = sb.ToString(); } return fieldPaths; })); } } [JsonConverter(typeof(JsonFilterSerializer))] public class JsonFilter<T> : JsonFilter { internal JsonFilter(T value, string[] fields) : base(value, fields) {} public static implicit operator JsonFilter<T>(T t) { return JsonFilter.Create(t); } } }
mit
C#
ef86d6f93660f383ea7649d73f1fc9d40fb46a9b
Test commit
reflectsoftware/Plato.NET
src/Plato.TestHarness/Program.cs
src/Plato.TestHarness/Program.cs
namespace Plato.TestHarness { class Program { static void Main(string[] args) { Cache.CachePlaygorund.RunAsync().Wait(); //RedisTest.RedisPlayground.RunAsync().Wait(); // Mapper.MapperPlayground.RunAsync().Wait(); // RMQ.RMQPlayground.RunAsync().Wait(); } } }
namespace Plato.TestHarness { class Program { static void Main(string[] args) { Cache.CachePlaygorund.RunAsync().Wait(); //RedisTest.RedisPlayground.RunAsync().Wait(); // Mapper.MapperPlayground.RunAsync().Wait(); // RMQ.RMQPlayground.RunAsync().Wait(); } } }
apache-2.0
C#
e58fb3f52823a4feb1ead00097000e4e689cac48
Make default taiko HP 1 for test scene
EVAST9919/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu-new,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,peppy/osu,EVAST9919/osu,2yangk23/osu,NeoAdonis/osu,smoogipoo/osu,2yangk23/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu
osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoModPerfect.cs
osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoModPerfect.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Mods; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Scoring; using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Taiko.Tests { public class TestSceneTaikoModPerfect : ModPerfectTestScene { public TestSceneTaikoModPerfect() : base(new TestTaikoRuleset(), new TaikoModPerfect()) { } [TestCase(false)] [TestCase(true)] public void TestHit(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestCase(new CentreHit { StartTime = 1000 }), shouldMiss); [TestCase(false)] [TestCase(true)] public void TestDrumRoll(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestCase(new DrumRoll { StartTime = 1000, EndTime = 3000 }), shouldMiss); [TestCase(false)] [TestCase(true)] public void TestSwell(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestCase(new Swell { StartTime = 1000, EndTime = 3000 }), shouldMiss); private class TestTaikoRuleset : TaikoRuleset { public override HealthProcessor CreateHealthProcessor(double drainStartTime) => new TestTaikoHealthProcessor(); private class TestTaikoHealthProcessor : TaikoHealthProcessor { protected override void Reset(bool storeResults) { base.Reset(storeResults); Health.Value = 1; // Don't care about the health condition (only the mod condition) } } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Rulesets.Taiko.Mods; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Taiko.Tests { public class TestSceneTaikoModPerfect : ModPerfectTestScene { public TestSceneTaikoModPerfect() : base(new TaikoRuleset(), new TaikoModPerfect()) { } [TestCase(false)] [TestCase(true)] public void TestHit(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestCase(new CentreHit { StartTime = 1000 }), shouldMiss); [TestCase(false)] [TestCase(true)] public void TestDrumRoll(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestCase(new DrumRoll { StartTime = 1000, EndTime = 3000 }), shouldMiss); [TestCase(false)] [TestCase(true)] public void TestSwell(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestCase(new Swell { StartTime = 1000, EndTime = 3000 }), shouldMiss); } }
mit
C#
f4cfc44905fbccf124631b10884bdacdb219b67e
Bump version to 1.0.4
rexcfnghk/Ninject.Web.Mvc5.FluentValidation
Ninject.Web.Mvc5.FluentValidation/Properties/AssemblyInfo.cs
Ninject.Web.Mvc5.FluentValidation/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("Ninject.Web.Mvc5.FluentValidation")] [assembly: AssemblyDescription("Fluent validation extension for Ninject.Web.Mvc")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rex Ng")] [assembly: AssemblyProduct("Ninject.Web.Mvc5.FluentValidation")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("fd62ab63-ca9f-45b4-b736-40450438dd89")] // 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.4")]
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("Ninject.Web.Mvc5.FluentValidation")] [assembly: AssemblyDescription("Fluent validation extension for Ninject.Web.Mvc")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rex Ng")] [assembly: AssemblyProduct("Ninject.Web.Mvc5.FluentValidation")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("fd62ab63-ca9f-45b4-b736-40450438dd89")] // 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.3")]
mit
C#
b305a160c9796c0591d8896dbdc036e6b55cc443
Add unit tests for enum sync type read and write.
henrikfroehling/TraktApiSharp
Source/Tests/TraktApiSharp.Tests/Enums/TraktSyncTypeTests.cs
Source/Tests/TraktApiSharp.Tests/Enums/TraktSyncTypeTests.cs
namespace TraktApiSharp.Tests.Enums { using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using TraktApiSharp.Enums; [TestClass] public class TraktSyncTypeTests { class TestObject { [JsonConverter(typeof(TraktSyncTypeConverter))] public TraktSyncType Value { get; set; } } [TestMethod] public void TestTraktSyncTypeHasMembers() { typeof(TraktSyncType).GetEnumNames().Should().HaveCount(3) .And.Contain("Unspecified", "Movie", "Episode"); } [TestMethod] public void TestTraktSyncTypeGetAsString() { TraktSyncType.Unspecified.AsString().Should().NotBeNull().And.BeEmpty(); TraktSyncType.Movie.AsString().Should().Be("movie"); TraktSyncType.Episode.AsString().Should().Be("episode"); } [TestMethod] public void TestTraktSyncTypeGetAsStringUriParameter() { TraktSyncType.Unspecified.AsStringUriParameter().Should().NotBeNull().And.BeEmpty(); TraktSyncType.Movie.AsStringUriParameter().Should().Be("movies"); TraktSyncType.Episode.AsStringUriParameter().Should().Be("episodes"); } [TestMethod] public void TestTraktSyncTypeWriteAndReadJson_Movie() { var obj = new TestObject { Value = TraktSyncType.Movie }; var objWritten = JsonConvert.SerializeObject(obj); objWritten.Should().NotBeNullOrEmpty(); var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten); objRead.Should().NotBeNull(); objRead.Value.Should().Be(TraktSyncType.Movie); } [TestMethod] public void TestTraktSyncTypeWriteAndReadJson_Episode() { var obj = new TestObject { Value = TraktSyncType.Episode }; var objWritten = JsonConvert.SerializeObject(obj); objWritten.Should().NotBeNullOrEmpty(); var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten); objRead.Should().NotBeNull(); objRead.Value.Should().Be(TraktSyncType.Episode); } [TestMethod] public void TestTraktSyncTypeWriteAndReadJson_Unspecified() { var obj = new TestObject { Value = TraktSyncType.Unspecified }; var objWritten = JsonConvert.SerializeObject(obj); objWritten.Should().NotBeNullOrEmpty(); var objRead = JsonConvert.DeserializeObject<TestObject>(objWritten); objRead.Should().NotBeNull(); objRead.Value.Should().Be(TraktSyncType.Unspecified); } } }
namespace TraktApiSharp.Tests.Enums { using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using TraktApiSharp.Enums; [TestClass] public class TraktSyncTypeTests { [TestMethod] public void TestTraktSyncTypeHasMembers() { typeof(TraktSyncType).GetEnumNames().Should().HaveCount(3) .And.Contain("Unspecified", "Movie", "Episode"); } [TestMethod] public void TestTraktSyncTypeGetAsString() { TraktSyncType.Unspecified.AsString().Should().NotBeNull().And.BeEmpty(); TraktSyncType.Movie.AsString().Should().Be("movie"); TraktSyncType.Episode.AsString().Should().Be("episode"); } [TestMethod] public void TestTraktSyncTypeGetAsStringUriParameter() { TraktSyncType.Unspecified.AsStringUriParameter().Should().NotBeNull().And.BeEmpty(); TraktSyncType.Movie.AsStringUriParameter().Should().Be("movies"); TraktSyncType.Episode.AsStringUriParameter().Should().Be("episodes"); } } }
mit
C#
7aa8a86682c56bdde474839339a0c39fd62297e2
fix for non-empty complex type being recognised as empty
avao/Codge
Src/Codge.Generator/Presentations/Xsd/XmlSchemaExtensions.cs
Src/Codge.Generator/Presentations/Xsd/XmlSchemaExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Schema; namespace Codge.Generator.Presentations.Xsd { public static class XmlSchemaExtensions { public static bool IsEmptyType(this XmlSchemaComplexType type) { return type.ContentModel == null && type.Attributes.Count == 0 && type.ContentType.ToString() == "Empty"; } public static IEnumerable<XmlSchemaEnumerationFacet> GetEnumerationFacets(this XmlSchemaSimpleType simpleType) { if (simpleType.Content != null) { var restriction = simpleType.Content as XmlSchemaSimpleTypeRestriction; if (restriction != null && restriction.Facets != null && restriction.Facets.Count > 0) { foreach (var facet in restriction.Facets) { var item = facet as XmlSchemaEnumerationFacet; if (item == null) yield break; yield return item; } } } yield break; } public static bool IsEnumeration(this XmlSchemaSimpleType simpleType) { return GetEnumerationFacets(simpleType).Any(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Schema; namespace Codge.Generator.Presentations.Xsd { public static class XmlSchemaExtensions { public static bool IsEmptyType(this XmlSchemaComplexType type) { return type.ContentModel == null && type.Attributes.Count == 0; } public static IEnumerable<XmlSchemaEnumerationFacet> GetEnumerationFacets(this XmlSchemaSimpleType simpleType) { if (simpleType.Content != null) { var restriction = simpleType.Content as XmlSchemaSimpleTypeRestriction; if (restriction != null && restriction.Facets != null && restriction.Facets.Count > 0) { foreach (var facet in restriction.Facets) { var item = facet as XmlSchemaEnumerationFacet; if (item == null) yield break; yield return item; } } } yield break; } public static bool IsEnumeration(this XmlSchemaSimpleType simpleType) { return GetEnumerationFacets(simpleType).Any(); } } }
apache-2.0
C#
0cdf6f5ce2a2b9120a1b731d36973179752c4567
Update microbenchmarks to use server GC (#635)
grpc/grpc-dotnet,grpc/grpc-dotnet,grpc/grpc-dotnet,grpc/grpc-dotnet
perf/Grpc.AspNetCore.Microbenchmarks/DefaultCoreConfig.cs
perf/Grpc.AspNetCore.Microbenchmarks/DefaultCoreConfig.cs
#region Copyright notice and license // Copyright 2019 The gRPC Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using BenchmarkDotNet.Columns; using BenchmarkDotNet.Configs; using BenchmarkDotNet.Diagnosers; using BenchmarkDotNet.Engines; using BenchmarkDotNet.Exporters; using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Loggers; using BenchmarkDotNet.Toolchains.CsProj; using BenchmarkDotNet.Toolchains.DotNetCli; using BenchmarkDotNet.Toolchains.InProcess; using BenchmarkDotNet.Validators; namespace Grpc.AspNetCore.Microbenchmarks { internal class DefaultCoreConfig : ManualConfig { public DefaultCoreConfig() { Add(ConsoleLogger.Default); Add(MarkdownExporter.GitHub); Add(MemoryDiagnoser.Default); Add(StatisticColumn.OperationsPerSecond); Add(DefaultColumnProviders.Instance); Add(JitOptimizationsValidator.FailOnError); Add(Job.Core .With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.0", null, ".NET Core 3.0"))) .With(new GcMode { Server = true }) .With(RunStrategy.Throughput)); } } }
#region Copyright notice and license // Copyright 2019 The gRPC Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using BenchmarkDotNet.Columns; using BenchmarkDotNet.Configs; using BenchmarkDotNet.Diagnosers; using BenchmarkDotNet.Engines; using BenchmarkDotNet.Exporters; using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Loggers; using BenchmarkDotNet.Toolchains.CsProj; using BenchmarkDotNet.Toolchains.DotNetCli; using BenchmarkDotNet.Toolchains.InProcess; using BenchmarkDotNet.Validators; namespace Grpc.AspNetCore.Microbenchmarks { internal class DefaultCoreConfig : ManualConfig { public DefaultCoreConfig() { Add(ConsoleLogger.Default); Add(MarkdownExporter.GitHub); Add(MemoryDiagnoser.Default); Add(StatisticColumn.OperationsPerSecond); Add(DefaultColumnProviders.Instance); Add(JitOptimizationsValidator.FailOnError); // TODO(JamesNK): Change to out of process and enable server GC when https://github.com/dotnet/BenchmarkDotNet/issues/1023 is fixed Add(Job.Core .With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.0", null, ".NET Core 3.0"))) .With(InProcessToolchain.Instance) .With(RunStrategy.Throughput)); } } }
apache-2.0
C#
653356a5cdbf16c639b4d00ded9e5098cf06f672
Clean up TestHarness to be more instructive
geffzhang/kafka-net,gigya/KafkaNetClient,bridgewell/kafka-net,CenturyLinkCloud/kafka-net,EranOfer/KafkaNetClient,martijnhoekstra/kafka-net,nightkid1027/kafka-net,Jroland/kafka-net,PKRoma/kafka-net,BDeus/KafkaNetClient
src/TestHarness/Program.cs
src/TestHarness/Program.cs
using System; using System.Threading.Tasks; using KafkaNet; using KafkaNet.Common; using KafkaNet.Model; using KafkaNet.Protocol; using System.Collections.Generic; namespace TestHarness { class Program { static void Main(string[] args) { //create an options file that sets up driver preferences var options = new KafkaOptions(new Uri("http://CSDKAFKA01:9092"), new Uri("http://CSDKAFKA02:9092")) { Log = new ConsoleLog() }; //start an out of process thread that runs a consumer that will write all received messages to the console Task.Factory.StartNew(() => { var consumer = new Consumer(new ConsumerOptions("TestHarness", new BrokerRouter(options))); foreach (var data in consumer.Consume()) { Console.WriteLine("Response: P{0},O{1} : {2}", data.Meta.PartitionId, data.Meta.Offset, data.Value.ToUTF8String()); } }); //create a producer to send messages with var producer = new Producer(new BrokerRouter(options)); Console.WriteLine("Type a message and press enter..."); while (true) { var message = Console.ReadLine(); if (message == "quit") break; if (string.IsNullOrEmpty(message)) { //special case, send multi messages quickly for (int i = 0; i < 20; i++) { producer.SendMessageAsync("TestHarness", new[] { new Message(i.ToString()) }) .ContinueWith(t => { t.Result.ForEach(x => Console.WriteLine("Complete: {0}, Offset: {1}", x.PartitionId, x.Offset)); }); } } else { producer.SendMessageAsync("TestHarness", new[] { new Message(message) }); } } using (producer) { } } } }
using System; using System.Threading.Tasks; using KafkaNet; using KafkaNet.Model; using KafkaNet.Protocol; using System.Collections.Generic; namespace TestHarness { class Program { static void Main(string[] args) { var options = new KafkaOptions(new Uri("http://CSDKAFKA01:9092"), new Uri("http://CSDKAFKA02:9092")) { Log = new ConsoleLog() }; var router = new BrokerRouter(options); var client = new Producer(router); Task.Factory.StartNew(() => { var consumer = new Consumer(new ConsumerOptions("TestHarness", router)); foreach (var data in consumer.Consume()) { Console.WriteLine("Response: P{0},O{1} : {2}", data.Meta.PartitionId, data.Meta.Offset, data.Value); } }); Console.WriteLine("Type a message and press enter..."); while (true) { var message = Console.ReadLine(); if (message == "quit") break; client.SendMessageAsync("TestHarness", new[] { new Message(message) }); } using (client) using (router) { } } } }
apache-2.0
C#
cf0af5c017cbaf7e633476801650224a9b850a73
Make appsettings optional again
amweiss/WeatherLink
src/WeatherLink/Startup.cs
src/WeatherLink/Startup.cs
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.PlatformAbstractions; using Swashbuckle.Swagger.Model; using System.IO; using WeatherLink.Models; using WeatherLink.Services; namespace WeatherLink { internal class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath($"{env.ContentRootPath}/src/WeatherLink") .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseStaticFiles(); app.UseMvc(); app.UseSwagger(); app.UseSwaggerUi(); } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services services.AddMvc(); services.AddOptions(); // Add custom services services.Configure<WeatherLinkSettings>(Configuration); services.AddTransient<ITrafficAdviceService, WeatherBasedTrafficAdviceService>(); services.AddTransient<IGeocodeService, GoogleMapsGeocodeService>(); services.AddTransient<IDistanceToDurationService, GoogleMapsDistanceToDurationService>(); services.AddTransient<IDarkSkyService, HourlyAndMinutelyDarkSkyService>(); // Configure swagger services.AddSwaggerGen(); services.ConfigureSwaggerGen(options => { options.SingleApiVersion(new Info { Version = "v1", Title = "Weather Link", Description = "An API to get weather based advice.", TermsOfService = "None" }); options.IncludeXmlComments(GetXmlCommentsPath()); options.DescribeAllEnumsAsStrings(); }); } private string GetXmlCommentsPath() { var app = PlatformServices.Default.Application; return Path.Combine(app.ApplicationBasePath, Path.ChangeExtension(app.ApplicationName, "xml")); } } }
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.PlatformAbstractions; using Swashbuckle.Swagger.Model; using System.IO; using WeatherLink.Models; using WeatherLink.Services; namespace WeatherLink { internal class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath($"{env.ContentRootPath}/src/WeatherLink") .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseStaticFiles(); app.UseMvc(); app.UseSwagger(); app.UseSwaggerUi(); } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services services.AddMvc(); services.AddOptions(); // Add custom services services.Configure<WeatherLinkSettings>(Configuration); services.AddTransient<ITrafficAdviceService, WeatherBasedTrafficAdviceService>(); services.AddTransient<IGeocodeService, GoogleMapsGeocodeService>(); services.AddTransient<IDistanceToDurationService, GoogleMapsDistanceToDurationService>(); services.AddTransient<IDarkSkyService, HourlyAndMinutelyDarkSkyService>(); // Configure swagger services.AddSwaggerGen(); services.ConfigureSwaggerGen(options => { options.SingleApiVersion(new Info { Version = "v1", Title = "Weather Link", Description = "An API to get weather based advice.", TermsOfService = "None" }); options.IncludeXmlComments(GetXmlCommentsPath()); options.DescribeAllEnumsAsStrings(); }); } private string GetXmlCommentsPath() { var app = PlatformServices.Default.Application; return Path.Combine(app.ApplicationBasePath, Path.ChangeExtension(app.ApplicationName, "xml")); } } }
mit
C#
740c8a4202ffa6f42a8a3609381dc27a1c395825
Change assembly version for integration tests too
ali-ince/neo4j-dotnet-driver,neo4j/neo4j-dotnet-driver,neo4j/neo4j-dotnet-driver
Neo4j.Driver/Neo4j.Driver.IntegrationTests/Properties/AssemblyInfo.cs
Neo4j.Driver/Neo4j.Driver.IntegrationTests/Properties/AssemblyInfo.cs
// Copyright (c) 2002-2017 "Neo Technology," // Network Engine for Objects in Lund AB [http://neotechnology.com] // // This file is part of Neo4j. // // 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Xunit; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Neo4j.Driver.IntegrationTests")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Neo4j.Driver.IntegrationTests")] [assembly: AssemblyCopyright("Copyright © 2002-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("02f68df2-0047-4b04-93b6-521bd12b5d45")] // 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.4.*")] [assembly: AssemblyVersion("1.4.0.0")] [assembly: AssemblyFileVersion("1.4.0.0")] // The integration tests defined in this assembly require a database service running in the background. // The tests might rely on certain status of the database, therefore the tests should be executed sequentially. [assembly: CollectionBehavior(DisableTestParallelization = true)]
// Copyright (c) 2002-2017 "Neo Technology," // Network Engine for Objects in Lund AB [http://neotechnology.com] // // This file is part of Neo4j. // // 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Xunit; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Neo4j.Driver.IntegrationTests")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Neo4j.Driver.IntegrationTests")] [assembly: AssemblyCopyright("Copyright © 2002-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("02f68df2-0047-4b04-93b6-521bd12b5d45")] // 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.3.*")] [assembly: AssemblyVersion("1.3.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")] // The integration tests defined in this assembly require a database service running in the background. // The tests might rely on certain status of the database, therefore the tests should be executed sequentially. [assembly: CollectionBehavior(DisableTestParallelization = true)]
apache-2.0
C#
82817760db61adbe6f0580aee8f548df9cb19f7e
Fix HTTP call to execute in LateUpdate
wbap/hackathon-2017-sample,wbap/hackathon-2017-sample,pekin0609/-,pekin0609/-,pekin0609/-,pekin0609/-,wbap/hackathon-2017-sample,wbap/hackathon-2017-sample
environment/Assets/Scripts/AgentBehaviour.cs
environment/Assets/Scripts/AgentBehaviour.cs
using UnityEngine; using MsgPack; [RequireComponent(typeof (AgentController))] [RequireComponent(typeof (AgentSensor))] public class AgentBehaviour : MonoBehaviour { private LISClient client = new LISClient("myagent"); private AgentController controller; private AgentSensor sensor; private MsgPack.CompiledPacker packer = new MsgPack.CompiledPacker(); bool created = false; void OnCollisionEnter(Collision col) { if(col.gameObject.tag == "Reward") { NotificationCenter.DefaultCenter.PostNotification(this, "OnRewardCollision"); } } byte[] GenerateMessage() { Message msg = new Message(); msg.reward = PlayerPrefs.GetFloat("Reward"); msg.image = sensor.GetRgbImages(); msg.depth = sensor.GetDepthImages(); return packer.Pack(msg); } byte[] GenerateResetMessage(bool finished) { ResetMessage msg = new ResetMessage(); msg.reward = PlayerPrefs.GetFloat("Reward"); msg.success = PlayerPrefs.GetInt("Success Count"); msg.failure = PlayerPrefs.GetInt("Failure Count"); msg.elapsed = PlayerPrefs.GetInt("Elapsed Time"); msg.finished = finished; return packer.Pack(msg); } public void Reset() { client.Reset(GenerateResetMessage(false)); } public void Finish() { client.Reset(GenerateResetMessage(true)); } void Start () { controller = GetComponent<AgentController>(); sensor = GetComponent<AgentSensor>(); } void LateUpdate () { if(!created) { if(!client.Calling) { client.Create(GenerateMessage()); created = true; } } else { if(!client.Calling) { client.Step(GenerateMessage()); } if(client.HasAction) { string action = client.GetAction(); controller.PerformAction(action); } } } }
using UnityEngine; using MsgPack; [RequireComponent(typeof (AgentController))] [RequireComponent(typeof (AgentSensor))] public class AgentBehaviour : MonoBehaviour { private LISClient client = new LISClient("myagent"); private AgentController controller; private AgentSensor sensor; private MsgPack.CompiledPacker packer = new MsgPack.CompiledPacker(); bool created = false; void OnCollisionEnter(Collision col) { if(col.gameObject.tag == "Reward") { NotificationCenter.DefaultCenter.PostNotification(this, "OnRewardCollision"); } } byte[] GenerateMessage() { Message msg = new Message(); msg.reward = PlayerPrefs.GetFloat("Reward"); msg.image = sensor.GetRgbImages(); msg.depth = sensor.GetDepthImages(); return packer.Pack(msg); } byte[] GenerateResetMessage(bool finished) { ResetMessage msg = new ResetMessage(); msg.reward = PlayerPrefs.GetFloat("Reward"); msg.success = PlayerPrefs.GetInt("Success Count"); msg.failure = PlayerPrefs.GetInt("Failure Count"); msg.elapsed = PlayerPrefs.GetInt("Elapsed Time"); msg.finished = finished; return packer.Pack(msg); } public void Reset() { client.Reset(GenerateResetMessage(false)); } public void Finish() { client.Reset(GenerateResetMessage(true)); } void Start () { controller = GetComponent<AgentController>(); sensor = GetComponent<AgentSensor>(); } void Update () { if(!created) { if(!client.Calling) { client.Create(GenerateMessage()); created = true; } } else { if(!client.Calling) { client.Step(GenerateMessage()); } if(client.HasAction) { string action = client.GetAction(); controller.PerformAction(action); } } } }
apache-2.0
C#
6d779f17b31746fc6a9f2c9f3c401b69ab936dfd
Fix video player tooltip going outside Form bounds
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
video/Controls/LabelTooltip.cs
video/Controls/LabelTooltip.cs
using System; using System.Drawing; using System.Windows.Forms; namespace TweetDuck.Video.Controls{ sealed class LabelTooltip : Label{ public LabelTooltip(){ Visible = false; } public void AttachTooltip(Control control, bool followCursor, string tooltip){ AttachTooltip(control, followCursor, args => tooltip); } public void AttachTooltip(Control control, bool followCursor, Func<MouseEventArgs, string> tooltipFunc){ control.MouseEnter += control_MouseEnter; control.MouseLeave += control_MouseLeave; control.MouseMove += (sender, args) => { Form form = control.FindForm(); System.Diagnostics.Debug.Assert(form != null); Text = tooltipFunc(args); Point loc = form.PointToClient(control.Parent.PointToScreen(new Point(control.Location.X+(followCursor ? args.X : control.Width/2), 0))); loc.X = Math.Max(0, Math.Min(form.Width-Width, loc.X-Width/2)); loc.Y -= Height-Margin.Top+Margin.Bottom; Location = loc; }; } private void control_MouseEnter(object sender, EventArgs e){ Visible = true; } private void control_MouseLeave(object sender, EventArgs e){ Visible = false; } } }
using System; using System.Diagnostics; using System.Drawing; using System.Windows.Forms; namespace TweetDuck.Video.Controls{ sealed class LabelTooltip : Label{ public LabelTooltip(){ Visible = false; } public void AttachTooltip(Control control, bool followCursor, string tooltip){ AttachTooltip(control, followCursor, args => tooltip); } public void AttachTooltip(Control control, bool followCursor, Func<MouseEventArgs, string> tooltipFunc){ control.MouseEnter += control_MouseEnter; control.MouseLeave += control_MouseLeave; control.MouseMove += (sender, args) => { Form form = control.FindForm(); Debug.Assert(form != null); Text = tooltipFunc(args); Location = form.PointToClient(control.Parent.PointToScreen(new Point(control.Location.X-Width/2+(followCursor ? args.X : control.Width/2), -Height+Margin.Top-Margin.Bottom)));; }; } private void control_MouseEnter(object sender, EventArgs e){ Visible = true; } private void control_MouseLeave(object sender, EventArgs e){ Visible = false; } } }
mit
C#
12241902ef17c1641cea255f39e7f534a5723c4a
Update option text.
earalov/Skylines-ElevatedTrainStationTrack
Options.cs
Options.cs
 using MetroOverhaul.Detours; using MetroOverhaul.OptionsFramework.Attibutes; namespace MetroOverhaul { [Options("MetroOverhaul")] public class Options { private const string UNSUBPREP = "Unsubscribe Prep"; private const string GENERAL = "General settings"; public Options() { improvedPassengerTrainAi = true; improvedMetroTrainAi = true; metroUi = true; ghostMode = false; depotsNotRequiredMode = false; } [Checkbox("Metro track customization UI (requires reloading from main menu)", GENERAL)] public bool metroUi { set; get; } [Checkbox("No depot required mode (requires reloading from main menu)", GENERAL)] public bool depotsNotRequiredMode { set; get; } [Checkbox("Improved PassengerTrainAI (Allows trains to return to depots)", GENERAL, typeof(PassengerTrainAIDetour), nameof(PassengerTrainAIDetour.ChangeDeployState))] public bool improvedPassengerTrainAi { set; get; } [Checkbox("Improved MetroTrainAI (Allows trains to properly spawn at surface)", GENERAL, typeof(MetroTrainAIDetour), nameof(MetroTrainAIDetour.ChangeDeployState))] public bool improvedMetroTrainAi { set; get; } [Checkbox("GHOST MODE (Load your MOM city with this ON and save before unsubscribing)", UNSUBPREP)] public bool ghostMode { set; get; } } }
 using MetroOverhaul.Detours; using MetroOverhaul.OptionsFramework.Attibutes; namespace MetroOverhaul { [Options("MetroOverhaul")] public class Options { private const string UNSUBPREP = "Unsubscribe Prep"; private const string GENERAL = "General settings"; public Options() { improvedPassengerTrainAi = true; improvedMetroTrainAi = true; metroUi = true; ghostMode = false; depotsNotRequiredMode = false; } [Checkbox("Metro track customization UI (requires reloading from main menu)", GENERAL)] public bool metroUi { set; get; } [Checkbox("No depot mode (Trains will spawn at stations. Please bulldoze existing depots after enabling)", GENERAL)] public bool depotsNotRequiredMode { set; get; } [Checkbox("Improved PassengerTrainAI (Allows trains to return to depots)", GENERAL, typeof(PassengerTrainAIDetour), nameof(PassengerTrainAIDetour.ChangeDeployState))] public bool improvedPassengerTrainAi { set; get; } [Checkbox("Improved MetroTrainAI (Allows trains to properly spawn at surface)", GENERAL, typeof(MetroTrainAIDetour), nameof(MetroTrainAIDetour.ChangeDeployState))] public bool improvedMetroTrainAi { set; get; } [Checkbox("GHOST MODE (Load your MOM city with this ON and save before unsubscribing)", UNSUBPREP)] public bool ghostMode { set; get; } } }
mit
C#
500e3227e110fcc5b971490cb8d6e7cf1af869f9
Fix BirdTarget manipulating the average flock direction
christiancrt/POVbird,christiancrt/POVbird
Flock/Assets/BirdTarget.cs
Flock/Assets/BirdTarget.cs
using UnityEngine; using System.Collections; public class BirdTarget : MonoBehaviour { [SerializeField] private int _flockSize = 5; [SerializeField] private GameObject _birdPrefab; [SerializeField] private Vector3[] _path; [SerializeField] private float _sqrPositionEps = 0.001f; // Squared threshold for checking if we reached a node. private int _targetNode = 0; public Vector3[] Path { get { return _path; }} public float Speed = 1.0f; [SerializeField] private Vector3 _currentDir; public Vector3 CurrentDir { get { return _currentDir; } set {_currentDir = value; } } // Flock properties public float DirChangeDeltaTime = 1.0f; // Time after which random direction changes should occur public float RecordingTime = 10.0f; // Defines for how long transform data should be written. public float RecordedTime = 0f; [SerializeField] private float _SqrMinDistance = 1.0f; public float SqrMinDistance { get { return _SqrMinDistance; } } public float MinDistance { get { return Mathf.Sqrt (_SqrMinDistance); } set { _SqrMinDistance = value * value; } } [SerializeField] private float _SqrMaxDistance = 5.0f; public float SqrMaxDistance { get {return _SqrMaxDistance; } } public float MaxDistance { get { return Mathf.Sqrt (_SqrMaxDistance); } set { _SqrMaxDistance = value * value; } } private void TargetNextNode () { _targetNode = (_targetNode + 1) % _path.Length; CurrentDir = (_path[_targetNode] - transform.position).normalized; } private void CreateFlock () { for (int i = 0; i < _flockSize; i++) { Vector3 position = transform.position; position.x += Random.Range (-5f, 5f); position.y += Random.Range (-5f, 5f); position.z += Random.Range (-5f, 5f); GameObject newBird = (GameObject)Instantiate (_birdPrefab, position, transform.rotation); newBird.GetComponent<BirdBehaviour> ().Target = gameObject; } } void Start () { if (_path.Length < 2) { throw new UnityException ("Not enough path nodes!"); } transform.position = _path[_targetNode]; TargetNextNode (); CreateFlock (); } void FixedUpdate () { if ((_path[_targetNode] - transform.position).sqrMagnitude < _sqrPositionEps) { TargetNextNode (); } transform.LookAt (transform.position + _currentDir); transform.position += _currentDir * Speed * Time.fixedDeltaTime; RecordedTime = Time.fixedTime; } }
using UnityEngine; using System.Collections; public class BirdTarget : MonoBehaviour { [SerializeField] private int _flockSize = 5; [SerializeField] private GameObject _birdPrefab; [SerializeField] private Vector3[] _path; [SerializeField] private float _sqrPositionEps = 0.001f; // Squared threshold for checking if we reached a node. private int _targetNode = 0; public Vector3[] Path { get { return _path; }} public float Speed = 1.0f; [SerializeField] private Vector3 _currentDir; public Vector3 CurrentDir { get { return _currentDir; } set {_currentDir = value; } } // Flock properties public float DirChangeDeltaTime = 1.0f; // Time after which random direction changes should occur public float RecordingTime = 10.0f; // Defines for how long transform data should be written. [SerializeField] private float _SqrMinDistance = 1.0f; public float SqrMinDistance { get { return _SqrMinDistance; } } public float MinDistance { get { return Mathf.Sqrt (_SqrMinDistance); } set { _SqrMinDistance = value * value; } } [SerializeField] private float _SqrMaxDistance = 5.0f; public float SqrMaxDistance { get {return _SqrMaxDistance; } } public float MaxDistance { get { return Mathf.Sqrt (_SqrMaxDistance); } set { _SqrMaxDistance = value * value; } } private void TargetNextNode () { _targetNode = (_targetNode + 1) % _path.Length; CurrentDir = (_path[_targetNode] - transform.position).normalized; } private void CreateFlock () { for (int i = 0; i < _flockSize; i++) { Vector3 position = transform.position; position.x += Random.Range (-5f, 5f); position.y += Random.Range (-5f, 5f); position.z += Random.Range (-5f, 5f); GameObject newBird = (GameObject)Instantiate (_birdPrefab, position, transform.rotation); newBird.GetComponent<BirdBehaviour> ().Target = gameObject; } } void Start () { if (_path.Length < 2) { throw new UnityException ("Not enough path nodes!"); } transform.position = _path[_targetNode]; TargetNextNode (); CreateFlock (); } void FixedUpdate () { if ((_path[_targetNode] - transform.position).sqrMagnitude < _sqrPositionEps) { TargetNextNode (); } transform.position += _currentDir * Speed * Time.fixedDeltaTime; } }
cc0-1.0
C#
0f4bd53e891a42c058e95004e2da592f11a14ff2
Update text diagnostic
gerryaobrien/code-cracker,carloscds/code-cracker,carloscds/code-cracker,adraut/code-cracker,code-cracker/code-cracker,andrecarlucci/code-cracker,code-cracker/code-cracker,akamud/code-cracker,thomaslevesque/code-cracker,modulexcite/code-cracker,GuilhermeSa/code-cracker,eirielson/code-cracker,ElemarJR/code-cracker,dlsteuer/code-cracker,caioadz/code-cracker,eriawan/code-cracker,f14n/code-cracker,dmgandini/code-cracker,giggio/code-cracker,kindermannhubert/code-cracker,baks/code-cracker,AlbertoMonteiro/code-cracker,jhancock93/code-cracker,thorgeirk11/code-cracker,robsonalves/code-cracker,jwooley/code-cracker
src/CodeCracker/Refactoring/ParameterRefactoryAnalyzer.cs
src/CodeCracker/Refactoring/ParameterRefactoryAnalyzer.cs
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using System.Collections.Immutable; using System.Linq; using System; namespace CodeCracker { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class ParameterRefactoryAnalyzer : DiagnosticAnalyzer { public const string DiagnosticId = "CC0020"; internal const string Title = "You should using 'new class'"; internal const string MessageFormat = "When the method has more than three parameters, use new class."; internal const string Category = "Syntax"; internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } } public override void Initialize(AnalysisContext context) { context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.MethodDeclaration); } private void AnalyzeNode(SyntaxNodeAnalysisContext context) { var method = (MethodDeclarationSyntax)context.Node; var contentParameter = method.ParameterList; if (!contentParameter.Parameters.Any() || contentParameter.Parameters.Count <= 3) return; if (method.Body.ChildNodes().Count() > 0) return; var diagnostic = Diagnostic.Create(Rule, contentParameter.GetLocation()); context.ReportDiagnostic(diagnostic); } } }
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using System.Collections.Immutable; using System.Linq; using System; namespace CodeCracker { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class ParameterRefactoryAnalyzer : DiagnosticAnalyzer { public const string DiagnosticId = "CC0020"; internal const string Title = "You should using 'new class'"; internal const string MessageFormat = "When the method has more than three parameters, use new Class."; internal const string Category = "Syntax"; internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } } public override void Initialize(AnalysisContext context) { context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.MethodDeclaration); } private void AnalyzeNode(SyntaxNodeAnalysisContext context) { var method = (MethodDeclarationSyntax)context.Node; var contentParameter = method.ParameterList; if (!contentParameter.Parameters.Any() || contentParameter.Parameters.Count <= 3) return; if (method.Body.ChildNodes().Count() > 0) return; var diagnostic = Diagnostic.Create(Rule, contentParameter.GetLocation(), "You can use new Class instead of for."); context.ReportDiagnostic(diagnostic); } } }
apache-2.0
C#
502856c6cd872dc63f95ac9e54df4ff419d9ebec
Declare Sequential layout on FileStatus to remove the uninitialized field warnings
bitcrazed/corefx,thiagodin/corefx,kkurni/corefx,YoupHulsebos/corefx,shmao/corefx,iamjasonp/corefx,chaitrakeshav/corefx,brett25/corefx,larsbj1988/corefx,adamralph/corefx,gkhanna79/corefx,elijah6/corefx,Frank125/corefx,wtgodbe/corefx,uhaciogullari/corefx,cartermp/corefx,marksmeltzer/corefx,adamralph/corefx,tstringer/corefx,cartermp/corefx,anjumrizwi/corefx,zhenlan/corefx,richlander/corefx,marksmeltzer/corefx,iamjasonp/corefx,mazong1123/corefx,twsouthwick/corefx,the-dwyer/corefx,dtrebbien/corefx,kyulee1/corefx,rjxby/corefx,rjxby/corefx,cnbin/corefx,mafiya69/corefx,nelsonsar/corefx,anjumrizwi/corefx,krytarowski/corefx,jcme/corefx,DnlHarvey/corefx,zhenlan/corefx,Chrisboh/corefx,SGuyGe/corefx,ravimeda/corefx,gabrielPeart/corefx,parjong/corefx,stormleoxia/corefx,YoupHulsebos/corefx,Jiayili1/corefx,stephenmichaelf/corefx,ptoonen/corefx,zhangwenquan/corefx,mokchhya/corefx,jcme/corefx,twsouthwick/corefx,Priya91/corefx-1,nchikanov/corefx,mellinoe/corefx,KrisLee/corefx,stone-li/corefx,vidhya-bv/corefx-sorting,mmitche/corefx,andyhebear/corefx,janhenke/corefx,tstringer/corefx,Jiayili1/corefx,benpye/corefx,tijoytom/corefx,stephenmichaelf/corefx,Ermiar/corefx,jeremymeng/corefx,YoupHulsebos/corefx,pallavit/corefx,alphonsekurian/corefx,manu-silicon/corefx,yizhang82/corefx,mellinoe/corefx,cydhaselton/corefx,JosephTremoulet/corefx,the-dwyer/corefx,MaggieTsang/corefx,bitcrazed/corefx,khdang/corefx,Priya91/corefx-1,brett25/corefx,wtgodbe/corefx,seanshpark/corefx,manu-silicon/corefx,ravimeda/corefx,axelheer/corefx,jmhardison/corefx,dhoehna/corefx,alexperovich/corefx,akivafr123/corefx,andyhebear/corefx,josguil/corefx,rahku/corefx,shana/corefx,ericstj/corefx,Petermarcu/corefx,shahid-pk/corefx,gabrielPeart/corefx,jlin177/corefx,shahid-pk/corefx,YoupHulsebos/corefx,tijoytom/corefx,cartermp/corefx,viniciustaveira/corefx,fgreinacher/corefx,stephenmichaelf/corefx,wtgodbe/corefx,wtgodbe/corefx,s0ne0me/corefx,thiagodin/corefx,shahid-pk/corefx,PatrickMcDonald/corefx,Ermiar/corefx,ptoonen/corefx,dotnet-bot/corefx,mazong1123/corefx,manu-silicon/corefx,ravimeda/corefx,the-dwyer/corefx,yizhang82/corefx,the-dwyer/corefx,pgavlin/corefx,akivafr123/corefx,690486439/corefx,shimingsg/corefx,Priya91/corefx-1,vidhya-bv/corefx-sorting,CloudLens/corefx,Yanjing123/corefx,n1ghtmare/corefx,axelheer/corefx,cydhaselton/corefx,stephenmichaelf/corefx,alphonsekurian/corefx,cartermp/corefx,jhendrixMSFT/corefx,vs-team/corefx,benpye/corefx,stone-li/corefx,ericstj/corefx,zhenlan/corefx,Ermiar/corefx,dtrebbien/corefx,zhangwenquan/corefx,shrutigarg/corefx,alphonsekurian/corefx,rahku/corefx,manu-silicon/corefx,alphonsekurian/corefx,richlander/corefx,Chrisboh/corefx,elijah6/corefx,gabrielPeart/corefx,DnlHarvey/corefx,Jiayili1/corefx,tijoytom/corefx,iamjasonp/corefx,yizhang82/corefx,richlander/corefx,viniciustaveira/corefx,pgavlin/corefx,marksmeltzer/corefx,pgavlin/corefx,jcme/corefx,jhendrixMSFT/corefx,Priya91/corefx-1,rahku/corefx,tstringer/corefx,SGuyGe/corefx,billwert/corefx,YoupHulsebos/corefx,dhoehna/corefx,Yanjing123/corefx,zhenlan/corefx,CloudLens/corefx,benjamin-bader/corefx,comdiv/corefx,krk/corefx,mokchhya/corefx,JosephTremoulet/corefx,heXelium/corefx,rahku/corefx,zhenlan/corefx,shimingsg/corefx,Alcaro/corefx,dkorolev/corefx,rajansingh10/corefx,Chrisboh/corefx,Ermiar/corefx,rubo/corefx,oceanho/corefx,ViktorHofer/corefx,stormleoxia/corefx,Chrisboh/corefx,weltkante/corefx,the-dwyer/corefx,ericstj/corefx,lydonchandra/corefx,billwert/corefx,stone-li/corefx,690486439/corefx,seanshpark/corefx,Jiayili1/corefx,krytarowski/corefx,marksmeltzer/corefx,lggomez/corefx,mmitche/corefx,vrassouli/corefx,alexperovich/corefx,ericstj/corefx,mafiya69/corefx,parjong/corefx,parjong/corefx,parjong/corefx,mazong1123/corefx,CloudLens/corefx,benjamin-bader/corefx,bitcrazed/corefx,gregg-miskelly/corefx,mafiya69/corefx,ellismg/corefx,tijoytom/corefx,CloudLens/corefx,Alcaro/corefx,KrisLee/corefx,mokchhya/corefx,brett25/corefx,iamjasonp/corefx,nchikanov/corefx,shmao/corefx,shmao/corefx,gkhanna79/corefx,krk/corefx,jhendrixMSFT/corefx,SGuyGe/corefx,stone-li/corefx,ViktorHofer/corefx,ellismg/corefx,shimingsg/corefx,heXelium/corefx,Priya91/corefx-1,rjxby/corefx,krk/corefx,axelheer/corefx,viniciustaveira/corefx,matthubin/corefx,JosephTremoulet/corefx,Yanjing123/corefx,gregg-miskelly/corefx,n1ghtmare/corefx,elijah6/corefx,iamjasonp/corefx,mellinoe/corefx,CherryCxldn/corefx,alexperovich/corefx,elijah6/corefx,jhendrixMSFT/corefx,Petermarcu/corefx,dkorolev/corefx,dhoehna/corefx,chaitrakeshav/corefx,gregg-miskelly/corefx,vrassouli/corefx,fgreinacher/corefx,nelsonsar/corefx,akivafr123/corefx,gkhanna79/corefx,stormleoxia/corefx,jeremymeng/corefx,shmao/corefx,vs-team/corefx,dkorolev/corefx,rahku/corefx,parjong/corefx,alexperovich/corefx,DnlHarvey/corefx,Priya91/corefx-1,ViktorHofer/corefx,seanshpark/corefx,larsbj1988/corefx,billwert/corefx,alexandrnikitin/corefx,twsouthwick/corefx,stone-li/corefx,shimingsg/corefx,khdang/corefx,rjxby/corefx,rubo/corefx,690486439/corefx,stone-li/corefx,shahid-pk/corefx,gkhanna79/corefx,rajansingh10/corefx,ViktorHofer/corefx,krytarowski/corefx,gkhanna79/corefx,Jiayili1/corefx,mokchhya/corefx,akivafr123/corefx,mokchhya/corefx,PatrickMcDonald/corefx,alexandrnikitin/corefx,twsouthwick/corefx,gregg-miskelly/corefx,akivafr123/corefx,zmaruo/corefx,krytarowski/corefx,pgavlin/corefx,dtrebbien/corefx,shana/corefx,benjamin-bader/corefx,dsplaisted/corefx,rahku/corefx,ptoonen/corefx,elijah6/corefx,stormleoxia/corefx,kyulee1/corefx,benjamin-bader/corefx,weltkante/corefx,josguil/corefx,chaitrakeshav/corefx,CherryCxldn/corefx,tijoytom/corefx,mmitche/corefx,shmao/corefx,ravimeda/corefx,shimingsg/corefx,oceanho/corefx,nchikanov/corefx,lydonchandra/corefx,jeremymeng/corefx,janhenke/corefx,larsbj1988/corefx,seanshpark/corefx,alphonsekurian/corefx,ptoonen/corefx,n1ghtmare/corefx,rajansingh10/corefx,josguil/corefx,axelheer/corefx,stephenmichaelf/corefx,jlin177/corefx,rubo/corefx,yizhang82/corefx,axelheer/corefx,chaitrakeshav/corefx,DnlHarvey/corefx,MaggieTsang/corefx,thiagodin/corefx,tstringer/corefx,comdiv/corefx,Ermiar/corefx,n1ghtmare/corefx,alexperovich/corefx,krytarowski/corefx,bitcrazed/corefx,mokchhya/corefx,JosephTremoulet/corefx,krk/corefx,krytarowski/corefx,Chrisboh/corefx,anjumrizwi/corefx,zhenlan/corefx,SGuyGe/corefx,gkhanna79/corefx,JosephTremoulet/corefx,cydhaselton/corefx,bitcrazed/corefx,mellinoe/corefx,ericstj/corefx,wtgodbe/corefx,pallavit/corefx,pallavit/corefx,shana/corefx,kkurni/corefx,ptoonen/corefx,cydhaselton/corefx,shrutigarg/corefx,BrennanConroy/corefx,elijah6/corefx,jeremymeng/corefx,wtgodbe/corefx,tstringer/corefx,zmaruo/corefx,DnlHarvey/corefx,matthubin/corefx,matthubin/corefx,billwert/corefx,benpye/corefx,billwert/corefx,CherryCxldn/corefx,dsplaisted/corefx,huanjie/corefx,jhendrixMSFT/corefx,dotnet-bot/corefx,nbarbettini/corefx,KrisLee/corefx,dotnet-bot/corefx,lggomez/corefx,tijoytom/corefx,weltkante/corefx,comdiv/corefx,BrennanConroy/corefx,shrutigarg/corefx,weltkante/corefx,josguil/corefx,shmao/corefx,adamralph/corefx,Jiayili1/corefx,huanjie/corefx,Ermiar/corefx,andyhebear/corefx,huanjie/corefx,dhoehna/corefx,kkurni/corefx,Frank125/corefx,YoupHulsebos/corefx,iamjasonp/corefx,alexandrnikitin/corefx,larsbj1988/corefx,mmitche/corefx,jhendrixMSFT/corefx,alphonsekurian/corefx,viniciustaveira/corefx,jlin177/corefx,heXelium/corefx,huanjie/corefx,billwert/corefx,ericstj/corefx,nchikanov/corefx,oceanho/corefx,richlander/corefx,josguil/corefx,comdiv/corefx,wtgodbe/corefx,dotnet-bot/corefx,Chrisboh/corefx,alexandrnikitin/corefx,vrassouli/corefx,billwert/corefx,tijoytom/corefx,nchikanov/corefx,weltkante/corefx,MaggieTsang/corefx,vs-team/corefx,dhoehna/corefx,nchikanov/corefx,Petermarcu/corefx,ravimeda/corefx,vrassouli/corefx,parjong/corefx,twsouthwick/corefx,ellismg/corefx,marksmeltzer/corefx,mellinoe/corefx,Ermiar/corefx,lggomez/corefx,lggomez/corefx,YoupHulsebos/corefx,andyhebear/corefx,vs-team/corefx,janhenke/corefx,benjamin-bader/corefx,ViktorHofer/corefx,dotnet-bot/corefx,benpye/corefx,Petermarcu/corefx,shana/corefx,jcme/corefx,nbarbettini/corefx,cartermp/corefx,zhangwenquan/corefx,alphonsekurian/corefx,mmitche/corefx,Petermarcu/corefx,jlin177/corefx,richlander/corefx,PatrickMcDonald/corefx,SGuyGe/corefx,rubo/corefx,khdang/corefx,shahid-pk/corefx,jcme/corefx,manu-silicon/corefx,josguil/corefx,seanshpark/corefx,krk/corefx,ellismg/corefx,manu-silicon/corefx,lggomez/corefx,ptoonen/corefx,kyulee1/corefx,kkurni/corefx,twsouthwick/corefx,Yanjing123/corefx,the-dwyer/corefx,nelsonsar/corefx,marksmeltzer/corefx,DnlHarvey/corefx,krytarowski/corefx,vidhya-bv/corefx-sorting,weltkante/corefx,richlander/corefx,mafiya69/corefx,benpye/corefx,mellinoe/corefx,s0ne0me/corefx,cydhaselton/corefx,cnbin/corefx,khdang/corefx,Petermarcu/corefx,ViktorHofer/corefx,s0ne0me/corefx,yizhang82/corefx,janhenke/corefx,krk/corefx,dsplaisted/corefx,mafiya69/corefx,jlin177/corefx,MaggieTsang/corefx,cydhaselton/corefx,rubo/corefx,marksmeltzer/corefx,mazong1123/corefx,zhangwenquan/corefx,mmitche/corefx,brett25/corefx,jlin177/corefx,dhoehna/corefx,dhoehna/corefx,Yanjing123/corefx,cnbin/corefx,shimingsg/corefx,elijah6/corefx,heXelium/corefx,stephenmichaelf/corefx,zhenlan/corefx,lggomez/corefx,MaggieTsang/corefx,thiagodin/corefx,ravimeda/corefx,seanshpark/corefx,fgreinacher/corefx,dkorolev/corefx,MaggieTsang/corefx,mazong1123/corefx,oceanho/corefx,shmao/corefx,shimingsg/corefx,benpye/corefx,Alcaro/corefx,jmhardison/corefx,ptoonen/corefx,uhaciogullari/corefx,SGuyGe/corefx,Alcaro/corefx,iamjasonp/corefx,vidhya-bv/corefx-sorting,zmaruo/corefx,Petermarcu/corefx,690486439/corefx,nbarbettini/corefx,krk/corefx,nbarbettini/corefx,jmhardison/corefx,nbarbettini/corefx,rjxby/corefx,anjumrizwi/corefx,nelsonsar/corefx,uhaciogullari/corefx,yizhang82/corefx,tstringer/corefx,matthubin/corefx,nchikanov/corefx,CherryCxldn/corefx,mafiya69/corefx,khdang/corefx,PatrickMcDonald/corefx,lydonchandra/corefx,cydhaselton/corefx,jlin177/corefx,richlander/corefx,Jiayili1/corefx,janhenke/corefx,690486439/corefx,DnlHarvey/corefx,MaggieTsang/corefx,mazong1123/corefx,ellismg/corefx,KrisLee/corefx,ViktorHofer/corefx,seanshpark/corefx,alexperovich/corefx,janhenke/corefx,vidhya-bv/corefx-sorting,alexperovich/corefx,JosephTremoulet/corefx,PatrickMcDonald/corefx,pallavit/corefx,cartermp/corefx,jmhardison/corefx,rahku/corefx,yizhang82/corefx,the-dwyer/corefx,parjong/corefx,mazong1123/corefx,kkurni/corefx,zmaruo/corefx,ravimeda/corefx,twsouthwick/corefx,manu-silicon/corefx,rjxby/corefx,khdang/corefx,shahid-pk/corefx,stephenmichaelf/corefx,JosephTremoulet/corefx,jcme/corefx,cnbin/corefx,s0ne0me/corefx,alexandrnikitin/corefx,dotnet-bot/corefx,weltkante/corefx,ericstj/corefx,jeremymeng/corefx,dtrebbien/corefx,pallavit/corefx,uhaciogullari/corefx,benjamin-bader/corefx,lydonchandra/corefx,pallavit/corefx,BrennanConroy/corefx,ellismg/corefx,axelheer/corefx,kkurni/corefx,jhendrixMSFT/corefx,n1ghtmare/corefx,gabrielPeart/corefx,rajansingh10/corefx,Frank125/corefx,nbarbettini/corefx,kyulee1/corefx,lggomez/corefx,stone-li/corefx,fgreinacher/corefx,nbarbettini/corefx,mmitche/corefx,Frank125/corefx,rjxby/corefx,dotnet-bot/corefx,shrutigarg/corefx,gkhanna79/corefx
src/Common/src/Interop/Unix/System.Native/Interop.Stat.cs
src/Common/src/Interop/Unix/System.Native/Interop.Stat.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Sys { // Even though csc will by default use a sequential layout, a CS0649 warning as error // is produced for un-assigned fields when no StructLayout is specified. // // Explicitly saying Sequential disables that warning/error for consumers which only // use Stat in debug builds. [StructLayout(LayoutKind.Sequential)] internal struct FileStatus { internal FileStatusFlags Flags; internal int Mode; internal int Uid; internal int Gid; internal long Size; internal long ATime; internal long MTime; internal long CTime; internal long BirthTime; } internal static class FileTypes { internal const int S_IFMT = 0xF000; internal const int S_IFIFO = 0x1000; internal const int S_IFCHR = 0x2000; internal const int S_IFDIR = 0x4000; internal const int S_IFREG = 0x8000; internal const int S_IFLNK = 0xA000; } [Flags] internal enum FileStatusFlags { None = 0, HasCreationTime = 1, } [DllImport(Libraries.SystemNative, SetLastError = true)] internal static extern int FStat(int fileDescriptor, out FileStatus output); [DllImport(Libraries.SystemNative, SetLastError = true)] internal static extern int Stat(string path, out FileStatus output); [DllImport(Libraries.SystemNative, SetLastError = true)] internal static extern int LStat(string path, out FileStatus output); } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Sys { internal struct FileStatus { internal FileStatusFlags Flags; internal int Mode; internal int Uid; internal int Gid; internal long Size; internal long ATime; internal long MTime; internal long CTime; internal long BirthTime; } internal static class FileTypes { internal const int S_IFMT = 0xF000; internal const int S_IFIFO = 0x1000; internal const int S_IFCHR = 0x2000; internal const int S_IFDIR = 0x4000; internal const int S_IFREG = 0x8000; internal const int S_IFLNK = 0xA000; } [Flags] internal enum FileStatusFlags { None = 0, HasCreationTime = 1, } [DllImport(Libraries.SystemNative, SetLastError = true)] internal static extern int FStat(int fileDescriptor, out FileStatus output); [DllImport(Libraries.SystemNative, SetLastError = true)] internal static extern int Stat(string path, out FileStatus output); [DllImport(Libraries.SystemNative, SetLastError = true)] internal static extern int LStat(string path, out FileStatus output); } }
mit
C#
ff601eefe6afaf6683af631f71361e05d644278a
Fix failing test
ppy/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,EVAST9919/osu,2yangk23/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,johnneijzen/osu,UselessToucan/osu,smoogipoo/osu,ZLima12/osu,ppy/osu,ZLima12/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu,EVAST9919/osu,peppy/osu,NeoAdonis/osu,johnneijzen/osu,ppy/osu
osu.Game.Tests/Visual/Gameplay/TestSceneHoldForMenuButton.cs
osu.Game.Tests/Visual/Gameplay/TestSceneHoldForMenuButton.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Play.HUD; using osuTK; using osuTK.Input; namespace osu.Game.Tests.Visual.Gameplay { [Description("'Hold to Quit' UI element")] public class TestSceneHoldForMenuButton : ManualInputManagerTestScene { private bool exitAction; protected override double TimePerAction => 100; // required for the early exit test, since hold-to-confirm delay is 200ms [BackgroundDependencyLoader] private void load() { HoldForMenuButton holdForMenuButton; Add(holdForMenuButton = new HoldForMenuButton { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Action = () => exitAction = true }); var text = holdForMenuButton.Children.OfType<SpriteText>().First(); AddStep("Trigger text fade in", () => InputManager.MoveMouseTo(holdForMenuButton)); AddUntilStep("Text visible", () => text.IsPresent && !exitAction); AddStep("Trigger text fade out", () => InputManager.MoveMouseTo(Vector2.One)); AddUntilStep("Text is not visible", () => !text.IsPresent && !exitAction); AddStep("Trigger exit action", () => { exitAction = false; InputManager.MoveMouseTo(holdForMenuButton); InputManager.PressButton(MouseButton.Left); }); AddStep("Early release", () => InputManager.ReleaseButton(MouseButton.Left)); AddAssert("action not triggered", () => !exitAction); AddStep("Trigger exit action", () => InputManager.PressButton(MouseButton.Left)); AddUntilStep($"{nameof(holdForMenuButton.Action)} was triggered", () => exitAction); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Play.HUD; using osuTK; using osuTK.Input; namespace osu.Game.Tests.Visual.Gameplay { [Description("'Hold to Quit' UI element")] public class TestSceneHoldForMenuButton : ManualInputManagerTestScene { private bool exitAction; [BackgroundDependencyLoader] private void load() { HoldForMenuButton holdForMenuButton; Add(holdForMenuButton = new HoldForMenuButton { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Action = () => exitAction = true }); var text = holdForMenuButton.Children.OfType<SpriteText>().First(); AddStep("Trigger text fade in", () => InputManager.MoveMouseTo(holdForMenuButton)); AddUntilStep("Text visible", () => text.IsPresent && !exitAction); AddStep("Trigger text fade out", () => InputManager.MoveMouseTo(Vector2.One)); AddUntilStep("Text is not visible", () => !text.IsPresent && !exitAction); AddStep("Trigger exit action", () => { exitAction = false; InputManager.MoveMouseTo(holdForMenuButton); InputManager.PressButton(MouseButton.Left); }); AddStep("Early release", () => InputManager.ReleaseButton(MouseButton.Left)); AddAssert("action not triggered", () => !exitAction); AddStep("Trigger exit action", () => InputManager.PressButton(MouseButton.Left)); AddUntilStep($"{nameof(holdForMenuButton.Action)} was triggered", () => exitAction); } } }
mit
C#
4a6e312a7d968c52aa795cbc46e2c4563d84cf61
make version lower case
ParticularLabs/APIComparer,modernist/APIComparer,ParticularLabs/APIComparer,modernist/APIComparer
APIComparer.Contracts/CompareNugetPackage.cs
APIComparer.Contracts/CompareNugetPackage.cs
// ReSharper disable MemberCanBePrivate.Global namespace APIComparer.Contracts { using NServiceBus; public class CompareNugetPackage : ICommand { public CompareNugetPackage(string packageId, string leftVersion, string rightVersion) { PackageId = packageId; RightVersion = rightVersion.ToLower(); LeftVersion = leftVersion.ToLower(); } public string PackageId { get; set; } public string LeftVersion { get; set; } public string RightVersion { get; set; } } }
// ReSharper disable MemberCanBePrivate.Global namespace APIComparer.Contracts { using NServiceBus; public class CompareNugetPackage : ICommand { public CompareNugetPackage(string packageId, string leftVersion, string rightVersion) { PackageId = packageId; RightVersion = rightVersion; LeftVersion = leftVersion; } public string PackageId { get; set; } public string LeftVersion { get; set; } public string RightVersion { get; set; } } }
mit
C#
5d170cba74689af59e28dacf91b01f065a51181a
Fix tax rule to be double not int
kroniak/extensions-ecwid,kroniak/extensions-ecwid
src/Ecwid/Models/Profile/Rule.cs
src/Ecwid/Models/Profile/Rule.cs
// Licensed under the GPL License, Version 3.0. See LICENSE in the git repository root for license information. using Newtonsoft.Json; namespace Ecwid.Models { /// <summary> /// </summary> public class TaxRule { /// <summary> /// Gets or sets the tax in %. /// </summary> /// <value> /// The tax. /// </value> [JsonProperty("tax")] public double Tax { get; set; } /// <summary> /// Gets or sets the destination zone identifier. /// </summary> /// <value> /// The zone identifier. /// </value> [JsonProperty("zoneId")] public string ZoneId { get; set; } } }
// Licensed under the GPL License, Version 3.0. See LICENSE in the git repository root for license information. using Newtonsoft.Json; namespace Ecwid.Models { /// <summary> /// </summary> public class TaxRule { /// <summary> /// Gets or sets the tax in %. /// </summary> /// <value> /// The tax. /// </value> [JsonProperty("tax")] public int Tax { get; set; } /// <summary> /// Gets or sets the destination zone identifier. /// </summary> /// <value> /// The zone identifier. /// </value> [JsonProperty("zoneId")] public string ZoneId { get; set; } } }
mit
C#
8897a7cfd2fea4b0a4d96706098b179b56593916
Update MyDataRepository.cs
kelong/Data-Repository-with-Data-Caching-in-ASP.NET-MVC-4,CarmelSoftware/Data-Repository-with-Data-Caching-in-ASP.NET-MVC-4
Models/MyDataRepository.cs
Models/MyDataRepository.cs
// TODO: file name should be "MyDataRepository.cs" using System; using System.Collections.Generic; using System.Linq; using System.Web; using RepositoryWithCaching.Models; namespace RepositoryWithCaching.Models { public class MyDataRepository { #region Context private MyDataEntities _Ctx; public MyDataEntities Ctx { get { if (_Ctx == null) { _Ctx = new MyDataEntities(); } return _Ctx; } } private RepositoryCaching _Cache; public RepositoryCaching Cache { get { if (_Cache == null) { _Cache = new RepositoryCaching(); } return _Cache; } } #endregion public IQueryable<Comment> RetrieveComments() { if (Cache.IsInMemory("Comments")) { return Cache.FetchData<Comment>("Comments"); } else { IQueryable<Comment> data = Ctx.Comments; Cache.Add("Comments", data, 60); return data; } } public Comment RetrieveComment(int Id) { return RetrieveComments().SingleOrDefault(c => c.CommentID == Id); } public void AddComment(Comment comment) { Ctx.Comments.Add(comment); Cache.Remove("Comments"); } public void UpdateComment(Comment comment) { Ctx.Comments.Attach(comment); Ctx.Entry(comment).State = System.Data.EntityState.Modified; Cache.Remove("Comments"); } public void DeleteComment(Comment comment) { Ctx.Comments.Remove(comment); Cache.Remove("Comments"); } public void Save() { Ctx.SaveChanges(); } public IQueryable<Blog> RetrieveBlogs() { if (Cache.IsInMemory("Blogs")) { return Cache.FetchData<Blog>("Blogs") as IQueryable<Blog>; } else { IQueryable<Blog> data = Ctx.Blogs; Cache.Add("Blogs",data,60); return data; } } } }
// TODO: fix this class : class name : "RepositoryCaching" using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Runtime.Caching; namespace RepositoryWithCaching.Models { public class RepositoryCaching { public ObjectCache Cache { get { return MemoryCache.Default; } } public bool IsInMemory(string Key) { return Cache.Contains(Key); } public void Add(string Key, object Value, int Expiration) { Cache.Add(Key, Value, new CacheItemPolicy().AbsoluteExpiration = DateTime.Now + TimeSpan.FromMinutes(Expiration)); } public IQueryable<T> FetchData<T>(string Key) where T : class { return Cache[Key] as IQueryable<T>; } public void Remove(string Key) { Cache.Remove(Key); } } }
mit
C#
9e2763d952437f34f8f6d3dcdb94f7b8f2c8e290
Fix ToString() in WorkingFolder
michael-reichenauer/GitMind
GitMind/ApplicationHandling/WorkingFolder.cs
GitMind/ApplicationHandling/WorkingFolder.cs
using System; using GitMind.Utils; namespace GitMind.ApplicationHandling { [SingleInstance] internal class WorkingFolder { private readonly IWorkingFolderService workingFolderService; public WorkingFolder(IWorkingFolderService workingFolderService) { this.workingFolderService = workingFolderService; } public event EventHandler OnChange { add { workingFolderService.OnChange += value; } remove { workingFolderService.OnChange -= value; } } public string Path => workingFolderService.Path; public bool IsValid => workingFolderService.IsValid; public bool HasValue => Path != null; public string Name => HasValue ? System.IO.Path.GetFileName(Path) : null; public static implicit operator string(WorkingFolder workingFolder) => workingFolder.Path; public bool TrySetPath(string path) { return workingFolderService.TrySetPath(path); } public override string ToString() => Path; } }
using System; using GitMind.Utils; namespace GitMind.ApplicationHandling { [SingleInstance] internal class WorkingFolder { private readonly IWorkingFolderService workingFolderService; public WorkingFolder(IWorkingFolderService workingFolderService) { this.workingFolderService = workingFolderService; } public event EventHandler OnChange { add { workingFolderService.OnChange += value; } remove { workingFolderService.OnChange -= value; } } public string Path => workingFolderService.Path; public bool IsValid => workingFolderService.IsValid; public bool HasValue => Path != null; public string Name => HasValue ? System.IO.Path.GetFileName(Path) : null; public static implicit operator string(WorkingFolder workingFolder) => workingFolder.Path; public bool TrySetPath(string path) { return workingFolderService.TrySetPath(path); } } }
mit
C#
2b269062e2749d4fa2ca1a7909e1ef452aaef26b
add diagnostic information to tests when launching redis-server.exe fails
collinsauve/redlock-cs
tests/TestHelper.cs
tests/TestHelper.cs
using System; using System.Diagnostics; using System.IO; using System.Reflection; namespace Redlock.CSharp.Tests { public static class TestHelper { public static Process StartRedisServer(long port) { var assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var fileName = Path.Combine(assemblyDir, "redis-server.exe"); // Launch Server var process = new Process { StartInfo = { FileName = fileName, Arguments = "--port " + port, WindowStyle = ProcessWindowStyle.Hidden } }; try { process.Start(); } catch (System.ComponentModel.Win32Exception) { Console.WriteLine($"Attempt to launch {fileName} failed."); Console.WriteLine("Directory listing:"); foreach (var file in Directory.GetFiles(assemblyDir)) { Console.WriteLine($"\t{file}"); } throw; } return process; } } }
using System.Diagnostics; namespace Redlock.CSharp.Tests { public static class TestHelper { public static Process StartRedisServer(long port) { var assemblyDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); var fileName = System.IO.Path.Combine(assemblyDir, "redis-server.exe"); // Launch Server var process = new Process { StartInfo = { FileName = fileName, Arguments = "--port " + port, WindowStyle = ProcessWindowStyle.Hidden } }; process.Start(); return process; } } }
apache-2.0
C#
e09541be0b25553f7a308485c44e75d3d42c82ae
Bump version to 0.6.1
FatturaElettronicaPA/FatturaElettronicaPA
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("FatturaElettronica.NET")] [assembly: AssemblyDescription("Fattura Elettronica per le aziende e la Pubblica Amministrazione Italiana")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nicola Iarocci, CIR2000")] [assembly: AssemblyProduct("FatturaElettronica.NET")] [assembly: AssemblyCopyright("Copyright © CIR2000 2017")] [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("0.6.1.0")] [assembly: AssemblyFileVersion("0.6.1.0")]
using System.Reflection; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("FatturaElettronica.NET")] [assembly: AssemblyDescription("Fattura Elettronica per le aziende e la Pubblica Amministrazione Italiana")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nicola Iarocci, CIR2000")] [assembly: AssemblyProduct("FatturaElettronica.NET")] [assembly: AssemblyCopyright("Copyright © CIR2000 2017")] [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("0.6.0.0")] [assembly: AssemblyFileVersion("0.6.0.0")]
bsd-3-clause
C#
8468eadb64ffab144a6e283d20d5f4d9e3c9d723
Bump version
Yuisbean/WebMConverter,nixxquality/WebMConverter,o11c/WebMConverter
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("WebM for Retards")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WebM for Retards")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.16.4")]
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("WebM for Retards")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WebM for Retards")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.16.3")]
mit
C#
74f478187b94528d0a905b76583374b664fa1715
Add PostgresException on postgresExceptionNames fixing select for NoWait locking exceptions
evicertia/Rebus.AdoNet
Rebus.AdoNet/Dialects/PostgreSql82Dialect.cs
Rebus.AdoNet/Dialects/PostgreSql82Dialect.cs
using System; using System.Linq; using System.Collections.Generic; using System.Data; using System.Data.Common; namespace Rebus.AdoNet.Dialects { public class PostgreSql82Dialect : PostgreSqlDialect { private static readonly IEnumerable<string> _postgresExceptionNames = new[] { "NpgsqlException", "PostgresException" }; protected override Version MinimumDatabaseVersion => new Version("8.2"); public override ushort Priority => 82; public override bool SupportsReturningClause => true; public override bool SupportsSelectForWithNoWait => true; public override string SelectForNoWaitClause => "NOWAIT"; public override bool IsSelectForNoWaitLockingException(DbException ex) { if (ex != null && _postgresExceptionNames.Contains(ex.GetType().Name)) { var psqlex = new PostgreSqlExceptionAdapter(ex); return psqlex.Code == "55P03"; } return false; } } }
using System; using System.Data; using System.Data.Common; namespace Rebus.AdoNet.Dialects { public class PostgreSql82Dialect : PostgreSqlDialect { protected override Version MinimumDatabaseVersion => new Version("8.2"); public override ushort Priority => 82; public override bool SupportsReturningClause => true; public override bool SupportsSelectForWithNoWait => true; public override string SelectForNoWaitClause => "NOWAIT"; public override bool IsSelectForNoWaitLockingException(DbException ex) { if (ex != null && ex.GetType().Name == "NpgsqlException") { var psqlex = new PostgreSqlExceptionAdapter(ex); return psqlex.Code == "55P03"; } return false; } } }
mit
C#
a394162d36b01541e186f8af3d6c9e98d1aa5ae6
Append strings with support for escape sequences.
PenguinF/sandra-three
Sandra.UI.WF/Storage/CompactSettingWriter.cs
Sandra.UI.WF/Storage/CompactSettingWriter.cs
#region License /********************************************************************************* * CompactSettingWriter.cs * * Copyright (c) 2004-2018 Henk Nicolai * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *********************************************************************************/ #endregion using System.Globalization; using System.Text; namespace Sandra.UI.WF.Storage { /// <summary> /// Used by <see cref="AutoSave"/> to convert a <see cref="PMap"/> to its compact representation in JSON. /// </summary> internal class CompactSettingWriter : PValueVisitor { private readonly StringBuilder outputBuilder = new StringBuilder(); private void AppendString(string value) { outputBuilder.Append(JsonString.QuoteCharacter); if (value != null) { // Save on Append() operations by appending escape-char-less substrings // that are as large as possible. int firstNonEscapedCharPosition = 0; for (int i = 0; i < value.Length; i++) { char c = value[i]; if (JsonString.CharacterMustBeEscaped(c)) { // Non-empty substring between this character and the last? if (firstNonEscapedCharPosition < i) { outputBuilder.Append( value, firstNonEscapedCharPosition, i - firstNonEscapedCharPosition); } // Append the escape sequence. outputBuilder.Append(JsonString.EscapedCharacterString(c)); firstNonEscapedCharPosition = i + 1; } } if (firstNonEscapedCharPosition < value.Length) { outputBuilder.Append( value, firstNonEscapedCharPosition, value.Length - firstNonEscapedCharPosition); } } outputBuilder.Append(JsonString.QuoteCharacter); } public override void VisitBoolean(PBoolean value) => outputBuilder.Append(value.Value ? JsonValue.True : JsonValue.False); public override void VisitInteger(PInteger value) => outputBuilder.Append(value.Value.ToString(CultureInfo.InvariantCulture)); public override void VisitString(PString value) => AppendString(value.Value); public string Output() => outputBuilder.ToString(); } }
#region License /********************************************************************************* * CompactSettingWriter.cs * * Copyright (c) 2004-2018 Henk Nicolai * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *********************************************************************************/ #endregion using System.Globalization; using System.Text; namespace Sandra.UI.WF.Storage { /// <summary> /// Used by <see cref="AutoSave"/> to convert a <see cref="PMap"/> to its compact representation in JSON. /// </summary> internal class CompactSettingWriter : PValueVisitor { private readonly StringBuilder outputBuilder = new StringBuilder(); public override void VisitBoolean(PBoolean value) => outputBuilder.Append(value.Value ? JsonValue.True : JsonValue.False); public override void VisitInteger(PInteger value) => outputBuilder.Append(value.Value.ToString(CultureInfo.InvariantCulture)); public string Output() => outputBuilder.ToString(); } }
apache-2.0
C#
2b13ce4e0676b4c4eb576efeeea31b530117c258
Add preprocessor to prevent compilation error
bhaptics/tactosy-unity
samples/Unity-Plugin/Assets/Tactosy/Scripts/TactosyEditor.cs
samples/Unity-Plugin/Assets/Tactosy/Scripts/TactosyEditor.cs
#if UNITY_EDITOR using UnityEditor; #endif using UnityEngine; namespace Tactosy.Unity { #if UNITY_EDITOR [CustomEditor(typeof(Manager_Tactosy))] public class TactosyEditor : Editor { public override void OnInspectorGUI() { DrawDefaultInspector(); Manager_Tactosy tactosyManager = (Manager_Tactosy) target; foreach (var mappings in tactosyManager.FeedbackMappings) { var key = mappings.Key; if (GUILayout.Button(key)) { tactosyManager.Play(key); } } if (GUILayout.Button("Turn Off")) { tactosyManager.TurnOff(); } } } #endif }
using UnityEditor; using UnityEngine; namespace Tactosy.Unity { [CustomEditor(typeof(Manager_Tactosy))] public class TactosyEditor : Editor { public override void OnInspectorGUI() { DrawDefaultInspector(); Manager_Tactosy tactosyManager = (Manager_Tactosy) target; foreach (var mappings in tactosyManager.FeedbackMappings) { var key = mappings.Key; if (GUILayout.Button(key)) { tactosyManager.Play(key); } } if (GUILayout.Button("Turn Off")) { tactosyManager.TurnOff(); } } } }
mit
C#
4b7d0d51634c4469cee6d03466ffd9c53fa0bc8b
Update ordering of types
nikhilk/scriptsharp,x335/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp
src/Core/Compiler/ScriptModel/Symbols/SymbolType.cs
src/Core/Compiler/ScriptModel/Symbols/SymbolType.cs
// SymbolType.cs // Script#/Core/Compiler // This source code is subject to terms and conditions of the Apache License, Version 2.0. // using System; namespace ScriptSharp.ScriptModel { internal enum SymbolType { Namespace = 0, Delegate = 1, Enumeration = 2, Resources = 3, Interface = 4, Record = 5, Class = 6, Field = 7, EnumerationField = 8, Constructor = 9, Property = 10, Indexer = 11, Event = 12, Method = 13, AnonymousMethod = 14, Variable = 15, Parameter = 16, GenericParameter = 17 } }
// SymbolType.cs // Script#/Core/Compiler // This source code is subject to terms and conditions of the Apache License, Version 2.0. // using System; namespace ScriptSharp.ScriptModel { internal enum SymbolType { Namespace = 0, Class = 1, Interface = 2, Enumeration = 3, Delegate = 4, Record = 5, Resources = 6, Field = 7, EnumerationField = 8, Constructor = 9, Property = 10, Indexer = 11, Event = 12, Method = 13, AnonymousMethod = 14, Variable = 15, Parameter = 16, GenericParameter = 17 } }
apache-2.0
C#
107f1b580380c8c5906fd61a3bdd86bc30c6ebc0
Add 'tweet' embed type
RogueException/Discord.Net,AntiTcb/Discord.Net,Confruggy/Discord.Net
src/Discord.Net.Core/Entities/Messages/EmbedType.cs
src/Discord.Net.Core/Entities/Messages/EmbedType.cs
namespace Discord { public enum EmbedType { Rich, Link, Video, Image, Gifv, Article, Tweet } }
namespace Discord { public enum EmbedType { Rich, Link, Video, Image, Gifv, Article } }
mit
C#
24ba07cfbfe9f40992e7ad5df2d855375580e916
Update MVC module order (#1830)
petedavis/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,xkproject/Orchard2,xkproject/Orchard2,xkproject/Orchard2,petedavis/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2,petedavis/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2
src/OrchardCore.Modules/OrchardCore.Mvc/Manifest.cs
src/OrchardCore.Modules/OrchardCore.Mvc/Manifest.cs
using OrchardCore.Modules.Manifest; [assembly: Module( Name = "Mvc", Author = "The Orchard Team", Website = "http://orchardproject.net", Version = "2.0.0", Description = "The mvc module.", Priority = "-10", Category = "Infrastructure" )]
using OrchardCore.Modules.Manifest; [assembly: Module( Name = "Mvc", Author = "The Orchard Team", Website = "http://orchardproject.net", Version = "2.0.0", Description = "The mvc module.", Priority = "-1", Category = "Infrastructure" )]
bsd-3-clause
C#
42d43789efd32db456eabec72cbfe088ae08c4f8
Make wallet name argument required
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/CommandLine/MixerCommand.cs
WalletWasabi.Gui/CommandLine/MixerCommand.cs
using Mono.Options; using System; using System.Collections.Generic; using System.Threading.Tasks; using WalletWasabi.Logging; namespace WalletWasabi.Gui.CommandLine { internal class MixerCommand : Command { public MixerCommand(Daemon daemon) : base("mix", "Start mixing without the GUI with the specified wallet.") { Daemon = daemon; Options = new OptionSet() { "usage: mix --wallet:WalletName --keepalive", "", "Start mixing without the GUI with the specified wallet.", "eg: ./wassabee mix --wallet:MyWalletName --keepalive", { "h|help", "Displays help page and exit.", x => ShowHelp = x != null }, { "w|wallet=", "The name of the wallet file.", x => WalletName = x }, { "destination:", "The name of the destination wallet file.", x => DestinationWalletName = x }, { "keepalive", "Do not exit the software after mixing has been finished, rather keep mixing when new money arrives.", x => KeepMixAlive = x != null } }; } public string WalletName { get; set; } public string DestinationWalletName { get; set; } public bool KeepMixAlive { get; set; } public bool ShowHelp { get; set; } public Daemon Daemon { get; } public override async Task<int> InvokeAsync(IEnumerable<string> args) { var error = false; try { var extra = Options.Parse(args); if (ShowHelp) { Options.WriteOptionDescriptions(CommandSet.Out); } if (!error && !ShowHelp) { await Daemon.RunAsync(WalletName, DestinationWalletName ?? WalletName, KeepMixAlive); } } catch (Exception ex) { if (!(ex is OperationCanceledException)) { Logger.LogCritical(ex); } Console.WriteLine($"commands: There was a problem interpreting the command, please review it."); Logger.LogDebug(ex); error = true; } Environment.Exit(error ? 1 : 0); return 0; } } }
using Mono.Options; using System; using System.Collections.Generic; using System.Threading.Tasks; using WalletWasabi.Logging; namespace WalletWasabi.Gui.CommandLine { internal class MixerCommand : Command { public MixerCommand(Daemon daemon) : base("mix", "Start mixing without the GUI with the specified wallet.") { Daemon = daemon; Options = new OptionSet() { "usage: mix --wallet:WalletName --keepalive", "", "Start mixing without the GUI with the specified wallet.", "eg: ./wassabee mix --wallet:MyWalletName --keepalive", { "h|help", "Displays help page and exit.", x => ShowHelp = x != null }, { "w|wallet:", "The name of the wallet file.", x => WalletName = x }, { "destination:", "The name of the destination wallet file.", x => DestinationWalletName = x }, { "keepalive", "Do not exit the software after mixing has been finished, rather keep mixing when new money arrives.", x => KeepMixAlive = x != null } }; } public string WalletName { get; set; } public string DestinationWalletName { get; set; } public bool KeepMixAlive { get; set; } public bool ShowHelp { get; set; } public Daemon Daemon { get; } public override async Task<int> InvokeAsync(IEnumerable<string> args) { var error = false; try { var extra = Options.Parse(args); if (ShowHelp) { Options.WriteOptionDescriptions(CommandSet.Out); } if (!error && !ShowHelp) { await Daemon.RunAsync(WalletName, DestinationWalletName ?? WalletName, KeepMixAlive); } } catch (Exception ex) { if (!(ex is OperationCanceledException)) { Logger.LogCritical(ex); } Console.WriteLine($"commands: There was a problem interpreting the command, please review it."); Logger.LogDebug(ex); error = true; } Environment.Exit(error ? 1 : 0); return 0; } } }
mit
C#
db1a9c7a67d6be83c765bfa0abd5b5e56581fbba
Add registration options for signaturehelp request
PowerShell/PowerShellEditorServices
src/PowerShellEditorServices.Protocol/LanguageServer/SignatureHelp.cs
src/PowerShellEditorServices.Protocol/LanguageServer/SignatureHelp.cs
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol; namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer { public class SignatureHelpRequest { public static readonly RequestType<TextDocumentPositionParams, SignatureHelp, object, SignatureHelpRegistrationOptions> Type = RequestType<TextDocumentPositionParams, SignatureHelp, object, SignatureHelpRegistrationOptions>.Create("textDocument/signatureHelp"); } public class SignatureHelpRegistrationOptions : TextDocumentRegistrationOptions { // We duplicate the properties of SignatureHelpOptions class here because // we cannot derive from two classes. One way to get around this situation // is to use define SignatureHelpOptions as an interface instead of a class. public string[] TriggerCharacters { get; set; } } public class ParameterInformation { public string Label { get; set; } public string Documentation { get; set; } } public class SignatureInformation { public string Label { get; set; } public string Documentation { get; set; } public ParameterInformation[] Parameters { get; set; } } public class SignatureHelp { public SignatureInformation[] Signatures { get; set; } public int? ActiveSignature { get; set; } public int? ActiveParameter { get; set; } } }
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol; namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer { public class SignatureHelpRequest { public static readonly RequestType<TextDocumentPositionParams, SignatureHelp, object, object> Type = RequestType<TextDocumentPositionParams, SignatureHelp, object, object>.Create("textDocument/signatureHelp"); } public class ParameterInformation { public string Label { get; set; } public string Documentation { get; set; } } public class SignatureInformation { public string Label { get; set; } public string Documentation { get; set; } public ParameterInformation[] Parameters { get; set; } } public class SignatureHelp { public SignatureInformation[] Signatures { get; set; } public int? ActiveSignature { get; set; } public int? ActiveParameter { get; set; } } }
mit
C#
4c1aee96ba0427cda062b23fabd12d9c1f98a728
Revert "Prevent form submit on grid quick search #209 fix"
vtfuture/BForms,vtfuture/BForms,vtfuture/BForms
BForms/Renderers/BsToolbarQuickSearchRenderer.cs
BForms/Renderers/BsToolbarQuickSearchRenderer.cs
using BForms.Grid; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.Mvc; namespace BForms.Renderers { public class BsToolbarQuickSearchRenderer : BsBaseRenderer<BsToolbarQuickSearch> { public BsToolbarQuickSearchRenderer(){} public BsToolbarQuickSearchRenderer(BsToolbarQuickSearch builder) : base(builder) { } // Step 4: implement Render html function. Here you decide how your // custom control will look like based on the customization settings /// <summary> /// Renders custom control /// </summary> public override string Render() { var liBuilder = new TagBuilder("li"); var formBuilder = new TagBuilder("form"); formBuilder.AddCssClass("navbar-form"); formBuilder.MergeAttribute("role","search"); var inputGroupBuilder = new TagBuilder("div"); inputGroupBuilder.AddCssClass("form-group bs-quick_search"); var inputBuilder = new TagBuilder("input"); inputBuilder.AddCssClass("form-control bs-text"); inputBuilder.MergeAttribute("type", "search"); inputBuilder.MergeAttribute("placeholder", this.Builder.placeholder); inputGroupBuilder.InnerHtml += inputBuilder.ToString(TagRenderMode.SelfClosing); formBuilder.InnerHtml += inputGroupBuilder; liBuilder.InnerHtml += formBuilder; return liBuilder.ToString(); } } }
using BForms.Grid; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.Mvc; namespace BForms.Renderers { public class BsToolbarQuickSearchRenderer : BsBaseRenderer<BsToolbarQuickSearch> { public BsToolbarQuickSearchRenderer(){} public BsToolbarQuickSearchRenderer(BsToolbarQuickSearch builder) : base(builder) { } // Step 4: implement Render html function. Here you decide how your // custom control will look like based on the customization settings /// <summary> /// Renders custom control /// </summary> public override string Render() { var liBuilder = new TagBuilder("li"); var divBuilder = new TagBuilder("div"); divBuilder.AddCssClass("navbar-form"); divBuilder.MergeAttribute("role","search"); var inputGroupBuilder = new TagBuilder("div"); inputGroupBuilder.AddCssClass("form-group bs-quick_search"); var inputBuilder = new TagBuilder("input"); inputBuilder.AddCssClass("form-control bs-text"); inputBuilder.MergeAttribute("type", "search"); inputBuilder.MergeAttribute("placeholder", this.Builder.placeholder); inputGroupBuilder.InnerHtml += inputBuilder.ToString(TagRenderMode.SelfClosing); divBuilder.InnerHtml += inputGroupBuilder; liBuilder.InnerHtml += divBuilder; return liBuilder.ToString(); } } }
mit
C#
196199d12b60609767be9b46c0adb6e0505c1d7e
Test reuse when plugin was not disposed
SeanFeldman/ServiceBus.AttachmentPlugin
src/ServiceBus.AttachmentPlugin.Tests/When_reusing_plugin.cs
src/ServiceBus.AttachmentPlugin.Tests/When_reusing_plugin.cs
namespace ServiceBus.AttachmentPlugin.Tests { using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Azure.ServiceBus; using Microsoft.Azure.ServiceBus.Core; using Xunit; public class When_reusing_plugin { [Fact] public void Should_throw_if_plugin_was_disposed() { var client = new FakeClientEntity("fake", string.Empty, RetryPolicy.Default); var configuration = new AzureStorageAttachmentConfiguration( connectionStringProvider: AzureStorageEmulatorFixture.ConnectionStringProvider, containerName: "attachments", messagePropertyToIdentifyAttachmentBlob: "attachment-id"); var registeredPlugin = AzureStorageAttachmentExtensions.RegisterAzureStorageAttachmentPlugin(client, configuration); ((IDisposable)registeredPlugin).Dispose(); Assert.ThrowsAsync<ObjectDisposedException>(() => registeredPlugin.BeforeMessageSend(null)); Assert.ThrowsAsync<ObjectDisposedException>(() => registeredPlugin.AfterMessageReceive(null)); } [Fact] public async Task Should_not_throw_if_plugin_was_not_disposed() { var client = new FakeClientEntity("fake", string.Empty, RetryPolicy.Default); var configuration = new AzureStorageAttachmentConfiguration( connectionStringProvider: AzureStorageEmulatorFixture.ConnectionStringProvider, containerName: "attachments", messagePropertyToIdentifyAttachmentBlob: "attachment-id"); var registeredPlugin = AzureStorageAttachmentExtensions.RegisterAzureStorageAttachmentPlugin(client, configuration); var message = new Message(new byte[] {}); await registeredPlugin.BeforeMessageSend(message); await registeredPlugin.AfterMessageReceive(message); } class FakeClientEntity : ClientEntity { public FakeClientEntity(string clientTypeName, string postfix, RetryPolicy retryPolicy) : base(clientTypeName, postfix, retryPolicy) { RegisteredPlugins = new List<ServiceBusPlugin>(); } public override void RegisterPlugin(ServiceBusPlugin serviceBusPlugin) { RegisteredPlugins.Add(serviceBusPlugin); } public override void UnregisterPlugin(string serviceBusPluginName) { var toRemove = RegisteredPlugins.First(x => x.Name == serviceBusPluginName); RegisteredPlugins.Remove(toRemove); } public override TimeSpan OperationTimeout { get; set; } public override IList<ServiceBusPlugin> RegisteredPlugins { get; } protected override Task OnClosingAsync() { throw new NotImplementedException(); } } } }
namespace ServiceBus.AttachmentPlugin.Tests { using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Azure.ServiceBus; using Microsoft.Azure.ServiceBus.Core; using Xunit; public class When_reusing_plugin { [Fact] public void Should_throw_if_plugin_was_disposed() { var client = new FakeClientEntity("fake", string.Empty, RetryPolicy.Default); var configuration = new AzureStorageAttachmentConfiguration( connectionStringProvider: AzureStorageEmulatorFixture.ConnectionStringProvider, containerName: "attachments", messagePropertyToIdentifyAttachmentBlob: "attachment-id"); var registeredPlugin = AzureStorageAttachmentExtensions.RegisterAzureStorageAttachmentPlugin(client, configuration); ((IDisposable)registeredPlugin).Dispose(); Assert.ThrowsAsync<ObjectDisposedException>(() => registeredPlugin.BeforeMessageSend(null)); Assert.ThrowsAsync<ObjectDisposedException>(() => registeredPlugin.AfterMessageReceive(null)); } class FakeClientEntity : ClientEntity { public FakeClientEntity(string clientTypeName, string postfix, RetryPolicy retryPolicy) : base(clientTypeName, postfix, retryPolicy) { RegisteredPlugins = new List<ServiceBusPlugin>(); } public override void RegisterPlugin(ServiceBusPlugin serviceBusPlugin) { RegisteredPlugins.Add(serviceBusPlugin); } public override void UnregisterPlugin(string serviceBusPluginName) { var toRemove = RegisteredPlugins.First(x => x.Name == serviceBusPluginName); RegisteredPlugins.Remove(toRemove); } public override TimeSpan OperationTimeout { get; set; } public override IList<ServiceBusPlugin> RegisteredPlugins { get; } protected override Task OnClosingAsync() { throw new NotImplementedException(); } } } }
mit
C#
5e452b6e1fba5a1f545de133894f4d195dcddb67
add Applications to payment Enum
smbc-digital/iag-contentapi
src/StockportContentApi/Enums/EPaymentReferenceValidation.cs
src/StockportContentApi/Enums/EPaymentReferenceValidation.cs
namespace StockportContentApi.Enums { public enum EPaymentReferenceValidation { None, ParkingFine, BusLaneAndCamera, FPN, CameraCar, BusLane, Applications } }
namespace StockportContentApi.Enums { public enum EPaymentReferenceValidation { None, ParkingFine, BusLaneAndCamera, FPN, CameraCar, BusLane } }
mit
C#
95e0a80719dfc0e462819125aaf4c96f256f9e68
remove lazy token
continuousit/seq-api,datalust/seq-api
src/Seq.Api/SeqConnection.cs
src/Seq.Api/SeqConnection.cs
using System; using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; using Seq.Api.Client; using Seq.Api.Model; using Seq.Api.Model.Root; using Seq.Api.ResourceGroups; namespace Seq.Api { public class SeqConnection : ISeqConnection { readonly SeqApiClient _client; readonly ConcurrentDictionary<string, Task<ResourceGroup>> _resourceGroups = new ConcurrentDictionary<string, Task<ResourceGroup>>(); readonly Lazy<Task<RootEntity>> _root; public SeqConnection(string serverUrl, string apiKey = null, bool useDefaultCredentials = true) { if (serverUrl == null) throw new ArgumentNullException(nameof(serverUrl)); _client = new SeqApiClient(serverUrl, apiKey, useDefaultCredentials); _root = new Lazy<Task<RootEntity>>(() => _client.GetRootAsync()); } public ApiKeysResourceGroup ApiKeys => new ApiKeysResourceGroup(this); public AppInstancesResourceGroup AppInstances => new AppInstancesResourceGroup(this); public AppsResourceGroup Apps => new AppsResourceGroup(this); public BackupsResourceGroup Backups => new BackupsResourceGroup(this); public DashboardsResourceGroup Dashboards => new DashboardsResourceGroup(this); public DataResourceGroup Data => new DataResourceGroup(this); public DiagnosticsResourceGroup Diagnostics => new DiagnosticsResourceGroup(this); public EventsResourceGroup Events => new EventsResourceGroup(this); public ExpressionsResourceGroup Expressions => new ExpressionsResourceGroup(this); public FeedsResourceGroup Feeds => new FeedsResourceGroup(this); public LicensesResourceGroup Licenses => new LicensesResourceGroup(this); public PermalinksResourceGroup Permalinks => new PermalinksResourceGroup(this); public RetentionPoliciesResourceGroup RetentionPolicies => new RetentionPoliciesResourceGroup(this); public SettingsResourceGroup Settings => new SettingsResourceGroup(this); public SignalsResourceGroup Signals => new SignalsResourceGroup(this); public UpdatesResourceGroup Updates => new UpdatesResourceGroup(this); public UsersResourceGroup Users => new UsersResourceGroup(this); public async Task<ResourceGroup> LoadResourceGroupAsync(string name, CancellationToken token = default) { return await _resourceGroups.GetOrAdd(name, s => ResourceGroupFactory(s, token)).ConfigureAwait(false); } async Task<ResourceGroup> ResourceGroupFactory(string name, CancellationToken token = default) { return await _client.GetAsync<ResourceGroup>(await _root.Value, name + "Resources", token: token).ConfigureAwait(false); } public SeqApiClient Client => _client; } }
using System; using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; using Seq.Api.Client; using Seq.Api.Model; using Seq.Api.Model.Root; using Seq.Api.ResourceGroups; namespace Seq.Api { public class SeqConnection : ISeqConnection { readonly SeqApiClient _client; readonly ConcurrentDictionary<string, Task<ResourceGroup>> _resourceGroups = new ConcurrentDictionary<string, Task<ResourceGroup>>(); readonly Lazy<Task<RootEntity>> _root; public SeqConnection(string serverUrl, string apiKey = null, bool useDefaultCredentials = true, CancellationToken token = default) { if (serverUrl == null) throw new ArgumentNullException(nameof(serverUrl)); _client = new SeqApiClient(serverUrl, apiKey, useDefaultCredentials); _root = new Lazy<Task<RootEntity>>(() => _client.GetRootAsync(token)); } public ApiKeysResourceGroup ApiKeys => new ApiKeysResourceGroup(this); public AppInstancesResourceGroup AppInstances => new AppInstancesResourceGroup(this); public AppsResourceGroup Apps => new AppsResourceGroup(this); public BackupsResourceGroup Backups => new BackupsResourceGroup(this); public DashboardsResourceGroup Dashboards => new DashboardsResourceGroup(this); public DataResourceGroup Data => new DataResourceGroup(this); public DiagnosticsResourceGroup Diagnostics => new DiagnosticsResourceGroup(this); public EventsResourceGroup Events => new EventsResourceGroup(this); public ExpressionsResourceGroup Expressions => new ExpressionsResourceGroup(this); public FeedsResourceGroup Feeds => new FeedsResourceGroup(this); public LicensesResourceGroup Licenses => new LicensesResourceGroup(this); public PermalinksResourceGroup Permalinks => new PermalinksResourceGroup(this); public RetentionPoliciesResourceGroup RetentionPolicies => new RetentionPoliciesResourceGroup(this); public SettingsResourceGroup Settings => new SettingsResourceGroup(this); public SignalsResourceGroup Signals => new SignalsResourceGroup(this); public UpdatesResourceGroup Updates => new UpdatesResourceGroup(this); public UsersResourceGroup Users => new UsersResourceGroup(this); public async Task<ResourceGroup> LoadResourceGroupAsync(string name, CancellationToken token = default) { return await _resourceGroups.GetOrAdd(name, s => ResourceGroupFactory(s, token)).ConfigureAwait(false); } async Task<ResourceGroup> ResourceGroupFactory(string name, CancellationToken token = default) { return await _client.GetAsync<ResourceGroup>(await _root.Value, name + "Resources", token: token).ConfigureAwait(false); } public SeqApiClient Client => _client; } }
apache-2.0
C#
c8871129b48dda0677263f5b41ffc2e1240ac571
Add another mapping test, non-auto inc Pk
garethbrown/biggy,garethbrown/biggy,jjchiw/biggy,jjchiw/biggy,jjchiw/biggy,garethbrown/biggy,xivSolutions/biggy
Biggy.SqlCe.Tests/SqlCEColumnMapping.cs
Biggy.SqlCe.Tests/SqlCEColumnMapping.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace Biggy.SqlCe.Tests { [Trait("SQL CE Compact column mapping", "")] public class SqlCEColumnMapping { public string _connectionStringName = "chinook"; [Fact(DisplayName = "Maps Pk if specified by attribute")] public void MapingSpecifiedPk() { var db = new SqlCeStore<Album>(_connectionStringName); //, "Album" var pkMap = db.TableMapping.PrimaryKeyMapping; Assert.Single(pkMap); Assert.Equal("Id", pkMap[0].PropertyName); Assert.Equal("AlbumId", pkMap[0].ColumnName); Assert.True(pkMap[0].IsAutoIncementing); } [Fact(DisplayName = "Maps Pk even if wasn't specified by attribute")] public void MapingNotSpecifiedPk() { var db = new SqlCeStore<Genre>(_connectionStringName); //, "Genre" var pkMap = db.TableMapping.PrimaryKeyMapping; Assert.Single(pkMap); Assert.Equal("Id", pkMap[0].PropertyName); Assert.Equal("GenreId", pkMap[0].ColumnName); Assert.True(pkMap[0].IsAutoIncementing); } [Fact(DisplayName = "Properly maps Pk when is not auto incrementing")] public void MapingNotAutoIncPk() { var db = new SqlCeDocumentStore<MonkeyDocument>(_connectionStringName); var pkMap = db.TableMapping.PrimaryKeyMapping; Assert.Single(pkMap); Assert.Equal("Name", pkMap[0].PropertyName); Assert.Equal("Name", pkMap[0].ColumnName); Assert.Equal(typeof(string), pkMap[0].DataType); Assert.False(pkMap[0].IsAutoIncementing); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace Biggy.SqlCe.Tests { [Trait("SQL CE Compact column mapping", "")] public class SqlCEColumnMapping { public string _connectionStringName = "chinook"; [Fact(DisplayName = "Maps Pk if specified by attribute")] public void MapingSpecifiedPk() { var db = new SqlCeStore<Album>(_connectionStringName); //, "Album" var pkMap = db.TableMapping.PrimaryKeyMapping; Assert.Single(pkMap); Assert.Equal("Id", pkMap[0].PropertyName); Assert.Equal("AlbumId", pkMap[0].ColumnName); Assert.True(pkMap[0].IsAutoIncementing); } [Fact(DisplayName = "Maps Pk even if wasn't specified by attribute")] public void MapingNotSpecifiedPk() { var db = new SqlCeStore<Genre>(_connectionStringName); //, "Genre" var pkMap = db.TableMapping.PrimaryKeyMapping; Assert.Single(pkMap); Assert.Equal("Id", pkMap[0].PropertyName); Assert.Equal("GenreId", pkMap[0].ColumnName); Assert.True(pkMap[0].IsAutoIncementing); } } }
bsd-3-clause
C#
d4a3ad3d6e8e70e9e95d3adb9282655be6c1245c
adjust json cache serializer
wanlitao/FCP.Cache
FCP.Cache.Core/Serializer/JsonCacheSerializer.cs
FCP.Cache.Core/Serializer/JsonCacheSerializer.cs
using Newtonsoft.Json; using System; using System.Text; namespace FCP.Cache { /// <summary> /// Newtonsoft.Json Serializer /// </summary> public class JsonCacheSerializer : ICacheSerializer { public JsonCacheSerializer() { SerializerSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; } public JsonCacheSerializer(JsonSerializerSettings settings) { if (settings == null) throw new ArgumentNullException(nameof(settings)); SerializerSettings = settings; } public JsonSerializerSettings SerializerSettings { get; private set; } public byte[] Serialize<TValue>(TValue value) { if (value == null) return null; var stringValue = JsonConvert.SerializeObject(value, SerializerSettings); return Encoding.UTF8.GetBytes(stringValue); } public TValue Deserialize<TValue>(byte[] data) { if (data == null || data.Length < 1) return default(TValue); var stringValue = Encoding.UTF8.GetString(data, 0, data.Length); return JsonConvert.DeserializeObject<TValue>(stringValue, SerializerSettings); } } }
using Newtonsoft.Json; using System; using System.Text; namespace FCP.Cache { /// <summary> /// Newtonsoft.Json Serializer /// </summary> public class JsonCacheSerializer : ICacheSerializer { public JsonCacheSerializer() { SerializerSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; } public JsonCacheSerializer(JsonSerializerSettings settings) { if (settings == null) throw new ArgumentNullException(nameof(settings)); SerializerSettings = settings; } public JsonSerializerSettings SerializerSettings { get; } public byte[] Serialize<TValue>(TValue value) { if (value == null) return null; var stringValue = JsonConvert.SerializeObject(value, SerializerSettings); return Encoding.UTF8.GetBytes(stringValue); } public TValue Deserialize<TValue>(byte[] data) { if (data == null || data.Length < 1) return default(TValue); var stringValue = Encoding.UTF8.GetString(data, 0, data.Length); return JsonConvert.DeserializeObject<TValue>(stringValue, SerializerSettings); } } }
apache-2.0
C#
705dd5beff4d634dc8e499d5af0c4ad42bb2132d
Fix weh spam (#6312)
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
Content.Server/Sound/EmitSoundSystem.cs
Content.Server/Sound/EmitSoundSystem.cs
using Content.Server.Interaction.Components; using Content.Server.Sound.Components; using Content.Server.Throwing; using Content.Shared.Audio; using Content.Shared.Interaction; using Content.Shared.Throwing; using JetBrains.Annotations; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Player; namespace Content.Server.Sound { /// <summary> /// Will play a sound on various events if the affected entity has a component derived from BaseEmitSoundComponent /// </summary> [UsedImplicitly] public class EmitSoundSystem : EntitySystem { /// <inheritdoc /> public override void Initialize() { base.Initialize(); SubscribeLocalEvent<EmitSoundOnLandComponent, LandEvent>(HandleEmitSoundOnLand); SubscribeLocalEvent<EmitSoundOnUseComponent, UseInHandEvent>(HandleEmitSoundOnUseInHand); SubscribeLocalEvent<EmitSoundOnThrowComponent, ThrownEvent>(HandleEmitSoundOnThrown); SubscribeLocalEvent<EmitSoundOnActivateComponent, ActivateInWorldEvent>(HandleEmitSoundOnActivateInWorld); } private void HandleEmitSoundOnLand(EntityUid eUI, BaseEmitSoundComponent component, LandEvent arg) { TryEmitSound(component); } private void HandleEmitSoundOnUseInHand(EntityUid eUI, BaseEmitSoundComponent component, UseInHandEvent arg) { if (arg.Handled) return; arg.Handled = true; TryEmitSound(component); } private void HandleEmitSoundOnThrown(EntityUid eUI, BaseEmitSoundComponent component, ThrownEvent arg) { TryEmitSound(component); } private void HandleEmitSoundOnActivateInWorld(EntityUid eUI, BaseEmitSoundComponent component, ActivateInWorldEvent arg) { if (arg.Handled) return; arg.Handled = true; TryEmitSound(component); } private static void TryEmitSound(BaseEmitSoundComponent component) { SoundSystem.Play(Filter.Pvs(component.Owner), component.Sound.GetSound(), component.Owner, AudioHelpers.WithVariation(component.PitchVariation).WithVolume(-2f)); } } }
using Content.Server.Interaction.Components; using Content.Server.Sound.Components; using Content.Server.Throwing; using Content.Shared.Audio; using Content.Shared.Interaction; using Content.Shared.Throwing; using JetBrains.Annotations; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Player; namespace Content.Server.Sound { /// <summary> /// Will play a sound on various events if the affected entity has a component derived from BaseEmitSoundComponent /// </summary> [UsedImplicitly] public class EmitSoundSystem : EntitySystem { /// <inheritdoc /> public override void Initialize() { base.Initialize(); SubscribeLocalEvent<EmitSoundOnLandComponent, LandEvent>(HandleEmitSoundOnLand); SubscribeLocalEvent<EmitSoundOnUseComponent, UseInHandEvent>(HandleEmitSoundOnUseInHand); SubscribeLocalEvent<EmitSoundOnThrowComponent, ThrownEvent>(HandleEmitSoundOnThrown); SubscribeLocalEvent<EmitSoundOnActivateComponent, ActivateInWorldEvent>(HandleEmitSoundOnActivateInWorld); } private void HandleEmitSoundOnLand(EntityUid eUI, BaseEmitSoundComponent component, LandEvent arg) { TryEmitSound(component); } private void HandleEmitSoundOnUseInHand(EntityUid eUI, BaseEmitSoundComponent component, UseInHandEvent arg) { TryEmitSound(component); } private void HandleEmitSoundOnThrown(EntityUid eUI, BaseEmitSoundComponent component, ThrownEvent arg) { TryEmitSound(component); } private void HandleEmitSoundOnActivateInWorld(EntityUid eUI, BaseEmitSoundComponent component, ActivateInWorldEvent arg) { TryEmitSound(component); } private static void TryEmitSound(BaseEmitSoundComponent component) { SoundSystem.Play(Filter.Pvs(component.Owner), component.Sound.GetSound(), component.Owner, AudioHelpers.WithVariation(component.PitchVariation).WithVolume(-2f)); } } }
mit
C#
c84dd4ae0e9d30ebde203c1e130490854edd723d
Fix text style above participate button. Button now points to the appropriate function.
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
src/CompetitionPlatform/Views/Project/ProjectDetailsStatusPartial.cshtml
src/CompetitionPlatform/Views/Project/ProjectDetailsStatusPartial.cshtml
@using System.Threading.Tasks @model CompetitionPlatform.Models.ProjectViewModels.ProjectDetailsStatusViewModel @if (Model.Status == Status.Initiative) { <div> <p class="project-voting-text">Cast your vote for or against the competition. Do you think this is the project that Lykke City needs?</p> <div class="project-voting-buttons"> <a asp-area="" asp-controller="ProjectDetails" asp-action="VoteFor" asp-route-id="@Model.ProjectId" type="button" id="voteForButton" class="btn btn-sm btn-primary alert-success"> <span class="glyphicon glyphicon-thumbs-up"></span> </a> <a asp-area="" asp-controller="ProjectDetails" asp-action="VoteAgainst" asp-route-id="@Model.ProjectId" type="button" id="voteAgainstButton" class="btn btn-sm btn-primary alert-danger"> <span class="glyphicon glyphicon-thumbs-up"></span> </a> <input asp-for="@Model.VotesFor" type="hidden" /> <input asp-for="@Model.VotesAgainst" type="hidden" /> <p class="inline">@(Model.VotesFor + Model.VotesAgainst) Votes</p> <div id="projectVoteResults"> </div> </div> </div> } @if (Model.Status == Status.CompetitionRegistration) { <div> <p class="project-voting-text text-muted">To participate in the contest with the prize, you must be registered in the competition. Registration can be completed any time.</p> <a asp-area="" asp-controller="ProjectDetails" asp-action="AddParticipant" asp-route-id="@Model.ProjectId" type="button" class="btn btn-primary project-details-status-button"> <span class="glyphicon glyphicon-user" aria-hidden="true"></span> Participate </a> </div> } @if (Model.Status == Status.Implementation) { <p class="project-voting-text">The contest began. You can no longer participate, but will be able to evaluate the results of the competition after @Model.ImplementationDeadline.ToString("MMMM d").</p> } @if (Model.Status == Status.Voting) { <div> <p class="project-voting-text">The contest is finished You can help us determine the winners. Voting ends on @Model.VotingDeadline.ToString("MMMM d").</p> <button class="btn btn-primary project-details-status-button"> <span class="glyphicon glyphicon-ok-circle" aria-hidden="true"></span> Vote/Test </button> </div> } @if (Model.Status == Status.Archive) { <div> <p class="project-voting-text">The competition and voting have completed. Winners were determined by the citizens of Lykke City.</p> </div> }
@using System.Threading.Tasks @model CompetitionPlatform.Models.ProjectViewModels.ProjectDetailsStatusViewModel @if (Model.Status == Status.Initiative) { <div> <p class="project-voting-text">Cast your vote for or against the competition. Do you think this is the project that Lykke City needs?</p> <div class="project-voting-buttons"> <a asp-area="" asp-controller="ProjectDetails" asp-action="VoteFor" asp-route-id="@Model.ProjectId" type="button" id="voteForButton" class="btn btn-sm btn-primary alert-success"> <span class="glyphicon glyphicon-thumbs-up"></span> </a> <a asp-area="" asp-controller="ProjectDetails" asp-action="VoteAgainst" asp-route-id="@Model.ProjectId" type="button" id="voteAgainstButton" class="btn btn-sm btn-primary alert-danger"> <span class="glyphicon glyphicon-thumbs-up"></span> </a> <input asp-for="@Model.VotesFor" type="hidden" /> <input asp-for="@Model.VotesAgainst" type="hidden" /> <p class="inline">@(Model.VotesFor + Model.VotesAgainst) Votes</p> <div id="projectVoteResults"> </div> </div> </div> } @if (Model.Status == Status.CompetitionRegistration) { <div> <p class="project-voting-text">To participate in the contest with the prize, you must be registered in the competition. Registration can be completed any time.</p> <button class="btn btn-primary project-details-status-button"> <span class="glyphicon glyphicon-user" aria-hidden="true"></span> Participate </button> </div> } @if (Model.Status == Status.Implementation) { <p class="project-voting-text">The contest began. You can no longer participate, but will be able to evaluate the results of the competition after @Model.ImplementationDeadline.ToString("MMMM d").</p> } @if (Model.Status == Status.Voting) { <div> <p class="project-voting-text">The contest is finished You can help us determine the winners. Voting ends on @Model.VotingDeadline.ToString("MMMM d").</p> <button class="btn btn-primary project-details-status-button"> <span class="glyphicon glyphicon-ok-circle" aria-hidden="true"></span> Vote/Test </button> </div> } @if (Model.Status == Status.Archive) { <div> <p class="project-voting-text">The competition and voting have completed. Winners were determined by the citizens of Lykke City.</p> </div> }
mit
C#
1b0a7980db5b520a77e06d704124e4658710f705
add required attributes
MIS-Department/HR-Department,MIS-Department/HR-Department,MIS-Department/HR-Department
HR-Department.Models/Tables/Employee.cs
HR-Department.Models/Tables/Employee.cs
using System.ComponentModel.DataAnnotations; using HR_Department.Models.Tables.Interfaces; namespace HR_Department.Models.Tables { public class Employee : IEmployee { public int EmployeeId { get; set; } [Required] public string EmployeeNumber { get; set; } [Required] public string LastName { get; set; } [Required] public string FirstName { get; set; } [Required] public string MiddleName { get; set; } //public string Address { get; set; } //public string Gender { get; set; } //public string ContactNumber { get; set; } //public DateTime Birthdate { get; set; } //public string SssNumber { get; set; } //public string TinNumber { get; set; } //public int CivilStatusId { get; set; } //public int TaxId { get; set; } //public int DepartmentId { get; set; } //public int SectionId { get; set; } //public int PositionId { get; set; } //public DateTime DateHired { get; set; } //public DateTime DateRegularization { get; set; } //public int EmploymentStatusId { get; set; } //public string PhilHealthNumber { get; set; } //public string HdmfNumber { get; set; } //public string HdmfRtn { get; set; } //public string SalaryRate { get; set; } //public string SalaryStructure { get; set; } //public int SalaryTypeId { get; set; } //public int IsResign { get; set; } //public int IsActive { get; set; } //public DateTime DateResign { get; set; } //public int WorkersId { get; set; } //public string InCaseOfEmergencyName { get; set; } //public string InCaseOfEmergencyContactNo { get; set; } [Required] public byte[] ImageEmployee { get; set; } //public int IsSelected { get; set; } } }
using System.ComponentModel.DataAnnotations; using HR_Department.Models.Tables.Interfaces; namespace HR_Department.Models.Tables { public class Employee : IEmployee { public int EmployeeId { get; set; } [Required] public string EmployeeNumber { get; set; } [Required] public string LastName { get; set; } [Required] public string FirstName { get; set; } [Required] public string MiddleName { get; set; } //public string Address { get; set; } //public string Gender { get; set; } //public string ContactNumber { get; set; } //public DateTime Birthdate { get; set; } //public string SssNumber { get; set; } //public string TinNumber { get; set; } //public int CivilStatusId { get; set; } //public int TaxId { get; set; } //public int DepartmentId { get; set; } //public int SectionId { get; set; } //public int PositionId { get; set; } //public DateTime DateHired { get; set; } //public DateTime DateRegularization { get; set; } //public int EmploymentStatusId { get; set; } //public string PhilHealthNumber { get; set; } //public string HdmfNumber { get; set; } //public string HdmfRtn { get; set; } //public string SalaryRate { get; set; } //public string SalaryStructure { get; set; } //public int SalaryTypeId { get; set; } //public int IsResign { get; set; } //public int IsActive { get; set; } //public DateTime DateResign { get; set; } //public int WorkersId { get; set; } //public string InCaseOfEmergencyName { get; set; } //public string InCaseOfEmergencyContactNo { get; set; } //[Required] public byte[] ImageEmployee { get; set; } //public int IsSelected { get; set; } } }
mit
C#
f6190211aa3d584310ef2aafa9db75cce2798d67
Disable 2 s/r tests that demonstrate known chorus problems
BloomBooks/BloomDesktop,andrew-polk/BloomDesktop,StephenMcConnel/BloomDesktop,JohnThomson/BloomDesktop,andrew-polk/BloomDesktop,andrew-polk/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,andrew-polk/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,JohnThomson/BloomDesktop,andrew-polk/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork
src/BloomTests/SendReceiveTests.cs
src/BloomTests/SendReceiveTests.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Text; using Bloom.Publish; using BloomTemp; using Chorus.VcsDrivers.Mercurial; using LibChorus.TestUtilities; using NUnit.Framework; using Palaso.IO; using Palaso.Progress.LogBox; namespace BloomTests { [TestFixture] public class SendReceiveTests { [Test, Ignore("not yet")] public void CreateOrLocate_FolderHasAccentedLetter_FindsIt() { using (var setup = new RepositorySetup("Abé Books")) { Assert.NotNull(HgRepository.CreateOrLocate(setup.Repository.PathToRepo, new ConsoleProgress())); } } [Test, Ignore("not yet")] public void CreateOrLocate_FolderHasAccentedLetter2_FindsIt() { using (var testRoot = new TemporaryFolder("bloom sr test")) { string path = Path.Combine(testRoot.FolderPath, "Abé Books"); Directory.CreateDirectory(path); Assert.NotNull(HgRepository.CreateOrLocate(path, new ConsoleProgress())); Assert.NotNull(HgRepository.CreateOrLocate(path, new ConsoleProgress())); } } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Text; using Bloom.Publish; using BloomTemp; using Chorus.VcsDrivers.Mercurial; using LibChorus.TestUtilities; using NUnit.Framework; using Palaso.IO; using Palaso.Progress.LogBox; namespace BloomTests { [TestFixture] public class SendReceiveTests { [Test] public void CreateOrLocate_FolderHasAccentedLetter_FindsIt() { using (var setup = new RepositorySetup("Abé Books")) { Assert.NotNull(HgRepository.CreateOrLocate(setup.Repository.PathToRepo, new ConsoleProgress())); } } [Test] public void CreateOrLocate_FolderHasAccentedLetter2_FindsIt() { using (var testRoot = new TemporaryFolder("bloom sr test")) { string path = Path.Combine(testRoot.FolderPath, "Abé Books"); Directory.CreateDirectory(path); Assert.NotNull(HgRepository.CreateOrLocate(path, new ConsoleProgress())); Assert.NotNull(HgRepository.CreateOrLocate(path, new ConsoleProgress())); } } } }
mit
C#
19380e332ebf906145001f971a861235bf5bd1a7
Update QuizGradeCalculator.cs
zulaldogan/unity-csharp-beginner
Practical/Assets/QuizGradeCalculator.cs
Practical/Assets/QuizGradeCalculator.cs
using UnityEngine; public class QuizGradeCalculator : MonoBehaviour { public float quiz1, quiz2, quiz3, quiz4, quiz5; public float average; public float Rndm() { return Random.Range(0f, 100.1f);//Random Float Numbers(0-100) } void Start() { quiz1 = Rndm(); quiz2 = Rndm(); quiz3 = Rndm(); quiz4 = Rndm(); quiz5 = Rndm(); average = (quiz1 + quiz2 + quiz3 + quiz4 + quiz5) / 5; average = Mathf.Round(average * 100) / 100; //if average is greater than 90 //print you have an A if (average >= 90) { Debug.Log("You have an A!"); } else if (average >= 80 && average < 90) { Debug.Log("You have a B"); } else if (average >= 70 && average < 80) { Debug.Log("You have a C"); } else { Debug.Log("You have a F"); } } void Update() { if (Input.GetKeyDown(KeyCode.Space)) { //recalculate average with new quiz grades Start(); } } }
using UnityEngine; public class QuizGradeCalculator : MonoBehaviour { public float quiz1, quiz2, quiz3, quiz4, quiz5; public float average; void Start() { quiz1 = Random.Range(0f, 100.1f);//Random Float Numbers(0-100) quiz2 = Random.Range(0f, 100.1f); quiz3 = Random.Range(0f, 100.1f); quiz4 = Random.Range(0f, 100.1f); quiz5 = Random.Range(0f, 100.1f); average = (quiz1 + quiz2 + quiz3 + quiz4 + quiz5) / 5; average = Mathf.Round(average * 100) / 100; //if average is greater than 90 //print you have an A if (average >= 90) { Debug.Log("You have an A!"); } else if (average >= 80 && average < 90) { Debug.Log("You have a B"); } else if (average >= 70 && average < 80) { Debug.Log("You have a C"); } else { Debug.Log("You have a F"); } } void Update() { if (Input.GetKeyDown(KeyCode.Space)) { //recalculate average with new quiz grades Start(); } } }
mit
C#
5d703b950a2167469e03cfe6d30bb93ec6ae1d74
Use case insensitive matching (fixes #39).
KN4CK3R/ReClass.NET,jesterret/ReClass.NET,jesterret/ReClass.NET,KN4CK3R/ReClass.NET,KN4CK3R/ReClass.NET,jesterret/ReClass.NET
ReClass.NET/Forms/ClassSelectionForm.cs
ReClass.NET/Forms/ClassSelectionForm.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ReClassNET.Nodes; namespace ReClassNET.Forms { public partial class ClassSelectionForm : IconForm { private readonly List<ClassNode> allClasses; public ClassNode SelectedClass => classesListBox.SelectedItem as ClassNode; public ClassSelectionForm(IEnumerable<ClassNode> classes) { Contract.Requires(classes != null); allClasses = classes.ToList(); InitializeComponent(); ShowFilteredClasses(); } private void filterNameTextBox_TextChanged(object sender, EventArgs e) { ShowFilteredClasses(); } private void classesListBox_SelectedIndexChanged(object sender, EventArgs e) { selectButton.Enabled = SelectedClass != null; } private void classesListBox_MouseDoubleClick(object sender, MouseEventArgs e) { if (SelectedClass != null) { selectButton.PerformClick(); } } private void ShowFilteredClasses() { IEnumerable<ClassNode> classes = allClasses; if (!string.IsNullOrEmpty(filterNameTextBox.Text)) { classes = classes.Where(c => c.Name.IndexOf(filterNameTextBox.Text, StringComparison.OrdinalIgnoreCase) >= 0); } classesListBox.DataSource = classes.ToList(); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ReClassNET.Nodes; namespace ReClassNET.Forms { public partial class ClassSelectionForm : IconForm { private readonly List<ClassNode> allClasses; public ClassNode SelectedClass => classesListBox.SelectedItem as ClassNode; public ClassSelectionForm(IEnumerable<ClassNode> classes) { Contract.Requires(classes != null); allClasses = classes.ToList(); InitializeComponent(); ShowFilteredClasses(); } private void filterNameTextBox_TextChanged(object sender, EventArgs e) { ShowFilteredClasses(); } private void classesListBox_SelectedIndexChanged(object sender, EventArgs e) { selectButton.Enabled = SelectedClass != null; } private void classesListBox_MouseDoubleClick(object sender, MouseEventArgs e) { if (SelectedClass != null) { selectButton.PerformClick(); } } private void ShowFilteredClasses() { IEnumerable<ClassNode> classes = allClasses; if (!string.IsNullOrEmpty(filterNameTextBox.Text)) { classes = classes.Where(c => c.Name.Contains(filterNameTextBox.Text)); } classesListBox.DataSource = classes.ToList(); } } }
mit
C#
d7db33ad12c265e49e1dbddd9cfec6e1dbaffa0c
Fix broken references in Household.Index
johanhelsing/vaskelista,johanhelsing/vaskelista
Vaskelista/Views/Household/Index.cshtml
Vaskelista/Views/Household/Index.cshtml
@model IEnumerable<Vaskelista.Models.Household> @{ ViewBag.Title = "Index"; } <h2>Index</h2> <p> @Html.ActionLink("Create New", "Create") </p> <table class="table"> <tr> <th> @Html.DisplayNameFor(model => model.Token) </th> <th></th> </tr> @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem => item.Token) </td> <td> @Html.ActionLink("Edit", "Edit", new { id=item.HouseholdId }) | @Html.ActionLink("Details", "Details", new { id=item.HouseholdId }) | @Html.ActionLink("Delete", "Delete", new { id=item.HouseholdId }) </td> </tr> } </table>
@model IEnumerable<Vaskelista.Models.Household> @{ ViewBag.Title = "Index"; } <h2>Index</h2> <p> @Html.ActionLink("Create New", "Create") </p> <table class="table"> <tr> <th> @Html.DisplayNameFor(model => model.Name) </th> <th></th> </tr> @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem => item.Name) </td> <td> @Html.ActionLink("Edit", "Edit", new { id=item.ScheduleId }) | @Html.ActionLink("Details", "Details", new { id=item.ScheduleId }) | @Html.ActionLink("Delete", "Delete", new { id=item.ScheduleId }) </td> </tr> } </table>
mit
C#
318180330f09744ef67a3e16ede8e386291fd910
Remove commented out code
googleapis/gapic-generator-csharp,googleapis/gapic-generator-csharp
Google.Api.Generator.Tests/ProtoTests/ResourceNames/ResourceNamesFakes.cs
Google.Api.Generator.Tests/ProtoTests/ResourceNames/ResourceNamesFakes.cs
// Copyright 2019 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://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 Google.Protobuf.Collections; namespace Testing.ResourceNames { public partial class SinglePattern : ProtoMsgFake<SinglePattern> { public string RealName { get; set; } public string Ref { get; set; } public RepeatedField<string> RepeatedRef { get; } } public partial class WildcardOnlyPattern : ProtoMsgFake<WildcardOnlyPattern> { public string Name { get; set; } public string Ref { get; set; } public RepeatedField<string> RepeatedRef { get; } public string RefSugar { get; set; } public RepeatedField<string> RepeatedRefSugar { get; } } public partial class WildcardMultiPattern : ProtoMsgFake<WildcardMultiPattern> { public string Name { get; set; } public string Ref { get; set; } public RepeatedField<string> RepeatedRef { get; } } public partial class WildcardMultiPatternMultiple : ProtoMsgFake<WildcardMultiPatternMultiple> { public string Name { get; set; } public string Ref { get; set; } public RepeatedField<string> RepeatedRef { get; } } public partial class Response : ProtoMsgFake<Response> { } }
// Copyright 2019 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://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 Google.Protobuf.Collections; namespace Testing.ResourceNames { public partial class SinglePattern : ProtoMsgFake<SinglePattern> { public string RealName { get; set; } public string Ref { get; set; } public RepeatedField<string> RepeatedRef { get; } } public partial class WildcardOnlyPattern : ProtoMsgFake<WildcardOnlyPattern> { public string Name { get; set; } public string Ref { get; set; } public RepeatedField<string> RepeatedRef { get; } public string RefSugar { get; set; } public RepeatedField<string> RepeatedRefSugar { get; } } public partial class WildcardMultiPattern : ProtoMsgFake<WildcardMultiPattern> { public string Name { get; set; } public string Ref { get; set; } public RepeatedField<string> RepeatedRef { get; } } public partial class WildcardMultiPatternMultiple : ProtoMsgFake<WildcardMultiPatternMultiple> { public string Name { get; set; } public string Ref { get; set; } public RepeatedField<string> RepeatedRef { get; } } public partial class Response : ProtoMsgFake<Response> { } //public partial class SingleResource : ProtoMsgFake<SingleResource> //{ // public string Name { get; set; } //} //public partial class SingleResourceRef : ProtoMsgFake<SingleResourceRef> //{ // public string SingleResource { get; set; } // public string SingleResourceName { get; set; } //} //public partial class MultiResource : ProtoMsgFake<MultiResource> //{ // public string Name { get; set; } //} //public partial class MultiResourceRef : ProtoMsgFake<MultiResourceRef> //{ // public string MultiResource { get; set; } //} //public partial class FutureMultiResource : ProtoMsgFake<FutureMultiResource> //{ // public string Name { get; set; } //} //public partial class OriginallySingleResource : ProtoMsgFake<OriginallySingleResource> //{ // public string Name { get; set; } //} //public partial class OriginallySingleResourceRef : ProtoMsgFake<OriginallySingleResourceRef> //{ // public string Resource1 { get; set; } // public string Resource2 { get; set; } //} //public class Response : ProtoMsgFake<Response> { } }
apache-2.0
C#
0bb300a1331e0b9a7146bf7484751c2865946067
Create a index pr. read model
AntoineGa/EventFlow,rasmus/EventFlow,liemqv/EventFlow
Source/EventFlow.ReadStores.Elasticsearch/ReadModelDescriptionProvider.cs
Source/EventFlow.ReadStores.Elasticsearch/ReadModelDescriptionProvider.cs
// The MIT License (MIT) // // Copyright (c) 2015 Rasmus Mikkelsen // https://github.com/rasmus/EventFlow // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using System; using System.Reflection; using System.Collections.Concurrent; using Nest; namespace EventFlow.ReadStores.Elasticsearch { public class ReadModelDescriptionProvider : IReadModelDescriptionProvider { private static readonly ConcurrentDictionary<Type, ReadModelDescription> _indexNames = new ConcurrentDictionary<Type, ReadModelDescription>(); public ReadModelDescription GetReadModelDescription<TReadModel>() where TReadModel : IElasticsearchReadModel { return _indexNames.GetOrAdd( typeof (TReadModel), t => { var elasticType = t.GetCustomAttribute<ElasticTypeAttribute>(); return new ReadModelDescription(new IndexName(elasticType == null ? "eventflow" : elasticType.Name)); }); } } }
// The MIT License (MIT) // // Copyright (c) 2015 Rasmus Mikkelsen // https://github.com/rasmus/EventFlow // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace EventFlow.ReadStores.Elasticsearch { public class ReadModelDescriptionProvider : IReadModelDescriptionProvider { public ReadModelDescription GetReadModelDescription<TReadModel>() where TReadModel : IElasticsearchReadModel { return new ReadModelDescription(new IndexName("eventflow")); } } }
mit
C#
ea459580533bc638714630391fc8fc9da1e6aa1d
Add back-end (db) user setting for benoit
KennethMoons/projectWindowsApp
WebApiOpendeurdag2/WebApiOpendeurdag2/Models/WebApiOpendeurdag2Context.cs
WebApiOpendeurdag2/WebApiOpendeurdag2/Models/WebApiOpendeurdag2Context.cs
using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Web; namespace WebApiOpendeurdag2.Models { public class WebApiOpendeurdag2Context : DbContext { // You can add custom code to this file. Changes will not be overwritten. // // If you want Entity Framework to drop and regenerate your database // automatically whenever you change your model schema, please use data migrations. // For more information refer to the documentation: // http://msdn.microsoft.com/en-us/data/jj591621.aspx public WebApiOpendeurdag2Context() : base("name=WebApiOpendeurdag2Context") { if (Environment.UserName.Equals("benoit")) { Database.Connection.ConnectionString = "Database=Opendeur;Data Source=ITEXT-BLAGAE;Integrated Security=True"; } } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.Campus> Campus { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.Gebruiker> Gebruikers { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.Infomoment> Infomoments { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.Opleiding> Opleidings { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.Newsitem> Newsitems { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.VoorkeurCampus> VoorkeurCampus { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.VoorkeurOpleiding> VoorkeurOpleidings { get; set; } } }
using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Web; namespace WebApiOpendeurdag2.Models { public class WebApiOpendeurdag2Context : DbContext { // You can add custom code to this file. Changes will not be overwritten. // // If you want Entity Framework to drop and regenerate your database // automatically whenever you change your model schema, please use data migrations. // For more information refer to the documentation: // http://msdn.microsoft.com/en-us/data/jj591621.aspx public WebApiOpendeurdag2Context() : base("name=WebApiOpendeurdag2Context") { } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.Campus> Campus { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.Gebruiker> Gebruikers { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.Infomoment> Infomoments { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.Opleiding> Opleidings { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.Newsitem> Newsitems { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.VoorkeurCampus> VoorkeurCampus { get; set; } public System.Data.Entity.DbSet<WebApiOpendeurdag2.Models.VoorkeurOpleiding> VoorkeurOpleidings { get; set; } } }
agpl-3.0
C#
94653b09f693187bab5de2c9286abe0a3df7376c
split tests for parameters out to multiple tests to better illustrate for demo
mefish/BookStore
BookStore/Tests/Tests.Presentation/Commands/StockBookPresenterTests.cs
BookStore/Tests/Tests.Presentation/Commands/StockBookPresenterTests.cs
using BookStore.Core.Core.Interfaces; using BookStore.Presentation.Commands; using Moq; using NUnit.Framework; namespace BookStore.Tests.Tests.Presentation.Commands { [TestFixture] internal class StockBookPresenterTests { private const string ISBN = "456"; private const string EXPECTED_TITLE = "Title"; private const string EXPECTED_AUTHOR = "Author"; private Mock<ICommandPresenterFactory> _factoryMock; private StockBookPresenter _presenter; private string[] _presenterParameters = new[] { ISBN, EXPECTED_TITLE, EXPECTED_AUTHOR, }; [SetUp] public void Setup() { _factoryMock = new Mock<ICommandPresenterFactory>(); _presenter = new StockBookPresenter(_factoryMock.Object); } [Test] public void OnSuccessWillPrintSuccessMessage() { var bookInventoryMock = new Mock<IBookInventory>(); _presenter.BookInventory = bookInventoryMock.Object; _presenter.ISBN = ISBN; var result = _presenter.PrintResult(); Assert.AreEqual($"Successfully added book with ISBN# {ISBN} to inventory!", result); } [Test] public void CanAddTitleWithParameters() { _presenter.Parameters = _presenterParameters; _presenter.BuildPropertiesFromParameters(); Assert.AreEqual(EXPECTED_TITLE, _presenter.Title); } [Test] public void CanAddAuthorWithParameters() { _presenter.Parameters = _presenterParameters; _presenter.BuildPropertiesFromParameters(); Assert.AreEqual(EXPECTED_AUTHOR, _presenter.Author); } } }
using BookStore.Core.Core.Interfaces; using BookStore.Presentation.Commands; using Moq; using NUnit.Framework; namespace BookStore.Tests.Tests.Presentation.Commands { [TestFixture] internal class StockBookPresenterTests { private const string ISBN = "456"; private Mock<ICommandPresenterFactory> _factoryMock; private StockBookPresenter _presenter; [SetUp] public void Setup() { _factoryMock = new Mock<ICommandPresenterFactory>(); _presenter = new StockBookPresenter(_factoryMock.Object); } [Test] public void OnSuccessWillPrintSuccessMessage() { var bookInventoryMock = new Mock<IBookInventory>(); _presenter.BookInventory = bookInventoryMock.Object; _presenter.ISBN = ISBN; var result = _presenter.PrintResult(); Assert.AreEqual($"Successfully added book with ISBN# {ISBN} to inventory!", result); } [Test] public void CanBuildBookFromParameters() { var title = "Title"; var author = "Author"; _presenter.Parameters = new[] { ISBN, title, author, }; _presenter.BuildPropertiesFromParameters(); Assert.AreEqual(ISBN, _presenter.ISBN); Assert.AreEqual(title, _presenter.Title); Assert.AreEqual(author, _presenter.Author); } } }
unlicense
C#
e7757f0ca5b26b57d32851dbb3164078af3d9594
add down migration for initial schema
Dirk-Peters/FS
Market/chat-server/Persistence/Migrations/InitialSchema.cs
Market/chat-server/Persistence/Migrations/InitialSchema.cs
using FluentMigrator; namespace chat_server.Persistence.Migrations { [Migration(1)] public sealed class InitialSchema : Migration { public override void Up() { var sessions = Create.Table("Sessions"); sessions.WithColumn("Id").AsGuid().PrimaryKey(); sessions.WithColumn("name").AsString(); } public override void Down() { Delete.Table("Sessions"); } } }
using FluentMigrator; namespace chat_server.Persistence.Migrations { [Migration(1)] public sealed class InitialSchema : MigrationBase { public override void Up() { var sessions = Create.Table("Sessions"); sessions.WithColumn("Id").AsGuid().PrimaryKey(); sessions.WithColumn("name").AsString(); } public override void Down() { //TODO } } }
mit
C#
feaefe489a84c4b0255601dae7bde46a2f43b29d
Change .net type to stable NuGet dependency for KaVEVersionUtil counter example.
kave-cc/csharp-commons,kave-cc/csharp-commons
KaVE.Commons.Tests/Utils/KaVEVersionUtilTestSuite/OtherAssemblyTest.cs
KaVE.Commons.Tests/Utils/KaVEVersionUtilTestSuite/OtherAssemblyTest.cs
/* * Copyright 2017 University of Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using KaVE.Commons.Model; using KaVE.Commons.Utils; using NUnit.Framework; namespace KaVE.Commons.Tests.Utils.KaVEVersionUtilTestSuite { internal class OtherAssemblyTest { private KaVEVersionUtil _sut; [SetUp] public void SetUp() { _sut = new KaVEVersionUtil(); } [Test] public void GetInformalVersion() { var actual = _sut.GetAssemblyInformalVersionByContainedType<Assert>(); const string expected = "2.6.4.14350"; Assert.AreEqual(expected, actual); } [Test] public void GetVariant() { var actual = _sut.GetAssemblyVariantByContainedType<Assert>(); Assert.AreEqual(Variant.Unknown, actual); } [Test] public void GetVersion() { var actual = _sut.GetAssemblyVersionByContainedType<Assert>(); var expected = new Version(2, 6, 4, 14350); Assert.AreEqual(expected, actual); } } }
/* * Copyright 2017 University of Zurich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using KaVE.Commons.Model; using KaVE.Commons.Utils; using NUnit.Framework; namespace KaVE.Commons.Tests.Utils.KaVEVersionUtilTestSuite { internal class OtherAssemblyTest { private KaVEVersionUtil _sut; [SetUp] public void SetUp() { _sut = new KaVEVersionUtil(); } [Test] public void GetInformalVersion() { var actual = _sut.GetAssemblyInformalVersionByContainedType<int>(); const string expected = "4.7.2115.0"; Assert.AreEqual(expected, actual); } [Test] public void GetVariant() { var actual = _sut.GetAssemblyVariantByContainedType<int>(); Assert.AreEqual(Variant.Unknown, actual); } [Test] public void GetVersion() { var actual = _sut.GetAssemblyVersionByContainedType<int>(); var expected = new Version(4, 0, 0, 0); Assert.AreEqual(expected, actual); } } }
apache-2.0
C#