commit
stringlengths
40
40
old_file
stringlengths
4
237
new_file
stringlengths
4
237
old_contents
stringlengths
1
4.24k
new_contents
stringlengths
1
4.87k
subject
stringlengths
15
778
message
stringlengths
15
8.75k
lang
stringclasses
266 values
license
stringclasses
13 values
repos
stringlengths
5
127k
e52f6cf1ac322c4d898c4abbda62e0cf2eeefe44
Client/Harmony/ShipConstruction_FindVesselsLandedAt.cs
Client/Harmony/ShipConstruction_FindVesselsLandedAt.cs
using Harmony; using LunaClient.Systems.Lock; using LunaCommon.Enums; using System.Collections.Generic; // ReSharper disable All namespace LunaClient.Harmony { /// <summary> /// This harmony patch is intended to override the "FindVesselsLandedAt" that sometimes is called to check if there are vessels in a launch site /// We just remove the other controlled vessels from that check and set them correctly /// </summary> [HarmonyPatch(typeof(ShipConstruction))] [HarmonyPatch("FindVesselsLandedAt")] [HarmonyPatch(new[] { typeof(FlightState), typeof(string) })] public class ShipConstruction_FindVesselsLandedAt { private static readonly List<ProtoVessel> ProtoVesselsToRemove = new List<ProtoVessel>(); [HarmonyPostfix] private static void PostfixFindVesselsLandedAt(List<ProtoVessel> __result) { if (MainSystem.NetworkState < ClientState.Connected) return; ProtoVesselsToRemove.Clear(); foreach (var pv in __result) { if (!LockSystem.LockQuery.ControlLockExists(pv.vesselID)) ProtoVesselsToRemove.Add(pv); } foreach (var pv in ProtoVesselsToRemove) { __result.Remove(pv); } } } }
using Harmony; using LunaClient.Systems.Lock; using LunaCommon.Enums; using System.Collections.Generic; // ReSharper disable All namespace LunaClient.Harmony { /// <summary> /// This harmony patch is intended to override the "FindVesselsLandedAt" that sometimes is called to check if there are vessels in a launch site /// We just remove the other controlled vessels from that check and set them correctly /// </summary> [HarmonyPatch(typeof(ShipConstruction))] [HarmonyPatch("FindVesselsLandedAt")] [HarmonyPatch(new[] { typeof(FlightState), typeof(string) })] public class ShipConstruction_FindVesselsLandedAt { private static readonly List<ProtoVessel> ProtoVesselsToRemove = new List<ProtoVessel>(); [HarmonyPostfix] private static void PostfixFindVesselsLandedAt(List<ProtoVessel> __result) { if (MainSystem.NetworkState < ClientState.Connected) return; ProtoVesselsToRemove.Clear(); foreach (var pv in __result) { if (LockSystem.LockQuery.ControlLockExists(pv.vesselID)) ProtoVesselsToRemove.Add(pv); } foreach (var pv in ProtoVesselsToRemove) { __result.Remove(pv); } } } }
Fix find vessels landed at
Fix find vessels landed at
C#
mit
gavazquez/LunaMultiPlayer,DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer
1ec6be087fb3cccded34477f1386ca1d72492ab1
src/Draw2D.Core/ObservableObject.cs
src/Draw2D.Core/ObservableObject.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.ComponentModel; using System.Runtime.CompilerServices; namespace Draw2D.Core { public abstract class ObservableObject : INotifyPropertyChanged { public bool IsDirty { get; set; } public event PropertyChangedEventHandler PropertyChanged; public void Notify([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public bool Update<T>(ref T field, T value, [CallerMemberName] string propertyName = null) { if (!Equals(field, value)) { field = value; IsDirty = true; Notify(propertyName); return true; } return false; } } }
// 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.ComponentModel; using System.Runtime.CompilerServices; namespace Draw2D.Core { public abstract class ObservableObject : INotifyPropertyChanged { internal bool IsDirty { get; set; } public event PropertyChangedEventHandler PropertyChanged; public void Notify([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public bool Update<T>(ref T field, T value, [CallerMemberName] string propertyName = null) { if (!Equals(field, value)) { field = value; IsDirty = true; Notify(propertyName); return true; } return false; } } }
Mark IsDirty property as internal
Mark IsDirty property as internal
C#
mit
wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D
a22912756784bae8b94d209ccabc30e908f765fa
food_tracker/TrackerContext.cs
food_tracker/TrackerContext.cs
using System.Data.Entity; namespace food_tracker { public class TrackerContext : DbContext { public TrackerContext() : base("name=NutritionTrackerContext") { Configuration.LazyLoadingEnabled = false; this.Database.Log = s => System.Diagnostics.Debug.WriteLine(s); } public DbSet<WholeDay> Days { get; set; } public DbSet<NutritionItem> Nutrition { get; set; } } }
using System.Data.Entity; namespace food_tracker { public class TrackerContext : DbContext { public TrackerContext() : base() { Configuration.LazyLoadingEnabled = false; this.Database.Log = s => System.Diagnostics.Debug.WriteLine(s); } public DbSet<WholeDay> Days { get; set; } public DbSet<NutritionItem> Nutrition { get; set; } } }
Change back to use the default database name.
Change back to use the default database name.
C#
mit
lukecahill/NutritionTracker
16af37474f59acebad35de77099910f68ea36c17
test/Bakery.Processes.Tests/Bakery/Processes/SystemDiagnosticsProcessTests.cs
test/Bakery.Processes.Tests/Bakery/Processes/SystemDiagnosticsProcessTests.cs
namespace Bakery.Processes { using Specification.Builder; using System; using System.Text; using System.Threading.Tasks; using Xunit; public class SystemDiagnosticsProcessTests { [Fact] public async Task EchoWithCombinedOutput() { var processSpecification = ProcessSpecificationBuilder.Create() .WithProgram(@"echo") .WithArguments("a", "b", "c") .WithEnvironment() .WithCombinedOutput() .Build(); var processFactory = new ProcessFactory(); var process = processFactory.Start(processSpecification); var stringBuilder = new StringBuilder(); await process.WaitForExit(TimeSpan.FromSeconds(5)); while (true) { var output = await process.TryReadAsync(TimeSpan.FromSeconds(1)); if (output == null) break; stringBuilder.Append(output.Text); } var totalOutput = stringBuilder.ToString(); Assert.Equal("a b c", totalOutput); } } }
namespace Bakery.Processes { using System; using System.Text; using System.Threading.Tasks; using Xunit; public class SystemDiagnosticsProcessTests { [Fact] public async Task EchoWithCombinedOutput() { var process = await new ProcessFactory().RunAsync(builder => { return builder .WithProgram("echo") .WithArguments("a", "b", "c") .WithEnvironment() .WithCombinedOutput() .Build(); }); var stringBuilder = new StringBuilder(); while (true) { var output = await process.TryReadAsync(TimeSpan.FromSeconds(1)); if (output == null) break; stringBuilder.Append(output.Text); } var totalOutput = stringBuilder.ToString(); Assert.Equal("a b c", totalOutput); } } }
Update tests re: process builder, etc.
Update tests re: process builder, etc.
C#
mit
brendanjbaker/Bakery
8cdb1c68ad25280e359e07d0ff68db3bfce4ce5a
src/Cake/Arguments/VerbosityParser.cs
src/Cake/Arguments/VerbosityParser.cs
using System; using System.Collections.Generic; using Cake.Core.Diagnostics; namespace Cake.Arguments { /// <summary> /// Responsible for parsing <see cref="Verbosity"/>. /// </summary> internal sealed class VerbosityParser { private readonly Dictionary<string, Verbosity> _lookup; /// <summary> /// Initializes a new instance of the <see cref="VerbosityParser"/> class. /// </summary> public VerbosityParser() { _lookup = new Dictionary<string, Verbosity>(StringComparer.OrdinalIgnoreCase) { { "q", Verbosity.Quiet }, { "quiet", Verbosity.Quiet }, { "m", Verbosity.Minimal }, { "minimal", Verbosity.Minimal }, { "n", Verbosity.Normal }, { "normal", Verbosity.Normal }, { "v", Verbosity.Verbose }, { "verbose", Verbosity.Verbose }, { "d", Verbosity.Diagnostic }, { "diagnostic", Verbosity.Diagnostic } }; } /// <summary> /// Parses the provided string to a <see cref="Verbosity"/>. /// </summary> /// <param name="value">The string to parse.</param> /// <returns>The verbosity.</returns> public Verbosity Parse(string value) { Verbosity verbosity; if (_lookup.TryGetValue(value, out verbosity)) { return verbosity; } const string format = "The value '{0}' is not a valid verbosity."; var message = string.Format(format, value ?? string.Empty); throw new InvalidOperationException(message); } } }
using System; using System.Collections.Generic; using System.Globalization; using Cake.Core.Diagnostics; namespace Cake.Arguments { /// <summary> /// Responsible for parsing <see cref="Verbosity"/>. /// </summary> internal sealed class VerbosityParser { private readonly Dictionary<string, Verbosity> _lookup; /// <summary> /// Initializes a new instance of the <see cref="VerbosityParser"/> class. /// </summary> public VerbosityParser() { _lookup = new Dictionary<string, Verbosity>(StringComparer.OrdinalIgnoreCase) { { "q", Verbosity.Quiet }, { "quiet", Verbosity.Quiet }, { "m", Verbosity.Minimal }, { "minimal", Verbosity.Minimal }, { "n", Verbosity.Normal }, { "normal", Verbosity.Normal }, { "v", Verbosity.Verbose }, { "verbose", Verbosity.Verbose }, { "d", Verbosity.Diagnostic }, { "diagnostic", Verbosity.Diagnostic } }; } /// <summary> /// Parses the provided string to a <see cref="Verbosity"/>. /// </summary> /// <param name="value">The string to parse.</param> /// <returns>The verbosity.</returns> public Verbosity Parse(string value) { Verbosity verbosity; if (_lookup.TryGetValue(value, out verbosity)) { return verbosity; } const string format = "The value '{0}' is not a valid verbosity."; var message = string.Format(CultureInfo.InvariantCulture, format, value); throw new InvalidOperationException(message); } } }
Add invariant IFormatterProvider to avoid issues based on user local
Add invariant IFormatterProvider to avoid issues based on user local
C#
mit
michael-wolfenden/cake,vlesierse/cake,phrusher/cake,cake-build/cake,gep13/cake,Julien-Mialon/cake,UnbelievablyRitchie/cake,Sam13/cake,robgha01/cake,robgha01/cake,thomaslevesque/cake,mholo65/cake,cake-build/cake,Julien-Mialon/cake,patriksvensson/cake,RehanSaeed/cake,ferventcoder/cake,RehanSaeed/cake,devlead/cake,patriksvensson/cake,mholo65/cake,andycmaj/cake,SharpeRAD/Cake,RichiCoder1/cake,Sam13/cake,devlead/cake,adamhathcock/cake,phrusher/cake,adamhathcock/cake,thomaslevesque/cake,daveaglick/cake,andycmaj/cake,RichiCoder1/cake,vlesierse/cake,DixonD-git/cake,michael-wolfenden/cake,ferventcoder/cake,UnbelievablyRitchie/cake,phenixdotnet/cake,phenixdotnet/cake,SharpeRAD/Cake,gep13/cake,daveaglick/cake
15858a9b19dca6e6d143f7201e241269c9ce84e2
Source/Lib/TraktApiSharp/Services/TraktSerializationService.cs
Source/Lib/TraktApiSharp/Services/TraktSerializationService.cs
namespace TraktApiSharp.Services { using Authentication; using System; /// <summary>Provides helper methods for serializing and deserializing Trakt objects.</summary> public static class TraktSerializationService { public static string Serialize(TraktAuthorization authorization) { if (authorization == null) throw new ArgumentNullException(nameof(authorization), "authorization must not be null"); return string.Empty; } public static TraktAuthorization Deserialize(string authorization) { return null; } } }
namespace TraktApiSharp.Services { using Authentication; using Extensions; using System; using Utils; /// <summary>Provides helper methods for serializing and deserializing Trakt objects.</summary> public static class TraktSerializationService { /// <summary>Serializes an <see cref="TraktAuthorization" /> instance to a Json string.</summary> /// <param name="authorization">The authorization information, which should be serialized.</param> /// <returns>A Json string, containing all properties of the given authorization.</returns> /// <exception cref="ArgumentNullException">Thrown, if the given authorization is null.</exception> public static string Serialize(TraktAuthorization authorization) { if (authorization == null) throw new ArgumentNullException(nameof(authorization), "authorization must not be null"); var anonymousAuthorization = new { AccessToken = authorization.AccessToken, RefreshToken = authorization.RefreshToken, ExpiresIn = authorization.ExpiresIn, Scope = authorization.AccessScope.ObjectName, TokenType = authorization.TokenType.ObjectName, CreatedAt = authorization.Created.ToTraktLongDateTimeString(), IgnoreExpiration = authorization.IgnoreExpiration }; return Json.Serialize(anonymousAuthorization); } public static TraktAuthorization Deserialize(string authorization) { return null; } } }
Add implementation for serializing TraktAuthorization.
Add implementation for serializing TraktAuthorization.
C#
mit
henrikfroehling/TraktApiSharp
a21be62f1cff70f799918e5692612f067ca50215
IIUWr/IIUWr/ConfigureIoC.cs
IIUWr/IIUWr/ConfigureIoC.cs
using IIUWr.Fereol.Common; using IIUWr.Fereol.Interface; using IIUWr.ViewModels.Fereol; using LionCub.Patterns.DependencyInjection; using System; using HTMLParsing = IIUWr.Fereol.HTMLParsing; namespace IIUWr { public static class ConfigureIoC { public static void All() { #if DEBUG IoC.AsInstance(new Uri(@"http://192.168.1.150:8002/")); #else IoC.AsInstance(new Uri(@"https://zapisy.ii.uni.wroc.pl/")); #endif ViewModels(); Fereol.Common(); Fereol.HTMLParsing(); } public static void ViewModels() { IoC.AsSingleton<SemestersViewModel>(); IoC.PerRequest<SemesterViewModel>(); IoC.PerRequest<CourseViewModel>(); IoC.PerRequest<TutorialViewModel>(); } public static class Fereol { public static void Common() { IoC.AsSingleton<ICredentialsManager, CredentialsManager>(); IoC.AsSingleton<ISessionManager, CredentialsManager>(); } public static void HTMLParsing() { IoC.AsSingleton<IConnection, HTMLParsing.Connection>(); IoC.AsSingleton<HTMLParsing.Interface.IHTTPConnection, HTMLParsing.Connection>(); IoC.AsSingleton<ICoursesService, HTMLParsing.CoursesService>(); } } } }
using IIUWr.Fereol.Common; using IIUWr.Fereol.Interface; using IIUWr.ViewModels.Fereol; using LionCub.Patterns.DependencyInjection; using System; using HTMLParsing = IIUWr.Fereol.HTMLParsing; namespace IIUWr { public static class ConfigureIoC { public static void All() { #if DEBUG IoC.AsInstance(new Uri(@"http://192.168.1.150:8002/")); #else IoC.AsInstance(new Uri(@"https://zapisy.ii.uni.wroc.pl/")); #endif ViewModels(); Fereol.Common(); Fereol.HTMLParsing(); } public static void ViewModels() { IoC.AsSingleton<SemestersViewModel>(); } public static class Fereol { public static void Common() { IoC.AsSingleton<ICredentialsManager, CredentialsManager>(); IoC.AsSingleton<ISessionManager, CredentialsManager>(); } public static void HTMLParsing() { IoC.AsSingleton<IConnection, HTMLParsing.Connection>(); IoC.AsSingleton<HTMLParsing.Interface.IHTTPConnection, HTMLParsing.Connection>(); IoC.AsSingleton<ICoursesService, HTMLParsing.CoursesService>(); } } } }
Remove not needed IoC registrations
Remove not needed IoC registrations
C#
mit
lion92pl/IIUWr,lion92pl/IIUWr
81747f8a01d081757ac279fef09db6177d6db6c3
NBi.Testing/Integration/Core/Structure/StructureDiscoveryFactoryProviderTest.cs
NBi.Testing/Integration/Core/Structure/StructureDiscoveryFactoryProviderTest.cs
using NBi.Core.Structure; using NBi.Core.Structure.Olap; using NBi.Core.Structure.Relational; using NBi.Core.Structure.Tabular; using NUnit.Framework; using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; namespace NBi.Testing.Integration.Core.Structure { public class StructureDiscoveryFactoryProviderTest { private class FakeStructureDiscoveryFactoryProvider : StructureDiscoveryFactoryProvider { public new string InquireFurtherAnalysisService(string connectionString) { return base.InquireFurtherAnalysisService(connectionString); } } [Test] [Category("Olap")] public void InquireFurtherAnalysisService_Multidimensional_ReturnCorrectServerMode() { var connectionString = ConnectionStringReader.GetAdomd(); var provider = new FakeStructureDiscoveryFactoryProvider(); var serverMode = provider.InquireFurtherAnalysisService(connectionString); Assert.That(serverMode, Is.EqualTo("olap")); } [Test] [Category("Tabular")] public void InquireFurtherAnalysisService_Tabular_ReturnCorrectServerMode() { var connectionString = ConnectionStringReader.GetAdomdTabular(); var provider = new FakeStructureDiscoveryFactoryProvider(); var serverMode = provider.InquireFurtherAnalysisService(connectionString); Assert.That(serverMode, Is.EqualTo("tabular")); } } }
using NBi.Core.Structure; using NBi.Core.Structure.Olap; using NBi.Core.Structure.Relational; using NBi.Core.Structure.Tabular; using NUnit.Framework; using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; namespace NBi.Testing.Integration.Core.Structure { public class StructureDiscoveryFactoryProviderTest { private class FakeStructureDiscoveryFactoryProvider : StructureDiscoveryFactoryProvider { public new string InquireFurtherAnalysisService(string connectionString) { return base.InquireFurtherAnalysisService(connectionString); } } [Test] [Category("Olap")] public void InquireFurtherAnalysisService_Multidimensional_ReturnCorrectServerMode() { var connectionString = ConnectionStringReader.GetAdomd(); var provider = new FakeStructureDiscoveryFactoryProvider(); var serverMode = provider.InquireFurtherAnalysisService(connectionString); Assert.That(serverMode, Is.EqualTo("olap")); } [Test] [Category("Olap")] public void InquireFurtherAnalysisService_Tabular_ReturnCorrectServerMode() { var connectionString = ConnectionStringReader.GetAdomdTabular(); var provider = new FakeStructureDiscoveryFactoryProvider(); var serverMode = provider.InquireFurtherAnalysisService(connectionString); Assert.That(serverMode, Is.EqualTo("tabular")); } } }
Fix category for a test about tabular structure
Fix category for a test about tabular structure Goal: Exclude them in the nightly build
C#
apache-2.0
Seddryck/NBi,Seddryck/NBi
d70dc5c0f9c55fc3410ef14745dacfae645cc3c8
src/SFA.DAS.EmployerApprenticeshipsService.Web/Models/UserAccountsViewModel.cs
src/SFA.DAS.EmployerApprenticeshipsService.Web/Models/UserAccountsViewModel.cs
using SFA.DAS.EmployerApprenticeshipsService.Domain.Entities.Account; namespace SFA.DAS.EmployerApprenticeshipsService.Web.Models { public class UserAccountsViewModel { public Accounts Accounts; public int Invitations; public string SuccessMessage; } }
using SFA.DAS.EmployerApprenticeshipsService.Domain.Entities.Account; namespace SFA.DAS.EmployerApprenticeshipsService.Web.Models { public class UserAccountsViewModel { public Accounts Accounts; public int Invitations; public SuccessMessageViewModel SuccessMessage; } }
Change user accounts view model to use the new viewmodel for displaying SuccessMessage
Change user accounts view model to use the new viewmodel for displaying SuccessMessage
C#
mit
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
833ff7291694d15d153a90234b83d98092af1f7e
Libraries/Sources/Converters/ImageConverter.cs
Libraries/Sources/Converters/ImageConverter.cs
/* ------------------------------------------------------------------------- */ // // Copyright (c) 2010 CubeSoft, 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. // /* ------------------------------------------------------------------------- */ using Cube.Mixin.Drawing; namespace Cube.Xui.Converters { /* --------------------------------------------------------------------- */ /// /// ImageConverter /// /// <summary> /// Provides functionality to convert from an Image object to /// a BitmapImage object. /// </summary> /// /* --------------------------------------------------------------------- */ public class ImageConverter : SimplexConverter { /* ----------------------------------------------------------------- */ /// /// ImageValueConverter /// /// <summary> /// Initializes a new instance of the ImageConverter class. /// </summary> /// /* ----------------------------------------------------------------- */ public ImageConverter() : base(e => { var src = e is System.Drawing.Image image ? image : e is System.Drawing.Icon icon ? icon.ToBitmap() : null; return src.ToBitmapImage(); }) { } } }
/* ------------------------------------------------------------------------- */ // // Copyright (c) 2010 CubeSoft, 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. // /* ------------------------------------------------------------------------- */ using Cube.Mixin.Drawing; namespace Cube.Xui.Converters { /* --------------------------------------------------------------------- */ /// /// ImageConverter /// /// <summary> /// Provides functionality to convert from an Image object to /// a BitmapImage object. /// </summary> /// /* --------------------------------------------------------------------- */ public class ImageConverter : SimplexConverter { /* ----------------------------------------------------------------- */ /// /// ImageValueConverter /// /// <summary> /// Initializes a new instance of the ImageConverter class. /// </summary> /// /* ----------------------------------------------------------------- */ public ImageConverter() : base(e => { if (e is System.Drawing.Image i0) return i0.ToBitmapImage(false); if (e is System.Drawing.Icon i1) return i1.ToBitmap().ToBitmapImage(true); return null; }) { } } }
Fix to dispose when the specified object is Icon.
Fix to dispose when the specified object is Icon.
C#
apache-2.0
cube-soft/Cube.Core,cube-soft/Cube.Core
3108bfd0500956740777db21190ee8bd9afa564e
MuffinFramework/MuffinClient.cs
MuffinFramework/MuffinClient.cs
using System; using System.ComponentModel.Composition.Hosting; using System.Reflection; using MuffinFramework.Muffin; using MuffinFramework.Platform; using MuffinFramework.Service; namespace MuffinFramework { public class MuffinClient : IDisposable { private readonly object _lockObj = new object(); public bool IsStarted { get; private set; } public AggregateCatalog Catalog { get; private set; } public PlatformLoader PlatformLoader { get; private set; } public ServiceLoader ServiceLoader { get; private set; } public MuffinLoader MuffinLoader { get; private set; } public MuffinClient() { Catalog = new AggregateCatalog(); Catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetCallingAssembly())); PlatformLoader = new PlatformLoader(); ServiceLoader = new ServiceLoader(); MuffinLoader = new MuffinLoader(); } public void Start() { lock (_lockObj) { if (IsStarted) throw new InvalidOperationException("MuffinClient has already been started."); IsStarted = true; } PlatformLoader.Enable(Catalog, new PlatformArgs(PlatformLoader)); ServiceLoader.Enable(Catalog, new ServiceArgs(PlatformLoader, ServiceLoader)); MuffinLoader.Enable(Catalog, new MuffinArgs(PlatformLoader, ServiceLoader, MuffinLoader)); } public virtual void Dispose() { Catalog.Dispose(); PlatformLoader.Dispose(); ServiceLoader.Dispose(); MuffinLoader.Dispose(); } } }
using System; using System.ComponentModel.Composition.Hosting; using System.Reflection; using MuffinFramework.Muffin; using MuffinFramework.Platform; using MuffinFramework.Service; namespace MuffinFramework { public class MuffinClient : IDisposable { private readonly object _lockObj = new object(); public bool IsStarted { get; private set; } public AggregateCatalog Catalog { get; private set; } public PlatformLoader PlatformLoader { get; private set; } public ServiceLoader ServiceLoader { get; private set; } public MuffinLoader MuffinLoader { get; private set; } public MuffinClient() { Catalog = new AggregateCatalog(); Catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetCallingAssembly())); PlatformLoader = new PlatformLoader(); ServiceLoader = new ServiceLoader(); MuffinLoader = new MuffinLoader(); } public void Start() { lock (_lockObj) { if (IsStarted) throw new InvalidOperationException("MuffinClient has already been started."); IsStarted = true; } PlatformLoader.Enable(Catalog, new PlatformArgs(PlatformLoader)); ServiceLoader.Enable(Catalog, new ServiceArgs(PlatformLoader, ServiceLoader)); MuffinLoader.Enable(Catalog, new MuffinArgs(PlatformLoader, ServiceLoader, MuffinLoader)); } public virtual void Dispose() { MuffinLoader.Dispose(); ServiceLoader.Dispose(); PlatformLoader.Dispose(); Catalog.Dispose(); } } }
Change the order Loaders are disposed
Change the order Loaders are disposed
C#
mit
Yonom/MuffinFramework
d5ed218488aac139909012bb0343a69edf357421
osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs
osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using OpenTK; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts { /// <summary> /// Represents a part of the summary timeline.. /// </summary> internal abstract class TimelinePart : CompositeDrawable { public Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); private readonly Container timeline; protected TimelinePart() { AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both }); Beatmap.ValueChanged += b => { timeline.RelativeChildSize = new Vector2((float)Math.Max(1, b.Track.Length), 1); LoadBeatmap(b); }; } protected void Add(Drawable visualisation) => timeline.Add(visualisation); protected virtual void LoadBeatmap(WorkingBeatmap beatmap) { timeline.Clear(); } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using OpenTK; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts { /// <summary> /// Represents a part of the summary timeline.. /// </summary> internal abstract class TimelinePart : CompositeDrawable { public Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); private readonly Container timeline; protected TimelinePart() { AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both }); Beatmap.ValueChanged += b => { updateRelativeChildSize(); LoadBeatmap(b); }; } private void updateRelativeChildSize() { if (!Beatmap.Value.TrackLoaded) { timeline.RelativeChildSize = Vector2.One; return; } var track = Beatmap.Value.Track; if (!track.IsLoaded) { // the track may not be loaded completely (only has a length once it is). Schedule(updateRelativeChildSize); return; } timeline.RelativeChildSize = new Vector2((float)Math.Max(1, track.Length), 1); } protected void Add(Drawable visualisation) => timeline.Add(visualisation); protected virtual void LoadBeatmap(WorkingBeatmap beatmap) { timeline.Clear(); } } }
Fix timeline sizes being updated potentially before the track has a length
Fix timeline sizes being updated potentially before the track has a length
C#
mit
ZLima12/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu,DrabWeb/osu,NeoAdonis/osu,DrabWeb/osu,peppy/osu-new,smoogipoo/osu,Frontear/osuKyzer,UselessToucan/osu,smoogipoo/osu,naoey/osu,NeoAdonis/osu,naoey/osu,UselessToucan/osu,2yangk23/osu,Nabile-Rahmani/osu,2yangk23/osu,ppy/osu,EVAST9919/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,johnneijzen/osu,DrabWeb/osu,johnneijzen/osu,ZLima12/osu,ppy/osu,Drezi126/osu,EVAST9919/osu,naoey/osu,peppy/osu,ppy/osu
f81b692493ef0918b8089f3e57359d53a8ed459d
test/DnxFlash.Test/MessageTest.cs
test/DnxFlash.Test/MessageTest.cs
using System; using Xunit; namespace DnxFlash.Test { public class MessageTest { private Message sut; public class Constructor : MessageTest { [Fact] public void Should_set_message() { sut = new Message("test message"); Assert.Equal("test message", sut.Text); } [Theory, InlineData(null), InlineData("")] public void Should_throw_exception_if_message_is_not_valid(string message) { var exception = Assert.Throws<ArgumentNullException>(() => new Message(message)); Assert.Equal("message", exception.ParamName); } [Fact] public void Should_set_title() { sut = new Message( text: "test message", title: "test"); Assert.Equal("test", sut.Title); } [Fact] public void Should_set_type() { sut = new Message( text: "test message", type: "test"); Assert.Equal("test", sut.Type); } } } }
using System; using Xunit; namespace DnxFlash.Test { public class MessageTest { private Message sut; public class Constructor : MessageTest { [Fact] public void Should_set_message() { sut = new Message("test message"); Assert.Equal("test message", sut.Text); } [Theory, InlineData(null), InlineData("")] public void Should_throw_exception_if_message_is_not_valid(string text) { var exception = Assert.Throws<ArgumentNullException>(() => new Message(text)); Assert.Equal("text", exception.ParamName); } [Fact] public void Should_set_title() { sut = new Message( text: "test message", title: "test"); Assert.Equal("test", sut.Title); } [Fact] public void Should_set_type() { sut = new Message( text: "test message", type: "test"); Assert.Equal("test", sut.Type); } } } }
Fix failing test due to project rename
Fix failing test due to project rename Previous behavior was still using old-version of message-property. Former was `message` while current is `text`.
C#
mit
billboga/dnxflash,billboga/dnxflash
f7cd6e83aa81bc24ccce152e37028851e1af8ee0
osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs
osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.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.Scoring; namespace osu.Game.Rulesets.Mania.Scoring { internal class ManiaScoreProcessor : ScoreProcessor { protected override double DefaultAccuracyPortion => 0.8; protected override double DefaultComboPortion => 0.2; public override HitWindows CreateHitWindows() => new ManiaHitWindows(); } }
// 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.Scoring; namespace osu.Game.Rulesets.Mania.Scoring { internal class ManiaScoreProcessor : ScoreProcessor { protected override double DefaultAccuracyPortion => 0.95; protected override double DefaultComboPortion => 0.05; public override HitWindows CreateHitWindows() => new ManiaHitWindows(); } }
Adjust mania scoring to be 95% based on accuracy
Adjust mania scoring to be 95% based on accuracy
C#
mit
smoogipooo/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,peppy/osu,NeoAdonis/osu
2b39857b8cec4b4a1d7777a7987bac9813f50d26
osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs
osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.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.Scoring; namespace osu.Game.Rulesets.Mania.Scoring { internal class ManiaScoreProcessor : ScoreProcessor { public override HitWindows CreateHitWindows() => new ManiaHitWindows(); } }
// 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.Scoring; namespace osu.Game.Rulesets.Mania.Scoring { internal class ManiaScoreProcessor : ScoreProcessor { protected override double DefaultAccuracyPortion => 0.8; protected override double DefaultComboPortion => 0.2; public override HitWindows CreateHitWindows() => new ManiaHitWindows(); } }
Make mania 80% acc 20% combo
Make mania 80% acc 20% combo
C#
mit
NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,peppy/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,peppy/osu
f6272a1e6ddc2a37630e789d2c9a18f6a408086f
SassSharp/Ast/SassSyntaxTree.cs
SassSharp/Ast/SassSyntaxTree.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SassSharp.Ast { public class SassSyntaxTree { public SassSyntaxTree(IEnumerable<Node> children) { this.Children = children; } public IEnumerable<Node> Children { get; private set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SassSharp.Ast { public class SassSyntaxTree { public SassSyntaxTree(IEnumerable<Node> children) { this.Children = children; } public IEnumerable<Node> Children { get; private set; } public static SassSyntaxTree Create(params Node[] nodes) { return new SassSyntaxTree(nodes); } } }
Add a fluent create method ast
Add a fluent create method ast
C#
mit
akatakritos/SassSharp
3797dbb67ebe0945c5801e93911fd2e919813b61
NewAnalyzerTemplate/NewAnalyzerTemplate/NewAnalyzerTemplate/DiagnosticAnalyzer.cs
NewAnalyzerTemplate/NewAnalyzerTemplate/NewAnalyzerTemplate/DiagnosticAnalyzer.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Text; namespace NewAnalyzerTemplate { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class NewAnalyzerTemplateAnalyzer : DiagnosticAnalyzer { public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { throw new NotImplementedException(); } } public override void Initialize(AnalysisContext context) { } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. /*This tutorial is going to guide you to write a diagnostic analyzer that enforces the placement of one space between the if keyword of an if statement and the open parenthesis of the condition. For more information, please reference the ReadMe. Before you begin, got to Tools->Extensions and Updates->Online, and install: - .NET Compiler SDK - Roslyn Syntax Visualizer */ using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Text; namespace NewAnalyzerTemplate { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class NewAnalyzerTemplateAnalyzer : DiagnosticAnalyzer { public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { throw new NotImplementedException(); } } public override void Initialize(AnalysisContext context) { } } }
Add description at top of new template
Add description at top of new template
C#
mit
qinxgit/roslyn-analyzers,dotnet/roslyn-analyzers,genlu/roslyn-analyzers,srivatsn/roslyn-analyzers,tmeschter/roslyn-analyzers-1,natidea/roslyn-analyzers,modulexcite/roslyn-analyzers,dotnet/roslyn-analyzers,jaredpar/roslyn-analyzers,Anniepoh/roslyn-analyzers,jasonmalinowski/roslyn-analyzers,VitalyTVA/roslyn-analyzers,jinujoseph/roslyn-analyzers,bkoelman/roslyn-analyzers,jepetty/roslyn-analyzers,mavasani/roslyn-analyzers,pakdev/roslyn-analyzers,SpotLabsNET/roslyn-analyzers,mavasani/roslyn-analyzers,mattwar/roslyn-analyzers,heejaechang/roslyn-analyzers,pakdev/roslyn-analyzers
f7e5106175167c87426c7e7a4bacc7fcea91a1af
NLog.Web/Properties/AssemblyInfo.cs
NLog.Web/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. #if DNX [assembly: AssemblyTitle("NLog.Web.ASPNET5")] [assembly: AssemblyProduct("NLog.Web for ASP.NET5")] #else [assembly: AssemblyTitle("NLog.Web")] [assembly: AssemblyProduct("NLog.Web")] #endif [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright © NLog 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("74d5915b-bea9-404c-b4d0-b663164def37")]
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. #if DNX [assembly: AssemblyTitle("NLog.Web.ASPNET5")] [assembly: AssemblyProduct("NLog.Web for ASP.NET Core")] #else [assembly: AssemblyTitle("NLog.Web")] [assembly: AssemblyProduct("NLog.Web")] #endif [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright © NLog 2015-2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("4.0.0.0")] //fixed // 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("74d5915b-bea9-404c-b4d0-b663164def37")]
Update assemblyinfo & strong name version to 4.0.0.0
Update assemblyinfo & strong name version to 4.0.0.0
C#
bsd-3-clause
304NotModified/NLog.Web,NLog/NLog.Web
d9c5a69c3711cdf6b7accaca15575da3a77aae6a
tests/Perspex.Markup.UnitTests/Binding/ExpressionObserverTests_PerspexProperty.cs
tests/Perspex.Markup.UnitTests/Binding/ExpressionObserverTests_PerspexProperty.cs
// Copyright (c) The Perspex Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using System.Collections.Generic; using System.Reactive.Linq; using Perspex.Markup.Data; using Xunit; namespace Perspex.Markup.UnitTests.Binding { public class ExpressionObserverTests_PerspexProperty { [Fact] public async void Should_Get_Simple_Property_Value() { var data = new Class1(); var target = new ExpressionObserver(data, "Foo"); var result = await target.Take(1); Assert.Equal("foo", result); } [Fact] public void Should_Track_Simple_Property_Value() { var data = new Class1(); var target = new ExpressionObserver(data, "Foo"); var result = new List<object>(); var sub = target.Subscribe(x => result.Add(x)); data.SetValue(Class1.FooProperty, "bar"); Assert.Equal(new[] { "foo", "bar" }, result); sub.Dispose(); } private class Class1 : PerspexObject { public static readonly PerspexProperty<string> FooProperty = PerspexProperty.Register<Class1, string>("Foo", defaultValue: "foo"); } } }
// Copyright (c) The Perspex Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using System.Collections.Generic; using System.Reactive.Linq; using Perspex.Markup.Data; using Xunit; namespace Perspex.Markup.UnitTests.Binding { public class ExpressionObserverTests_PerspexProperty { public ExpressionObserverTests_PerspexProperty() { var foo = Class1.FooProperty; } [Fact] public async void Should_Get_Simple_Property_Value() { var data = new Class1(); var target = new ExpressionObserver(data, "Foo"); var result = await target.Take(1); Assert.Equal("foo", result); } [Fact] public void Should_Track_Simple_Property_Value() { var data = new Class1(); var target = new ExpressionObserver(data, "Foo"); var result = new List<object>(); var sub = target.Subscribe(x => result.Add(x)); data.SetValue(Class1.FooProperty, "bar"); Assert.Equal(new[] { "foo", "bar" }, result); sub.Dispose(); } private class Class1 : PerspexObject { public static readonly PerspexProperty<string> FooProperty = PerspexProperty.Register<Class1, string>("Foo", defaultValue: "foo"); } } }
Fix test in Release mode.
Fix test in Release mode.
C#
mit
AvaloniaUI/Avalonia,SuperJMN/Avalonia,MrDaedra/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,susloparovdenis/Perspex,kekekeks/Perspex,OronDF343/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,OronDF343/Avalonia,grokys/Perspex,SuperJMN/Avalonia,susloparovdenis/Avalonia,susloparovdenis/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jazzay/Perspex,SuperJMN/Avalonia,kekekeks/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,punker76/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,akrisiun/Perspex,jkoritzinsky/Avalonia,MrDaedra/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,susloparovdenis/Perspex,jkoritzinsky/Avalonia,grokys/Perspex
658df31cb2387f82191c1b7357623e6a16b8d9b8
Assets/Microgames/_Bosses/YoumuSlash/Scripts/YoumuSlashTimingEffectsController.cs
Assets/Microgames/_Bosses/YoumuSlash/Scripts/YoumuSlashTimingEffectsController.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; public class YoumuSlashTimingEffectsController : MonoBehaviour { [SerializeField] private AudioSource musicSource; [SerializeField] private float pitchMult = 1f; [SerializeField] private float timeScaleMult = 1f; [SerializeField] private float volumeMult = 1f; bool failed = false; bool ended = false; float initialTimeScale; float initialVolume; void Start () { YoumuSlashPlayerController.onFail += onFail; YoumuSlashPlayerController.onGameplayEnd += onGameplayEnd; initialTimeScale = Time.timeScale; initialVolume = musicSource.volume; } void onGameplayEnd() { ended = true; } void onFail() { failed = true; } private void LateUpdate() { if (MicrogameController.instance.getVictoryDetermined()) Time.timeScale = initialVolume; else if (ended) Time.timeScale = timeScaleMult * initialTimeScale; if (failed) musicSource.pitch = Time.timeScale * pitchMult; musicSource.volume = volumeMult * initialVolume; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; public class YoumuSlashTimingEffectsController : MonoBehaviour { [SerializeField] private AudioSource musicSource; [SerializeField] private float pitchMult = 1f; [SerializeField] private float timeScaleMult = 1f; [SerializeField] private float volumeMult = 1f; bool failed = false; bool ended = false; float initialTimeScale; float initialVolume; void Start () { YoumuSlashPlayerController.onFail += onFail; YoumuSlashPlayerController.onGameplayEnd += onGameplayEnd; initialTimeScale = Time.timeScale; initialVolume = musicSource.volume; } void onGameplayEnd() { ended = true; } void onFail() { failed = true; } private void LateUpdate() { if (MicrogameController.instance.getVictoryDetermined()) Time.timeScale = initialTimeScale; else if (ended) Time.timeScale = timeScaleMult * initialTimeScale; if (failed) musicSource.pitch = Time.timeScale * pitchMult; musicSource.volume = volumeMult * initialVolume; } }
Fix wrong timescale being forced on win/loss
Fix wrong timescale being forced on win/loss
C#
mit
NitorInc/NitoriWare,Barleytree/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare
0ddb0b505c350072fc5e705f1c04c30db06a6d4c
shared/AppSettingsHelper.csx
shared/AppSettingsHelper.csx
#load "LogHelper.csx" using System.Configuration; public static class AppSettingsHelper { public static string GetAppSetting(string SettingName, bool LogValue = true ) { string SettingValue = ""; try { SettingValue = ConfigurationManager.AppSettings[SettingName].ToString(); if ((!String.IsNullOrEmpty(SettingValue)) && LogValue) { LogHelper.Info($"Retreived AppSetting {SettingName} with a value of {SettingValue}"); } else if((!String.IsNullOrEmpty(SettingValue)) && !LogValue) { LogHelper.Info($"Retreived AppSetting {SettingName} but logging value was turned off"); } else if(!String.IsNullOrEmpty(SettingValue)) { LogHelper.Info($"AppSetting {SettingName} was null of empty"); } } catch (ConfigurationErrorsException ex) { LogHelper.Error($"Unable to find AppSetting {SettingName} with exception of {ex.Message}"); } catch (System.Exception ex) { LogHelper.Error($"Looking for AppSetting {SettingName} caused an exception of {ex.Message}"); } return SettingValue; } }
#load "LogHelper.csx" using System.Configuration; public static class AppSettingsHelper { public static string GetAppSetting(string SettingName, bool LogValue = true ) { string SettingValue = ""; try { SettingValue = ConfigurationManager.AppSettings[SettingName].ToString(); if ((!String.IsNullOrEmpty(SettingValue)) && LogValue) { LogHelper.Info($"Retreived AppSetting {SettingName} with a value of {SettingValue}"); } else if((!String.IsNullOrEmpty(SettingValue)) && !LogValue) { LogHelper.Info($"Retreived AppSetting {SettingName} but logging value was turned off"); } else if(!String.IsNullOrEmpty(SettingValue)) { LogHelper.Info($"AppSetting {SettingName} was null or empty"); } } catch (ConfigurationErrorsException ex) { LogHelper.Error($"Unable to find AppSetting {SettingName} with exception of {ex.Message}"); } catch (System.Exception ex) { LogHelper.Error($"Looking for AppSetting {SettingName} caused an exception of {ex.Message}"); } return SettingValue; } }
Change type in error from of to or
Change type in error from of to or
C#
mit
USDXStartups/CalendarHelper
607f1df9aa73a7bfe6ab790d9658175094ea6bfc
src/Common/src/System/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs
src/Common/src/System/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)] internal sealed class ExcludeFromCodeCoverageAttribute : Attribute { } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace System.Diagnostics.CodeAnalysis { [Conditional("DEBUG")] // don't bloat release assemblies [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)] internal sealed class ExcludeFromCodeCoverageAttribute : Attribute { } }
Make ExcludeFromCodeCoverage conditional on DEBUG
Make ExcludeFromCodeCoverage conditional on DEBUG Some of our assemblies use ExcludeFromCodeCoverage to exclude from code coverage various members. Since we only do code coverage runs against debug builds, there's no need to bloat such assemblies with ExcludeFromCodeCoverage on these members in release builds.
C#
mit
weltkante/corefx,Priya91/corefx-1,weltkante/corefx,seanshpark/corefx,tijoytom/corefx,shmao/corefx,lggomez/corefx,nbarbettini/corefx,stone-li/corefx,Jiayili1/corefx,krk/corefx,alexperovich/corefx,gkhanna79/corefx,manu-silicon/corefx,the-dwyer/corefx,tstringer/corefx,dhoehna/corefx,manu-silicon/corefx,stone-li/corefx,nchikanov/corefx,DnlHarvey/corefx,MaggieTsang/corefx,josguil/corefx,the-dwyer/corefx,shimingsg/corefx,shimingsg/corefx,wtgodbe/corefx,marksmeltzer/corefx,tijoytom/corefx,ravimeda/corefx,ravimeda/corefx,rahku/corefx,pallavit/corefx,rjxby/corefx,YoupHulsebos/corefx,billwert/corefx,pgavlin/corefx,ravimeda/corefx,benpye/corefx,janhenke/corefx,krk/corefx,jcme/corefx,cartermp/corefx,alexandrnikitin/corefx,seanshpark/corefx,stephenmichaelf/corefx,cydhaselton/corefx,benjamin-bader/corefx,rahku/corefx,rahku/corefx,benpye/corefx,YoupHulsebos/corefx,690486439/corefx,vidhya-bv/corefx-sorting,yizhang82/corefx,khdang/corefx,ptoonen/corefx,DnlHarvey/corefx,kkurni/corefx,stephenmichaelf/corefx,n1ghtmare/corefx,manu-silicon/corefx,yizhang82/corefx,shmao/corefx,alexandrnikitin/corefx,rubo/corefx,dhoehna/corefx,mafiya69/corefx,tijoytom/corefx,tijoytom/corefx,jhendrixMSFT/corefx,alexperovich/corefx,cydhaselton/corefx,axelheer/corefx,nbarbettini/corefx,MaggieTsang/corefx,mazong1123/corefx,DnlHarvey/corefx,nbarbettini/corefx,khdang/corefx,axelheer/corefx,seanshpark/corefx,jcme/corefx,Chrisboh/corefx,krk/corefx,alphonsekurian/corefx,yizhang82/corefx,mmitche/corefx,mellinoe/corefx,Ermiar/corefx,ptoonen/corefx,gkhanna79/corefx,alexperovich/corefx,ptoonen/corefx,cartermp/corefx,twsouthwick/corefx,josguil/corefx,elijah6/corefx,vidhya-bv/corefx-sorting,YoupHulsebos/corefx,BrennanConroy/corefx,wtgodbe/corefx,elijah6/corefx,manu-silicon/corefx,dhoehna/corefx,shmao/corefx,weltkante/corefx,PatrickMcDonald/corefx,nbarbettini/corefx,pallavit/corefx,SGuyGe/corefx,DnlHarvey/corefx,zhenlan/corefx,jlin177/corefx,alexperovich/corefx,marksmeltzer/corefx,weltkante/corefx,seanshpark/corefx,rubo/corefx,ellismg/corefx,mafiya69/corefx,MaggieTsang/corefx,pgavlin/corefx,pallavit/corefx,Priya91/corefx-1,ptoonen/corefx,wtgodbe/corefx,cydhaselton/corefx,Chrisboh/corefx,khdang/corefx,mellinoe/corefx,shahid-pk/corefx,mokchhya/corefx,ericstj/corefx,stone-li/corefx,gkhanna79/corefx,Petermarcu/corefx,nchikanov/corefx,ellismg/corefx,richlander/corefx,billwert/corefx,vidhya-bv/corefx-sorting,mazong1123/corefx,yizhang82/corefx,yizhang82/corefx,khdang/corefx,rjxby/corefx,n1ghtmare/corefx,JosephTremoulet/corefx,tstringer/corefx,MaggieTsang/corefx,parjong/corefx,mokchhya/corefx,JosephTremoulet/corefx,shahid-pk/corefx,Ermiar/corefx,seanshpark/corefx,n1ghtmare/corefx,ViktorHofer/corefx,Priya91/corefx-1,n1ghtmare/corefx,cydhaselton/corefx,the-dwyer/corefx,billwert/corefx,akivafr123/corefx,bitcrazed/corefx,tstringer/corefx,lggomez/corefx,SGuyGe/corefx,mmitche/corefx,Yanjing123/corefx,JosephTremoulet/corefx,adamralph/corefx,seanshpark/corefx,pallavit/corefx,rubo/corefx,mmitche/corefx,alexperovich/corefx,shahid-pk/corefx,690486439/corefx,the-dwyer/corefx,alexandrnikitin/corefx,kkurni/corefx,billwert/corefx,dotnet-bot/corefx,adamralph/corefx,wtgodbe/corefx,shahid-pk/corefx,parjong/corefx,pallavit/corefx,rjxby/corefx,billwert/corefx,parjong/corefx,zhenlan/corefx,jeremymeng/corefx,lggomez/corefx,Jiayili1/corefx,jeremymeng/corefx,janhenke/corefx,mokchhya/corefx,richlander/corefx,marksmeltzer/corefx,BrennanConroy/corefx,benjamin-bader/corefx,bitcrazed/corefx,axelheer/corefx,elijah6/corefx,gkhanna79/corefx,nbarbettini/corefx,mazong1123/corefx,josguil/corefx,fgreinacher/corefx,twsouthwick/corefx,axelheer/corefx,cartermp/corefx,benpye/corefx,stone-li/corefx,josguil/corefx,akivafr123/corefx,alphonsekurian/corefx,PatrickMcDonald/corefx,jcme/corefx,lggomez/corefx,wtgodbe/corefx,gregg-miskelly/corefx,nbarbettini/corefx,jlin177/corefx,Petermarcu/corefx,alexperovich/corefx,iamjasonp/corefx,elijah6/corefx,mellinoe/corefx,Petermarcu/corefx,manu-silicon/corefx,gregg-miskelly/corefx,zhenlan/corefx,Chrisboh/corefx,ericstj/corefx,gkhanna79/corefx,ViktorHofer/corefx,nchikanov/corefx,josguil/corefx,axelheer/corefx,richlander/corefx,fgreinacher/corefx,ericstj/corefx,mazong1123/corefx,kkurni/corefx,rjxby/corefx,nchikanov/corefx,twsouthwick/corefx,nchikanov/corefx,Priya91/corefx-1,the-dwyer/corefx,mmitche/corefx,gkhanna79/corefx,janhenke/corefx,DnlHarvey/corefx,jcme/corefx,alphonsekurian/corefx,ravimeda/corefx,shahid-pk/corefx,dotnet-bot/corefx,lggomez/corefx,cydhaselton/corefx,zhenlan/corefx,rubo/corefx,mazong1123/corefx,akivafr123/corefx,mmitche/corefx,the-dwyer/corefx,mellinoe/corefx,dhoehna/corefx,ViktorHofer/corefx,kkurni/corefx,Jiayili1/corefx,parjong/corefx,tijoytom/corefx,ptoonen/corefx,stephenmichaelf/corefx,jlin177/corefx,Ermiar/corefx,yizhang82/corefx,marksmeltzer/corefx,elijah6/corefx,ViktorHofer/corefx,krytarowski/corefx,Petermarcu/corefx,Jiayili1/corefx,DnlHarvey/corefx,jhendrixMSFT/corefx,mafiya69/corefx,zhenlan/corefx,benpye/corefx,benjamin-bader/corefx,dotnet-bot/corefx,jlin177/corefx,tstringer/corefx,shmao/corefx,jcme/corefx,ericstj/corefx,krytarowski/corefx,elijah6/corefx,shahid-pk/corefx,rjxby/corefx,iamjasonp/corefx,jhendrixMSFT/corefx,Ermiar/corefx,mokchhya/corefx,MaggieTsang/corefx,jlin177/corefx,BrennanConroy/corefx,jhendrixMSFT/corefx,iamjasonp/corefx,mmitche/corefx,ellismg/corefx,YoupHulsebos/corefx,MaggieTsang/corefx,mazong1123/corefx,benpye/corefx,gregg-miskelly/corefx,richlander/corefx,wtgodbe/corefx,pgavlin/corefx,dsplaisted/corefx,krytarowski/corefx,PatrickMcDonald/corefx,shmao/corefx,ericstj/corefx,manu-silicon/corefx,Yanjing123/corefx,krk/corefx,dsplaisted/corefx,janhenke/corefx,ViktorHofer/corefx,twsouthwick/corefx,billwert/corefx,JosephTremoulet/corefx,SGuyGe/corefx,benjamin-bader/corefx,nbarbettini/corefx,ravimeda/corefx,weltkante/corefx,stephenmichaelf/corefx,krk/corefx,stephenmichaelf/corefx,690486439/corefx,dotnet-bot/corefx,jeremymeng/corefx,gregg-miskelly/corefx,Ermiar/corefx,rjxby/corefx,elijah6/corefx,nchikanov/corefx,khdang/corefx,parjong/corefx,the-dwyer/corefx,Yanjing123/corefx,PatrickMcDonald/corefx,mellinoe/corefx,twsouthwick/corefx,twsouthwick/corefx,shmao/corefx,Jiayili1/corefx,Yanjing123/corefx,shimingsg/corefx,jlin177/corefx,alphonsekurian/corefx,jhendrixMSFT/corefx,stephenmichaelf/corefx,tstringer/corefx,dsplaisted/corefx,rahku/corefx,Petermarcu/corefx,ravimeda/corefx,parjong/corefx,Chrisboh/corefx,mafiya69/corefx,alexandrnikitin/corefx,rahku/corefx,akivafr123/corefx,Yanjing123/corefx,SGuyGe/corefx,axelheer/corefx,ellismg/corefx,zhenlan/corefx,dhoehna/corefx,richlander/corefx,lggomez/corefx,JosephTremoulet/corefx,PatrickMcDonald/corefx,alexandrnikitin/corefx,krytarowski/corefx,iamjasonp/corefx,jcme/corefx,shmao/corefx,nchikanov/corefx,jhendrixMSFT/corefx,alphonsekurian/corefx,tstringer/corefx,akivafr123/corefx,kkurni/corefx,mokchhya/corefx,ViktorHofer/corefx,ericstj/corefx,bitcrazed/corefx,jeremymeng/corefx,krk/corefx,mellinoe/corefx,MaggieTsang/corefx,Priya91/corefx-1,iamjasonp/corefx,ravimeda/corefx,mafiya69/corefx,marksmeltzer/corefx,shimingsg/corefx,Petermarcu/corefx,rahku/corefx,Ermiar/corefx,vidhya-bv/corefx-sorting,mmitche/corefx,iamjasonp/corefx,alphonsekurian/corefx,janhenke/corefx,benjamin-bader/corefx,khdang/corefx,wtgodbe/corefx,dhoehna/corefx,YoupHulsebos/corefx,krk/corefx,YoupHulsebos/corefx,weltkante/corefx,cartermp/corefx,JosephTremoulet/corefx,cartermp/corefx,jlin177/corefx,shimingsg/corefx,yizhang82/corefx,cydhaselton/corefx,billwert/corefx,benpye/corefx,jhendrixMSFT/corefx,pallavit/corefx,ellismg/corefx,JosephTremoulet/corefx,dotnet-bot/corefx,Chrisboh/corefx,pgavlin/corefx,mafiya69/corefx,dhoehna/corefx,alexperovich/corefx,YoupHulsebos/corefx,DnlHarvey/corefx,Jiayili1/corefx,tijoytom/corefx,Chrisboh/corefx,SGuyGe/corefx,rahku/corefx,stone-li/corefx,mazong1123/corefx,vidhya-bv/corefx-sorting,690486439/corefx,tijoytom/corefx,janhenke/corefx,seanshpark/corefx,benjamin-bader/corefx,ellismg/corefx,alphonsekurian/corefx,dotnet-bot/corefx,rjxby/corefx,rubo/corefx,stephenmichaelf/corefx,Priya91/corefx-1,richlander/corefx,mokchhya/corefx,parjong/corefx,krytarowski/corefx,fgreinacher/corefx,bitcrazed/corefx,stone-li/corefx,cartermp/corefx,n1ghtmare/corefx,690486439/corefx,zhenlan/corefx,adamralph/corefx,ViktorHofer/corefx,lggomez/corefx,jeremymeng/corefx,bitcrazed/corefx,Petermarcu/corefx,krytarowski/corefx,kkurni/corefx,SGuyGe/corefx,Jiayili1/corefx,stone-li/corefx,krytarowski/corefx,gkhanna79/corefx,iamjasonp/corefx,weltkante/corefx,shimingsg/corefx,marksmeltzer/corefx,josguil/corefx,Ermiar/corefx,ericstj/corefx,fgreinacher/corefx,ptoonen/corefx,manu-silicon/corefx,richlander/corefx,cydhaselton/corefx,marksmeltzer/corefx,ptoonen/corefx,shimingsg/corefx,twsouthwick/corefx,dotnet-bot/corefx
212b307ba588d85b5c8da968eef8ed766fac22d0
ServerHost/Properties/AssemblyInfo.cs
ServerHost/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ServerHost")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Jorgen Thelin")] [assembly: AssemblyProduct("ServerHost")] [assembly: AssemblyCopyright("Copyright © Jorgen Thelin 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("e9fff8d5-f4c0-483d-aee6-5ff82afd434f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.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("ServerHost")] [assembly: AssemblyDescription("ServerHost - A .NET Server Hosting utility library, including in-process server host testing.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Jorgen Thelin")] [assembly: AssemblyProduct("ServerHost")] [assembly: AssemblyCopyright("Copyright © Jorgen Thelin 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("e9fff8d5-f4c0-483d-aee6-5ff82afd434f")] // 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")]
Update copyright data and assembly description.
Update copyright data and assembly description.
C#
apache-2.0
jthelin/ServerHost,jthelin/ServerHost
72f39ed79461cc0616b9cdd78b864ba5cf9724d1
src/benchmarking/BrightstarDB.PerformanceBenchmarks/Models/IFoafPerson.cs
src/benchmarking/BrightstarDB.PerformanceBenchmarks/Models/IFoafPerson.cs
using System; using System.Collections.Generic; using System.Text; using BrightstarDB.EntityFramework; namespace BrightstarDB.PerformanceBenchmarks.Models { [Entity("http://xmlns.com/foaf/0.1/Person")] public interface IFoafPerson { string Id { get; } [PropertyType("http://xmlns.com/foaf/0.1/name")] string Name { get; set; } [PropertyType("http://xmlns.com/foaf/0.1/givenName")] string GivenName { get; set; } [PropertyType("http://xmlns.com/foaf/0.1/familyName")] string FamilyName { get; set; } [PropertyType("http://xmlns.com/foaf/0.1/age")] int Age { get; set; } [PropertyType("http://xmlns.com/foaf/0.1/organization")] string Organisation { get; set; } [PropertyType("http://xmlns.com/foaf/0.1/knows")] ICollection<IFoafPerson> Knows { get; set; } } }
using System; using System.Collections.Generic; using System.Text; using BrightstarDB.EntityFramework; namespace BrightstarDB.PerformanceBenchmarks.Models { [Entity("http://xmlns.com/foaf/0.1/Person")] public interface IFoafPerson { [Identifier("http://www.brightstardb.com/people/")] string Id { get; } [PropertyType("http://xmlns.com/foaf/0.1/name")] string Name { get; set; } [PropertyType("http://xmlns.com/foaf/0.1/givenName")] string GivenName { get; set; } [PropertyType("http://xmlns.com/foaf/0.1/familyName")] string FamilyName { get; set; } [PropertyType("http://xmlns.com/foaf/0.1/age")] int Age { get; set; } [PropertyType("http://xmlns.com/foaf/0.1/organization")] string Organisation { get; set; } [PropertyType("http://xmlns.com/foaf/0.1/knows")] ICollection<IFoafPerson> Knows { get; set; } } }
Fix so that SPARQL query test works
Fix so that SPARQL query test works
C#
mit
kentcb/BrightstarDB,BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB,kentcb/BrightstarDB,dharmatech/BrightstarDB,dharmatech/BrightstarDB,dharmatech/BrightstarDB,kentcb/BrightstarDB,dharmatech/BrightstarDB,BrightstarDB/BrightstarDB,dharmatech/BrightstarDB,dharmatech/BrightstarDB,kentcb/BrightstarDB,BrightstarDB/BrightstarDB
f830c8da35ecd30145d57e3232bee0d5ae6ec886
src/Bakery/UuidTypeConverter.cs
src/Bakery/UuidTypeConverter.cs
namespace Bakery { using System; using System.ComponentModel; using System.Globalization; public class UuidTypeConverter : TypeConverter { public override Boolean CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(String); } public override Object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) { return new Uuid(Guid.Parse((String)value)); } } }
namespace Bakery { using System; using System.ComponentModel; using System.Globalization; public class UuidTypeConverter : TypeConverter { public override Boolean CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(String); } public override Boolean CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(String); } public override Object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) { return new Uuid(Guid.Parse((String)value)); } public override Object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, Object value, Type destinationType) { if (value == null) return null; return value.ToString(); } } }
Implement TypeConverter CanConvertTo() and ConvertTo() methods for Uuid.
Implement TypeConverter CanConvertTo() and ConvertTo() methods for Uuid.
C#
mit
brendanjbaker/Bakery
65bbc610bf212ac9b054fef1f7e760501869cf56
Models/Helpers.cs
Models/Helpers.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ForumModels { public static class Helpers { public static DateTimeOffset GetStartOfWeek(string date) { var dt = DateTimeOffset.Now; if (!String.IsNullOrEmpty(date)) { dt = DateTimeOffset.Parse(date); } dt = dt.ToLocalTime(); var dayOfWeekLocal = (int)dt.DayOfWeek; // +1 because we want to start the week on Monday and not Sunday (local time) return dt.Date.AddDays(-dayOfWeekLocal + 1); } public static string GetDataFileNameFromDate(DateTimeOffset startOfPeriod) { return startOfPeriod.ToString("yyyy-MM-dd") + ".json"; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ForumModels { public static class Helpers { public static DateTimeOffset GetStartOfWeek(string date) { var dt = DateTimeOffset.Now; if (!String.IsNullOrEmpty(date)) { dt = DateTimeOffset.Parse(date); } dt = dt.ToLocalTime(); var dayOfWeekLocal = (int)dt.DayOfWeek; // Adjust it so the week starts Monday instead of Sunday dayOfWeekLocal = (dayOfWeekLocal + 6) % 7; // Go back to the start of the current week return dt.Date.AddDays(-dayOfWeekLocal); } public static string GetDataFileNameFromDate(DateTimeOffset startOfPeriod) { return startOfPeriod.ToString("yyyy-MM-dd") + ".json"; } } }
Fix start of week calculation
Fix start of week calculation
C#
apache-2.0
davidebbo/ForumScorer
b8ecfd744cb58338626e70185cb2c633b78c8e3a
PexelsNet/PexelsClient.cs
PexelsNet/PexelsClient.cs
using System; using System.Net.Http; using Newtonsoft.Json; namespace PexelsNet { public class PexelsClient { private readonly string _apiKey; private const string BaseUrl = "http://api.pexels.com/v1/"; public PexelsClient(string apiKey) { _apiKey = apiKey; } private HttpClient InitHttpClient() { var client = new HttpClient(); client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", _apiKey); return client; } public Page Search(string query, int page = 1, int perPage = 15) { var client = InitHttpClient(); HttpResponseMessage response = client.GetAsync(BaseUrl + "search?query=" + Uri.EscapeDataString(query) + "&per_page="+ perPage + "&page=" + page).Result; return GetResult(response); } public Page Popular(int page = 1, int perPage = 15) { var client = InitHttpClient(); HttpResponseMessage response = client.GetAsync(BaseUrl + "popular?per_page=" + perPage + "&page=" + page).Result; return GetResult(response); } private static Page GetResult(HttpResponseMessage response) { var body = response.Content.ReadAsStringAsync().Result; response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { return JsonConvert.DeserializeObject<Page>(body); } throw new PexelsNetException(response.StatusCode, body); } } }
using System; using System.Net.Http; using Newtonsoft.Json; using System.Threading.Tasks; namespace PexelsNet { public class PexelsClient { private readonly string _apiKey; private const string BaseUrl = "http://api.pexels.com/v1/"; public PexelsClient(string apiKey) { _apiKey = apiKey; } private HttpClient InitHttpClient() { var client = new HttpClient(); client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", _apiKey); return client; } public async Task<Page> SearchAsync(string query, int page = 1, int perPage = 15) { var client = InitHttpClient(); HttpResponseMessage response = await client.GetAsync(BaseUrl + "search?query=" + Uri.EscapeDataString(query) + "&per_page=" + perPage + "&page=" + page); return await GetResultAsync(response); } public async Task<Page> PopularAsync(int page = 1, int perPage = 15) { var client = InitHttpClient(); HttpResponseMessage response = await client.GetAsync(BaseUrl + "popular?per_page=" + perPage + "&page=" + page); return await GetResultAsync(response); } private static async Task<Page> GetResultAsync(HttpResponseMessage response) { var body = await response.Content.ReadAsStringAsync(); response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { return JsonConvert.DeserializeObject<Page>(body); } throw new PexelsNetException(response.StatusCode, body); } } }
Make use of asynchronous methods
Make use of asynchronous methods Use await Task<T> istead of accessing Task<T>.Result property.
C#
mit
Selz/PexelsNet
177e8408dfe6293ae644ecbbdbba71ed7148b35f
src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/V2/SingleProvider.cshtml
src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/V2/SingleProvider.cshtml
 @model SFA.DAS.EmployerAccounts.Web.ViewModels.AccountDashboardViewModel <h3 class="das-panel__heading">@Model.AccountViewModel.Providers.First().Name</h3> <dl class="das-definition-list das-definition-list--inline das-definition-list--muted govuk-!-font-size-16"> <dt class="das-definition-list__title">UK Provider Reference Number</dt> <dd class="das-definition-list__definition">@Model.AccountViewModel.Providers.First().Ukprn</dd> </dl> <p> @if (@Model.AccountViewModel.Providers.First().Street != null) { @(Model.AccountViewModel.Providers.First().Street)@:, <br> } @(Model.AccountViewModel.Providers.First().Town)<text>, </text>@(Model.AccountViewModel.Providers.First().Postcode) </p> <dl class="das-definition-list das-definition-list--inline"> <dt class="das-definition-list__title">Tel</dt> <dd class="das-definition-list__definition">@Model.AccountViewModel.Providers.First().Phone</dd> <dt class="das-definition-list__title">Email</dt> <dd class="das-definition-list__definition"><span class="das-breakable">@Model.AccountViewModel.Providers.First().Email</span></dd> </dl> <p><a href="@Url.ProviderRelationshipsAction("providers")" class="govuk-link govuk-link--no-visited-state">View permissions</a> </p>
 @model SFA.DAS.EmployerAccounts.Web.ViewModels.AccountDashboardViewModel <h3 class="das-panel__heading">@Model.AccountViewModel.Providers.First().Name</h3> <dl class="das-definition-list das-definition-list--inline das-definition-list--muted govuk-!-font-size-16"> <dt class="das-definition-list__title">UK Provider Reference Number</dt> <dd class="das-definition-list__definition">@Model.AccountViewModel.Providers.First().Ukprn</dd> </dl> <p> @if (@Model.AccountViewModel.Providers.First().Street != null) { @(Model.AccountViewModel.Providers.First().Street)@:, <br> } @(Model.AccountViewModel.Providers.First().Town)<text>, </text>@(Model.AccountViewModel.Providers.First().Postcode) </p> <dl class="das-definition-list das-definition-list--table-narrow"> <dt class="das-definition-list__title">Tel</dt> <dd class="das-definition-list__definition">@Model.AccountViewModel.Providers.First().Phone</dd> <dt class="das-definition-list__title">Email</dt> <dd class="das-definition-list__definition"><span class="das-breakable">@Model.AccountViewModel.Providers.First().Email</span></dd> </dl> <p><a href="@Url.ProviderRelationshipsAction("providers")" class="govuk-link govuk-link--no-visited-state">View permissions</a> </p>
Apply new css class for displaying long email addresses and other data in panel
[CON-409] Apply new css class for displaying long email addresses and other data in panel
C#
mit
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
507e651ca5520b42adcabdbaad46da3c5c45d862
src/Slp.Evi.Storage/Slp.Evi.Test.System/SPARQL/SPARQL_TestSuite/Db/MSSQLDb.cs
src/Slp.Evi.Storage/Slp.Evi.Test.System/SPARQL/SPARQL_TestSuite/Db/MSSQLDb.cs
using System.Collections.Generic; using System.Configuration; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Console; using Microsoft.VisualStudio.TestTools.UnitTesting; using Slp.Evi.Storage; using Slp.Evi.Storage.Bootstrap; using Slp.Evi.Storage.Database; using Slp.Evi.Storage.Database.Vendor.MsSql; namespace Slp.Evi.Test.System.SPARQL.SPARQL_TestSuite.Db { [TestClass] public class MSSQLDb : TestSuite { private static Dictionary<string, EviQueryableStorage> _storages; [ClassInitialize] public static void TestSuiteInitialization(TestContext context) { _storages = new Dictionary<string, EviQueryableStorage>(); foreach (var dataset in StorageNames) { var storage = InitializeDataset(dataset, GetSqlDb(), GetStorageFactory()); _storages.Add(dataset, storage); } } private static ISqlDatabase GetSqlDb() { var connectionString = ConfigurationManager.ConnectionStrings["mssql_connection"].ConnectionString; return (new MsSqlDbFactory()).CreateSqlDb(connectionString); } private static IEviQueryableStorageFactory GetStorageFactory() { var loggerFactory = new LoggerFactory(); loggerFactory.AddConsole(LogLevel.Trace); loggerFactory.AddDebug(LogLevel.Trace); return new DefaultEviQueryableStorageFactory(loggerFactory); } protected override EviQueryableStorage GetStorage(string storageName) { return _storages[storageName]; } } }
using System; using System.Collections.Generic; using System.Configuration; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Console; using Microsoft.VisualStudio.TestTools.UnitTesting; using Slp.Evi.Storage; using Slp.Evi.Storage.Bootstrap; using Slp.Evi.Storage.Database; using Slp.Evi.Storage.Database.Vendor.MsSql; namespace Slp.Evi.Test.System.SPARQL.SPARQL_TestSuite.Db { [TestClass] public class MSSQLDb : TestSuite { private static Dictionary<string, EviQueryableStorage> _storages; [ClassInitialize] public static void TestSuiteInitialization(TestContext context) { _storages = new Dictionary<string, EviQueryableStorage>(); foreach (var dataset in StorageNames) { var storage = InitializeDataset(dataset, GetSqlDb(), GetStorageFactory()); _storages.Add(dataset, storage); } } private static ISqlDatabase GetSqlDb() { var connectionString = ConfigurationManager.ConnectionStrings["mssql_connection"].ConnectionString; return (new MsSqlDbFactory()).CreateSqlDb(connectionString); } private static IEviQueryableStorageFactory GetStorageFactory() { var loggerFactory = new LoggerFactory(); loggerFactory.AddConsole(LogLevel.Trace); if (Environment.GetEnvironmentVariable("APPVEYOR") != "True") { loggerFactory.AddDebug(LogLevel.Trace); } return new DefaultEviQueryableStorageFactory(loggerFactory); } protected override EviQueryableStorage GetStorage(string storageName) { return _storages[storageName]; } } }
Disable test debug logging in appveyor.
Disable test debug logging in appveyor.
C#
mit
mchaloupka/DotNetR2RMLStore,mchaloupka/EVI
af38c72b6cc9d8b0a37b29d7143f4a8cfffffa9d
test/Diffbot.Client.Tests/DiffbotClientTest.cs
test/Diffbot.Client.Tests/DiffbotClientTest.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="DiffbotClientTest.cs" company="KriaSoft LLC"> // Copyright © 2014 Konstantin Tarkus, KriaSoft LLC. See LICENSE.txt // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace Diffbot.Client.Tests { using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] public class DiffbotClientTest { private const string ValidApiKey = "<your api key>"; private const string InvalidApiKey = "b2571e7c9108ac25ef31cdd30ef83194"; [TestMethod, TestCategory("Integration")] public async Task DiffbotClient_GetArticle_Should_Return_an_Article() { // Arrange var client = new DiffbotClient(ValidApiKey); // Act var article = await client.GetArticle( "http://gigaom.com/cloud/silicon-valley-royalty-pony-up-2m-to-scale-diffbots-visual-learning-robot/"); // Assert Assert.IsNotNull(article); Assert.AreEqual("Silicon Valley stars pony up $2M to scale Diffbot’s visual learning robot", article.Title); } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="DiffbotClientTest.cs" company="KriaSoft LLC"> // Copyright © 2014 Konstantin Tarkus, KriaSoft LLC. See LICENSE.txt // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace Diffbot.Client.Tests { using System.Net.Http; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] public class DiffbotClientTest { private const string ValidApiKey = "<your api key>"; private const string InvalidApiKey = "b2571e7c9108ac25ef31cdd30ef83194"; private const string WebPageUrl1 = "http://gigaom.com/cloud/silicon-valley-royalty-pony-up-2m-to-scale-diffbots-visual-learning-robot/"; [TestMethod, TestCategory("Integration")] public async Task DiffbotClient_GetArticle_Should_Return_an_Article() { // Arrange var client = new DiffbotClient(ValidApiKey); // Act var article = await client.GetArticle(WebPageUrl1); // Assert Assert.IsNotNull(article); Assert.AreEqual("Silicon Valley stars pony up $2M to scale Diffbot’s visual learning robot", article.Title); } [TestMethod, TestCategory("Integration"), ExpectedException(typeof(HttpRequestException))] public async Task DiffbotClient_GetArticle_Should_Throw_an_Exception() { // Arrange var client = new DiffbotClient(InvalidApiKey); // Act await client.GetArticle(WebPageUrl1); } } }
Add one more unit test
Add one more unit test
C#
apache-2.0
kriasoft/Diffbot
a0efdd321b8394d94bf07796b9ffe1f18696bec2
GUI/Types/ParticleRenderer/IVectorProvider.cs
GUI/Types/ParticleRenderer/IVectorProvider.cs
using System; using System.Numerics; using ValveResourceFormat.Serialization; namespace GUI.Types.ParticleRenderer { public interface IVectorProvider { Vector3 NextVector(); } public class LiteralVectorProvider : IVectorProvider { private readonly Vector3 value; public LiteralVectorProvider(Vector3 value) { this.value = value; } public LiteralVectorProvider(double[] value) { this.value = new Vector3((float)value[0], (float)value[1], (float)value[2]); } public Vector3 NextVector() => value; } public static class IVectorProviderExtensions { public static IVectorProvider GetVectorProvider(this IKeyValueCollection keyValues, string propertyName) { var property = keyValues.GetProperty<object>(propertyName); if (property is IKeyValueCollection numberProviderParameters && numberProviderParameters.ContainsKey("m_nType")) { var type = numberProviderParameters.GetProperty<string>("m_nType"); switch (type) { case "PVEC_TYPE_LITERAL": return new LiteralVectorProvider(numberProviderParameters.GetArray<double>("m_vLiteralValue")); default: throw new InvalidCastException($"Could not create vector provider of type {type}."); } } return new LiteralVectorProvider(keyValues.GetArray<double>(propertyName)); } } }
using System; using System.Numerics; using ValveResourceFormat.Serialization; namespace GUI.Types.ParticleRenderer { public interface IVectorProvider { Vector3 NextVector(); } public class LiteralVectorProvider : IVectorProvider { private readonly Vector3 value; public LiteralVectorProvider(Vector3 value) { this.value = value; } public LiteralVectorProvider(double[] value) { this.value = new Vector3((float)value[0], (float)value[1], (float)value[2]); } public Vector3 NextVector() => value; } public static class IVectorProviderExtensions { public static IVectorProvider GetVectorProvider(this IKeyValueCollection keyValues, string propertyName) { var property = keyValues.GetProperty<object>(propertyName); if (property is IKeyValueCollection numberProviderParameters && numberProviderParameters.ContainsKey("m_nType")) { var type = numberProviderParameters.GetProperty<string>("m_nType"); switch (type) { case "PVEC_TYPE_LITERAL": return new LiteralVectorProvider(numberProviderParameters.GetArray<double>("m_vLiteralValue")); default: if (numberProviderParameters.ContainsKey("m_vLiteralValue")) { Console.Error.WriteLine($"Vector provider of type {type} is not directly supported, but it has m_vLiteralValue."); return new LiteralVectorProvider(numberProviderParameters.GetArray<double>("m_vLiteralValue")); } throw new InvalidCastException($"Could not create vector provider of type {type}."); } } return new LiteralVectorProvider(keyValues.GetArray<double>(propertyName)); } } }
Support all particle vector providers that have m_vLiteralValue
Support all particle vector providers that have m_vLiteralValue
C#
mit
SteamDatabase/ValveResourceFormat
874576d8d166393696765bd60867c72c8a14582c
vuwall-motion/vuwall-motion/TransparentForm.cs
vuwall-motion/vuwall-motion/TransparentForm.cs
using System; using System.Drawing; using System.Windows.Forms; namespace vuwall_motion { public partial class TransparentForm : Form { public TransparentForm() { InitializeComponent(); DoubleBuffered = true; ShowInTaskbar = false; } private void TransparentForm_Load(object sender, EventArgs e) { int wl = TransparentWindowAPI.GetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle); wl = wl | 0x80000 | 0x20; TransparentWindowAPI.SetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle, wl); TransparentWindowAPI.SetLayeredWindowAttributes(this.Handle, 0, 128, TransparentWindowAPI.LWA.Alpha); Invalidate(); } private void TransparentForm_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawEllipse(Pens.Red, 250, 250, 20, 20); } // TODO: Method to get an event from MYO to get x & y positions, used to invalidate } }
using System; using System.Drawing; using System.Windows.Forms; namespace vuwall_motion { public partial class TransparentForm : Form { private Pen pen = new Pen(Color.Red, 5); public TransparentForm() { InitializeComponent(); DoubleBuffered = true; SetStyle(ControlStyles.SupportsTransparentBackColor, true); TransparencyKey = BackColor; ShowInTaskbar = false; } private void TransparentForm_Load(object sender, EventArgs e) { int wl = TransparentWindowAPI.GetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle); wl = wl | 0x80000 | 0x20; TransparentWindowAPI.SetLayeredWindowAttributes(this.Handle, 0, 128, TransparentWindowAPI.LWA.Alpha); Invalidate(); } private void TransparentForm_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawEllipse(pen, 250, 250, 20, 20); } // TODO: Method to get an event from MYO to get x & y positions, used to invalidate } }
Fix bug where drawn objects are also transparent, and add pen variable.
Fix bug where drawn objects are also transparent, and add pen variable.
C#
mit
VuWall/VuWall-Motion,DanH91/vuwall-motion
323d48439648eaf95493f021dc50e7e81c606825
LibrarySystem/LibrarySystem.Models/Subject.cs
LibrarySystem/LibrarySystem.Models/Subject.cs
using System.ComponentModel.DataAnnotations; namespace LibrarySystem.Models { public class Subject { public int Id { get; set; } [Required] [MaxLength(50)] public string Name { get; set; } } }
// <copyright file="Subject.cs" company="YAGNI"> // All rights reserved. // </copyright> // <summary>Holds implementation of Book model.</summary> using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace LibrarySystem.Models { /// <summary> /// Represent a <see cref="Subject"/> entity model. /// </summary> public class Subject { /// <summary> /// Child nodes of the <see cref="Subject"/> entity. /// </summary> private ICollection<Subject> subSubjects; /// <summary> /// Journal of the <see cref="Subject"/> entity. /// </summary> private ICollection<Journal> journals; /// <summary> /// Initializes a new instance of the <see cref="Subject"/> class. /// </summary> public Subject() { this.subSubjects = new HashSet<Subject>(); this.journals = new HashSet<Journal>(); } /// <summary> /// Gets or sets the primary key of the <see cref="Subject"/> entity. /// </summary> /// <value>Primary key of the <see cref="Subject"/> entity.</value> [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } /// <summary> /// Gets or sets the name of the <see cref="Subject"/> entity. /// </summary> /// <value>Name of the <see cref="Subject"/> entity.</value> [Required] [StringLength(50, ErrorMessage = "Subject Name Invalid Length", MinimumLength = 1)] public string Name { get; set; } /// <summary> /// Gets or sets foreign key of the parent node of the <see cref="Subject"/> entity. /// </summary> /// <value>Primary key of the parent node of the <see cref="Subject"/> entity.</value> public int? SuperSubjectId { get; set; } /// <summary> /// Gets or sets the parent node of the <see cref="Subject"/> entity. /// </summary> /// <value>Parent node of the <see cref="Subject"/> entity.</value> public virtual Subject SuperSubject { get; set; } /// <summary> /// Gets or sets the child nodes of the <see cref="Subject"/> entity. /// </summary> /// <value>Initial collection of child nodes of the <see cref="Subject"/> entity.</value> public virtual ICollection<Subject> SubSubjects { get { return this.subSubjects; } set { this.subSubjects = value; } } /// <summary> /// Gets or sets the journals related to the <see cref="Subject"/> entity. /// </summary> /// <value>Initial collection of journals related to the <see cref="Subject"/> entity.</value> public virtual ICollection<Journal> Journals { get { return this.journals; } set { this.journals = value; } } } }
Add journals and self relations.
Add journals and self relations.
C#
mit
TeamYAGNI/LibrarySystem
1f39efa1195bb4fbe64e7df6692fc9d43ea6b353
src/NQuery.Authoring/QuickInfo/ExpressionSelectColumnQuickInfoModelProvider.cs
src/NQuery.Authoring/QuickInfo/ExpressionSelectColumnQuickInfoModelProvider.cs
using System; using System.ComponentModel.Composition; using NQuery.Syntax; namespace NQuery.Authoring.QuickInfo { [Export(typeof(IQuickInfoModelProvider))] internal sealed class ExpressionSelectColumnQuickInfoModelProvider : QuickInfoModelProvider<ExpressionSelectColumnSyntax> { protected override QuickInfoModel CreateModel(SemanticModel semanticModel, int position, ExpressionSelectColumnSyntax node) { if (node.Alias == null) return null; var symbol = semanticModel.GetDeclaredSymbol(node); return symbol == null ? null : QuickInfoModel.ForSymbol(semanticModel, node.Alias.Identifier.Span, symbol); } } }
using System; using System.ComponentModel.Composition; using NQuery.Syntax; namespace NQuery.Authoring.QuickInfo { [Export(typeof(IQuickInfoModelProvider))] internal sealed class ExpressionSelectColumnQuickInfoModelProvider : QuickInfoModelProvider<ExpressionSelectColumnSyntax> { protected override QuickInfoModel CreateModel(SemanticModel semanticModel, int position, ExpressionSelectColumnSyntax node) { if (node.Alias == null || !node.Alias.Span.Contains(position)) return null; var symbol = semanticModel.GetDeclaredSymbol(node); return symbol == null ? null : QuickInfoModel.ForSymbol(semanticModel, node.Alias.Identifier.Span, symbol); } } }
Fix bug in IQuickInfoModelProvider for SELECT column aliases
Fix bug in IQuickInfoModelProvider for SELECT column aliases The current implementation is too eager. This results in no quick info being displayed for any part except for the column alias.
C#
mit
terrajobst/nquery-vnext
51e4995e3575efc47985c527db0cc018b36602f4
SparklrLib/Objects/Responses/Work/Username.cs
SparklrLib/Objects/Responses/Work/Username.cs
 using System; namespace SparklrLib.Objects.Responses.Work { public class Username : IEquatable<Username> { public string username { get; set; } public string displayname { get; set; } public int id { get; set; } public override string ToString() { return id + ": " + displayname + " (@" + username + ")"; } public override bool Equals(object obj) { // If parameter is null return false. if (obj == null) { return false; } // If parameter cannot be cast to Point return false. Username u = obj as Username; if ((object)u == null) { return false; } // Return true if the fields match: return id == u.id; } public bool Equals(Username u) { // If parameter is null return false: if ((object)u == null) { return false; } // Return true if the fields match: return id == u.id; } public bool Equals(int newid) { // If parameter is null return false: if ((object)newid == null) { return false; } // Return true if the fields match: return id == newid; } } }
 using System; namespace SparklrLib.Objects.Responses.Work { public class Username : IEquatable<Username> { public string username { get; set; } public string displayname { get; set; } public int id { get; set; } public override string ToString() { return id + ": " + displayname + " (@" + username + ")"; } public override int GetHashCode() { return id; } public override bool Equals(object obj) { // If parameter is null return false. if (obj == null) { return false; } // If parameter cannot be cast to Point return false. Username u = obj as Username; if ((object)u == null) { return false; } // Return true if the fields match: return id == u.id; } public bool Equals(Username u) { // If parameter is null return false: if ((object)u == null) { return false; } // Return true if the fields match: return id == u.id; } public bool Equals(int newid) { // If parameter is null return false: if ((object)newid == null) { return false; } // Return true if the fields match: return id == newid; } } }
Add hash code to work/username
Add hash code to work/username
C#
mit
windowsphonehacker/SparklrWP
d6297823419371fcbfe75e148a6ffdfb9db1b66f
MultiMiner.Win/Extensions/DateTimeExtensions.cs
MultiMiner.Win/Extensions/DateTimeExtensions.cs
using System; using System.Globalization; namespace MultiMiner.Win.Extensions { public static class DateTimeExtensions { public static string ToReallyShortDateString(this DateTime dateTime) { //short date no year string shortDateString = dateTime.ToShortDateString(); //year could be at beginning (JP) or end (EN) string dateSeparator = CultureInfo.CurrentCulture.DateTimeFormat.DateSeparator; string value1 = dateTime.Year + dateSeparator; string value2 = dateSeparator + dateTime.Year; return shortDateString.Replace(value1, String.Empty).Replace(value2, String.Empty); } public static string ToReallyShortDateTimeString(this DateTime dateTime) { return String.Format("{0} {1}", dateTime.ToReallyShortDateString(), dateTime.ToShortTimeString()); } } }
using System; using System.Globalization; namespace MultiMiner.Win.Extensions { public static class DateTimeExtensions { private static string ToReallyShortDateString(this DateTime dateTime) { //short date no year string shortDateString = dateTime.ToShortDateString(); //year could be at beginning (JP) or end (EN) string dateSeparator = CultureInfo.CurrentCulture.DateTimeFormat.DateSeparator; string value1 = dateTime.Year + dateSeparator; string value2 = dateSeparator + dateTime.Year; return shortDateString.Replace(value1, String.Empty).Replace(value2, String.Empty); } public static string ToReallyShortDateTimeString(this DateTime dateTime) { return String.Format("{0} {1}", dateTime.ToReallyShortDateString(), dateTime.ToShortTimeString()); } } }
Update test suite for latest changes
Update test suite for latest changes
C#
mit
nwoolls/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner,IWBWbiz/MultiMiner
e36bdaafaf7ac04b4fa8eb71a6e4e05f02eb5036
WootzJs.Mvc/Views/AutocompleteTextBox.cs
WootzJs.Mvc/Views/AutocompleteTextBox.cs
using WootzJs.Web; namespace WootzJs.Mvc.Views { public class AutocompleteTextBox<T> : Control { private Control content; private Control overlay; private Element contentNode; private Element overlayContainer; private DropDownAlignment alignment; private T selectedItem; protected override Element CreateNode() { contentNode = Browser.Document.CreateElement("input"); contentNode.SetAttribute("type", "text"); contentNode.Style.Height = "100%"; var dropdown = Browser.Document.CreateElement(""); overlayContainer = Browser.Document.CreateElement("div"); overlayContainer.Style.Position = "absolute"; overlayContainer.Style.Display = "none"; overlayContainer.AppendChild(overlay.Node); Add(overlay); var overlayAnchor = Browser.Document.CreateElement("div"); overlayAnchor.Style.Position = "relative"; overlayAnchor.AppendChild(overlayContainer); var result = Browser.Document.CreateElement("div"); result.AppendChild(contentNode); result.AppendChild(overlayAnchor); return result; } } }
using WootzJs.Web; namespace WootzJs.Mvc.Views { public class AutocompleteTextBox<T> : Control { private Control content; private Control overlay; private Element contentNode; private Element overlayContainer; private DropDownAlignment alignment; private T selectedItem; protected override Element CreateNode() { contentNode = Browser.Document.CreateElement("input"); contentNode.SetAttribute("type", "text"); contentNode.Style.Height = "100%"; overlayContainer = Browser.Document.CreateElement("div"); overlayContainer.Style.Position = "absolute"; overlayContainer.Style.Display = "none"; overlayContainer.AppendChild(overlay.Node); Add(overlay); var overlayAnchor = Browser.Document.CreateElement("div"); overlayAnchor.Style.Position = "relative"; overlayAnchor.AppendChild(overlayContainer); var result = Browser.Document.CreateElement("div"); result.AppendChild(contentNode); result.AppendChild(overlayAnchor); return result; } } }
Remove dead line from autocomplete
Remove dead line from autocomplete
C#
mit
kswoll/WootzJs,kswoll/WootzJs,x335/WootzJs,x335/WootzJs,x335/WootzJs,kswoll/WootzJs
6cab3b6d8cb8bd20d5ff033e46bdf909cf7a0f6b
src/UseCases/ReactiveUI.Routing.UseCases.Android/MainActivity.cs
src/UseCases/ReactiveUI.Routing.UseCases.Android/MainActivity.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Disposables; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Support.V4.App; using Android.Views; using Android.Widget; using ReactiveUI.Routing.Android; using ReactiveUI.Routing.Presentation; using ReactiveUI.Routing.UseCases.Common.ViewModels; using Splat; namespace ReactiveUI.Routing.UseCases.Android { [Activity(Label = "ReactiveUI.Routing.UseCases.Android", MainLauncher = true)] public class MainActivity : FragmentActivity, IActivatable { protected override void OnCreate(Bundle savedInstanceState) { Locator.CurrentMutable.InitializeRoutingAndroid(this); this.WhenActivated(d => { Locator.Current.GetService<FragmentActivationForViewFetcher>().SetFragmentManager(SupportFragmentManager); PagePresenter.RegisterHost(SupportFragmentManager, Resource.Id.Container) .DisposeWith(d); Locator.Current.GetService<IAppPresenter>() .PresentPage(new LoginViewModel()) .Subscribe() .DisposeWith(d); }); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Disposables; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Support.V4.App; using Android.Views; using Android.Widget; using ReactiveUI.Routing.Android; using ReactiveUI.Routing.Presentation; using ReactiveUI.Routing.UseCases.Common.ViewModels; using Splat; namespace ReactiveUI.Routing.UseCases.Android { [Activity(Label = "ReactiveUI.Routing.UseCases.Android", MainLauncher = true)] public class MainActivity : FragmentActivity, IActivatable { protected override void OnCreate(Bundle savedInstanceState) { Locator.CurrentMutable.InitializeRoutingAndroid(this); this.WhenActivated(d => { Locator.Current.GetService<FragmentActivationForViewFetcher>().SetFragmentManager(SupportFragmentManager); PagePresenter.RegisterHost(SupportFragmentManager, Resource.Id.Container) .DisposeWith(d); var presenter = Locator.Current.GetService<IAppPresenter>(); if (!presenter.ActiveViews.Any()) { presenter.PresentPage(new LoginViewModel()) .Subscribe() .DisposeWith(d); } }); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); } } }
Fix app always showing the login page after orientation change
Fix app always showing the login page after orientation change
C#
mit
KallynGowdy/ReactiveUI.Routing
d0e46de7d20d7a896e1014821bdbd83663ce7722
Source/Lib/TraktApiSharp/Requests/WithoutOAuth/Movies/Common/TraktMoviesPopularRequest.cs
Source/Lib/TraktApiSharp/Requests/WithoutOAuth/Movies/Common/TraktMoviesPopularRequest.cs
namespace TraktApiSharp.Requests.WithoutOAuth.Movies.Common { using Base.Get; using Objects.Basic; using Objects.Get.Movies; internal class TraktMoviesPopularRequest : TraktGetRequest<TraktPaginationListResult<TraktMovie>, TraktMovie> { internal TraktMoviesPopularRequest(TraktClient client) : base(client) { } protected override string UriTemplate => "movies/popular{?extended,page,limit}"; protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.NotRequired; protected override bool SupportsPagination => true; protected override bool IsListResult => true; } }
namespace TraktApiSharp.Requests.WithoutOAuth.Movies.Common { using Base; using Base.Get; using Objects.Basic; using Objects.Get.Movies; internal class TraktMoviesPopularRequest : TraktGetRequest<TraktPaginationListResult<TraktMovie>, TraktMovie> { internal TraktMoviesPopularRequest(TraktClient client) : base(client) { } protected override string UriTemplate => "movies/popular{?extended,page,limit,query,years,genres,languages,countries,runtimes,ratings,certifications}"; protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.NotRequired; internet TraktMovieFilter Filter { get; set; } protected override bool SupportsPagination => true; protected override bool IsListResult => true; } }
Add filter property to popular movies request.
Add filter property to popular movies request.
C#
mit
henrikfroehling/TraktApiSharp
1732eb337dbb12f4a92975051e0a47a990389818
RadosGW.AdminAPI/Models/User.cs
RadosGW.AdminAPI/Models/User.cs
using System; using System.Collections.Generic; using Newtonsoft.Json; namespace Radosgw.AdminAPI { public class User { [JsonProperty(PropertyName = "display_name")] public string DisplayName { get; set; } [JsonProperty(PropertyName = "user_id")] public string UserId { get; set; } [JsonProperty(PropertyName = "tenant")] public string Tenant { get; set; } [JsonProperty(PropertyName = "email")] public string Email { get; set; } [JsonProperty(PropertyName = "max_buckets")] public uint MaxBuckets { get; set; } [JsonConverter(typeof(BoolConverter))] [JsonProperty(PropertyName = "suspended")] public bool Suspended { get; set; } [JsonProperty(PropertyName="keys")] public List<Key> Keys { get; set; } public override string ToString() { return string.Format("[User: DisplayName={0}, UserId={1}, Tenant={2}, Email={3}, MaxBuckets={4}, Suspended={5}, Keys={6}]", DisplayName, UserId, Tenant, Email, MaxBuckets, Suspended, string.Format("[{0}]", string.Join(",", Keys))); } public User() { } } }
using System; using System.Collections.Generic; using Newtonsoft.Json; namespace Radosgw.AdminAPI { public class User { [JsonProperty(PropertyName = "display_name")] public string DisplayName { get; set; } [JsonProperty(PropertyName = "user_id")] public string UserId { get; set; } [JsonProperty(PropertyName = "tenant")] public string Tenant { get; set; } [JsonProperty(PropertyName = "email")] public string Email { get; set; } [JsonProperty(PropertyName = "max_buckets")] public uint MaxBuckets { get; set; } [JsonConverter(typeof(BoolConverter))] [JsonProperty(PropertyName = "suspended")] public bool Suspended { get; set; } [JsonProperty(PropertyName="keys")] public List<Key> Keys { get; set; } public override string ToString() { return string.Format("[User: DisplayName={0}, UserId={1}, Tenant={2}, Email={3}, MaxBuckets={4}, Suspended={5}, Keys={6}]", DisplayName, UserId, Tenant, Email, MaxBuckets, Suspended, string.Format("[{0}]", string.Join(",", Keys ?? new List<Key>()))); } public User() { } } }
Fix exception if Keys is null
Fix exception if Keys is null
C#
apache-2.0
ClemPi/radosgwadminapi
03e6330e88e955f9cd938ff2b619a023dffe0439
src/NewsReader/NewsReader.Presentation/DesignData/SampleFeedItemListViewModel.cs
src/NewsReader/NewsReader.Presentation/DesignData/SampleFeedItemListViewModel.cs
using Jbe.NewsReader.Applications.ViewModels; using Jbe.NewsReader.Applications.Views; namespace Jbe.NewsReader.Presentation.DesignData { public class SampleFeedItemListViewModel : FeedItemListViewModel { public SampleFeedItemListViewModel() : base(new MockFeedItemListView(), null) { } private class MockFeedItemListView : IFeedItemListView { public object DataContext { get; set; } } } }
using Jbe.NewsReader.Applications.ViewModels; using Jbe.NewsReader.Applications.Views; namespace Jbe.NewsReader.Presentation.DesignData { public class SampleFeedItemListViewModel : FeedItemListViewModel { public SampleFeedItemListViewModel() : base(new MockFeedItemListView(), null) { // Note: Design time data does not work with {x:Bind} } private class MockFeedItemListView : IFeedItemListView { public object DataContext { get; set; } } } }
Add comment that design time data does not work with {x:Bind}
Add comment that design time data does not work with {x:Bind}
C#
mit
jbe2277/waf
68a81e0eb0f813fc3710ea09aa273d75ac2b8671
osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs
osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.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 osuTK; using osuTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { public class FollowPoint : Container { private const float width = 8; public override bool RemoveWhenNotAlive => false; public FollowPoint() { Origin = Anchor.Centre; Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.FollowPoint), _ => new Container { Masking = true, AutoSizeAxes = Axes.Both, CornerRadius = width / 2, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, Colour = Color4.White.Opacity(0.2f), Radius = 4, }, Child = new Box { Size = new Vector2(width), Blending = BlendingParameters.Additive, Origin = Anchor.Centre, Anchor = Anchor.Centre, Alpha = 0.5f, } }, confineMode: ConfineMode.NoScaling); } } }
// 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 osuTK; using osuTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { public class FollowPoint : Container { private const float width = 8; public override bool RemoveWhenNotAlive => false; public override bool RemoveCompletedTransforms => false; public FollowPoint() { Origin = Anchor.Centre; Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.FollowPoint), _ => new Container { Masking = true, AutoSizeAxes = Axes.Both, CornerRadius = width / 2, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, Colour = Color4.White.Opacity(0.2f), Radius = 4, }, Child = new Box { Size = new Vector2(width), Blending = BlendingParameters.Additive, Origin = Anchor.Centre, Anchor = Anchor.Centre, Alpha = 0.5f, } }, confineMode: ConfineMode.NoScaling); } } }
Fix follow point transforms not working after rewind
Fix follow point transforms not working after rewind
C#
mit
smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,johnneijzen/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,smoogipooo/osu,UselessToucan/osu,peppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,EVAST9919/osu,johnneijzen/osu,UselessToucan/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,2yangk23/osu,EVAST9919/osu,ppy/osu,peppy/osu
b57ed808ceb0b3637865a70ae01402ecf296baef
Verdeler/ConcurrencyLimiter.cs
Verdeler/ConcurrencyLimiter.cs
using System; using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; namespace Verdeler { internal class ConcurrencyLimiter<TSubject> { private readonly Func<TSubject, object> _subjectReductionMap; private readonly int _concurrencyLimit; private readonly ConcurrentDictionary<object, SemaphoreSlim> _semaphores = new ConcurrentDictionary<object, SemaphoreSlim>(); public ConcurrencyLimiter(Func<TSubject, object> subjectReductionMap, int concurrencyLimit) { if (concurrencyLimit <= 0) { throw new ArgumentException(@"Concurrency limit must be greater than 0.", nameof(concurrencyLimit)); } _subjectReductionMap = subjectReductionMap; _concurrencyLimit = concurrencyLimit; } public async Task WaitFor(TSubject subject) { var semaphore = GetSemaphoreForReduction(subject); await semaphore.WaitAsync(); } public void Release(TSubject subject) { var semaphore = GetSemaphoreForReduction(subject); semaphore.Release(); } private SemaphoreSlim GetSemaphoreForReduction(TSubject subject) { var reducedSubject = _subjectReductionMap.Invoke(subject); var semaphore = _semaphores.GetOrAdd(reducedSubject, new SemaphoreSlim(_concurrencyLimit)); return semaphore; } } }
using System; using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; namespace Verdeler { internal class ConcurrencyLimiter<TSubject> { private readonly Func<TSubject, object> _subjectReductionMap; private readonly int _concurrencyLimit; private readonly ConcurrentDictionary<object, SemaphoreSlim> _semaphores = new ConcurrentDictionary<object, SemaphoreSlim>(); public ConcurrencyLimiter(Func<TSubject, object> subjectReductionMap, int concurrencyLimit) { if (concurrencyLimit <= 0) { throw new ArgumentException(@"Concurrency limit must be greater than 0.", nameof(concurrencyLimit)); } _subjectReductionMap = subjectReductionMap; _concurrencyLimit = concurrencyLimit; } public async Task WaitFor(TSubject subject) { var semaphore = GetSemaphoreForReducedSubject(subject); await semaphore.WaitAsync(); } public void Release(TSubject subject) { var semaphore = GetSemaphoreForReducedSubject(subject); semaphore.Release(); } private SemaphoreSlim GetSemaphoreForReducedSubject(TSubject subject) { var reducedSubject = _subjectReductionMap.Invoke(subject); var semaphore = _semaphores.GetOrAdd(reducedSubject, new SemaphoreSlim(_concurrencyLimit)); return semaphore; } } }
Rename method to get semaphore
Rename method to get semaphore
C#
mit
justinjstark/Verdeler,justinjstark/Delivered
6452cc632aac0a99e34ad369cd5c539f01423010
src/Glimpse.Common/GlimpseServices.cs
src/Glimpse.Common/GlimpseServices.cs
using Glimpse; using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection; using System.Collections.Generic; namespace Glimpse { public class GlimpseServices { public static IEnumerable<IServiceDescriptor> GetDefaultServices() { return GetDefaultServices(new Configuration()); } public static IEnumerable<IServiceDescriptor> GetDefaultServices(IConfiguration configuration) { var describe = new ServiceDescriber(configuration); // // Discovery & Reflection. // yield return describe.Transient<ITypeActivator, DefaultTypeActivator>(); yield return describe.Transient<ITypeSelector, DefaultTypeSelector>(); yield return describe.Transient<IAssemblyProvider, DefaultAssemblyProvider>(); yield return describe.Transient<ITypeService, DefaultTypeService>(); yield return describe.Transient(typeof(IDiscoverableCollection<>), typeof(ReflectionDiscoverableCollection<>)); } } }
using Glimpse; using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection; using System.Collections.Generic; namespace Glimpse { public class GlimpseServices { public static IEnumerable<IServiceDescriptor> GetDefaultServices() { return GetDefaultServices(new Configuration()); } public static IEnumerable<IServiceDescriptor> GetDefaultServices(IConfiguration configuration) { var describe = new ServiceDescriber(configuration); // // Discovery & Reflection. // yield return describe.Transient<ITypeActivator, DefaultTypeActivator>(); yield return describe.Transient<ITypeSelector, DefaultTypeSelector>(); yield return describe.Transient<IAssemblyProvider, DefaultAssemblyProvider>(); yield return describe.Transient<ITypeService, DefaultTypeService>(); yield return describe.Transient(typeof(IDiscoverableCollection<>), typeof(ReflectionDiscoverableCollection<>)); // // Broker // yield return describe.Singleton<IMessageBus, DefaultMessageBus>(); } } }
Add registration to the serive
Add registration to the serive
C#
mit
zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype
a32855838c3931d463eb0e50f6f5523aa50e4296
Source/ArduinoSketchUploader/Program.cs
Source/ArduinoSketchUploader/Program.cs
using ArduinoUploader; namespace ArduinoSketchUploader { /// <summary> /// The ArduinoLibCSharp SketchUploader can upload a compiled (Intel) HEX file directly to an attached Arduino. /// </summary> internal class Program { private static void Main(string[] args) { var commandLineOptions = new CommandLineOptions(); if (!CommandLine.Parser.Default.ParseArguments(args, commandLineOptions)) return; var options = new ArduinoSketchUploaderOptions { PortName = commandLineOptions.PortName, FileName = commandLineOptions.FileName, ArduinoModel = commandLineOptions.ArduinoModel }; var uploader = new ArduinoUploader.ArduinoSketchUploader(options); uploader.UploadSketch(); } } }
using ArduinoUploader; namespace ArduinoSketchUploader { /// <summary> /// The ArduinoSketchUploader can upload a compiled (Intel) HEX file directly to an attached Arduino. /// </summary> internal class Program { private static void Main(string[] args) { var commandLineOptions = new CommandLineOptions(); if (!CommandLine.Parser.Default.ParseArguments(args, commandLineOptions)) return; var options = new ArduinoSketchUploaderOptions { PortName = commandLineOptions.PortName, FileName = commandLineOptions.FileName, ArduinoModel = commandLineOptions.ArduinoModel }; var uploader = new ArduinoUploader.ArduinoSketchUploader(options); uploader.UploadSketch(); } } }
Remove reference to old library name.
Remove reference to old library name.
C#
mit
christophediericx/ArduinoSketchUploader
2765546fd331cc05a37d346145cfa34d284e6a14
PolarisServer/Models/FixedPackets.cs
PolarisServer/Models/FixedPackets.cs
using System; using System.Runtime.InteropServices; using PolarisServer.Models; namespace PolarisServer.Models { public struct PacketHeader { public UInt32 Size; public byte Type; public byte Subtype; public byte Flags1; public byte Flags2; public PacketHeader(int size, byte type, byte subtype, byte flags1, byte flags2) { this.Size = (uint)size; this.Type = type; this.Subtype = subtype; this.Flags1 = flags1; this.Flags2 = flags2; } public PacketHeader(byte type, byte subtype) : this(type, subtype, (byte)0) { } public PacketHeader(byte type, byte subtype, byte flags1) : this(0, type, subtype, flags1, 0) { } public PacketHeader(byte type, byte subtype, PacketFlags packetFlags) : this(type, subtype, (byte)packetFlags) { } } [Flags] public enum PacketFlags : byte { NONE, STREAM_PACKED = 0x4, FLAG_10 = 0x10, ENTITY_HEADER = 0x40 } }
using System; using System.Runtime.InteropServices; using PolarisServer.Models; namespace PolarisServer.Models { public struct PacketHeader { public UInt32 Size; public byte Type; public byte Subtype; public byte Flags1; public byte Flags2; public PacketHeader(int size, byte type, byte subtype, byte flags1, byte flags2) { this.Size = (uint)size; this.Type = type; this.Subtype = subtype; this.Flags1 = flags1; this.Flags2 = flags2; } public PacketHeader(byte type, byte subtype) : this(type, subtype, (byte)0) { } public PacketHeader(byte type, byte subtype, byte flags1) : this(0, type, subtype, flags1, 0) { } public PacketHeader(byte type, byte subtype, PacketFlags packetFlags) : this(type, subtype, (byte)packetFlags) { } } [Flags] public enum PacketFlags : byte { NONE, STREAM_PACKED = 0x4, FLAG_10 = 0x10, FULL_MOVEMENT = 0x20, ENTITY_HEADER = 0x40 } }
Add flag 0x20 to PacketFlags
Add flag 0x20 to PacketFlags
C#
agpl-3.0
MrSwiss/PolarisServer,cyberkitsune/PolarisServer,PolarisTeam/PolarisServer,Dreadlow/PolarisServer,lockzag/PolarisServer
bcf529d1c3e0945db12274ca1cba7d640dadf354
src/Provision.AspNet.Identity.PlainSql/Properties/AssemblyInfo.cs
src/Provision.AspNet.Identity.PlainSql/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Provision.AspNet.Identity.PlainSql")] [assembly: AssemblyDescription("ASP.NET Identity provider for SQL databases")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Provision Data Systems Inc.")] [assembly: AssemblyProduct("Provision.AspNet.Identity.PlainSql")] [assembly: AssemblyCopyright("Copyright © 2016 Provision Data Systems Inc.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("EN-us")] [assembly: ComVisible(false)] [assembly: Guid("9248deff-4947-481f-ba7c-09e9925e62d2")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Provision.AspNet.Identity.PlainSql")] [assembly: AssemblyDescription("ASP.NET Identity provider for SQL databases")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Provision Data Systems Inc.")] [assembly: AssemblyProduct("Provision.AspNet.Identity.PlainSql")] [assembly: AssemblyCopyright("Copyright © 2016 Provision Data Systems Inc.")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9248deff-4947-481f-ba7c-09e9925e62d2")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
Remove EN-us culture from assembly attributes.
Remove EN-us culture from assembly attributes.
C#
mit
provisiondata/Provision.AspNet.Identity.PlainSql
0ba6b7246e63a3fd8ab1d1c530be7f5a4b26523f
Assets/MixedRealityToolkit.Providers/WindowsMixedReality/Extensions/InteractionSourceExtensions.cs
Assets/MixedRealityToolkit.Providers/WindowsMixedReality/Extensions/InteractionSourceExtensions.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. #if WINDOWS_UWP using Microsoft.MixedReality.Toolkit.Windows.Utilities; using System; using System.Collections.Generic; using UnityEngine.XR.WSA.Input; using Windows.Foundation; using Windows.Perception; using Windows.Storage.Streams; using Windows.UI.Input.Spatial; #endif namespace Microsoft.MixedReality.Toolkit.Windows.Input { /// <summary> /// Extensions for the InteractionSource class to expose the renderable model. /// </summary> public static class InteractionSourceExtensions { #if WINDOWS_UWP public static IAsyncOperation<IRandomAccessStreamWithContentType> TryGetRenderableModelAsync(this InteractionSource interactionSource) { IAsyncOperation<IRandomAccessStreamWithContentType> returnValue = null; if (WindowsApiChecker.UniversalApiContractV5_IsAvailable) { UnityEngine.WSA.Application.InvokeOnUIThread(() => { IReadOnlyList<SpatialInteractionSourceState> sources = SpatialInteractionManager.GetForCurrentView()?.GetDetectedSourcesAtTimestamp(PerceptionTimestampHelper.FromHistoricalTargetTime(DateTimeOffset.Now)); for (var i = 0; i < sources.Count; i++) { if (sources[i].Source.Id.Equals(interactionSource.id)) { returnValue = sources[i].Source.Controller.TryGetRenderableModelAsync(); } } }, true); } return returnValue; } #endif // WINDOWS_UWP } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. #if WINDOWS_UWP using Microsoft.MixedReality.Toolkit.Windows.Utilities; using System; using System.Collections.Generic; using UnityEngine.XR.WSA.Input; using Windows.Foundation; using Windows.Perception; using Windows.Storage.Streams; using Windows.UI.Input.Spatial; #endif namespace Microsoft.MixedReality.Toolkit.Windows.Input { /// <summary> /// Extensions for the InteractionSource class to expose the renderable model. /// </summary> public static class InteractionSourceExtensions { #if WINDOWS_UWP public static IAsyncOperation<IRandomAccessStreamWithContentType> TryGetRenderableModelAsync(this InteractionSource interactionSource) { IAsyncOperation<IRandomAccessStreamWithContentType> returnValue = null; if (WindowsApiChecker.UniversalApiContractV5_IsAvailable) { IReadOnlyList<SpatialInteractionSourceState> sources = null; UnityEngine.WSA.Application.InvokeOnUIThread(() => { sources = SpatialInteractionManager.GetForCurrentView()?.GetDetectedSourcesAtTimestamp(PerceptionTimestampHelper.FromHistoricalTargetTime(DateTimeOffset.Now)); }, true); for (var i = 0; i < sources?.Count; i++) { if (sources[i].Source.Id.Equals(interactionSource.id)) { returnValue = sources[i].Source.Controller.TryGetRenderableModelAsync(); } } } return returnValue; } #endif // WINDOWS_UWP } }
Rework extension to spend less time on UI thread
Rework extension to spend less time on UI thread
C#
mit
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity
295729fb7bd23e592560e408b62771b5b1f8d3f1
src/Spark.Engine.Test/Extensions/OperationOutcomeInnerErrorsTest.cs
src/Spark.Engine.Test/Extensions/OperationOutcomeInnerErrorsTest.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Hl7.Fhir.Model; using Microsoft.VisualStudio.TestTools.UnitTesting; using Spark.Engine.Extensions; namespace Spark.Engine.Test.Extensions { [TestClass] public class OperationOutcomeInnerErrorsTest { [TestMethod] public void AddAllInnerErrorsTest() { OperationOutcome outcome; try { try { try { throw new Exception("Third error level"); } catch (Exception e3) { throw new Exception("Second error level", e3); } } catch (Exception e2) { throw new Exception("First error level", e2); } } catch (Exception e1) { outcome = new OperationOutcome().AddAllInnerErrors(e1); } Assert.IsFalse(!outcome.Issue.Any(i => i.Diagnostics.Equals("Exception: First error level")), "No info about first error"); Assert.IsFalse(!outcome.Issue.Any(i => i.Diagnostics.Equals("Exception: Second error level")), "No info about second error"); Assert.IsFalse(!outcome.Issue.Any(i => i.Diagnostics.Equals("Exception: Third error level")), "No info about third error"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Hl7.Fhir.Model; using Microsoft.VisualStudio.TestTools.UnitTesting; using Spark.Engine.Extensions; namespace Spark.Engine.Test.Extensions { [TestClass] public class OperationOutcomeInnerErrorsTest { [TestMethod] public void AddAllInnerErrorsTest() { OperationOutcome outcome; try { try { try { throw new Exception("Third error level"); } catch (Exception e3) { throw new Exception("Second error level", e3); } } catch (Exception e2) { throw new Exception("First error level", e2); } } catch (Exception e1) { outcome = new OperationOutcome().AddAllInnerErrors(e1); } Assert.IsTrue(outcome.Issue.FindIndex(i => i.Diagnostics.Equals("Exception: First error level")) == 0, "First error level should be at index 0"); Assert.IsTrue(outcome.Issue.FindIndex(i => i.Diagnostics.Equals("Exception: Second error level")) == 1, "Second error level should be at index 1"); Assert.IsTrue(outcome.Issue.FindIndex(i => i.Diagnostics.Equals("Exception: Third error level")) == 2, "Third error level should be at index 2"); } } }
Make sure Issues are at correct index
fix: Make sure Issues are at correct index
C#
bsd-3-clause
furore-fhir/spark,furore-fhir/spark,furore-fhir/spark
6e418e3506682046bf47c50c458cd895f0e2533d
src/Arkivverket.Arkade/Core/Addml/Definitions/DataTypes/DateDataType.cs
src/Arkivverket.Arkade/Core/Addml/Definitions/DataTypes/DateDataType.cs
using System; using System.Collections.Generic; using System.Globalization; namespace Arkivverket.Arkade.Core.Addml.Definitions.DataTypes { public class DateDataType : DataType { private readonly string _dateTimeFormat; private readonly string _fieldFormat; public DateDataType(string fieldFormat) : this(fieldFormat, null) { } public DateDataType(string fieldFormat, List<string> nullValues) : base(nullValues) { _fieldFormat = fieldFormat; _dateTimeFormat = ConvertToDateTimeFormat(_fieldFormat); } public DateDataType() { throw new NotImplementedException(); } private string ConvertToDateTimeFormat(string fieldFormat) { // TODO: Do we have to convert ADDML data fieldFormat til .NET format? return fieldFormat; } public DateTimeOffset Parse(string dateTimeString) { DateTimeOffset dto = DateTimeOffset.ParseExact (dateTimeString, _dateTimeFormat, CultureInfo.InvariantCulture); return dto; } protected bool Equals(DateDataType other) { return string.Equals(_fieldFormat, other._fieldFormat); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return false; } if (ReferenceEquals(this, obj)) { return true; } if (obj.GetType() != GetType()) { return false; } return Equals((DateDataType) obj); } public override int GetHashCode() { return _fieldFormat?.GetHashCode() ?? 0; } public override bool IsValid(string s) { try { Parse(s); return true; } catch (FormatException e) { return false; } } } }
using System; using System.Collections.Generic; using System.Globalization; namespace Arkivverket.Arkade.Core.Addml.Definitions.DataTypes { public class DateDataType : DataType { private readonly string _dateTimeFormat; private readonly string _fieldFormat; public DateDataType(string fieldFormat) : this(fieldFormat, null) { } public DateDataType(string fieldFormat, List<string> nullValues) : base(nullValues) { _fieldFormat = fieldFormat; _dateTimeFormat = ConvertToDateTimeFormat(_fieldFormat); } private string ConvertToDateTimeFormat(string fieldFormat) { return fieldFormat; } public DateTimeOffset Parse(string dateTimeString) { DateTimeOffset dto = DateTimeOffset.ParseExact (dateTimeString, _dateTimeFormat, CultureInfo.InvariantCulture); return dto; } protected bool Equals(DateDataType other) { return string.Equals(_fieldFormat, other._fieldFormat); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return false; } if (ReferenceEquals(this, obj)) { return true; } if (obj.GetType() != GetType()) { return false; } return Equals((DateDataType) obj); } public override int GetHashCode() { return _fieldFormat?.GetHashCode() ?? 0; } public override bool IsValid(string s) { DateTimeOffset res; return DateTimeOffset.TryParseExact(s, _dateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out res); } } }
Use TryParseExact instead of ParseExact. Better performance.
Use TryParseExact instead of ParseExact. Better performance.
C#
agpl-3.0
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
a0aeccf2322d06c782c9fc15d5eda86d1b15df6b
osu.Game/Skinning/DefaultSkin.cs
osu.Game/Skinning/DefaultSkin.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; using osu.Game.Audio; namespace osu.Game.Skinning { public class DefaultSkin : Skin { public DefaultSkin() : base(SkinInfo.Default) { Configuration = new DefaultSkinConfiguration(); } public override Drawable GetDrawableComponent(ISkinComponent component) => null; public override Texture GetTexture(string componentName) => null; public override SampleChannel GetSample(ISampleInfo sampleInfo) => null; public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => null; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; using osu.Game.Audio; using osuTK.Graphics; namespace osu.Game.Skinning { public class DefaultSkin : Skin { public DefaultSkin() : base(SkinInfo.Default) { Configuration = new DefaultSkinConfiguration(); } public override Drawable GetDrawableComponent(ISkinComponent component) => null; public override Texture GetTexture(string componentName) => null; public override SampleChannel GetSample(ISampleInfo sampleInfo) => null; public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) { switch (lookup) { case GlobalSkinConfiguration global: switch (global) { case GlobalSkinConfiguration.ComboColours: return SkinUtils.As<TValue>(new Bindable<List<Color4>>(Configuration.ComboColours)); } break; } return null; } } }
Fix fallback to default combo colours not working
Fix fallback to default combo colours not working
C#
mit
smoogipooo/osu,2yangk23/osu,2yangk23/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,peppy/osu-new,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,ZLima12/osu,smoogipoo/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu,ZLima12/osu,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,EVAST9919/osu,peppy/osu,peppy/osu,ppy/osu
c02c41dced73796bf9938c28df0d9aaad4368d19
src/AtomicChessPuzzles/Views/Shared/Error.cshtml
src/AtomicChessPuzzles/Views/Shared/Error.cshtml
@model AtomicChessPuzzles.HttpErrors.HttpError <h1>@Model.StatusCode - @Model.StatusText</h1> <p>@Model.Description</p>
@model AtomicChessPuzzles.HttpErrors.HttpError @section Title{@Model.StatusCode @Model.StatusText} <h1>@Model.StatusCode - @Model.StatusText</h1> <p>@Model.Description</p>
Add a HTML title to error view
Add a HTML title to error view
C#
agpl-3.0
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
078aa0a8fe90bfcab69bcf916edc3b14874e1ce0
Flirper/ImageListEntry.cs
Flirper/ImageListEntry.cs
using System; using System.IO; namespace Flirper { public class ImageListEntry { public string uri; public string title; public string author; public string extraInfo; public ImageListEntry (string uri, string title, string author, string extraInfo) { this.uri = uri; this.title = title; this.author = author; this.extraInfo = extraInfo; } public bool isHTTP { get { return this.uri.ToLower ().StartsWith ("http:") || this.uri.ToLower ().StartsWith ("https:"); } } public bool isFile { get { if (isHTTP || isLatestSaveGame) return false; return !System.IO.Directory.Exists(@uri) && System.IO.File.Exists(@uri); } } public bool isDirectory { get { if (isHTTP || isLatestSaveGame || isFile) return false; FileAttributes attr = System.IO.File.GetAttributes (@uri); return (attr & FileAttributes.Directory) == FileAttributes.Directory; } } public bool isLatestSaveGame { get { return this.uri.ToLower ().StartsWith ("savegame"); } } public bool isValidPath { get { if(isHTTP || isLatestSaveGame) return true; try { FileInfo fi = new System.IO.FileInfo(@uri); FileAttributes attr = System.IO.File.GetAttributes (@uri); } catch (Exception ex) { ex.ToString(); return false; } return true; } } } }
using System; using System.IO; namespace Flirper { public class ImageListEntry { public string uri; public string title; public string author; public string extraInfo; public ImageListEntry (string uri, string title, string author, string extraInfo) { this.uri = uri; this.title = title; this.author = author; this.extraInfo = extraInfo; } public bool isHTTP { get { return this.uri.ToLower ().StartsWith ("http:") || this.uri.ToLower ().StartsWith ("https:"); } } public bool isFile { get { return isLocal && !System.IO.Directory.Exists(@uri) && System.IO.File.Exists(@uri); } } public bool isDirectory { get { if (!isLocal || isFile) return false; FileAttributes attr = System.IO.File.GetAttributes (@uri); return (attr & FileAttributes.Directory) == FileAttributes.Directory; } } public bool isLatestSaveGame { get { return this.uri.ToLower ().StartsWith ("savegame"); } } private bool isLocal { get { return !(isHTTP || isLatestSaveGame); } } public bool isValidPath { get { if(!isLocal) return true; try { FileInfo fi = new System.IO.FileInfo(@uri); FileAttributes attr = System.IO.File.GetAttributes (@uri); } catch (Exception ex) { ex.ToString(); return false; } return true; } } } }
Modify case handling of entry types
Modify case handling of entry types
C#
mit
githubpermutation/Flirper
cd6ea4f89ca7148c3e144ce36b3491af3f74431f
consoleApp/Program.cs
consoleApp/Program.cs
using System; namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("Hello World, I was created by my father, Bigsby, in an unidentified evironment!"); } } }
using System; namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("Hello World, I was created by my father, Bigsby, in an unidentified evironment!"); Console.WriteLine("Bigsby Gates was here!"); } } }
Add Bigsby Gates was here
Add Bigsby Gates was here
C#
apache-2.0
Bigsby/NetCore,Bigsby/NetCore,Bigsby/NetCore
8c9e06664a6f38de6c34bb62bdb8c9a09ca7de26
Joinrpg/App_Start/ApiSignInProvider.cs
Joinrpg/App_Start/ApiSignInProvider.cs
using System.Data.Entity; using System.Threading.Tasks; using JoinRpg.Web.Helpers; using Microsoft.Owin.Security.OAuth; namespace JoinRpg.Web { internal class ApiSignInProvider : OAuthAuthorizationServerProvider { private ApplicationUserManager Manager { get; } public ApiSignInProvider(ApplicationUserManager manager) { Manager = manager; } /// <inheritdoc /> public override Task ValidateClientAuthentication( OAuthValidateClientAuthenticationContext context) { context.Validated(); return Task.FromResult(0); } public override async Task GrantResourceOwnerCredentials( OAuthGrantResourceOwnerCredentialsContext context) { context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] {"*"}); var user = await Manager.FindByEmailAsync(context.UserName); if (!await Manager.CheckPasswordAsync(user, context.Password)) { context.SetError("invalid_grant", "The user name or password is incorrect."); return; } var x = await user.GenerateUserIdentityAsync(Manager, context.Options.AuthenticationType); context.Validated(x); } } }
using System.Threading.Tasks; using JoinRpg.Web.Helpers; using Microsoft.Owin.Security.OAuth; namespace JoinRpg.Web { internal class ApiSignInProvider : OAuthAuthorizationServerProvider { private ApplicationUserManager Manager { get; } public ApiSignInProvider(ApplicationUserManager manager) { Manager = manager; } /// <inheritdoc /> public override Task ValidateClientAuthentication( OAuthValidateClientAuthenticationContext context) { context.Validated(); return Task.FromResult(0); } public override async Task GrantResourceOwnerCredentials( OAuthGrantResourceOwnerCredentialsContext context) { context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] {"*"}); if (string.IsNullOrWhiteSpace(context.UserName) || string.IsNullOrWhiteSpace(context.Password)) { context.SetError("invalid_grant", "Please supply susername and password."); return; } var user = await Manager.FindByEmailAsync(context.UserName); if (!await Manager.CheckPasswordAsync(user, context.Password)) { context.SetError("invalid_grant", "The user name or password is incorrect."); return; } var x = await user.GenerateUserIdentityAsync(Manager, context.Options.AuthenticationType); context.Validated(x); } } }
Return 400 instead of 500 if no login/password
Return 400 instead of 500 if no login/password
C#
mit
joinrpg/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net
637febe9b632c3de7d13ee50460151f69e378857
MahApps.Metro/Behaviours/GlowWindowBehavior.cs
MahApps.Metro/Behaviours/GlowWindowBehavior.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Interactivity; using MahApps.Metro.Controls; namespace MahApps.Metro.Behaviours { public class GlowWindowBehavior : Behavior<Window> { private GlowWindow left, right, top, bottom; protected override void OnAttached() { base.OnAttached(); this.AssociatedObject.Loaded += (sender, e) => { left = new GlowWindow(this.AssociatedObject, GlowDirection.Left); right = new GlowWindow(this.AssociatedObject, GlowDirection.Right); top = new GlowWindow(this.AssociatedObject, GlowDirection.Top); bottom = new GlowWindow(this.AssociatedObject, GlowDirection.Bottom); Show(); left.Update(); right.Update(); top.Update(); bottom.Update(); }; this.AssociatedObject.Closed += (sender, args) => { if (left != null) left.Close(); if (right != null) right.Close(); if (top != null) top.Close(); if (bottom != null) bottom.Close(); }; } public void Hide() { left.Hide(); right.Hide(); bottom.Hide(); top.Hide(); } public void Show() { left.Show(); right.Show(); top.Show(); bottom.Show(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Interactivity; using MahApps.Metro.Controls; namespace MahApps.Metro.Behaviours { public class GlowWindowBehavior : Behavior<Window> { private GlowWindow left, right, top, bottom; protected override void OnAttached() { base.OnAttached(); this.AssociatedObject.Loaded += (sender, e) => { left = new GlowWindow(this.AssociatedObject, GlowDirection.Left); right = new GlowWindow(this.AssociatedObject, GlowDirection.Right); top = new GlowWindow(this.AssociatedObject, GlowDirection.Top); bottom = new GlowWindow(this.AssociatedObject, GlowDirection.Bottom); left.Owner = (MetroWindow)sender; right.Owner = (MetroWindow)sender; top.Owner = (MetroWindow)sender; bottom.Owner = (MetroWindow)sender; Show(); left.Update(); right.Update(); top.Update(); bottom.Update(); }; this.AssociatedObject.Closed += (sender, args) => { if (left != null) left.Close(); if (right != null) right.Close(); if (top != null) top.Close(); if (bottom != null) bottom.Close(); }; } public void Hide() { left.Hide(); right.Hide(); bottom.Hide(); top.Hide(); } public void Show() { left.Show(); right.Show(); top.Show(); bottom.Show(); } } }
Fix The GlowWindow in the taskmanager
Fix The GlowWindow in the taskmanager
C#
mit
Danghor/MahApps.Metro,xxMUROxx/MahApps.Metro,psinl/MahApps.Metro,Jack109/MahApps.Metro,batzen/MahApps.Metro,Evangelink/MahApps.Metro,MahApps/MahApps.Metro,jumulr/MahApps.Metro,p76984275/MahApps.Metro,pfattisc/MahApps.Metro,chuuddo/MahApps.Metro,ye4241/MahApps.Metro
6db044cc6c5d7a9fb8ef03c1bcfe5b3d37cc85e1
WebPlayer/Mobile/Default.aspx.cs
WebPlayer/Mobile/Default.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; namespace WebPlayer.Mobile { public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string origUrl = Request.QueryString.Get("origUrl"); int queryPos = origUrl.IndexOf("Play.aspx?"); if (queryPos != -1) { var origUrlValues = HttpUtility.ParseQueryString(origUrl.Substring(origUrl.IndexOf("?"))); string id = origUrlValues.Get("id"); Response.Redirect("Play.aspx?id=" + id); return; } Response.Clear(); Response.StatusCode = 404; Response.End(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; namespace WebPlayer.Mobile { public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string origUrl = Request.QueryString.Get("origUrl"); int queryPos = origUrl.IndexOf("Play.aspx?"); if (queryPos != -1) { var origUrlValues = HttpUtility.ParseQueryString(origUrl.Substring(origUrl.IndexOf("?"))); string id = origUrlValues.Get("id"); if (!string.IsNullOrEmpty(id)) { Response.Redirect("Play.aspx?id=" + id); return; } string load = origUrlValues.Get("load"); if (!string.IsNullOrEmpty(load)) { Response.Redirect("Play.aspx?load=" + load); return; } } Response.Clear(); Response.StatusCode = 404; Response.End(); } } }
Fix broken redirect when restoring game on mobile
Fix broken redirect when restoring game on mobile
C#
mit
siege918/quest,siege918/quest,siege918/quest,textadventures/quest,textadventures/quest,F2Andy/quest,siege918/quest,F2Andy/quest,textadventures/quest,textadventures/quest,F2Andy/quest
ecf8f05331c7cbb385fa0cfdd80c3c013edf8631
SeleniumTasksProject1.1/SeleniumTasksProject1.1/InternetExplorer.cs
SeleniumTasksProject1.1/SeleniumTasksProject1.1/InternetExplorer.cs
using System; using System.Text; using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenQA.Selenium; using OpenQA.Selenium.IE; using OpenQA.Selenium.Support.UI; using NUnit.Framework; namespace SeleniumTasksProject1._1 { [TestFixture] public class InternetExplorer { private IWebDriver driver; private WebDriverWait wait; [SetUp] public void start() { driver = new InternetExplorerDriver(); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); } [Test] public void LoginTestInInternetExplorer() { driver.Url = "http://localhost:8082/litecart/admin/"; } [TearDown] public void stop() { driver.Quit(); driver = null; } } }
using System; using System.Text; using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenQA.Selenium; using OpenQA.Selenium.IE; using OpenQA.Selenium.Support.UI; using NUnit.Framework; namespace SeleniumTasksProject1._1 { [TestFixture] public class InternetExplorer { private IWebDriver driver; private WebDriverWait wait; [SetUp] public void start() { driver = new InternetExplorerDriver(); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); } [Test] public void LoginTestInInternetExplorer() { driver.Url = "http://localhost:8082/litecart/admin/"; driver.FindElement(By.Name("username")).SendKeys("admin"); driver.FindElement(By.Name("password")).SendKeys("admin"); driver.FindElement(By.Name("login")).Click(); //wait.Until(ExpectedConditions.TitleIs("My Store")); } [TearDown] public void stop() { driver.Quit(); driver = null; } } }
Revert "Revert "LoginTest is completed""
Revert "Revert "LoginTest is completed"" This reverts commit c76b8f73e61cd34ff62c1748821ef070987b7869.
C#
apache-2.0
oleksandrp1/SeleniumTasks
e0187ecf7a3bc913b757767344065226771d5ea3
Libraries/Triggers/DisposeAction.cs
Libraries/Triggers/DisposeAction.cs
/* ------------------------------------------------------------------------- */ // // Copyright (c) 2010 CubeSoft, 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. // /* ------------------------------------------------------------------------- */ using System; using System.Windows; using System.Windows.Interactivity; namespace Cube.Xui.Behaviors { /* --------------------------------------------------------------------- */ /// /// DisposeAction /// /// <summary> /// DataContext の開放処理を実行する TriggerAction です。 /// </summary> /// /* --------------------------------------------------------------------- */ public class DisposeAction : TriggerAction<FrameworkElement> { /* ----------------------------------------------------------------- */ /// /// Invoke /// /// <summary> /// 処理を実行します。 /// </summary> /// /* ----------------------------------------------------------------- */ protected override void Invoke(object notused) { if (AssociatedObject.DataContext is IDisposable dc) dc.Dispose(); AssociatedObject.DataContext = null; } } }
/* ------------------------------------------------------------------------- */ // // Copyright (c) 2010 CubeSoft, 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. // /* ------------------------------------------------------------------------- */ using System; using System.Windows; using System.Windows.Interactivity; namespace Cube.Xui.Behaviors { /* --------------------------------------------------------------------- */ /// /// DisposeAction /// /// <summary> /// DataContext の開放処理を実行する TriggerAction です。 /// </summary> /// /* --------------------------------------------------------------------- */ public class DisposeAction : TriggerAction<FrameworkElement> { /* ----------------------------------------------------------------- */ /// /// Invoke /// /// <summary> /// 処理を実行します。 /// </summary> /// /* ----------------------------------------------------------------- */ protected override void Invoke(object notused) { var dc = AssociatedObject.DataContext as IDisposable; AssociatedObject.DataContext = null; dc?.Dispose(); } } }
Fix for disposing DataContext object.
Fix for disposing DataContext object.
C#
apache-2.0
cube-soft/Cube.Core,cube-soft/Cube.Core
fd70b866560b660726bfca8855599e13ac9dd9a0
src/Booma.Proxy.Packets.BlockServer/Payloads/Client/Subpayloads/Command60/Sub60FinishedWarpingBurstingPayload.cs
src/Booma.Proxy.Packets.BlockServer/Payloads/Client/Subpayloads/Command60/Sub60FinishedWarpingBurstingPayload.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma.Proxy { /// <summary> /// Payload that tells the server we've finsihed loading/bursting/warping. /// We should have sent a warp request to the server before this so it should know where we /// were going. /// </summary> [WireDataContract] [SubCommand60Client(SubCommand60OperationCode.EnterFreshlyWrappedZoneCommand)] public sealed class Sub60FinishedWarpingBurstingPayload : BlockNetworkCommandEventClientPayload { //Packet is empty. Just tells the server we bursted/warped finished. public Sub60FinishedWarpingBurstingPayload() { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma.Proxy { /// <summary> /// Payload that tells the server we've finsihed loading/bursting/warping. /// We should have sent a warp request to the server before this so it should know where we /// were going. /// </summary> [WireDataContract] [SubCommand60Client(SubCommand60OperationCode.EnterFreshlyWrappedZoneCommand)] public sealed class Sub60FinishedWarpingBurstingPayload : BlockNetworkCommandEventClientPayload { //Packet is empty. Just tells the server we bursted/warped finished. //TODO: Is this client id? [WireMember(1)] private short unk { get; } public Sub60FinishedWarpingBurstingPayload() { } } }
Add missing field to FinishedWarp
Add missing field to FinishedWarp
C#
agpl-3.0
HelloKitty/Booma.Proxy
26f3a32cd61ba56f4dff1acc38acc67f67782616
src/CommonAssemblyInfo.cs
src/CommonAssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Yevgeniy Shunevych")] [assembly: AssemblyProduct("Atata")] [assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2016")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("0.7.0.0")] [assembly: AssemblyFileVersion("0.7.0.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Yevgeniy Shunevych")] [assembly: AssemblyProduct("Atata")] [assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2016")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("0.8.0.0")] [assembly: AssemblyFileVersion("0.8.0.0")]
Increase project version number to 0.8
Increase project version number to 0.8
C#
apache-2.0
YevgeniyShunevych/Atata,atata-framework/atata,atata-framework/atata,YevgeniyShunevych/Atata
e1d22e58bfbd03c6d8c198460711860ae1c23fb1
osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs
osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Rooms; namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist { public class MultiplayerPlaylistTabControl : OsuTabControl<MultiplayerPlaylistDisplayMode> { public readonly IBindableList<PlaylistItem> QueueItems = new BindableList<PlaylistItem>(); protected override TabItem<MultiplayerPlaylistDisplayMode> CreateTabItem(MultiplayerPlaylistDisplayMode value) { if (value == MultiplayerPlaylistDisplayMode.Queue) return new QueueTabItem { QueueItems = { BindTarget = QueueItems } }; return base.CreateTabItem(value); } private class QueueTabItem : OsuTabItem { public readonly IBindableList<PlaylistItem> QueueItems = new BindableList<PlaylistItem>(); public QueueTabItem() : base(MultiplayerPlaylistDisplayMode.Queue) { } protected override void LoadComplete() { base.LoadComplete(); QueueItems.BindCollectionChanged((_,__) => { Text.Text = $"Queue"; if (QueueItems.Count != 0) Text.Text += $" ({QueueItems.Count})"; }, 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.Framework.Bindables; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Rooms; namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist { public class MultiplayerPlaylistTabControl : OsuTabControl<MultiplayerPlaylistDisplayMode> { public readonly IBindableList<PlaylistItem> QueueItems = new BindableList<PlaylistItem>(); protected override TabItem<MultiplayerPlaylistDisplayMode> CreateTabItem(MultiplayerPlaylistDisplayMode value) { if (value == MultiplayerPlaylistDisplayMode.Queue) return new QueueTabItem { QueueItems = { BindTarget = QueueItems } }; return base.CreateTabItem(value); } private class QueueTabItem : OsuTabItem { public readonly IBindableList<PlaylistItem> QueueItems = new BindableList<PlaylistItem>(); public QueueTabItem() : base(MultiplayerPlaylistDisplayMode.Queue) { } protected override void LoadComplete() { base.LoadComplete(); QueueItems.BindCollectionChanged((_, __) => Text.Text = QueueItems.Count > 0 ? $"Queue ({QueueItems.Count})" : "Queue", true); } } } }
Simplify queue count text logic
Simplify queue count text logic
C#
mit
peppy/osu,ppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu
10348af50fc26b09ec12fab5f865cdab07dd4e7c
tests/cs/foreach/Foreach.cs
tests/cs/foreach/Foreach.cs
using System; using System.Collections.Generic; public class Enumerator { public Enumerator() { } public int Current { get; private set; } = 10; public bool MoveNext() { Current--; return Current > 0; } public void Dispose() { Console.WriteLine("Hi!"); } } public class Enumerable { public Enumerable() { } public Enumerator GetEnumerator() { return new Enumerator(); } } public static class Program { public static Enumerable StaticEnumerable = new Enumerable(); public static void Main(string[] Args) { var col = Args; foreach (var item in col) Console.WriteLine(item); foreach (var item in new List<string>(Args)) Console.WriteLine(item); foreach (var item in StaticEnumerable) Console.WriteLine(item); } }
using System; using System.Collections.Generic; public class Enumerator { public Enumerator() { } public int Current { get; private set; } = 10; public bool MoveNext() { Current--; return Current > 0; } public void Dispose() { Console.WriteLine("Hi!"); } } public class Enumerable { public Enumerable() { } public Enumerator GetEnumerator() { return new Enumerator(); } } public static class Program { public static Enumerable StaticEnumerable = new Enumerable(); public static void Main(string[] Args) { var col = Args; foreach (var item in col) Console.WriteLine(item); foreach (var item in new List<string>(Args)) Console.WriteLine(item); foreach (var item in StaticEnumerable) Console.WriteLine(item); foreach (string item in new List<object>()) Console.WriteLine(item); } }
Add a foreach induction variable cast test
Add a foreach induction variable cast test
C#
mit
jonathanvdc/ecsc
2975ea9210a7e329a2ae35dfb7f0ef57a283fd74
osu.Game.Rulesets.Osu/Objects/SliderEndCircle.cs
osu.Game.Rulesets.Osu/Objects/SliderEndCircle.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.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects { /// <summary> /// A hitcircle which is at the end of a slider path (either repeat or final tail). /// </summary> public abstract class SliderEndCircle : HitCircle { public int RepeatIndex { get; set; } public double SpanDuration { get; set; } protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); // Out preempt should be one span early to give the user ample warning. TimePreempt += SpanDuration; // We want to show the first RepeatPoint as the TimePreempt dictates but on short (and possibly fast) sliders // we may need to cut down this time on following RepeatPoints to only show up to two RepeatPoints at any given time. if (RepeatIndex > 0) TimePreempt = Math.Min(SpanDuration * 2, TimePreempt); } protected override HitWindows CreateHitWindows() => HitWindows.Empty; } }
// 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.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects { /// <summary> /// A hitcircle which is at the end of a slider path (either repeat or final tail). /// </summary> public abstract class SliderEndCircle : HitCircle { public int RepeatIndex { get; set; } public double SpanDuration { get; set; } protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); if (RepeatIndex > 0) { // Repeat points after the first span should appear behind the still-visible one. TimeFadeIn = 0; // The next end circle should appear exactly after the previous circle (on the same end) is hit. TimePreempt = SpanDuration * 2; } } protected override HitWindows CreateHitWindows() => HitWindows.Empty; } }
Adjust repeat/tail fade in to match stable closer
Adjust repeat/tail fade in to match stable closer
C#
mit
UselessToucan/osu,peppy/osu-new,ppy/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu
62be3861971382632dea63eddb5adefc17a7974d
src/SFA.DAS.Payments.AcceptanceTests/Assertions/TransactionTypeRules/TransactionTypeRuleBase.cs
src/SFA.DAS.Payments.AcceptanceTests/Assertions/TransactionTypeRules/TransactionTypeRuleBase.cs
using System; using System.Collections.Generic; using System.Linq; using SFA.DAS.Payments.AcceptanceTests.Contexts; using SFA.DAS.Payments.AcceptanceTests.ReferenceDataModels; using SFA.DAS.Payments.AcceptanceTests.ResultsDataModels; namespace SFA.DAS.Payments.AcceptanceTests.Assertions.TransactionTypeRules { public abstract class TransactionTypeRuleBase { public virtual void AssertPeriodValues(IEnumerable<PeriodValue> periodValues, LearnerResults[] submissionResults, EmployerAccountContext employerAccountContext) { foreach (var period in periodValues) { var payments = FilterPayments(period, submissionResults, employerAccountContext); var paidInPeriod = payments.Sum(p => p.Amount); if (period.Value != paidInPeriod) { throw new Exception(FormatAssertionFailureMessage(period, paidInPeriod)); } } } protected abstract IEnumerable<PaymentResult> FilterPayments(PeriodValue period, IEnumerable<LearnerResults> submissionResults, EmployerAccountContext employerAccountContext); protected abstract string FormatAssertionFailureMessage(PeriodValue period, decimal actualPaymentInPeriod); } }
using System; using System.Collections.Generic; using System.Linq; using SFA.DAS.Payments.AcceptanceTests.Contexts; using SFA.DAS.Payments.AcceptanceTests.ReferenceDataModels; using SFA.DAS.Payments.AcceptanceTests.ResultsDataModels; namespace SFA.DAS.Payments.AcceptanceTests.Assertions.TransactionTypeRules { public abstract class TransactionTypeRuleBase { public virtual void AssertPeriodValues(IEnumerable<PeriodValue> periodValues, LearnerResults[] submissionResults, EmployerAccountContext employerAccountContext) { foreach (var period in periodValues) { var payments = FilterPayments(period, submissionResults, employerAccountContext); var paidInPeriod = payments.Sum(p => p.Amount); if(Math.Round(paidInPeriod, 2) != Math.Round(period.Value, 2)) { throw new Exception(FormatAssertionFailureMessage(period, paidInPeriod)); } } } protected abstract IEnumerable<PaymentResult> FilterPayments(PeriodValue period, IEnumerable<LearnerResults> submissionResults, EmployerAccountContext employerAccountContext); protected abstract string FormatAssertionFailureMessage(PeriodValue period, decimal actualPaymentInPeriod); } }
Fix issue with precision in assertions
Fix issue with precision in assertions
C#
mit
SkillsFundingAgency/das-paymentsacceptancetesting
170be79da78f8427ee1b932314d208b6584f3313
osu.Framework/Threading/SchedulerSynchronizationContext.cs
osu.Framework/Threading/SchedulerSynchronizationContext.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.Threading; #nullable enable namespace osu.Framework.Threading { /// <summary> /// A synchronisation context which posts all continuatiuons to a scheduler instance. /// </summary> internal class SchedulerSynchronizationContext : SynchronizationContext { private readonly Scheduler scheduler; public SchedulerSynchronizationContext(Scheduler scheduler) { this.scheduler = scheduler; } public override void Send(SendOrPostCallback d, object? state) => scheduler.Add(() => d(state), false); public override void Post(SendOrPostCallback d, object? state) => scheduler.Add(() => d(state), 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 System.Diagnostics; using System.Threading; #nullable enable namespace osu.Framework.Threading { /// <summary> /// A synchronisation context which posts all continuatiuons to a scheduler instance. /// </summary> internal class SchedulerSynchronizationContext : SynchronizationContext { private readonly Scheduler scheduler; public SchedulerSynchronizationContext(Scheduler scheduler) { this.scheduler = scheduler; } public override void Send(SendOrPostCallback d, object? state) { var del = scheduler.Add(() => d(state)); Debug.Assert(del != null); while (del.State == ScheduledDelegate.RunState.Waiting) scheduler.Update(); } public override void Post(SendOrPostCallback d, object? state) => scheduler.Add(() => d(state)); } }
Fix `SynchronizationContext` to match correctly implementation structure
Fix `SynchronizationContext` to match correctly implementation structure `Send` is supposed to block until the work completes (and run all previous work). `Post` is supposed to fire-and-forget. Both cases need to ensure correct execution order.
C#
mit
smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework
2964d6b5b9ce9d76b818880be7b47c1dea848c0b
Tests/Boilerplate.Templates.Test/Framework/TempDirectoryExtensions.cs
Tests/Boilerplate.Templates.Test/Framework/TempDirectoryExtensions.cs
namespace Boilerplate.Templates.Test { using System; using System.IO; using System.Threading.Tasks; public static class TempDirectoryExtensions { public static async Task<Project> DotnetNew( this TempDirectory tempDirectory, string templateName, string name = null, TimeSpan? timeout = null) { await ProcessAssert.AssertStart(tempDirectory.DirectoryPath, "dotnet", $"new {templateName} --name \"{name}\"", timeout ?? TimeSpan.FromSeconds(20)); var projectDirectoryPath = Path.Combine(tempDirectory.DirectoryPath, name); var projectFilePath = Path.Combine(projectDirectoryPath, name + ".csproj"); var publishDirectoryPath = Path.Combine(projectDirectoryPath, "Publish"); return new Project(name, projectFilePath, projectDirectoryPath, publishDirectoryPath); } } }
namespace Boilerplate.Templates.Test { using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Threading.Tasks; public static class TempDirectoryExtensions { public static async Task<Project> DotnetNew( this TempDirectory tempDirectory, string templateName, string name, IDictionary<string, string> arguments = null, TimeSpan? timeout = null) { var stringBuilder = new StringBuilder($"new {templateName} --name \"{name}\""); if (arguments != null) { foreach (var argument in arguments) { stringBuilder.Append($" --{argument.Key} \"{argument.Value}\""); } } await ProcessAssert.AssertStart( tempDirectory.DirectoryPath, "dotnet", stringBuilder.ToString(), timeout ?? TimeSpan.FromSeconds(20)); var projectDirectoryPath = Path.Combine(tempDirectory.DirectoryPath, name); var projectFilePath = Path.Combine(projectDirectoryPath, name + ".csproj"); var publishDirectoryPath = Path.Combine(projectDirectoryPath, "Publish"); return new Project(name, projectFilePath, projectDirectoryPath, publishDirectoryPath); } } }
Add optional dotnet new arguments
Add optional dotnet new arguments
C#
mit
RehanSaeed/ASP.NET-MVC-Boilerplate,RehanSaeed/ASP.NET-MVC-Boilerplate,ASP-NET-Core-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates,ASP-NET-Core-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates,RehanSaeed/ASP.NET-MVC-Boilerplate,ASP-NET-Core-Boilerplate/Templates
927a4b299872989d5e73b38e297a8ef7bb78fcd0
src/MiniCover.HitServices/HitService.cs
src/MiniCover.HitServices/HitService.cs
using System; using System.IO; namespace MiniCover.HitServices { public static class HitService { public static MethodContext EnterMethod( string hitsPath, string assemblyName, string className, string methodName) { return new MethodContext(hitsPath, assemblyName, className, methodName); } public class MethodContext : IDisposable { private readonly string _hitsPath; private readonly HitContext _hitContext; private readonly bool _saveHitContext; public MethodContext( string hitsPath, string assemblyName, string className, string methodName) { _hitsPath = hitsPath; if (HitContext.Current == null) { _hitContext = new HitContext(assemblyName, className, methodName); HitContext.Current = _hitContext; _saveHitContext = true; } else { _hitContext = HitContext.Current; } } public void HitInstruction(int id) { _hitContext.RecordHit(id); } public void Dispose() { if (_saveHitContext) { Directory.CreateDirectory(_hitsPath); var filePath = Path.Combine(_hitsPath, $"{Guid.NewGuid()}.hits"); using (var fileStream = File.Open(filePath, FileMode.CreateNew)) { _hitContext.Serialize(fileStream); fileStream.Flush(); } HitContext.Current = null; } } } } }
using System; using System.Collections.Concurrent; using System.IO; namespace MiniCover.HitServices { public static class HitService { public static MethodContext EnterMethod( string hitsPath, string assemblyName, string className, string methodName) { return new MethodContext(hitsPath, assemblyName, className, methodName); } public class MethodContext : IDisposable { private static ConcurrentDictionary<string, Stream> _filesStream = new ConcurrentDictionary<string, Stream>(); private readonly string _hitsPath; private readonly HitContext _hitContext; private readonly bool _saveHitContext; public MethodContext( string hitsPath, string assemblyName, string className, string methodName) { _hitsPath = hitsPath; if (HitContext.Current == null) { _hitContext = new HitContext(assemblyName, className, methodName); HitContext.Current = _hitContext; _saveHitContext = true; } else { _hitContext = HitContext.Current; } } public void HitInstruction(int id) { _hitContext.RecordHit(id); } public void Dispose() { if (_saveHitContext) { var fileStream = _filesStream.GetOrAdd(_hitsPath, CreateOutputFile); lock (fileStream) { _hitContext.Serialize(fileStream); fileStream.Flush(); } HitContext.Current = null; } } private static FileStream CreateOutputFile(string hitsPath) { Directory.CreateDirectory(hitsPath); var filePath = Path.Combine(hitsPath, $"{Guid.NewGuid()}.hits"); return File.Open(filePath, FileMode.CreateNew); } } } }
Create only 1 hit file per running process
Create only 1 hit file per running process
C#
mit
lucaslorentz/minicover,lucaslorentz/minicover,lucaslorentz/minicover
b9b8d3d655dafb6417172838970c6e41ed0eb1e5
src/CompetitionPlatform/Data/BlogCategory/BlogCategoriesRepository.cs
src/CompetitionPlatform/Data/BlogCategory/BlogCategoriesRepository.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace CompetitionPlatform.Data.BlogCategory { public class BlogCategoriesRepository : IBlogCategoriesRepository { public List<string> GetCategories() { return new List<string> { "News", "Results", "Winners", "Success stories", "Videos", "About" }; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace CompetitionPlatform.Data.BlogCategory { public class BlogCategoriesRepository : IBlogCategoriesRepository { public List<string> GetCategories() { return new List<string> { "News", "Results", "Winners", "Success stories", "Videos", "About", "Tutorials" }; } } }
Add tutorials to blog categories.
Add tutorials to blog categories.
C#
mit
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
7062b0aa1db962eb02f7abc42e51e27f77547301
LibGit2Sharp/Core/Epoch.cs
LibGit2Sharp/Core/Epoch.cs
using System; namespace LibGit2Sharp.Core { /// <summary> /// Provides helper methods to help converting between Epoch (unix timestamp) and <see cref="DateTimeOffset"/>. /// </summary> internal static class Epoch { private static readonly DateTimeOffset epochDateTimeOffset = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); /// <summary> /// Builds a <see cref="DateTimeOffset"/> from a Unix timestamp and a timezone offset. /// </summary> /// <param name="secondsSinceEpoch">The number of seconds since 00:00:00 UTC on 1 January 1970.</param> /// <param name="timeZoneOffsetInMinutes">The number of minutes from UTC in a timezone.</param> /// <returns>A <see cref="DateTimeOffset"/> representing this instant.</returns> public static DateTimeOffset ToDateTimeOffset(long secondsSinceEpoch, int timeZoneOffsetInMinutes) { DateTimeOffset utcDateTime = epochDateTimeOffset.AddSeconds(secondsSinceEpoch); TimeSpan offset = TimeSpan.FromMinutes(timeZoneOffsetInMinutes); return new DateTimeOffset(utcDateTime.DateTime.Add(offset), offset); } /// <summary> /// Converts the<see cref="DateTimeOffset.UtcDateTime"/> part of a <see cref="DateTimeOffset"/> into a Unix timestamp. /// </summary> /// <param name="date">The <see cref="DateTimeOffset"/> to convert.</param> /// <returns>The number of seconds since 00:00:00 UTC on 1 January 1970.</returns> public static Int32 ToSecondsSinceEpoch(this DateTimeOffset date) { DateTimeOffset utcDate = date.ToUniversalTime(); return (Int32)utcDate.Subtract(epochDateTimeOffset).TotalSeconds; } } }
using System; namespace LibGit2Sharp.Core { /// <summary> /// Provides helper methods to help converting between Epoch (unix timestamp) and <see cref="DateTimeOffset"/>. /// </summary> internal static class Epoch { /// <summary> /// Builds a <see cref="DateTimeOffset"/> from a Unix timestamp and a timezone offset. /// </summary> /// <param name="secondsSinceEpoch">The number of seconds since 00:00:00 UTC on 1 January 1970.</param> /// <param name="timeZoneOffsetInMinutes">The number of minutes from UTC in a timezone.</param> /// <returns>A <see cref="DateTimeOffset"/> representing this instant.</returns> public static DateTimeOffset ToDateTimeOffset(long secondsSinceEpoch, int timeZoneOffsetInMinutes) => DateTimeOffset.FromUnixTimeSeconds(secondsSinceEpoch).ToOffset(TimeSpan.FromMinutes(timeZoneOffsetInMinutes)); /// <summary> /// Converts the<see cref="DateTimeOffset.UtcDateTime"/> part of a <see cref="DateTimeOffset"/> into a Unix timestamp. /// </summary> /// <param name="date">The <see cref="DateTimeOffset"/> to convert.</param> /// <returns>The number of seconds since 00:00:00 UTC on 1 January 1970.</returns> public static Int32 ToSecondsSinceEpoch(this DateTimeOffset date) => (int)date.ToUnixTimeSeconds(); } }
Replace helper implementation with DateOffset members
Replace helper implementation with DateOffset members
C#
mit
PKRoma/libgit2sharp,libgit2/libgit2sharp
660cb641b7395b99db6c0a8e8c68beafe65d3c46
Views/Widgets/BooleanRadioButton.cs
Views/Widgets/BooleanRadioButton.cs
using System; namespace Views { [System.ComponentModel.ToolboxItem(true)] public partial class BooleanRadioButton : Gtk.Bin, IEditable { String[] labels; bool isEditable; public BooleanRadioButton () { this.Build (); } public String[] Labels { get { return this.labels; } set { labels = value; radiobutton_true.Label = labels[0]; radiobutton_false.Label = labels[1]; } } public bool Value () { if (radiobutton_true.Active) return true; else return false; } public bool IsEditable { get { return this.isEditable; } set { isEditable = value; radiobutton_true.Visible = value; radiobutton_false.Visible = value; text.Visible = !value; text.Text = radiobutton_true.Active ? labels[0] : labels[1]; } } public new bool Activate { get { return Value (); } set { bool state = value; if (state) radiobutton_true.Activate (); else radiobutton_false.Activate (); } } } }
using System; namespace Views { [System.ComponentModel.ToolboxItem(true)] public partial class BooleanRadioButton : Gtk.Bin, IEditable { String[] labels; bool isEditable; public BooleanRadioButton () { this.Build (); } public String[] Labels { get { return this.labels; } set { labels = value; radiobutton_true.Label = labels[0]; radiobutton_false.Label = labels[1]; } } public bool Value () { if (radiobutton_true.Active) return true; else return false; } public bool IsEditable { get { return this.isEditable; } set { isEditable = value; radiobutton_true.Visible = value; radiobutton_false.Visible = value; text.Visible = !value; text.Text = radiobutton_true.Active ? labels[0] : labels[1]; } } public new bool Activate { get { return Value (); } set { bool state = value; if (state) { radiobutton_true.Active = true; } else { radiobutton_false.Active = true; } } } } }
Fix RadioButtons, need to use Active insted of Activate.
Fix RadioButtons, need to use Active insted of Activate.
C#
lgpl-2.1
monsterlabs/HumanRightsTracker,monsterlabs/HumanRightsTracker,monsterlabs/HumanRightsTracker,monsterlabs/HumanRightsTracker,monsterlabs/HumanRightsTracker
7c90e6b379581049c235d9ac1da7e7a38b0d2e57
Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs
Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs
using System.Collections.Generic; using Promact.Trappist.DomainModel.Models.Question; using System.Linq; using Promact.Trappist.DomainModel.DbContext; namespace Promact.Trappist.Repository.Questions { public class QuestionRepository : IQuestionRespository { private readonly TrappistDbContext _dbContext; public QuestionRepository(TrappistDbContext dbContext) { _dbContext = dbContext; } /// <summary> /// Get all questions /// </summary> /// <returns>Question list</returns> public List<SingleMultipleAnswerQuestion> GetAllQuestions() { var question = _dbContext.SingleMultipleAnswerQuestion.ToList(); return question; } /// <summary> /// Add single multiple answer question into model /// </summary> /// <param name="singleMultipleAnswerQuestion"></param> /// <param name="singleMultipleAnswerQuestionOption"></param> public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption) { _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion); foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption) { singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id; _dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement); } _dbContext.SaveChanges(); } } }
using System.Collections.Generic; using Promact.Trappist.DomainModel.Models.Question; using System.Linq; using Promact.Trappist.DomainModel.DbContext; namespace Promact.Trappist.Repository.Questions { public class QuestionRepository : IQuestionRespository { private readonly TrappistDbContext _dbContext; public QuestionRepository(TrappistDbContext dbContext) { _dbContext = dbContext; } /// <summary> /// Get all questions /// </summary> /// <returns>Question list</returns> public List<SingleMultipleAnswerQuestion> GetAllQuestions() { var question = _dbContext.SingleMultipleAnswerQuestion.ToList(); return question; } /// <summary> /// Add single multiple answer question into model /// </summary> /// <param name="singleMultipleAnswerQuestion"></param> /// <param name="singleMultipleAnswerQuestionOption"></param> public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption) { _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion); foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption) { singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id; _dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement); } _dbContext.SaveChanges(); } } }
Update server side API for single multiple answer question
Update server side API for single multiple answer question
C#
mit
Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist
20413b9a921b8629be53a36c50d55a78febcbda2
Markel.REMUS.DesignSystem.Web/Components/cookies-disabled/template/cookiesDisabledMessage.cshtml
Markel.REMUS.DesignSystem.Web/Components/cookies-disabled/template/cookiesDisabledMessage.cshtml
<article id="cookies-disabled-panel" class="panel-inverse"> <h1>Cookies are disabled</h1> <section> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum </section> </br> </br> </article>
<article id="cookies-disabled-panel" class="panel-inverse"> <h1>@Text.Content.CookiesDisabledHeading</h1> <section> @Text.Content.CookiesDisabledDetails </section> </br> </br> </article>
Use localized content for cookies disabled message
C1566: Use localized content for cookies disabled message
C#
mit
markeldigital/design-system,markeldigital/design-system,markeldigital/design-system,markeldigital/design-system,markeldigital/design-system
f968a31ebf964215e8493997589d21252f9d413a
src/UnityExtension/Assets/Editor/GitHub.Unity/IO/DefaultEnvironment.cs
src/UnityExtension/Assets/Editor/GitHub.Unity/IO/DefaultEnvironment.cs
using System; using System.IO; namespace GitHub.Unity { class DefaultEnvironment : IEnvironment { public string GetSpecialFolder(Environment.SpecialFolder folder) { return Environment.GetFolderPath(folder); } public string ExpandEnvironmentVariables(string name) { return Environment.ExpandEnvironmentVariables(name); } public string GetEnvironmentVariable(string variable) { return Environment.GetEnvironmentVariable(variable); } public string UserProfilePath { get { return Environment.GetEnvironmentVariable("USERPROFILE"); } } public string Path { get { return Environment.GetEnvironmentVariable("PATH"); } } public string NewLine { get { return Environment.NewLine; } } public string GitInstallPath { get; set; } public bool IsWindows { get { return !IsLinux && !IsMac; } } public bool IsLinux { get { return Environment.OSVersion.Platform == PlatformID.Unix && Directory.Exists("/proc"); } } public bool IsMac { get { // most likely it'll return the proper id but just to be on the safe side, have a fallback return Environment.OSVersion.Platform == PlatformID.MacOSX || (Environment.OSVersion.Platform == PlatformID.Unix && !Directory.Exists("/proc")); } } } }
using System; using System.IO; namespace GitHub.Unity { class DefaultEnvironment : IEnvironment { public string GetSpecialFolder(Environment.SpecialFolder folder) { return Environment.GetFolderPath(folder); } public string ExpandEnvironmentVariables(string name) { return Environment.ExpandEnvironmentVariables(name); } public string GetEnvironmentVariable(string variable) { return Environment.GetEnvironmentVariable(variable); } public string UserProfilePath { get { return Environment.GetEnvironmentVariable("USERPROFILE"); } } public string Path { get { return Environment.GetEnvironmentVariable("PATH"); } } public string NewLine { get { return Environment.NewLine; } } public string GitInstallPath { get; set; } public bool IsWindows { get { return Environment.OSVersion.Platform != PlatformID.Unix && Environment.OSVersion.Platform != PlatformID.MacOSX; } } public bool IsLinux { get { return Environment.OSVersion.Platform == PlatformID.Unix && Directory.Exists("/proc"); } } public bool IsMac { get { // most likely it'll return the proper id but just to be on the safe side, have a fallback return Environment.OSVersion.Platform == PlatformID.MacOSX || (Environment.OSVersion.Platform == PlatformID.Unix && !Directory.Exists("/proc")); } } } }
Optimize windows platform detection code
Optimize windows platform detection code
C#
mit
github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity,mpOzelot/Unity,mpOzelot/Unity
88ed56836d926d141d945210b21b7111b5da3d82
src/Microsoft.ApplicationInsights.AspNetCore/Properties/AssemblyInfo.cs
src/Microsoft.ApplicationInsights.AspNetCore/Properties/AssemblyInfo.cs
using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.AspNetCore.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.AspNetCore.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] [assembly: ComVisible(false)]
Make project comvisible explicitly set to false to meet compliance requirements.
Make project comvisible explicitly set to false to meet compliance requirements.
C#
mit
Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnet5
473407d2a12c8f36b2ba7ea1d5cc2bc7e39d4dda
src/Stripe.net/Entities/Issuing/Authorizations/AuthorizationControls.cs
src/Stripe.net/Entities/Issuing/Authorizations/AuthorizationControls.cs
namespace Stripe.Issuing { using System.Collections.Generic; using Newtonsoft.Json; public class AuthorizationControls : StripeEntity { [JsonProperty("allowed_categories")] public List<string> AllowedCategories { get; set; } [JsonProperty("blocked_categories")] public List<string> BlockedCategories { get; set; } [JsonProperty("currency")] public string Currency { get; set; } [JsonProperty("max_amount")] public long MaxAmount { get; set; } [JsonProperty("max_approvals")] public long MaxApprovals { get; set; } } }
namespace Stripe.Issuing { using System.Collections.Generic; using Newtonsoft.Json; public class AuthorizationControls : StripeEntity { [JsonProperty("allowed_categories")] public List<string> AllowedCategories { get; set; } [JsonProperty("blocked_categories")] public List<string> BlockedCategories { get; set; } [JsonProperty("currency")] public string Currency { get; set; } [JsonProperty("max_amount")] public long? MaxAmount { get; set; } [JsonProperty("max_approvals")] public long? MaxApprovals { get; set; } } }
Support nullable properties on authorization_controls
Support nullable properties on authorization_controls
C#
apache-2.0
richardlawley/stripe.net,stripe/stripe-dotnet
5284e17ecb7436cbfc2c1c3eb9cf50ff40474691
src/Feature/faq/code/Views/FAQ/FaqAccordion.cshtml
src/Feature/faq/code/Views/FAQ/FaqAccordion.cshtml
@using System.Web.Mvc.Html @using Sitecore.Feature.FAQ.Repositories @using Sitecore.Feature.FAQ @using Sitecore.Data.Items @model Sitecore.Mvc.Presentation.RenderingModel @{ var elements = GroupMemberRepository.Get(Model.Item).ToArray(); int i = 1; } @foreach (Item item in elements) { var ID = Guid.NewGuid().ToString(); <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#@ID"> @Html.Sitecore().Field(Templates.Faq.Fields.Question_FieldName, item) </a> </h4> </div> <div id=@ID class="panel-collapse collapse"> <div class="panel-body"> @Html.Sitecore().Field(Templates.Faq.Fields.Answer_FieldName,item) </div> </div> </div> <!-- /.panel --> </div> } @if (Sitecore.Context.PageMode.IsPageEditor) { <script> $('.panel-collapse').toggle(); </script> }
@using System.Web.Mvc.Html @using Sitecore.Feature.FAQ.Repositories @using Sitecore.Feature.FAQ @using Sitecore.Data.Items @model Sitecore.Mvc.Presentation.RenderingModel @{ var elements = GroupMemberRepository.Get(Model.Item).ToArray(); } @foreach (Item item in elements) { var ID = Guid.NewGuid().ToString(); <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingcollapse0"> <h4 class="panel-title"> <a role="button" class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#@ID"> <span class="glyphicon glyphicon-search" aria-hidden="true"></span> @Html.Sitecore().Field(Templates.Faq.Fields.Question_FieldName, item) </a> </h4> </div> <div id=@ID class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingcollapse0"> <div class="panel-body"> @Html.Sitecore().Field(Templates.Faq.Fields.Answer_FieldName,item) </div> </div> </div> <!-- /.panel --> </div> } @if (Sitecore.Context.PageMode.IsPageEditor) { <script> $('.panel-collapse').toggle(); </script> }
Change the HTML according to the new Habitat theming
Change the HTML according to the new Habitat theming
C#
apache-2.0
zyq524/Habitat,bhaveshmaniya/Habitat,nurunquebec/Habitat,GoranHalvarsson/Habitat,bhaveshmaniya/Habitat,ClearPeopleLtd/Habitat,GoranHalvarsson/Habitat,nurunquebec/Habitat,zyq524/Habitat,ClearPeopleLtd/Habitat
e1b99799eb9f206b624745fc12914f8c2d0f38c4
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("Autofac.Tests.Integration.Wcf")] [assembly: AssemblyDescription("")]
using System.Reflection; [assembly: AssemblyTitle("Autofac.Tests.Integration.Wcf")]
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
C#
mit
caioproiete/Autofac.Wcf,autofac/Autofac.Wcf
83e92f6ecff44d7be9a3c73a4a81f6a25b31acb8
DevTyr.Gullap.Tests/With_Converter/For_SetParser/When_argument_is_null.cs
DevTyr.Gullap.Tests/With_Converter/For_SetParser/When_argument_is_null.cs
using System; using NUnit.Framework; using DevTyr.Gullap; namespace DevTyr.Gullap.Tests.With_Converter.For_SetParser { [TestFixture] public class When_argument_is_null { [Test] public void Should_throw_argument_exception () { var converter = new Converter (new ConverterOptions { SitePath = "any" }); Assert.Throws<ArgumentException> (() => converter.SetParser (null)); } [Test] public void Should_throw_exception_with_proper_message () { var converter = new Converter (new ConverterOptions { SitePath = "any" }); Assert.Throws<ArgumentException> (() => converter.SetParser (null), "No valid parser given"); } } }
using System; using NUnit.Framework; using DevTyr.Gullap; namespace DevTyr.Gullap.Tests.With_Converter.For_SetParser { [TestFixture] public class When_argument_is_null { [Test] public void Should_throw_argument_null_exception () { var converter = new Converter (new ConverterOptions { SitePath = "any" }); Assert.Throws<ArgumentNullException> (() => converter.SetParser (null)); } [Test] public void Should_throw_exception_with_proper_message () { var converter = new Converter (new ConverterOptions { SitePath = "any" }); Assert.Throws<ArgumentNullException> (() => converter.SetParser (null), "No valid parser given"); } } }
Change exception type for null argument to ArgumentNullException.
Change exception type for null argument to ArgumentNullException.
C#
mit
devtyr/gullap
27e8c971d05ee4bd8600d46a250aac6de90610b6
WalletWasabi.Gui/Converters/StatusColorConvertor.cs
WalletWasabi.Gui/Converters/StatusColorConvertor.cs
using System; using System.Collections.Generic; using System.Globalization; using System.Text; using Avalonia.Data.Converters; using Avalonia.Media; using AvalonStudio.Extensibility.Theme; using WalletWasabi.Models; namespace WalletWasabi.Gui.Converters { public class StatusColorConvertor : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool isTor = Enum.TryParse(value.ToString(), out TorStatus tor); if (isTor && tor == TorStatus.NotRunning) { return Brushes.Red; } bool isBackend = Enum.TryParse(value.ToString(), out BackendStatus backend); if (isBackend && backend == BackendStatus.NotConnected) { return Brushes.Red; } return ColorTheme.CurrentTheme.Foreground; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotSupportedException(); } } }
using System; using System.Collections.Generic; using System.Globalization; using System.Text; using Avalonia.Data.Converters; using Avalonia.Media; using AvalonStudio.Extensibility.Theme; using WalletWasabi.Models; namespace WalletWasabi.Gui.Converters { public class StatusColorConvertor : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool isTor = Enum.TryParse(value.ToString(), out TorStatus tor); if (isTor && tor == TorStatus.NotRunning) { return Brushes.Yellow; } bool isBackend = Enum.TryParse(value.ToString(), out BackendStatus backend); if (isBackend && backend == BackendStatus.NotConnected) { return Brushes.Yellow; } return ColorTheme.CurrentTheme.Foreground; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotSupportedException(); } } }
Change statusbar errors to yellow
Change statusbar errors to yellow
C#
mit
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
3fba9ac775397a18cacb0524039283e0e6e9062a
FubarDev.WebDavServer.Props.Store.TextFile/TextFilePropertyStoreOptions.cs
FubarDev.WebDavServer.Props.Store.TextFile/TextFilePropertyStoreOptions.cs
// <copyright file="TextFilePropertyStoreOptions.cs" company="Fubar Development Junker"> // Copyright (c) Fubar Development Junker. All rights reserved. // </copyright> namespace FubarDev.WebDavServer.Props.Store.TextFile { public class TextFilePropertyStoreOptions { public int EstimatedCost { get; set; } public string RootFolder { get; set; } public bool StoreInTargetFileSystem { get; set; } } }
// <copyright file="TextFilePropertyStoreOptions.cs" company="Fubar Development Junker"> // Copyright (c) Fubar Development Junker. All rights reserved. // </copyright> namespace FubarDev.WebDavServer.Props.Store.TextFile { public class TextFilePropertyStoreOptions { public int EstimatedCost { get; set; } = 10; public string RootFolder { get; set; } public bool StoreInTargetFileSystem { get; set; } } }
Increase the estinated cost for the text file property store to 10 to avoid fetching all dead properties
Increase the estinated cost for the text file property store to 10 to avoid fetching all dead properties
C#
mit
FubarDevelopment/WebDavServer,FubarDevelopment/WebDavServer,FubarDevelopment/WebDavServer
deb74939afb981f12cbf0b84147dd04c87e3e612
src/Umbraco.Core/PropertyEditors/ValueConverters/DecimalValueConverter.cs
src/Umbraco.Core/PropertyEditors/ValueConverters/DecimalValueConverter.cs
using Umbraco.Core.Models.PublishedContent; namespace Umbraco.Core.PropertyEditors.ValueConverters { [PropertyValueType(typeof(decimal))] [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] public class DecimalValueConverter : PropertyValueConverterBase { public override bool IsConverter(PublishedPropertyType propertyType) { return Constants.PropertyEditors.DecimalAlias.Equals(propertyType.PropertyEditorAlias); } public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) { if (source == null) return 0M; // in XML a decimal is a string var sourceString = source as string; if (sourceString != null) { decimal d; return (decimal.TryParse(sourceString, out d)) ? d : 0M; } // in the database an a decimal is an a decimal // default value is zero return (source is decimal) ? source : 0M; } } }
using System.Globalization; using Umbraco.Core.Models.PublishedContent; namespace Umbraco.Core.PropertyEditors.ValueConverters { [PropertyValueType(typeof(decimal))] [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] public class DecimalValueConverter : PropertyValueConverterBase { public override bool IsConverter(PublishedPropertyType propertyType) { return Constants.PropertyEditors.DecimalAlias.Equals(propertyType.PropertyEditorAlias); } public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) { if (source == null) return 0M; // in XML a decimal is a string var sourceString = source as string; if (sourceString != null) { decimal d; return (decimal.TryParse(sourceString, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d)) ? d : 0M; } // in the database an a decimal is an a decimal // default value is zero return (source is decimal) ? source : 0M; } } }
Fix decimal property value converter to work on non EN-US cultures
U4-8365: Fix decimal property value converter to work on non EN-US cultures
C#
mit
robertjf/Umbraco-CMS,Phosworks/Umbraco-CMS,WebCentrum/Umbraco-CMS,rasmusfjord/Umbraco-CMS,NikRimington/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Phosworks/Umbraco-CMS,abjerner/Umbraco-CMS,sargin48/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,WebCentrum/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,WebCentrum/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS,rasmusfjord/Umbraco-CMS,aaronpowell/Umbraco-CMS,romanlytvyn/Umbraco-CMS,kasperhhk/Umbraco-CMS,gkonings/Umbraco-CMS,KevinJump/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,rustyswayne/Umbraco-CMS,tcmorris/Umbraco-CMS,aadfPT/Umbraco-CMS,robertjf/Umbraco-CMS,rustyswayne/Umbraco-CMS,leekelleher/Umbraco-CMS,abryukhov/Umbraco-CMS,aadfPT/Umbraco-CMS,hfloyd/Umbraco-CMS,Phosworks/Umbraco-CMS,KevinJump/Umbraco-CMS,leekelleher/Umbraco-CMS,sargin48/Umbraco-CMS,rasmuseeg/Umbraco-CMS,abryukhov/Umbraco-CMS,neilgaietto/Umbraco-CMS,tcmorris/Umbraco-CMS,gavinfaux/Umbraco-CMS,neilgaietto/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,lars-erik/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,kasperhhk/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,base33/Umbraco-CMS,lars-erik/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,leekelleher/Umbraco-CMS,romanlytvyn/Umbraco-CMS,gavinfaux/Umbraco-CMS,bjarnef/Umbraco-CMS,romanlytvyn/Umbraco-CMS,jchurchley/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,kasperhhk/Umbraco-CMS,NikRimington/Umbraco-CMS,mattbrailsford/Umbraco-CMS,rasmuseeg/Umbraco-CMS,gkonings/Umbraco-CMS,rustyswayne/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,bjarnef/Umbraco-CMS,gkonings/Umbraco-CMS,neilgaietto/Umbraco-CMS,gavinfaux/Umbraco-CMS,jchurchley/Umbraco-CMS,robertjf/Umbraco-CMS,gkonings/Umbraco-CMS,tompipe/Umbraco-CMS,tcmorris/Umbraco-CMS,Phosworks/Umbraco-CMS,lars-erik/Umbraco-CMS,sargin48/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,Phosworks/Umbraco-CMS,madsoulswe/Umbraco-CMS,sargin48/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,abryukhov/Umbraco-CMS,rasmusfjord/Umbraco-CMS,rasmuseeg/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,abjerner/Umbraco-CMS,base33/Umbraco-CMS,sargin48/Umbraco-CMS,neilgaietto/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,tompipe/Umbraco-CMS,robertjf/Umbraco-CMS,gavinfaux/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,lars-erik/Umbraco-CMS,hfloyd/Umbraco-CMS,lars-erik/Umbraco-CMS,marcemarc/Umbraco-CMS,romanlytvyn/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,aaronpowell/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,mattbrailsford/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,romanlytvyn/Umbraco-CMS,kasperhhk/Umbraco-CMS,NikRimington/Umbraco-CMS,jchurchley/Umbraco-CMS,kgiszewski/Umbraco-CMS,gkonings/Umbraco-CMS,marcemarc/Umbraco-CMS,rustyswayne/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,rasmusfjord/Umbraco-CMS,neilgaietto/Umbraco-CMS,madsoulswe/Umbraco-CMS,dawoe/Umbraco-CMS,base33/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,aadfPT/Umbraco-CMS,gavinfaux/Umbraco-CMS,kgiszewski/Umbraco-CMS,KevinJump/Umbraco-CMS,kasperhhk/Umbraco-CMS,kgiszewski/Umbraco-CMS,marcemarc/Umbraco-CMS,rustyswayne/Umbraco-CMS,hfloyd/Umbraco-CMS,aaronpowell/Umbraco-CMS,umbraco/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS
a385695fbf7ab75939f81cefa0a331a06a00feac
TAUtil.Gdi/Bitmap/BitmapSerializer.cs
TAUtil.Gdi/Bitmap/BitmapSerializer.cs
namespace TAUtil.Gdi.Bitmap { using System.Drawing; using System.Drawing.Imaging; using System.IO; using TAUtil.Gdi.Palette; /// <summary> /// Serializes a 32-bit Bitmap instance into raw 8-bit indexed color data. /// The mapping from color to index is done according to the given /// reverse palette lookup. /// </summary> public class BitmapSerializer { private readonly IPalette palette; public BitmapSerializer(IPalette palette) { this.palette = palette; } public byte[] ToBytes(Bitmap bitmap) { int length = bitmap.Width * bitmap.Height; byte[] output = new byte[length]; this.Serialize(new MemoryStream(output, true), bitmap); return output; } public void Serialize(Stream output, Bitmap bitmap) { Rectangle r = new Rectangle(0, 0, bitmap.Width, bitmap.Height); BitmapData data = bitmap.LockBits(r, ImageLockMode.ReadOnly, bitmap.PixelFormat); int length = bitmap.Width * bitmap.Height; unsafe { int* pointer = (int*)data.Scan0; for (int i = 0; i < length; i++) { Color c = Color.FromArgb(pointer[i]); output.WriteByte((byte)this.palette.LookUp(c)); } } bitmap.UnlockBits(data); } } }
namespace TAUtil.Gdi.Bitmap { using System.Drawing; using System.Drawing.Imaging; using System.IO; using TAUtil.Gdi.Palette; /// <summary> /// Serializes a 32-bit Bitmap instance into raw 8-bit indexed color data. /// The mapping from color to index is done according to the given /// reverse palette lookup. /// </summary> public class BitmapSerializer { private readonly IPalette palette; public BitmapSerializer(IPalette palette) { this.palette = palette; } public byte[] ToBytes(Bitmap bitmap) { int length = bitmap.Width * bitmap.Height; byte[] output = new byte[length]; this.Serialize(new MemoryStream(output, true), bitmap); return output; } public void Serialize(Stream output, Bitmap bitmap) { Rectangle r = new Rectangle(0, 0, bitmap.Width, bitmap.Height); BitmapData data = bitmap.LockBits(r, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); int length = bitmap.Width * bitmap.Height; unsafe { int* pointer = (int*)data.Scan0; for (int i = 0; i < length; i++) { Color c = Color.FromArgb(pointer[i]); output.WriteByte((byte)this.palette.LookUp(c)); } } bitmap.UnlockBits(data); } } }
Fix bitmap serialization with indexed format bitmaps
Fix bitmap serialization with indexed format bitmaps
C#
mit
MHeasell/Mappy,MHeasell/Mappy
56f7b4e647fc8b29874e5956525280afe7d15a26
src/FilterLists.Agent/Program.cs
src/FilterLists.Agent/Program.cs
using System; using System.Threading.Tasks; using FilterLists.Agent.AppSettings; using FilterLists.Agent.Extensions; using FilterLists.Agent.Features.Lists; using FilterLists.Agent.Features.Urls; using FilterLists.Agent.Features.Urls.Models.DataFileUrls; using MediatR; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace FilterLists.Agent { public static class Program { private static IServiceProvider _serviceProvider; public static async Task Main() { BuildServiceProvider(); var mediator = _serviceProvider.GetService<IOptions<GitHub>>().Value; Console.WriteLine(mediator.ProductHeaderValue); //await mediator.Send(new CaptureLists.Command()); //await mediator.Send(new ValidateAllUrls.Command()); } private static void BuildServiceProvider() { var serviceCollection = new ServiceCollection(); serviceCollection.RegisterAgentServices(); _serviceProvider = serviceCollection.BuildServiceProvider(); } } }
using System; using System.Threading.Tasks; using FilterLists.Agent.Extensions; using FilterLists.Agent.Features.Lists; using FilterLists.Agent.Features.Urls; using MediatR; using Microsoft.Extensions.DependencyInjection; namespace FilterLists.Agent { public static class Program { private static IServiceProvider _serviceProvider; public static async Task Main() { BuildServiceProvider(); var mediator = _serviceProvider.GetService<IMediator>(); await mediator.Send(new CaptureLists.Command()); await mediator.Send(new ValidateAllUrls.Command()); } private static void BuildServiceProvider() { var serviceCollection = new ServiceCollection(); serviceCollection.RegisterAgentServices(); _serviceProvider = serviceCollection.BuildServiceProvider(); } } }
Revert "TEMP: test env vars on prod"
Revert "TEMP: test env vars on prod" This reverts commit 4d177274d48888d1b38880b3af89b1d515dfb1cf.
C#
mit
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
8c9c9f3d2b5d9471f2815c0ab0db32a1617d5614
src/Tgstation.Server.Host/Models/RepositorySettings.cs
src/Tgstation.Server.Host/Models/RepositorySettings.cs
using System.ComponentModel.DataAnnotations; using Tgstation.Server.Api.Models; namespace Tgstation.Server.Host.Models { /// <inheritdoc /> public sealed class RepositorySettings : Api.Models.Internal.RepositorySettings { /// <summary> /// The row Id /// </summary> public long Id { get; set; } /// <summary> /// The instance <see cref="EntityId.Id"/> /// </summary> public long InstanceId { get; set; } /// <summary> /// The parent <see cref="Models.Instance"/> /// </summary> [Required] public Instance Instance { get; set; } /// <summary> /// Convert the <see cref="Repository"/> to it's API form /// </summary> /// <returns>A new <see cref="Repository"/></returns> public Repository ToApi() => new Repository { // AccessToken = AccessToken, // never show this AccessUser = AccessUser, AutoUpdatesKeepTestMerges = AutoUpdatesKeepTestMerges, AutoUpdatesSynchronize = AutoUpdatesSynchronize, CommitterEmail = CommitterEmail, CommitterName = CommitterName, PushTestMergeCommits = PushTestMergeCommits, ShowTestMergeCommitters = ShowTestMergeCommitters, PostTestMergeComment = PostTestMergeComment // revision information and the rest retrieved by controller }; } }
using System.ComponentModel.DataAnnotations; using Tgstation.Server.Api.Models; namespace Tgstation.Server.Host.Models { /// <inheritdoc /> public sealed class RepositorySettings : Api.Models.Internal.RepositorySettings { /// <summary> /// The row Id /// </summary> public long Id { get; set; } /// <summary> /// The instance <see cref="EntityId.Id"/> /// </summary> public long InstanceId { get; set; } /// <summary> /// The parent <see cref="Models.Instance"/> /// </summary> [Required] public Instance Instance { get; set; } /// <summary> /// Convert the <see cref="Repository"/> to it's API form /// </summary> /// <returns>A new <see cref="Repository"/></returns> public Repository ToApi() => new Repository { // AccessToken = AccessToken, // never show this AccessUser = AccessUser, AutoUpdatesKeepTestMerges = AutoUpdatesKeepTestMerges, AutoUpdatesSynchronize = AutoUpdatesSynchronize, CommitterEmail = CommitterEmail, CommitterName = CommitterName, PushTestMergeCommits = PushTestMergeCommits, ShowTestMergeCommitters = ShowTestMergeCommitters, PostTestMergeComment = PostTestMergeComment, CreateGitHubDeployments = CreateGitHubDeployments, // revision information and the rest retrieved by controller }; } }
Fix Repository's `createGitHubDeployments` not being returned in API responses
Fix Repository's `createGitHubDeployments` not being returned in API responses
C#
agpl-3.0
tgstation/tgstation-server,tgstation/tgstation-server,tgstation/tgstation-server-tools
5a630cbb87935e96ce88b9aff98a54794179934a
OData/src/CommonAssemblyInfo.cs
OData/src/CommonAssemblyInfo.cs
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; using System.Reflection; using System.Resources; using System.Runtime.InteropServices; #if !BUILD_GENERATED_VERSION [assembly: AssemblyCompany("Microsoft Open Technologies, Inc.")] [assembly: AssemblyCopyright("© Microsoft Open Technologies, Inc. All rights reserved.")] #endif [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] #if !NOT_CLS_COMPLIANT [assembly: CLSCompliant(true)] #endif [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyMetadata("Serviceable", "True")] // =========================================================================== // DO NOT EDIT OR REMOVE ANYTHING BELOW THIS COMMENT. // Version numbers are automatically generated based on regular expressions. // =========================================================================== #if ASPNETODATA #if !BUILD_GENERATED_VERSION [assembly: AssemblyVersion("5.3.0.0")] // ASPNETODATA [assembly: AssemblyFileVersion("5.3.0.0")] // ASPNETODATA #endif [assembly: AssemblyProduct("Microsoft ASP.NET Web API OData")] #endif
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System; using System.Reflection; using System.Resources; using System.Runtime.InteropServices; #if !BUILD_GENERATED_VERSION [assembly: AssemblyCompany("Microsoft Open Technologies, Inc.")] [assembly: AssemblyCopyright("© Microsoft Open Technologies, Inc. All rights reserved.")] #endif [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] #if !NOT_CLS_COMPLIANT [assembly: CLSCompliant(true)] #endif [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyMetadata("Serviceable", "True")] // =========================================================================== // DO NOT EDIT OR REMOVE ANYTHING BELOW THIS COMMENT. // Version numbers are automatically generated based on regular expressions. // =========================================================================== #if ASPNETODATA #if !BUILD_GENERATED_VERSION [assembly: AssemblyVersion("5.3.1.0")] // ASPNETODATA [assembly: AssemblyFileVersion("5.3.1.0")] // ASPNETODATA #endif [assembly: AssemblyProduct("Microsoft ASP.NET Web API OData")] #endif
Update OData assembly versions to 5.3.1.0
Update OData assembly versions to 5.3.1.0
C#
mit
congysu/WebApi,LianwMS/WebApi,yonglehou/WebApi,lungisam/WebApi,congysu/WebApi,lewischeng-ms/WebApi,chimpinano/WebApi,LianwMS/WebApi,chimpinano/WebApi,abkmr/WebApi,scz2011/WebApi,lungisam/WebApi,abkmr/WebApi,scz2011/WebApi,yonglehou/WebApi,lewischeng-ms/WebApi
ed61f618202c091e8358ae52ae499d6f3ee7aaed
Assets/Birdy.cs
Assets/Birdy.cs
using UnityEngine; using System.Collections; public class Birdy : MonoBehaviour { public bool IsAlive; public float DropDeadTime = 0.5f; public MoveForward Mover; public ScriptSwitch FlyToFallSwitch; public FallDown FallDown; public MonoBehaviour[] Feeders; // Use this for initialization void Start () { FallDown.Time = DropDeadTime; } // Update is called once per frame void Update () { } public void DropDead() { if (!IsAlive) { return; } Mover.Speed = Random.Range(5/DropDeadTime, 10/DropDeadTime); FlyToFallSwitch.Switch(); LeanTween.delayedCall(gameObject, DropDeadTime, TurnOffMover); IsAlive = false; } private void TurnOffMover() { this.IsDown = true; this.Mover.enabled = false; foreach (var monoBehaviour in this.Feeders) { monoBehaviour.enabled = true; } } public bool IsDown { get; set; } }
using UnityEngine; using System.Collections; public class Birdy : MonoBehaviour { public bool IsAlive; public float DropDeadTime = 0.5f; public MoveForward Mover; public ScriptSwitch FlyToFallSwitch; public FallDown FallDown; public MonoBehaviour[] Feeders; // Use this for initialization void Start () { FallDown.Time = DropDeadTime; } // Update is called once per frame void Update () { } public void DropDead() { if (!IsAlive) { return; } Mover.Speed = Random.Range(5/DropDeadTime, 10/DropDeadTime); this.GetComponentInChildren<Animator>().enabled = false; FlyToFallSwitch.Switch(); LeanTween.delayedCall(gameObject, DropDeadTime, TurnOffMover); this.transform.GetChild(0).tag = "Food"; IsAlive = false; } private void TurnOffMover() { this.IsDown = true; this.Mover.enabled = false; foreach (var monoBehaviour in this.Feeders) { monoBehaviour.enabled = true; } } public bool IsDown { get; set; } }
Stop bird animation on drop down
Stop bird animation on drop down
C#
mit
L4fter/CrocoDie
121d75fc76014ec4ba0c7f67b3158c221694bd56
src/core/BrightstarDB.ReadWriteBenchmark/Program.cs
src/core/BrightstarDB.ReadWriteBenchmark/Program.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BrightstarDB.ReadWriteBenchmark { internal class Program { private static void Main(string[] args) { var opts = new BenchmarkArgs(); if (CommandLine.Parser.ParseArgumentsWithUsage(args, opts)) { if (!string.IsNullOrEmpty(opts.LogFilePath)) { BenchmarkLogging.EnableFileLogging(opts.LogFilePath); } } else { var usage = CommandLine.Parser.ArgumentsUsage(typeof (BenchmarkArgs)); Console.WriteLine(usage); } var runner = new BenchmarkRunner(opts); runner.Run(); BenchmarkLogging.Close(); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BrightstarDB.ReadWriteBenchmark { internal class Program { public static TraceListener BrightstarListener; private static void Main(string[] args) { var opts = new BenchmarkArgs(); if (CommandLine.Parser.ParseArgumentsWithUsage(args, opts)) { if (!string.IsNullOrEmpty(opts.LogFilePath)) { BenchmarkLogging.EnableFileLogging(opts.LogFilePath); var logStream = new FileStream(opts.LogFilePath + ".bslog", FileMode.Create); BrightstarListener = new TextWriterTraceListener(logStream); BrightstarDB.Logging.BrightstarTraceSource.Listeners.Add(BrightstarListener); BrightstarDB.Logging.BrightstarTraceSource.Switch.Level = SourceLevels.All; } } else { var usage = CommandLine.Parser.ArgumentsUsage(typeof (BenchmarkArgs)); Console.WriteLine(usage); } var runner = new BenchmarkRunner(opts); runner.Run(); BenchmarkLogging.Close(); BrightstarDB.Logging.BrightstarTraceSource.Close(); } } }
Write BrightstarDB log output if a log file is specified
Write BrightstarDB log output if a log file is specified
C#
mit
BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB
a3928f715cd19c44808639f0cfb6a79993a7dabb
src/StructureMap.Microsoft.DependencyInjection/AspNetConstructorSelector.cs
src/StructureMap.Microsoft.DependencyInjection/AspNetConstructorSelector.cs
using System; using System.Linq; using System.Reflection; using StructureMap.Graph; using StructureMap.Pipeline; namespace StructureMap { internal class AspNetConstructorSelector : IConstructorSelector { // ASP.NET expects registered services to be considered when selecting a ctor, SM doesn't by default. public ConstructorInfo Find(Type pluggedType, DependencyCollection dependencies, PluginGraph graph) { var constructors = from constructor in pluggedType.GetConstructors() select new { Constructor = constructor, Parameters = constructor.GetParameters(), }; var satisfiable = from constructor in constructors where constructor.Parameters.All(parameter => ParameterIsRegistered(parameter, dependencies, graph)) orderby constructor.Parameters.Length descending select constructor.Constructor; return satisfiable.FirstOrDefault(); } private static bool ParameterIsRegistered(ParameterInfo parameter, DependencyCollection dependencies, PluginGraph graph) { return graph.HasFamily(parameter.ParameterType) || dependencies.Any(dependency => dependency.Type == parameter.ParameterType); } } }
using System; using System.Linq; using System.Reflection; using StructureMap.Graph; using StructureMap.Pipeline; namespace StructureMap { internal class AspNetConstructorSelector : IConstructorSelector { // ASP.NET expects registered services to be considered when selecting a ctor, SM doesn't by default. public ConstructorInfo Find(Type pluggedType, DependencyCollection dependencies, PluginGraph graph) => pluggedType.GetTypeInfo() .DeclaredConstructors .Select(ctor => new { Constructor = ctor, Parameters = ctor.GetParameters() }) .Where(x => x.Parameters.All(param => graph.HasFamily(param.ParameterType) || dependencies.Any(dep => dep.Type == param.ParameterType))) .OrderByDescending(x => x.Parameters.Length) .Select(x => x.Constructor) .FirstOrDefault(); } }
Revert to method LINQ syntax.
Revert to method LINQ syntax.
C#
mit
structuremap/structuremap.dnx,structuremap/StructureMap.Microsoft.DependencyInjection,khellang/StructureMap.Dnx
15a960dcfe8da6e8b14cc1fd8647f453ca21fe69
src/LfMerge/LanguageDepotProject.cs
src/LfMerge/LanguageDepotProject.cs
// Copyright (c) 2015 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Linq; using MongoDB.Bson; using MongoDB.Driver; using MongoDB.Driver.Core.Clusters; namespace LfMerge { public class LanguageDepotProject { public LanguageDepotProject(string lfProjectCode) { var client = new MongoClient("mongodb://" + LfMergeSettings.Current.MongoDbHostNameAndPort); var database = client.GetDatabase("languageforge"); var collection = database.GetCollection<BsonDocument>("projects"); var filter = new BsonDocument("projectCode", lfProjectCode); var list = collection.Find(filter).ToListAsync(); list.Wait(); var project = list.Result.FirstOrDefault(); if (project == null) throw new ArgumentException("Can't find project code", "lfProjectCode"); BsonValue value; if (project.TryGetValue("ldUsername", out value)) Username = value.AsString; if (project.TryGetValue("ldPassword", out value)) Password = value.AsString; if (project.TryGetValue("ldProjectCode", out value)) ProjectCode = value.AsString; } public string Username { get; private set; } public string Password { get; private set; } public string ProjectCode { get; private set; } } }
// Copyright (c) 2015 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Linq; using MongoDB.Bson; using MongoDB.Driver; using MongoDB.Driver.Core.Clusters; namespace LfMerge { public class LanguageDepotProject { public LanguageDepotProject(string lfProjectCode) { var client = new MongoClient("mongodb://" + LfMergeSettings.Current.MongoDbHostNameAndPort); var database = client.GetDatabase("scriptureforge"); var projectCollection = database.GetCollection<BsonDocument>("projects"); //var userCollection = database.GetCollection<BsonDocument>("users"); var projectFilter = new BsonDocument("projectCode", lfProjectCode); var list = projectCollection.Find(projectFilter).ToListAsync(); list.Wait(); var project = list.Result.FirstOrDefault(); if (project == null) throw new ArgumentException("Can't find project code", "lfProjectCode"); BsonValue value; if (project.TryGetValue("ldProjectCode", out value)) ProjectCode = value.AsString; // TODO: need to get S/R server (language depot public, language depot private, custom, etc). // TODO: ldUsername and ldPassword should come from the users collection if (project.TryGetValue("ldUsername", out value)) Username = value.AsString; if (project.TryGetValue("ldPassword", out value)) Password = value.AsString; } public string Username { get; private set; } public string Password { get; private set; } public string ProjectCode { get; private set; } } }
Use scriptureforge database to get project data
Use scriptureforge database to get project data
C#
mit
ermshiperete/LfMerge,sillsdev/LfMerge,ermshiperete/LfMerge,sillsdev/LfMerge,sillsdev/LfMerge,ermshiperete/LfMerge
169b7826bfb91ab4b2c80e49fc6c8c4859441b37
Scripts/LiteNetLibPacketSender.cs
Scripts/LiteNetLibPacketSender.cs
using LiteNetLib; using LiteNetLib.Utils; using LiteNetLibManager; public static class LiteNetLibPacketSender { public static readonly NetDataWriter Writer = new NetDataWriter(); public static void SendPacket(NetDataWriter writer, SendOptions options, NetPeer peer, short msgType, System.Action<NetDataWriter> serializer) { writer.Reset(); writer.Put(msgType); serializer(writer); peer.Send(writer, options); } public static void SendPacket(SendOptions options, NetPeer peer, short msgType, System.Action<NetDataWriter> serializer) { SendPacket(Writer, options, peer, msgType, serializer); } public static void SendPacket<T>(NetDataWriter writer, SendOptions options, NetPeer peer, short msgType, T messageData) where T : ILiteNetLibMessage { SendPacket(writer, options, peer, msgType, messageData.Serialize); } public static void SendPacket<T>(SendOptions options, NetPeer peer, short msgType, T messageData) where T : ILiteNetLibMessage { SendPacket(Writer, options, peer, msgType, messageData); } public static void SendPacket(NetDataWriter writer, SendOptions options, NetPeer peer, short msgType) { writer.Reset(); writer.Put(msgType); peer.Send(writer, options); } public static void SendPacket(SendOptions options, NetPeer peer, short msgType) { SendPacket(Writer, options, peer, msgType); } }
using LiteNetLib; using LiteNetLib.Utils; using LiteNetLibManager; public static class LiteNetLibPacketSender { public static readonly NetDataWriter Writer = new NetDataWriter(); public static void SendPacket(NetDataWriter writer, SendOptions options, NetPeer peer, short msgType, System.Action<NetDataWriter> serializer) { writer.Reset(); writer.Put(msgType); if (serializer != null) serializer(writer); peer.Send(writer, options); } public static void SendPacket(SendOptions options, NetPeer peer, short msgType, System.Action<NetDataWriter> serializer) { SendPacket(Writer, options, peer, msgType, serializer); } public static void SendPacket<T>(NetDataWriter writer, SendOptions options, NetPeer peer, short msgType, T messageData) where T : ILiteNetLibMessage { SendPacket(writer, options, peer, msgType, messageData.Serialize); } public static void SendPacket<T>(SendOptions options, NetPeer peer, short msgType, T messageData) where T : ILiteNetLibMessage { SendPacket(Writer, options, peer, msgType, messageData); } public static void SendPacket(NetDataWriter writer, SendOptions options, NetPeer peer, short msgType) { SendPacket(writer, options, peer, msgType, null); } public static void SendPacket(SendOptions options, NetPeer peer, short msgType) { SendPacket(Writer, options, peer, msgType); } }
Improve packet sender seralize codes
Improve packet sender seralize codes
C#
mit
insthync/LiteNetLibManager,insthync/LiteNetLibManager
36e480d9aa571b0fb548a23cd2cd8d44277bfbad
Knapcode.SocketToMe.Sandbox/Program.cs
Knapcode.SocketToMe.Sandbox/Program.cs
using System; using System.Net; using System.Net.Http; using Knapcode.SocketToMe.Http; using Knapcode.SocketToMe.Socks; namespace Knapcode.SocketToMe.Sandbox { public class Program { private static void Main() { var endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9150); var client = new Socks5Client(); var socket = client.ConnectToServer(endpoint); socket = client.ConnectToDestination(socket, "icanhazip.com", 80); var httpClient = new HttpClient(new NetworkHandler(socket)); var response = httpClient.GetAsync("http://icanhazip.com/").Result; Console.WriteLine(response.Content.ReadAsStringAsync().Result); } } }
using System; using System.Net; using System.Net.Http; using Knapcode.SocketToMe.Http; using Knapcode.SocketToMe.Socks; namespace Knapcode.SocketToMe.Sandbox { public class Program { private static void Main() { var endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9150); var client = new Socks5Client(); var socket = client.ConnectToServer(endpoint); socket = client.ConnectToDestination(socket, "icanhazip.com", 443); var httpClient = new HttpClient(new NetworkHandler(socket)); var response = httpClient.GetAsync("https://icanhazip.com/").Result; Console.WriteLine(response.Content.ReadAsStringAsync().Result); } } }
Make the sandbox example even more complex
Make the sandbox example even more complex
C#
mit
joelverhagen/SocketToMe
e21c61152b8d57471121f0faaaa585d23238c835
managed/tracelogging/Program.cs
managed/tracelogging/Program.cs
using System; using System.Diagnostics.Tracing; namespace tracelogging { public sealed class MySource : EventSource { MySource() : base(EventSourceSettings.EtwSelfDescribingEventFormat) { } public static MySource Logger = new MySource(); } class Program { static void Main(string[] args) { MySource.Logger.Write("TestEvent", new { field1 = "Hello", field2 = 3, field3 = 6 }); MySource.Logger.Write("TestEvent1", new { field1 = "Hello", field2 = 3, }); MySource.Logger.Write("TestEvent2", new { field1 = "Hello" }); MySource.Logger.Write("TestEvent3", new { field1 = new byte[10] }); } } }
using System; using System.Diagnostics.Tracing; namespace tracelogging { public sealed class MySource : EventSource { MySource() : base(EventSourceSettings.EtwSelfDescribingEventFormat) { } [Event(1)] public void TestEventMethod(int i, string s) { WriteEvent(1, i, s); } public static MySource Logger = new MySource(); } class Program { static void Main(string[] args) { MySource.Logger.TestEventMethod(1, "Hello World!"); MySource.Logger.Write("TestEvent", new { field1 = "Hello", field2 = 3, field3 = 6 }); MySource.Logger.Write("TestEvent1", new { field1 = "Hello", field2 = 3, }); MySource.Logger.Write("TestEvent2", new { field1 = "Hello" }); MySource.Logger.Write("TestEvent3", new { field1 = new byte[10] }); } } }
Add event method to TraceLogging test.
Add event method to TraceLogging test.
C#
mit
brianrob/coretests,brianrob/coretests
3736083da8e887e52ae98587d06311305635cfcd
osu.Framework.Benchmarks/BenchmarkTextBuilder.cs
osu.Framework.Benchmarks/BenchmarkTextBuilder.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.Threading.Tasks; using BenchmarkDotNet.Attributes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Text; namespace osu.Framework.Benchmarks { public class BenchmarkTextBuilder { private readonly ITexturedGlyphLookupStore store = new TestStore(); private TextBuilder textBuilder; [Benchmark] public void AddCharacters() => initialiseBuilder(false); [Benchmark] public void RemoveLastCharacter() { initialiseBuilder(false); textBuilder.RemoveLastCharacter(); } private void initialiseBuilder(bool allDifferentBaselines) { textBuilder = new TextBuilder(store, FontUsage.Default); char different = 'B'; for (int i = 0; i < 100; i++) textBuilder.AddCharacter(i % (allDifferentBaselines ? 1 : 10) == 0 ? different++ : 'A'); } private class TestStore : ITexturedGlyphLookupStore { public ITexturedCharacterGlyph Get(string fontName, char character) => new TexturedCharacterGlyph(new CharacterGlyph(character, character, character, character, null), Texture.WhitePixel); public Task<ITexturedCharacterGlyph> GetAsync(string fontName, char character) => Task.Run(() => Get(fontName, character)); } } }
// 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.Threading.Tasks; using BenchmarkDotNet.Attributes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Text; namespace osu.Framework.Benchmarks { public class BenchmarkTextBuilder { private readonly ITexturedGlyphLookupStore store = new TestStore(); private TextBuilder textBuilder; [Benchmark] public void AddCharacters() => initialiseBuilder(false); [Benchmark] public void AddCharactersWithDifferentBaselines() => initialiseBuilder(true); [Benchmark] public void RemoveLastCharacter() { initialiseBuilder(false); textBuilder.RemoveLastCharacter(); } [Benchmark] public void RemoveLastCharacterWithDifferentBaselines() { initialiseBuilder(true); textBuilder.RemoveLastCharacter(); } private void initialiseBuilder(bool withDifferentBaselines) { textBuilder = new TextBuilder(store, FontUsage.Default); char different = 'B'; for (int i = 0; i < 100; i++) textBuilder.AddCharacter(withDifferentBaselines && (i % 10 == 0) ? different++ : 'A'); } private class TestStore : ITexturedGlyphLookupStore { public ITexturedCharacterGlyph Get(string fontName, char character) => new TexturedCharacterGlyph(new CharacterGlyph(character, character, character, character, character, null), Texture.WhitePixel); public Task<ITexturedCharacterGlyph> GetAsync(string fontName, char character) => Task.Run(() => Get(fontName, character)); } } }
Update benchmark and add worst case scenario
Update benchmark and add worst case scenario
C#
mit
smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework
bab1b750087f7efd290bd906aeeaa0a4e167f5d4
src/Lezen.Core/Entity/Document.cs
src/Lezen.Core/Entity/Document.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Lezen.Core.Entity { public class Document { public Document() { this.Authors = new HashSet<Author>(); } public int ID { get; set; } public string Title { get; set; } public virtual ICollection<Author> Authors { get; private set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Lezen.Core.Entity { public class Document { public Document() { this.Authors = new HashSet<Author>(); } public int ID { get; set; } public string Title { get; set; } public virtual ICollection<Author> Authors { get; set; } } }
Change private setter to public.
Change private setter to public.
C#
apache-2.0
boumenot/lezen,boumenot/lezen
b852aa3b4fe98c7310dbe8157a6b74e1132a84d9
CardsAgainstIRC3/Game/Bots/Rando.cs
CardsAgainstIRC3/Game/Bots/Rando.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CardsAgainstIRC3.Game.Bots { [Bot("rando")] public class Rando : IBot { public GameManager Manager { get; private set; } public GameUser User { get; private set; } public Rando(GameManager manager) { Manager = manager; } public void RegisteredToUser(GameUser user) { User = user; } public Card[] ResponseToCard(Card blackCard) { return Manager.TakeWhiteCards(blackCard.Parts.Length - 1).ToArray(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CardsAgainstIRC3.Game.Bots { [Bot("rando")] public class Rando : IBot { public GameManager Manager { get; private set; } public GameUser User { get; private set; } public Rando(GameManager manager) { Manager = manager; } public void LinkedToUser(GameUser user) { User = user; } public Card[] ResponseToCard(Card blackCard) { return Manager.TakeWhiteCards(blackCard.Parts.Length - 1).ToArray(); } } }
Fix wrong method name, causing a build error
Fix wrong method name, causing a build error
C#
mit
puckipedia/CardsAgainstIRC
020f794b1cdb90dae350c74fe3cad1b8a8bb05e5
Subtle.UI/Controls/ImdbTextBox.cs
Subtle.UI/Controls/ImdbTextBox.cs
using System.Text.RegularExpressions; using System.Windows.Forms; namespace Subtle.UI.Controls { public class ImdbTextBox : TextBox { // ReSharper disable once InconsistentNaming private const int WM_PASTE = 0x0302; private static readonly Regex ImdbRegex = new Regex(@"tt(\d{7})"); /// <summary> /// Handles paste event and tries to extract IMDb ID. /// </summary> /// <param name="m"></param> protected override void WndProc(ref Message m) { if (m.Msg != WM_PASTE) { base.WndProc(ref m); return; } var match = ImdbRegex.Match(Clipboard.GetText()); if (match.Success) { Text = match.Groups[1].Value; } } } }
using System.Text.RegularExpressions; using System.Windows.Forms; namespace Subtle.UI.Controls { public class ImdbTextBox : TextBox { // ReSharper disable once InconsistentNaming private const int WM_PASTE = 0x0302; private static readonly Regex ImdbRegex = new Regex(@"tt(\d{7})"); /// <summary> /// Handles paste event and tries to extract IMDb ID. /// </summary> /// <param name="m"></param> protected override void WndProc(ref Message m) { if (m.Msg != WM_PASTE) { base.WndProc(ref m); return; } var match = ImdbRegex.Match(Clipboard.GetText()); if (match.Success) { Text = match.Groups[1].Value; } else { base.WndProc(ref m); } } } }
Correct default paste behaviour for IMDb textbox
Correct default paste behaviour for IMDb textbox
C#
mit
tvdburgt/subtle
030bc4d1a58d3d8fdad425816c5300759b83429e
Joinrpg/Views/CheckIn/Index.cshtml
Joinrpg/Views/CheckIn/Index.cshtml
@model JoinRpg.Web.Models.CheckIn.CheckInIndexViewModel @{ ViewBag.Title = "Регистрация"; } <h2>Регистрация</h2> @using (Html.BeginForm()) { @Html.HiddenFor(model => model.ProjectId) @Html.AntiForgeryToken() @Html.SearchableDropdownFor(model => model.ClaimId, Model.Claims.Select( claim => new ImprovedSelectListItem() { Value = claim.ClaimId.ToString(), Text = claim.CharacterName, ExtraSearch = claim.OtherNicks, Subtext = "<br />" + claim.NickName + " (" + claim.Fullname + " )" })) <input type="submit" class="btn btn-success" value="Зарегистрировать"/> } <hr/> @Html.ActionLink("Статистика по регистрации", "Stat", new {Model.ProjectId})
@model JoinRpg.Web.Models.CheckIn.CheckInIndexViewModel @{ ViewBag.Title = "Регистрация"; } <h2>Регистрация</h2> @using (Html.BeginForm()) { @Html.HiddenFor(model => model.ProjectId) @Html.AntiForgeryToken() @Html.SearchableDropdownFor(model => model.ClaimId, Model.Claims.Select( claim => new ImprovedSelectListItem() { Value = claim.ClaimId.ToString(), Text = claim.CharacterName, ExtraSearch = claim.OtherNicks, Subtext = claim.NickName + " (" + claim.Fullname + " )" })) <input type="submit" class="btn btn-success" value="Зарегистрировать"/> } <hr/> @Html.ActionLink("Статистика по регистрации", "Stat", new {Model.ProjectId})
Remove <br> from select in checkin
Remove <br> from select in checkin
C#
mit
joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net
18a68079997cf8efc683f56952e12ae88091d94a
Syndll2/SynelServer.cs
Syndll2/SynelServer.cs
using System; using System.Collections.Generic; using System.Net; using System.Threading; namespace Syndll2 { public class SynelServer : IDisposable { private readonly IConnection _connection; private bool _disposed; private SynelServer(IConnection connection) { _connection = connection; } public void Dispose() { Dispose(true); } protected virtual void Dispose(bool disposing) { if (_disposed) return; if (disposing) _connection.Dispose(); _disposed = true; } public static SynelServer Listen(Action<PushNotification> action) { return Listen(3734, action); } public static SynelServer Listen(int port, Action<PushNotification> action) { var connection = NetworkConnection.Listen(port, (stream, socket) => { var history = new List<string>(); var receiver = new Receiver(stream); var signal = new SemaphoreSlim(1); receiver.MessageHandler += message => { if (!history.Contains(message.RawResponse)) { history.Add(message.RawResponse); Util.Log(string.Format("Received: {0}", message.RawResponse)); if (message.Response != null) { var notification = new PushNotification(stream, message.Response, (IPEndPoint) socket.RemoteEndPoint); action(notification); } } signal.Release(); }; receiver.WatchStream(); while (stream.CanRead) signal.Wait(); }); return new SynelServer(connection); } } }
using System; using System.Collections.Generic; using System.Net; using System.Threading; namespace Syndll2 { public class SynelServer : IDisposable { private readonly IConnection _connection; private bool _disposed; private SynelServer(IConnection connection) { _connection = connection; } public void Dispose() { Dispose(true); } protected virtual void Dispose(bool disposing) { if (_disposed) return; if (disposing) _connection.Dispose(); _disposed = true; } public static SynelServer Listen(Action<PushNotification> action) { return Listen(3734, action); } public static SynelServer Listen(int port, Action<PushNotification> action) { var connection = NetworkConnection.Listen(port, (stream, socket) => { var history = new List<string>(); var receiver = new Receiver(stream); var signal = new ManualResetEvent(false); receiver.MessageHandler = message => { if (!history.Contains(message.RawResponse)) { history.Add(message.RawResponse); Util.Log(string.Format("Received: {0}", message.RawResponse)); if (message.Response != null) { var notification = new PushNotification(stream, message.Response, (IPEndPoint) socket.RemoteEndPoint); action(notification); } } signal.Set(); }; receiver.WatchStream(); // Wait until a message is received while (stream.CanRead && socket.Connected) if (signal.WaitOne(100)) break; }); return new SynelServer(connection); } } }
Improve server wait and disconnect after each msg
Improve server wait and disconnect after each msg
C#
mit
synel/syndll2
12e0591979a045657c101815c64a51f474f41cdf
ForecastPCL.Test/LanguageTests.cs
ForecastPCL.Test/LanguageTests.cs
namespace ForecastPCL.Test { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ForecastIOPortable; using NUnit.Framework; [TestFixture] public class LanguageTests { [Test] public void AllLanguagesHaveValues() { foreach (Language language in Enum.GetValues(typeof(Language))) { Assert.That(() => language.ToValue(), Throws.Nothing); } } } }
namespace ForecastPCL.Test { using System; using System.Configuration; using ForecastIOPortable; using NUnit.Framework; [TestFixture] public class LanguageTests { // These coordinates came from the Forecast API documentation, // and should return forecasts with all blocks. private const double AlcatrazLatitude = 37.8267; private const double AlcatrazLongitude = -122.423; private const double MumbaiLatitude = 18.975; private const double MumbaiLongitude = 72.825833; /// <summary> /// API key to be used for testing. This should be specified in the /// test project's app.config file. /// </summary> private string apiKey; /// <summary> /// Sets up all tests by retrieving the API key from app.config. /// </summary> [TestFixtureSetUp] public void SetUp() { this.apiKey = ConfigurationManager.AppSettings["ApiKey"]; } [Test] public void AllLanguagesHaveValues() { foreach (Language language in Enum.GetValues(typeof(Language))) { Assert.That(() => language.ToValue(), Throws.Nothing); } } [Test] public async void UnicodeLanguageIsSupported() { var client = new ForecastApi(this.apiKey); var result = await client.GetWeatherDataAsync(AlcatrazLatitude, AlcatrazLongitude, Unit.Auto, Language.Chinese); Assert.That(result, Is.Not.Null); } } }
Add test to check that Unicode languages work (testing Chinese).
Add test to check that Unicode languages work (testing Chinese).
C#
mit
jcheng31/DarkSkyApi,jcheng31/ForecastPCL