commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
63dd61004b3c967411360aad70803dac0b8507bc
Fix build for iOS picker
monostefan/Xamarin.Plugins,jamesmontemagno/Xamarin.Plugins,predictive-technology-laboratory/Xamarin.Plugins,LostBalloon1/Xamarin.Plugins
Media/Media/Media.Plugin.iOS/MediaPickerController.cs
Media/Media/Media.Plugin.iOS/MediaPickerController.cs
// // Copyright 2011-2013, Xamarin 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.Threading.Tasks; using Media.Plugin.Abstractions; #if __UNIFIED__ using UIKit; using Foundation; #else using MonoTouch.UIKit; using MonoTouch.Foundation; #endif namespace Media.Plugin { /// <summary> /// Media Picker Controller /// </summary> public sealed class MediaPickerController : UIImagePickerController { internal MediaPickerController(MediaPickerDelegate mpDelegate) { base.Delegate = mpDelegate; //UIApplication.SharedApplication.SetStatusBarHidden = true; } public override bool PrefersStatusBarHidden() { return true; } public override UIViewController ChildViewControllerForStatusBarHidden() { return null; } /// <summary> /// Deleage /// </summary> public override NSObject Delegate { get { return base.Delegate; } set { throw new NotSupportedException(); } } /// <summary> /// Gets result of picker /// </summary> /// <returns></returns> public Task<MediaFile> GetResultAsync() { return ((MediaPickerDelegate)Delegate).Task; } } }
// // Copyright 2011-2013, Xamarin 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.Threading.Tasks; using Media.Plugin.Abstractions; #if __UNIFIED__ using UIKit; using Foundation; #else using MonoTouch.UIKit; using MonoTouch.Foundation; #endif namespace Media.Plugin { /// <summary> /// Media Picker Controller /// </summary> public sealed class MediaPickerController : UIImagePickerController { internal MediaPickerController(MediaPickerDelegate mpDelegate) { base.Delegate = mpDelegate; UIApplication.SharedApplication.SetStatusBarHidden = true; } public override bool PrefersStatusBarHidden() { return true; } public override UIViewController ChildViewControllerForStatusBarHidden() { return null; } /// <summary> /// Deleage /// </summary> public override NSObject Delegate { get { return base.Delegate; } set { throw new NotSupportedException(); } } /// <summary> /// Gets result of picker /// </summary> /// <returns></returns> public Task<MediaFile> GetResultAsync() { return ((MediaPickerDelegate)Delegate).Task; } } }
mit
C#
dfbb0951b7dbb916f2fdf835a2039bb417fd7984
Build version 1.0.0-beta1
xpressive-websolutions/Xpressive.Home,xpressive-websolutions/Xpressive.Home.ProofOfConcept,xpressive-websolutions/Xpressive.Home,xpressive-websolutions/Xpressive.Home,xpressive-websolutions/Xpressive.Home.ProofOfConcept,xpressive-websolutions/Xpressive.Home.ProofOfConcept
Xpressive.Home/Properties/AssemblyInfo.shared.cs
Xpressive.Home/Properties/AssemblyInfo.shared.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by Cake. // </auto-generated> //------------------------------------------------------------------------------ using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Xpressive Websolutions")] [assembly: AssemblyProduct("Xpressive.Home")] [assembly: AssemblyVersion("1.0.0.14518")] [assembly: AssemblyFileVersion("1.0.0.14518")] [assembly: AssemblyInformationalVersion("1.0.0-beta1")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyConfiguration("")] [assembly: ComVisible(false)]
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by Cake. // </auto-generated> //------------------------------------------------------------------------------ using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Xpressive Websolutions")] [assembly: AssemblyProduct("Xpressive.Home")] [assembly: AssemblyVersion("1.0.0.14496")] [assembly: AssemblyFileVersion("1.0.0.14496")] [assembly: AssemblyInformationalVersion("1.0.0.14496-beta1")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyConfiguration("")] [assembly: ComVisible(false)]
mit
C#
6c0dcf3e6f8f829cb2ef3d413fc80e2279d06406
Update OidcConfigurationController.cs
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/OidcConfigurationController.cs
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/OidcConfigurationController.cs
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; namespace Company.WebApplication1.Controllers { public class OidcConfigurationController : Controller { private readonly ILogger<OidcConfigurationController> logger; public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> _logger) { ClientRequestParametersProvider = clientRequestParametersProvider; logger = _logger; } public IClientRequestParametersProvider ClientRequestParametersProvider { get; } [HttpGet("_configuration/{clientId}")] public IActionResult GetClientRequestParameters([FromRoute]string clientId) { var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId); return Ok(parameters); } } }
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.Mvc; namespace Company.WebApplication1.Controllers { public class OidcConfigurationController : Controller { private readonly ILogger<OidcConfigurationController> logger; public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider, ILogger<OidcConfigurationController> _logger) { ClientRequestParametersProvider = clientRequestParametersProvider; logger = _logger; } public IClientRequestParametersProvider ClientRequestParametersProvider { get; } [HttpGet("_configuration/{clientId}")] public IActionResult GetClientRequestParameters([FromRoute]string clientId) { var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId); return Ok(parameters); } } }
apache-2.0
C#
71d17b9fd4c9267362e2e907d02e8ff3ddb112e2
Add InternalsVisibleTo and other metadata to the SharpTools assembly properties
bitwalker/SharpTools,bitwalker/SharpTools
SharpTools/Properties/AssemblyInfo.cs
SharpTools/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SharpTools")] [assembly: AssemblyDescription("A collection of pratical C# code to build upon.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("IronForged Softworks, LLC.")] [assembly: AssemblyProduct("SharpTools")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("bab38356-49cb-49c2-8803-ff75fd79f632")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.*")] [assembly: AssemblyFileVersion("1.0.0.*")] // Permit the Test project to access internals of this assembly [assembly: InternalsVisibleTo("SharpTools.Test")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SharpTools")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SharpTools")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("bab38356-49cb-49c2-8803-ff75fd79f632")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
39fa044a66f584e1222a91b06303f559a46d6694
Write defaulted methods
sharper-library/Sharper.C.Either
Sharper.C.Either/Data/EitherModule.cs
Sharper.C.Either/Data/EitherModule.cs
using System; namespace Sharper.C.Data { public static class EitherModule { public sealed class Either<A, B> { public bool IsLeft { get; } public bool IsRight => !IsLeft; private readonly A leftValue; private readonly B rightValue; internal Either(bool isLeft, A left, B right) { IsLeft = isLeft; leftValue = left; rightValue = right; } public Either<A, C> FlatMap<C>(Func<B, Either<A, C>> f) => IsLeft ? new Either<A, C>(true, leftValue, default(C)) : f(rightValue); public Either<A, C> Map<C>(Func<B, C> f) => IsLeft ? new Either<A, C>(true, leftValue, default(C)) : new Either<A, C>(false, default(A), f(rightValue)); public C Match<C>(Func<A, C> left, Func<B, C> right) => IsLeft ? left(leftValue) : right(rightValue); } public static Either<A, B> Left<A, B>(A a) => new Either<A, B>(true, a, default(B)); public static Either<A, B> Right<A, B>(B b) => new Either<A, B>(false, default(A), b); public struct LeftModule<A> { public Either<A, B> Left<B>(A a) => Left<A, B>(a); public Either<A, B> Right<B>(B b) => Right<A, B>(b); } } }
using System; namespace Sharper.C.Data { public static class EitherModule { public struct Either<A, B> { public Either<A, C> FlatMap<C>(Func<B, Either<A, C>> f) => default(Either<A, C>); public Either<A, C> Map<C>(Func<B, C> f) => default(Either<A, C>); public C Match<C>(Func<A, C> left, Func<B, C> right) => default(C); } public static Either<A, B> Left<A, B>(A a) => default(Either<A, B>); public static Either<A, B> Right<A, B>(B b) => default(Either<A, B>); public struct LeftModule<A> { public Either<A, B> Left<B>(A a) => Left<A, B>(a); public Either<A, B> Right<B>(B b) => Right<A, B>(b); } } }
mit
C#
76c978af8bff77facbffcc2864705678aad6d320
Add sanity check to dissalow invalid file paths
EVAST9919/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,paparony03/osu-framework,EVAST9919/osu-framework,default0/osu-framework,RedNesto/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,RedNesto/osu-framework,naoey/osu-framework,naoey/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,default0/osu-framework,Tom94/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,Nabile-Rahmani/osu-framework,Nabile-Rahmani/osu-framework,paparony03/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,EVAST9919/osu-framework
osu.Framework/Platform/BasicStorage.cs
osu.Framework/Platform/BasicStorage.cs
// Copyright (c) 2007-2016 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.IO; using osu.Framework.IO.File; using SQLite.Net; namespace osu.Framework.Platform { public abstract class BasicStorage { public string BaseName { get; set; } protected BasicStorage(string baseName) { BaseName = FileSafety.WindowsFilenameStrip(baseName); } public abstract bool Exists(string path); public abstract void Delete(string path); public abstract Stream GetStream(string path, FileAccess mode = FileAccess.Read); public abstract SQLiteConnection GetDatabase(string name); public abstract void OpenInNativeExplorer(); } }
// Copyright (c) 2007-2016 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.IO; using SQLite.Net; namespace osu.Framework.Platform { public abstract class BasicStorage { public string BaseName { get; set; } protected BasicStorage(string baseName) { BaseName = baseName; } public abstract bool Exists(string path); public abstract void Delete(string path); public abstract Stream GetStream(string path, FileAccess mode = FileAccess.Read); public abstract SQLiteConnection GetDatabase(string name); public abstract void OpenInNativeExplorer(); } }
mit
C#
6d3a24ff01cdeea9bf52d164087279989b277b6d
Reorder tick hit results
NeoAdonis/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,ppy/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu-new,NeoAdonis/osu,smoogipooo/osu,UselessToucan/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu
osu.Game/Rulesets/Scoring/HitResult.cs
osu.Game/Rulesets/Scoring/HitResult.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.ComponentModel; namespace osu.Game.Rulesets.Scoring { public enum HitResult { /// <summary> /// Indicates that the object has not been judged yet. /// </summary> [Description(@"")] None, /// <summary> /// Indicates that the object has been judged as a miss. /// </summary> /// <remarks> /// This miss window should determine how early a hit can be before it is considered for judgement (as opposed to being ignored as /// "too far in the future). It should also define when a forced miss should be triggered (as a result of no user input in time). /// </remarks> [Description(@"Miss")] Miss, [Description(@"Meh")] Meh, /// <summary> /// Optional judgement. /// </summary> [Description(@"OK")] Ok, [Description(@"Good")] Good, [Description(@"Great")] Great, /// <summary> /// Optional judgement. /// </summary> [Description(@"Perfect")] Perfect, /// <summary> /// Indicates small tick miss. /// </summary> SmallTickMiss, /// <summary> /// Indicates a small tick hit. /// </summary> SmallTickHit, /// <summary> /// Indicates a large tick miss. /// </summary> LargeTickMiss, /// <summary> /// Indicates a large tick hit. /// </summary> LargeTickHit } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.ComponentModel; namespace osu.Game.Rulesets.Scoring { public enum HitResult { /// <summary> /// Indicates that the object has not been judged yet. /// </summary> [Description(@"")] None, /// <summary> /// Indicates that the object has been judged as a miss. /// </summary> /// <remarks> /// This miss window should determine how early a hit can be before it is considered for judgement (as opposed to being ignored as /// "too far in the future). It should also define when a forced miss should be triggered (as a result of no user input in time). /// </remarks> [Description(@"Miss")] Miss, [Description(@"Meh")] Meh, /// <summary> /// Optional judgement. /// </summary> [Description(@"OK")] Ok, [Description(@"Good")] Good, [Description(@"Great")] Great, /// <summary> /// Optional judgement. /// </summary> [Description(@"Perfect")] Perfect, SmallTickHit, SmallTickMiss, LargeTickHit, LargeTickMiss, } }
mit
C#
bf606522c1c3cd33ec90d70d1290fbfd5114d3aa
Make hyperdash testcase easier to win again
NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,ZLima12/osu,NeoAdonis/osu,EVAST9919/osu,johnneijzen/osu,naoey/osu,2yangk23/osu,smoogipoo/osu,naoey/osu,DrabWeb/osu,peppy/osu,ppy/osu,peppy/osu,Frontear/osuKyzer,naoey/osu,2yangk23/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu-new,ppy/osu,Nabile-Rahmani/osu,johnneijzen/osu,NeoAdonis/osu,ppy/osu,ZLima12/osu,EVAST9919/osu,DrabWeb/osu,DrabWeb/osu
osu.Game.Rulesets.Catch/Tests/TestCaseHyperdash.cs
osu.Game.Rulesets.Catch/Tests/TestCaseHyperdash.cs
using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] [Ignore("getting CI working")] public class TestCaseHyperdash : Game.Tests.Visual.TestCasePlayer { public TestCaseHyperdash() : base(typeof(CatchRuleset)) { } protected override Beatmap CreateBeatmap() { var beatmap = new Beatmap(); for (int i = 0; i < 512; i++) if (i % 5 < 3) beatmap.HitObjects.Add(new Fruit { X = i % 10 < 5 ? 0.02f : 0.98f, StartTime = i * 100, NewCombo = i % 8 == 0 }); return beatmap; } } }
using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] [Ignore("getting CI working")] public class TestCaseHyperdash : Game.Tests.Visual.TestCasePlayer { public TestCaseHyperdash() : base(typeof(CatchRuleset)) { } protected override Beatmap CreateBeatmap() { var beatmap = new Beatmap(); for (int i = 0; i < 512; i++) beatmap.HitObjects.Add(new Fruit { X = i % 8 < 4 ? 0.02f : 0.98f, StartTime = i * 100, NewCombo = i % 8 == 0 }); return beatmap; } } }
mit
C#
8b25e4c9eea54cb5353da8ca743ba38edff0d60d
Fix searching for "channel" matching all channels
naoey/osu,smoogipoo/osu,johnneijzen/osu,peppy/osu,smoogipoo/osu,DrabWeb/osu,johnneijzen/osu,peppy/osu-new,EVAST9919/osu,ppy/osu,DrabWeb/osu,smoogipoo/osu,UselessToucan/osu,2yangk23/osu,naoey/osu,smoogipooo/osu,ZLima12/osu,peppy/osu,ppy/osu,EVAST9919/osu,peppy/osu,NeoAdonis/osu,2yangk23/osu,naoey/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,ZLima12/osu,NeoAdonis/osu,DrabWeb/osu
osu.Game/Overlays/Chat/Selection/ChannelSection.cs
osu.Game/Overlays/Chat/Selection/ChannelSection.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; using System.Linq; using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat.Selection { public class ChannelSection : Container, IHasFilterableChildren { private readonly OsuSpriteText header; public readonly FillFlowContainer<ChannelListItem> ChannelFlow; public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children; public IEnumerable<string> FilterTerms => Array.Empty<string>(); public bool MatchingFilter { set { this.FadeTo(value ? 1f : 0f, 100); } } public string Header { get { return header.Text; } set { header.Text = value.ToUpperInvariant(); } } public IEnumerable<Channel> Channels { set { ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c)); } } public ChannelSection() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Children = new Drawable[] { header = new OsuSpriteText { TextSize = 15, Font = @"Exo2.0-Bold", }, ChannelFlow = new FillFlowContainer<ChannelListItem> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Top = 25 }, Spacing = new Vector2(0f, 5f), }, }; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; using System.Linq; using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat.Selection { public class ChannelSection : Container, IHasFilterableChildren { private readonly OsuSpriteText header; public readonly FillFlowContainer<ChannelListItem> ChannelFlow; public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children; public IEnumerable<string> FilterTerms => new[] { Header }; public bool MatchingFilter { set { this.FadeTo(value ? 1f : 0f, 100); } } public string Header { get { return header.Text; } set { header.Text = value.ToUpperInvariant(); } } public IEnumerable<Channel> Channels { set { ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c)); } } public ChannelSection() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Children = new Drawable[] { header = new OsuSpriteText { TextSize = 15, Font = @"Exo2.0-Bold", }, ChannelFlow = new FillFlowContainer<ChannelListItem> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Top = 25 }, Spacing = new Vector2(0f, 5f), }, }; } } }
mit
C#
c9de84b99a95043a0b05e753711eb21299816d30
move from on demand to regular build
AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell
src/ResourceManager/Profile/Commands.Profile.Test/ArgumentCompleterTests.cs
src/ResourceManager/Profile/Commands.Profile.Test/ArgumentCompleterTests.cs
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // 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 Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Commands.Resources.Test.ScenarioTests; using Microsoft.Azure.Commands.ScenarioTest; using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Xunit; using Xunit.Abstractions; namespace Microsoft.Azure.Commands.Profile.Test { public class ArgumentCompleterTests : RMTestBase { private XunitTracingInterceptor xunitLogger; public ArgumentCompleterTests(ITestOutputHelper output) { TestExecutionHelpers.SetUpSessionAndProfile(); ResourceManagerProfileProvider.InitializeResourceManagerProfile(true); xunitLogger = new XunitTracingInterceptor(output); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestLocationCompleter() { ProfileController.NewInstance.RunPsTest(xunitLogger, "72f988bf-86f1-41af-91ab-2d7cd011db47", "Test-LocationCompleter"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestResourceGroupCompleter() { ProfileController.NewInstance.RunPsTest(xunitLogger, "72f988bf-86f1-41af-91ab-2d7cd011db47", "Test-ResourceGroupCompleter"); } } }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // 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 Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Commands.Resources.Test.ScenarioTests; using Microsoft.Azure.Commands.ScenarioTest; using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; using Xunit; using Xunit.Abstractions; namespace Microsoft.Azure.Commands.Profile.Test { public class ArgumentCompleterTests : RMTestBase { private XunitTracingInterceptor xunitLogger; public ArgumentCompleterTests(ITestOutputHelper output) { TestExecutionHelpers.SetUpSessionAndProfile(); ResourceManagerProfileProvider.InitializeResourceManagerProfile(true); xunitLogger = new XunitTracingInterceptor(output); } [Fact] [Trait(Category.AcceptanceType, Category.Flaky)] public void TestLocationCompleter() { ProfileController.NewInstance.RunPsTest(xunitLogger, "72f988bf-86f1-41af-91ab-2d7cd011db47", "Test-LocationCompleter"); } [Fact] [Trait(Category.AcceptanceType, Category.Flaky)] public void TestResourceGroupCompleter() { ProfileController.NewInstance.RunPsTest(xunitLogger, "72f988bf-86f1-41af-91ab-2d7cd011db47", "Test-ResourceGroupCompleter"); } } }
apache-2.0
C#
5a4fc04da40b89a0da05d1f6119ad3c5227f6680
Fix test name
stsrki/fluentmigrator,amroel/fluentmigrator,spaccabit/fluentmigrator,fluentmigrator/fluentmigrator,amroel/fluentmigrator,igitur/fluentmigrator,stsrki/fluentmigrator,igitur/fluentmigrator,spaccabit/fluentmigrator,fluentmigrator/fluentmigrator
test/FluentMigrator.Tests/Unit/Loggers/TextWriterSemicolonDelimiterTests.cs
test/FluentMigrator.Tests/Unit/Loggers/TextWriterSemicolonDelimiterTests.cs
#region License // // Copyright (c) 2018, Fluent Migrator Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.IO; using FluentMigrator.Runner; using FluentMigrator.Runner.Logging; using Microsoft.Extensions.Logging; using NUnit.Framework; using Shouldly; namespace FluentMigrator.Tests.Unit.Loggers { public class TextWriterSemicolonDelimiter { private StringWriter stringWriter; private SqlScriptFluentMigratorLoggerOptions options; private ILoggerFactory loggerFactory; private ILogger logger; private string Output => stringWriter.ToString(); [SetUp] public void SetUp() => stringWriter = new StringWriter(); [Test] public void WhenEnabledSqlShouldHaveSemicolonDelimiter() { options = new SqlScriptFluentMigratorLoggerOptions() { OutputSemicolonDelimiter = true }; loggerFactory = new LoggerFactory(); loggerFactory.AddProvider(new SqlScriptFluentMigratorLoggerProvider(stringWriter, options)); logger = loggerFactory.CreateLogger("Test"); logger.LogSql("DELETE Blah"); Output.ShouldBe($"DELETE Blah;{Environment.NewLine}"); } [Test] public void WhenDisabledSqlShouldNotHaveSemicolonDelimiter() { options = new SqlScriptFluentMigratorLoggerOptions() { OutputSemicolonDelimiter = false }; loggerFactory = new LoggerFactory(); loggerFactory.AddProvider(new SqlScriptFluentMigratorLoggerProvider(stringWriter, options)); logger = loggerFactory.CreateLogger("Test"); logger.LogSql("DELETE Blah"); Output.ShouldNotContain(";"); } } }
#region License // // Copyright (c) 2018, Fluent Migrator Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.IO; using FluentMigrator.Runner; using FluentMigrator.Runner.Logging; using Microsoft.Extensions.Logging; using NUnit.Framework; using Shouldly; namespace FluentMigrator.Tests.Unit.Loggers { public class TextWriterSemicolonDelimiter { private StringWriter stringWriter; private SqlScriptFluentMigratorLoggerOptions options; private ILoggerFactory loggerFactory; private ILogger logger; private string Output => stringWriter.ToString(); [SetUp] public void SetUp() => stringWriter = new StringWriter(); [Test] public void WhenEnabledSqlShouldHaveSemicolonDelimiter() { options = new SqlScriptFluentMigratorLoggerOptions() { OutputSemicolonDelimiter = true }; loggerFactory = new LoggerFactory(); loggerFactory.AddProvider(new SqlScriptFluentMigratorLoggerProvider(stringWriter, options)); logger = loggerFactory.CreateLogger("Test"); logger.LogSql("DELETE Blah"); Output.ShouldBe($"DELETE Blah;{Environment.NewLine}"); } [Test] public void WhenDisabledSqlShouldHaveSemicolonDelimiter() { options = new SqlScriptFluentMigratorLoggerOptions() { OutputSemicolonDelimiter = false }; loggerFactory = new LoggerFactory(); loggerFactory.AddProvider(new SqlScriptFluentMigratorLoggerProvider(stringWriter, options)); logger = loggerFactory.CreateLogger("Test"); logger.LogSql("DELETE Blah"); Output.ShouldNotContain(";"); } } }
apache-2.0
C#
e26cc9acc53fb86bb7a1512a63703b0d56564095
print if FTraceSwitch.Level >= ATraceLevel
DBCG/Dataphor,n8allan/Dataphor,DBCG/Dataphor,n8allan/Dataphor,n8allan/Dataphor,DBCG/Dataphor,n8allan/Dataphor,n8allan/Dataphor,n8allan/Dataphor,DBCG/Dataphor,DBCG/Dataphor,DBCG/Dataphor
Dataphor/Logging/Logger.cs
Dataphor/Logging/Logger.cs
 using System.Diagnostics; namespace Alphora.Dataphor.Logging { internal class Logger : ILogger { private static TraceSwitch FTraceSwitch; public Logger(string ADisplayName):this(ADisplayName,"TraceSwitch for "+ADisplayName) { } public Logger(string ADisplayName, string ADescription) { FTraceSwitch=new TraceSwitch(ADisplayName,ADescription); } public void WriteLine(TraceLevel ATraceLevel, string AFormat) { bool LWillWriteLine = FTraceSwitch.Level >= ATraceLevel; Debug.WriteLineIf(LWillWriteLine, AFormat, FTraceSwitch.DisplayName); } public void WriteLine(TraceLevel ATraceLevel, string AFormat, params object[] AArgs) { bool LWillWriteLine = FTraceSwitch.Level >= ATraceLevel; Debug.WriteLineIf(LWillWriteLine, string.Format(AFormat, AArgs), FTraceSwitch.DisplayName); } } }
 using System.Diagnostics; namespace Alphora.Dataphor.Logging { internal class Logger : ILogger { private static TraceSwitch FTraceSwitch; public Logger(string ADisplayName):this(ADisplayName,"TraceSwitch for "+ADisplayName) { } public Logger(string ADisplayName, string ADescription) { FTraceSwitch=new TraceSwitch(ADisplayName,ADescription); } public void WriteLine(TraceLevel ATraceLevel, string AFormat) { bool LWillWriteLine = FTraceSwitch.Level <= ATraceLevel; Debug.WriteLineIf(LWillWriteLine, AFormat, FTraceSwitch.DisplayName); } public void WriteLine(TraceLevel ATraceLevel, string AFormat, params object[] AArgs) { bool LWillWriteLine = FTraceSwitch.Level <= ATraceLevel; Debug.WriteLineIf(LWillWriteLine, string.Format(AFormat, AArgs), FTraceSwitch.DisplayName); } } }
bsd-3-clause
C#
f3df088262ae738c95c55bf44326a9080720129b
Fix missing broadcast check in ModPacket.Send
peteyus/tModLoader,peteyus/tModLoader,peteyus/tModLoader,peteyus/tModLoader
patches/tModLoader/Terraria.ModLoader/ModPacket.cs
patches/tModLoader/Terraria.ModLoader/ModPacket.cs
using System; using System.IO; namespace Terraria.ModLoader { public sealed class ModPacket : BinaryWriter { private byte[] buf; private ushort len; internal ModPacket(byte messageID, int capacity = 256) : base(new MemoryStream(capacity)) { Write((ushort)0); Write(messageID); } public void Send(int toClient = -1, int ignoreClient = -1) { Finish(); if (Main.netMode == 1) Netplay.Connection.Socket.AsyncSend(buf, 0, len, SendCallback); else if (toClient != -1) Netplay.Clients[toClient].Socket.AsyncSend(buf, 0, len, SendCallback); else for (int i = 0; i < 256; i++) if (i != ignoreClient && Netplay.Clients[i].IsConnected() && NetMessage.buffer[i].broadcast) Netplay.Clients[i].Socket.AsyncSend(buf, 0, len, SendCallback); } private void SendCallback(object state) {} private void Finish() { if (buf != null) return; if (OutStream.Position > ushort.MaxValue) throw new Exception("Packet too large " + OutStream.Position + " > " + ushort.MaxValue); len = (ushort)OutStream.Position; Seek(0, SeekOrigin.Begin); Write(len); Close(); buf = ((MemoryStream) OutStream).GetBuffer(); } } }
using System; using System.IO; namespace Terraria.ModLoader { public sealed class ModPacket : BinaryWriter { private byte[] buf; private ushort len; internal ModPacket(byte messageID, int capacity = 256) : base(new MemoryStream(capacity)) { Write((ushort)0); Write(messageID); } public void Send(int toClient = -1, int ignoreClient = -1) { Finish(); if (Main.netMode == 1) Netplay.Connection.Socket.AsyncSend(buf, 0, len, SendCallback); else if (toClient != -1) Netplay.Clients[toClient].Socket.AsyncSend(buf, 0, len, SendCallback); else for (int i = 0; i < 256; i++) if (i != ignoreClient && Netplay.Clients[i].IsConnected()) Netplay.Clients[i].Socket.AsyncSend(buf, 0, len, SendCallback); } private void SendCallback(object state) {} private void Finish() { if (buf != null) return; if (OutStream.Position > ushort.MaxValue) throw new Exception("Packet too large " + OutStream.Position + " > " + ushort.MaxValue); len = (ushort)OutStream.Position; Seek(0, SeekOrigin.Begin); Write(len); Close(); buf = ((MemoryStream) OutStream).GetBuffer(); } } }
mit
C#
8f0fa03a179846a5203db628ad13a780d7e73946
Fix infinity climbing slope
bunashibu/kikan
Assets/Scripts/Character2D.cs
Assets/Scripts/Character2D.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Bunashibu.Kikan { [RequireComponent(typeof(Rigidbody2D))] [RequireComponent(typeof(Collider2D))] public class Character2D : MonoBehaviour { void Awake() { _character = gameObject.GetComponent<ICharacter>(); } void Update() { UpdateGroundRaycast(); } private void UpdateGroundRaycast() { Vector2 footRayOrigin = new Vector2(_character.FootCollider.bounds.center.x, _character.FootCollider.bounds.min.y); float rayLength = 0.1f + Mathf.Abs(_character.Rigid.velocity.y) * Time.deltaTime; RaycastHit2D hitGround = Physics2D.Raycast(footRayOrigin, Vector2.down, rayLength, _groundMask); if (_character.State.Ground) { float degAngle = Vector2.Angle(hitGround.normal, Vector2.up); if (degAngle == 90) degAngle = 0; _character.State.GroundAngle = degAngle; if (degAngle > 0 && degAngle < 90) { float sign = Mathf.Sign(hitGround.normal.x); _character.State.GroundLeft = (sign == 1 ) ? true : false; _character.State.GroundRight = (sign == -1) ? true : false; } else { _character.State.GroundLeft = false; _character.State.GroundRight = false; } } else { _character.State.GroundAngle = 0; _character.State.GroundLeft = false; _character.State.GroundRight = false; } Debug.DrawRay(footRayOrigin, Vector2.down * rayLength, Color.red); } [SerializeField] private LayerMask _groundMask; private ICharacter _character; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Bunashibu.Kikan { [RequireComponent(typeof(Rigidbody2D))] [RequireComponent(typeof(Collider2D))] public class Character2D : MonoBehaviour { void Awake() { _character = gameObject.GetComponent<ICharacter>(); } void Update() { UpdateGroundRaycast(); } private void UpdateGroundRaycast() { Vector2 footRayOrigin = new Vector2(_character.FootCollider.bounds.center.x, _character.FootCollider.bounds.min.y); float rayLength = 0.1f + Mathf.Abs(_character.Rigid.velocity.y) * Time.deltaTime; RaycastHit2D hitGround = Physics2D.Raycast(footRayOrigin, Vector2.down, rayLength, _groundMask); if (_character.State.Ground) { float degAngle = Vector2.Angle(hitGround.normal, Vector2.up); if (degAngle == 90) degAngle = 0; _character.State.GroundAngle = degAngle; if (degAngle > 0 && degAngle < 90) { float sign = Mathf.Sign(hitGround.normal.x); _character.State.GroundLeft = (sign == 1 ) ? true : false; _character.State.GroundRight = (sign == -1) ? true : false; } else { _character.State.GroundLeft = false; _character.State.GroundRight = false; } } Debug.DrawRay(footRayOrigin, Vector2.down * rayLength, Color.red); } [SerializeField] private LayerMask _groundMask; private ICharacter _character; } }
mit
C#
231973e987e304020599ecb21b620123685d33f2
Change access modifier
PolarbearDK/Miracle.FileZilla.Api
Source/Miracle.FileZilla.Api/Error.cs
Source/Miracle.FileZilla.Api/Error.cs
using System; using System.IO; namespace Miracle.FileZilla.Api { public class Error: IBinarySerializable { public bool IsError { get; set; } public string Message { get; set; } public void Deserialize(BinaryReader reader, int protocolVersion, int index) { IsError = reader.ReadBoolean(); Message = reader.ReadRemainingAsText(); } public void Serialize(BinaryWriter writer, int protocolVersion, int index) { throw new NotImplementedException(); } } }
using System; using System.IO; namespace Miracle.FileZilla.Api { internal class Error: IBinarySerializable { public bool IsError { get; set; } public string Message { get; set; } public void Deserialize(BinaryReader reader, int protocolVersion, int index) { IsError = reader.ReadBoolean(); Message = reader.ReadRemainingAsText(); } public void Serialize(BinaryWriter writer, int protocolVersion, int index) { throw new NotImplementedException(); } } }
mit
C#
ff80f5bc2031e5c267f56762861cdb416a7486df
Bump assembly version
NateShoffner/Strike.NET
Strike.NET/Properties/AssemblyInfo.cs
Strike.NET/Properties/AssemblyInfo.cs
#region using System.Reflection; using System.Runtime.InteropServices; #endregion // 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("Strike.NET")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nate Shoffner")] [assembly: AssemblyProduct("Strike.NET")] [assembly: AssemblyCopyright("Copyright © Nate Shoffner 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("f006da29-57a3-4a09-9154-a238ab7a8bb9")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
#region using System.Reflection; using System.Runtime.InteropServices; #endregion // 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("Strike.NET")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nate Shoffner")] [assembly: AssemblyProduct("Strike.NET")] [assembly: AssemblyCopyright("Copyright © Nate Shoffner 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("f006da29-57a3-4a09-9154-a238ab7a8bb9")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
c8ad18605a4e620b7f74f89c944e4a855308c7f6
Bump to 0.2.0
nekno/Transcoder,nekno/Transcoder
Transcoder/Properties/AssemblyInfo.cs
Transcoder/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Transcoder")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Transcoder")] [assembly: AssemblyCopyright("Copyright © 2016 nekno")] [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("8c462e6d-3d08-4676-b84c-60ead3559ce5")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.2.0.0")] [assembly: AssemblyFileVersion("0.2.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Transcoder")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Transcoder")] [assembly: AssemblyCopyright("Copyright © 2016 nekno")] [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("8c462e6d-3d08-4676-b84c-60ead3559ce5")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")]
mit
C#
3c1032734817f476e4490098dd9398acf61333d1
Add WatchingTestAsync
ats124/backlog4net
src/Backlog4net.Test/WatchingMethodsTest.cs
src/Backlog4net.Test/WatchingMethodsTest.cs
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Runtime.Remoting; using System.Text; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Backlog4net.Test { using Api; using Api.Option; using Backlog4net.Internal.Json; using Backlog4net.Internal.Json.Activities; using Conf; using Newtonsoft.Json; using TestConfig; [TestClass] public class WatchingMethodsTest { private static BacklogClient client; private static GeneralConfig generalConfig; private static string projectKey; private static long projectId; private static User ownUser; [ClassInitialize] public static async Task SetupClient(TestContext context) { generalConfig = GeneralConfig.Instance.Value; var conf = new BacklogJpConfigure(generalConfig.SpaceKey); conf.ApiKey = generalConfig.ApiKey; client = new BacklogClientFactory(conf).NewClient(); var users = await client.GetUsersAsync(); projectKey = generalConfig.ProjectKey; var project = await client.GetProjectAsync(projectKey); projectId = project.Id; ownUser = await client.GetMyselfAsync(); } [TestMethod] public async Task WatchingTestAsync() { var issueTypes = await client.GetIssueTypesAsync(projectId); var issue = await client.CreateIssueAsync(new CreateIssueParams(projectId, "WatchingTestIssue", issueTypes.First().Id, IssuePriorityType.High)); var watch = await client.AddWatchToIssueAsync(issue.Id, "Note"); Assert.AreNotEqual(watch.Id, 0); Assert.AreEqual(watch.Issue.Id, issue.Id); Assert.AreEqual(watch.Note, "Note"); Assert.IsNotNull(watch.Created); Assert.IsNotNull(watch.Updated); await client.MarkAsCheckedUserWatchesAsync(ownUser.Id); var watchGet = await client.GetWatchAsync(watch.Id); Assert.AreEqual(watchGet.Id, watch.Id); Assert.AreEqual(watchGet.Note, watch.Note); Assert.AreEqual(watchGet.Issue.Id, watch.Issue.Id); var watchUpdated = await client.UpdateWatchAsync(new UpdateWatchParams(watch.Id) { Note = "NoteUpdated" }); Assert.AreEqual(watchUpdated.Id, watch.Id); Assert.AreEqual(watchUpdated.Note, "NoteUpdated"); var watchDeleted = await client.DeleteWatchAsync(watch.Id); Assert.AreEqual(watchDeleted.Id, watchUpdated.Id); Assert.AreEqual(watchDeleted.Note, watchUpdated.Note); await client.DeleteIssueAsync(issue.Id); } } }
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Runtime.Remoting; using System.Text; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Backlog4net.Test { using Api; using Api.Option; using Backlog4net.Internal.Json; using Backlog4net.Internal.Json.Activities; using Conf; using Newtonsoft.Json; using TestConfig; [TestClass] public class WatchingMethodsTest { private static BacklogClient client; private static GeneralConfig generalConfig; private static string projectKey; private static long projectId; private static User ownUser; [ClassInitialize] public static async Task SetupClient(TestContext context) { generalConfig = GeneralConfig.Instance.Value; var conf = new BacklogJpConfigure(generalConfig.SpaceKey); conf.ApiKey = generalConfig.ApiKey; client = new BacklogClientFactory(conf).NewClient(); var users = await client.GetUsersAsync(); projectKey = generalConfig.ProjectKey; var project = await client.GetProjectAsync(projectKey); projectId = project.Id; ownUser = await client.GetMyselfAsync(); } } }
mit
C#
e7419f382e81444a44ccaec61c4b232de68ef430
Fix TestSceneHyperDash in test browser
peppy/osu,smoogipoo/osu,peppy/osu,ppy/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,EVAST9919/osu,EVAST9919/osu,UselessToucan/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,2yangk23/osu,UselessToucan/osu,johnneijzen/osu,ZLima12/osu,smoogipoo/osu,ZLima12/osu,peppy/osu-new,smoogipooo/osu,johnneijzen/osu,ppy/osu,ppy/osu
osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs
osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] public class TestSceneHyperDash : PlayerTestScene { public TestSceneHyperDash() : base(new CatchRuleset()) { } [Test] public void TestHyperDash() { AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash); } protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = { Ruleset = ruleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 3.6f } } }; // Should produce a hyper-dash beatmap.HitObjects.Add(new Fruit { StartTime = 816, X = 308 / 512f, NewCombo = true }); beatmap.HitObjects.Add(new Fruit { StartTime = 1008, X = 56 / 512f, }); for (int i = 0; i < 512; i++) if (i % 5 < 3) beatmap.HitObjects.Add(new Fruit { X = i % 10 < 5 ? 0.02f : 0.98f, StartTime = 2000 + i * 100, NewCombo = i % 8 == 0 }); return beatmap; } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] public class TestSceneHyperDash : PlayerTestScene { public TestSceneHyperDash() : base(new CatchRuleset()) { } [BackgroundDependencyLoader] private void load() { AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash); } protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) { var beatmap = new Beatmap { BeatmapInfo = { Ruleset = ruleset, BaseDifficulty = new BeatmapDifficulty { CircleSize = 3.6f } } }; // Should produce a hyper-dash beatmap.HitObjects.Add(new Fruit { StartTime = 816, X = 308 / 512f, NewCombo = true }); beatmap.HitObjects.Add(new Fruit { StartTime = 1008, X = 56 / 512f, }); for (int i = 0; i < 512; i++) if (i % 5 < 3) beatmap.HitObjects.Add(new Fruit { X = i % 10 < 5 ? 0.02f : 0.98f, StartTime = 2000 + i * 100, NewCombo = i % 8 == 0 }); return beatmap; } } }
mit
C#
6e2e6b76f957960a2f31660b2b009b3e83aa0963
Add some static functions.
snakealpha/Sturnus
CS/Sturnus/Sturnus/Sturnus.cs
CS/Sturnus/Sturnus/Sturnus.cs
using System; using System.Collections.Generic; namespace Elecelf.Sturnus { public abstract class Sturnus { public static Expression Parse(string expression, OperatorContext operatorContext = null) { return Parser.Parse(expression, operatorContext); } public static double Calculate(string expression, OperatorContext operatorContext = null, IDictionary<string, double> context = null) { return Parse(expression, operatorContext).Calculate(context); } public static double Calculate( string expression, OperatorContext operatorContext = null, IDictionary<string, Expression> expressionContext = null, IDictionary<string, double> globalContext = null) { IDictionary<string, double> context = (globalContext != null) ? globalContext : new Dictionary<string, double>(); foreach(var expKey in expressionContext) { context[expKey.Key] = expKey.Value.Calculate(context); } return Calculate(expression, operatorContext, context); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Elecelf.Sturnus { class Sturnus { } }
mit
C#
e2d0a0f699c755821df3a847aed5f0e1b170d64f
Add docstrings to IHtmlSanitizer
abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,arknu/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,abryukhov/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS
src/Umbraco.Core/Security/IHtmlSanitizer.cs
src/Umbraco.Core/Security/IHtmlSanitizer.cs
namespace Umbraco.Core.Security { public interface IHtmlSanitizer { /// <summary> /// Sanitizes HTML /// </summary> /// <param name="html">HTML to be sanitized</param> /// <returns>Sanitized HTML</returns> string Sanitize(string html); } }
namespace Umbraco.Core.Security { public interface IHtmlSanitizer { string Sanitize(string html); } }
mit
C#
bb931fd42210a285e178cd00591b937ac0183088
Fix slight error in documentation
albinsunnanbo/AssemblyVersionFromGit,albinsunnanbo/AssemblyVersionFromGit
AssemblyVersionFromGit/AssemblyVersionReader.cs
AssemblyVersionFromGit/AssemblyVersionReader.cs
using System; using System.Linq; using System.Reflection; namespace AssemblyVersionFromGit { public static class AssemblyVersionReader { /// <summary> /// Formats the assembly version from the specified assembly. /// Requires that <paramref name="assembly"/> contains an AssemblyInformationalVersion attribute. /// </summary> /// <param name="assembly"></param> /// <returns></returns> public static string FormatApplicationVersion(this Assembly assembly) { var version = assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false) .OfType<AssemblyInformationalVersionAttribute>().FirstOrDefault(); if (version == null) { return noVersion; } // Truncate long git hashes before display var printVersion = version.InformationalVersion; if (printVersion != null) { var dotLocation = printVersion.IndexOf(".", StringComparison.Ordinal); if (dotLocation >= 0) { const int hashLength = 8; var targetLength = dotLocation + 1 + hashLength; if (printVersion.Length > targetLength) { printVersion = printVersion.Substring(0, targetLength); } } } return printVersion; } private const string noVersion = "No version"; } }
using System; using System.Linq; using System.Reflection; namespace AssemblyVersionFromGit { public static class AssemblyVersionReader { /// <summary> /// Formats the assembly version from the specified assembly. /// Requires that the AssemblyInfo.cs file contains the AssemblyInformationalVersion attribute. /// </summary> /// <param name="assembly"></param> /// <returns></returns> public static string FormatApplicationVersion(this Assembly assembly) { var version = assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false) .OfType<AssemblyInformationalVersionAttribute>().FirstOrDefault(); if (version == null) { return noVersion; } // Truncate long git hashes before display var printVersion = version.InformationalVersion; if (printVersion != null) { var dotLocation = printVersion.IndexOf(".", StringComparison.Ordinal); if (dotLocation >= 0) { const int hashLength = 8; var targetLength = dotLocation + 1 + hashLength; if (printVersion.Length > targetLength) { printVersion = printVersion.Substring(0, targetLength); } } } return printVersion; } private const string noVersion = "No version"; } }
mit
C#
1c374536e150da487a0f7226902594eacef2fbe5
Update AlphaStreamsBrokerageModel.cs
StefanoRaggi/Lean,JKarathiya/Lean,StefanoRaggi/Lean,jameschch/Lean,jameschch/Lean,QuantConnect/Lean,jameschch/Lean,QuantConnect/Lean,JKarathiya/Lean,QuantConnect/Lean,QuantConnect/Lean,JKarathiya/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,AlexCatarino/Lean,jameschch/Lean,AlexCatarino/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,jameschch/Lean,JKarathiya/Lean,AlexCatarino/Lean
Common/Brokerages/AlphaStreamsBrokerageModel.cs
Common/Brokerages/AlphaStreamsBrokerageModel.cs
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * 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 QuantConnect.Orders.Fees; using QuantConnect.Orders.Slippage; using QuantConnect.Securities; namespace QuantConnect.Brokerages { /// <summary> /// Provides properties specific to Alpha Streams /// </summary> public class AlphaStreamsBrokerageModel : DefaultBrokerageModel { /// <summary> /// Initializes a new instance of the <see cref="AlphaStreamsBrokerageModel"/> class /// </summary> /// <param name="accountType">The type of account to be modelled, defaults to <see cref="AccountType.Margin"/> does not accept <see cref="AccountType.Cash"/>.</param> public AlphaStreamsBrokerageModel(AccountType accountType = AccountType.Margin) : base(accountType) { if (accountType == AccountType.Cash) { throw new ArgumentException("The Alpha Streams brokerage does not currently support Cash trading.", nameof(accountType)); } } /// <summary> /// Gets a new fee model that represents this brokerage's fee structure /// </summary> /// <param name="security">The security to get a fee model for</param> /// <returns>The new fee model for this brokerage</returns> public override IFeeModel GetFeeModel(Security security) => new AlphaStreamsFeeModel(); /// <summary> /// Gets a new slippage model that represents this brokerage's fill slippage behavior /// </summary> /// <param name="security">The security to get a slippage model for</param> /// <returns>The new slippage model for this brokerage</returns> public override ISlippageModel GetSlippageModel(Security security) => new AlphaStreamsSlippageModel(); /// <summary> /// Gets a new settlement model for the security /// </summary> /// <param name="security">The security to get a settlement model for</param> /// <returns>The settlement model for this brokerage</returns> public override ISettlementModel GetSettlementModel(Security security) => new ImmediateSettlementModel(); } }
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * 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 QuantConnect.Orders.Fees; using QuantConnect.Orders.Slippage; using QuantConnect.Securities; namespace QuantConnect.Brokerages { /// <summary> /// Provides properties specific to Alpha Streams /// </summary> public class AlphaStreamsBrokerageModel : DefaultBrokerageModel { /// <summary> /// Initializes a new instance of the <see cref="AlphaStreamsBrokerageModel"/> class /// </summary> /// <param name="accountType">The type of account to be modelled, defaults to <see cref="AccountType.Margin"/> does not accept <see cref="AccountType.Cash"/>.</param> public AlphaStreamsBrokerageModel(AccountType accountType = AccountType.Margin) : base(accountType) { if (accountType == AccountType.Cash) { throw new ArgumentException("The Alpha Streams brokerage does not currently support Cash trading.", nameof(accountType)); } } /// <summary> /// Gets a new fee model that represents this brokerage's fee structure /// </summary> /// <param name="security">The security to get a fee model for</param> /// <returns>The new fee model for this brokerage</returns> public override IFeeModel GetFeeModel(Security security) => new AlphaStreamsFeeModel(); /// <summary> /// Gets a new slippage model that represents this brokerage's fill slippage behavior /// </summary> /// <param name="security">The security to get a slippage model for</param> /// <returns>The new slippage model for this brokerage</returns> public override ISlippageModel GetSlippageModel(Security security) => new AlphaStreamsSlippageModel(); /// <summary> /// Force all security types to be restricted to 1.1x leverage /// - Current restriction to 1.1x is for the AS competition /// - Will be update in the future /// </summary> /// <param name="security"></param> /// <returns>The leverage for the specified security</returns> public override decimal GetLeverage(Security security) => 1.1m; /// <summary> /// Gets a new settlement model for the security /// </summary> /// <param name="security">The security to get a settlement model for</param> /// <returns>The settlement model for this brokerage</returns> public override ISettlementModel GetSettlementModel(Security security) => new ImmediateSettlementModel(); } }
apache-2.0
C#
13fed2843910161138d1464cec5bab7470114b68
Implement GetAllPosts
bsstahl/PPTail,bsstahl/PPTail
PrehensilePonyTail/PPTail.Data.FileSystem/Repository.cs
PrehensilePonyTail/PPTail.Data.FileSystem/Repository.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using PPTail.Entities; using Microsoft.Extensions.DependencyInjection; namespace PPTail.Data.FileSystem { public class Repository: Interfaces.IContentRepository { private readonly IServiceProvider _serviceProvider; private readonly string _rootPath; public Repository(IServiceProvider serviceProvider, string rootPath) { _serviceProvider = serviceProvider; _rootPath = rootPath; } public IEnumerable<ContentItem> GetAllPages() { var fileSystem = _serviceProvider.GetService<IFileSystem>(); var results = new List<ContentItem>(); string pagePath = System.IO.Path.Combine(_rootPath, "pages"); var files = fileSystem.EnumerateFiles(pagePath); foreach (var file in files.Where(f => f.ToLowerInvariant().EndsWith(".xml"))) { var contentItem = fileSystem.ReadAllText(file).ParseContentItem("page"); if (contentItem != null) results.Add(contentItem); } return results; } public IEnumerable<ContentItem> GetAllPosts() { var fileSystem = _serviceProvider.GetService<IFileSystem>(); var results = new List<ContentItem>(); string pagePath = System.IO.Path.Combine(_rootPath, "posts"); var files = fileSystem.EnumerateFiles(pagePath); foreach (var file in files.Where(f => f.ToLowerInvariant().EndsWith(".xml"))) { var contentItem = fileSystem.ReadAllText(file).ParseContentItem("post"); if (contentItem != null) results.Add(contentItem); } return results; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using PPTail.Entities; using Microsoft.Extensions.DependencyInjection; namespace PPTail.Data.FileSystem { public class Repository: Interfaces.IContentRepository { private readonly IServiceProvider _serviceProvider; private readonly string _rootPath; public Repository(IServiceProvider serviceProvider, string rootPath) { _serviceProvider = serviceProvider; _rootPath = rootPath; } public IEnumerable<ContentItem> GetAllPages() { var fileSystem = _serviceProvider.GetService<IFileSystem>(); var results = new List<ContentItem>(); string pagePath = System.IO.Path.Combine(_rootPath, "pages"); var files = fileSystem.EnumerateFiles(pagePath); foreach (var file in files.Where(f => f.ToLowerInvariant().EndsWith(".xml"))) { var contentItem = fileSystem.ReadAllText(file).ParseContentItem("page"); if (contentItem != null) results.Add(contentItem); } return results; } public IEnumerable<ContentItem> GetAllPosts() { throw new NotImplementedException(); } } }
mit
C#
95abb6c52e77a4b023434d9d2fb424066ee2fb0e
Fix warnings.
JohanLarsson/Gu.Roslyn.Asserts
Gu.Roslyn.Asserts.Analyzers/AnalyzerCategory.cs
Gu.Roslyn.Asserts.Analyzers/AnalyzerCategory.cs
namespace Gu.Roslyn.Asserts.Analyzers { internal static class AnalyzerCategory { internal const string Ocd = nameof(Ocd); internal const string Correctness = nameof(Correctness); } }
namespace Gu.Roslyn.Asserts.Analyzers { internal class AnalyzerCategory { internal static readonly string Ocd = nameof(Ocd); internal static readonly string Correctness = nameof(Correctness); } }
mit
C#
1d14fb9488c9227cc19e81807d07732ce8670663
Unify shared settings, per-site settings and environment settings
YOTOV-LIMITED/kudu,YOTOV-LIMITED/kudu,MavenRain/kudu,badescuga/kudu,kali786516/kudu,juvchan/kudu,shrimpy/kudu,puneet-gupta/kudu,projectkudu/kudu,duncansmart/kudu,puneet-gupta/kudu,shibayan/kudu,duncansmart/kudu,juvchan/kudu,shanselman/kudu,kali786516/kudu,mauricionr/kudu,shibayan/kudu,sitereactor/kudu,EricSten-MSFT/kudu,sitereactor/kudu,dev-enthusiast/kudu,juoni/kudu,badescuga/kudu,projectkudu/kudu,EricSten-MSFT/kudu,shrimpy/kudu,chrisrpatterson/kudu,juoni/kudu,MavenRain/kudu,chrisrpatterson/kudu,shibayan/kudu,kenegozi/kudu,juoni/kudu,oliver-feng/kudu,oliver-feng/kudu,kali786516/kudu,barnyp/kudu,uQr/kudu,barnyp/kudu,WeAreMammoth/kudu-obsolete,duncansmart/kudu,duncansmart/kudu,EricSten-MSFT/kudu,shrimpy/kudu,dev-enthusiast/kudu,shanselman/kudu,dev-enthusiast/kudu,badescuga/kudu,oliver-feng/kudu,uQr/kudu,mauricionr/kudu,projectkudu/kudu,barnyp/kudu,barnyp/kudu,puneet-gupta/kudu,kenegozi/kudu,uQr/kudu,projectkudu/kudu,mauricionr/kudu,juvchan/kudu,shanselman/kudu,MavenRain/kudu,chrisrpatterson/kudu,uQr/kudu,kenegozi/kudu,EricSten-MSFT/kudu,sitereactor/kudu,kali786516/kudu,shrimpy/kudu,puneet-gupta/kudu,MavenRain/kudu,bbauya/kudu,oliver-feng/kudu,YOTOV-LIMITED/kudu,kenegozi/kudu,bbauya/kudu,shibayan/kudu,juvchan/kudu,puneet-gupta/kudu,badescuga/kudu,WeAreMammoth/kudu-obsolete,juoni/kudu,mauricionr/kudu,bbauya/kudu,bbauya/kudu,dev-enthusiast/kudu,shibayan/kudu,juvchan/kudu,chrisrpatterson/kudu,sitereactor/kudu,sitereactor/kudu,WeAreMammoth/kudu-obsolete,badescuga/kudu,projectkudu/kudu,EricSten-MSFT/kudu,YOTOV-LIMITED/kudu
Kudu.Core/Settings/DeploymentSettingsManager.cs
Kudu.Core/Settings/DeploymentSettingsManager.cs
using Kudu.Contracts.Settings; using System; using System.Collections.Generic; using XmlSettings; namespace Kudu.Core.Settings { public class DeploymentSettingsManager : IDeploymentSettingsManager { private const string DeploymentSettingsSection = "deployment"; private const string EnvVariablePrefix = "KUDU_"; private readonly ISettings _settings; // Ideally, these default settings would live in Kudu's web.config. However, we also need them in // kudu.exe, so they actually need to be in a shaed config file. For now, it's easier to hard code // the defaults, since things like 'branch' will rarely want a different global default private static Dictionary<string, string> _defaultSettings = new Dictionary<string, string> { { "branch", "master" } }; public DeploymentSettingsManager(ISettings settings) { _settings = settings; } public void SetValue(string key, string value) { // Note that this only applies to persisted per-site settings _settings.SetValue(DeploymentSettingsSection, key, value); } public IEnumerable<KeyValuePair<string, string>> GetValues() { var values = new Dictionary<string, string>(); // Start with the default values, potentially overridden by environment variables foreach (var pair in _defaultSettings) { values[pair.Key] = GetEnvironmentVariableValueWithFallback(pair.Key); } // Add all the per-site settings, overriding AppSettings if needed var settings = _settings.GetValues(DeploymentSettingsSection); if (settings != null) { foreach (var entry in settings) { values[entry.Key] = entry.Value; } } return values; } public string GetValue(string key) { // First try the per-site persisted settings string val = _settings.GetValue(DeploymentSettingsSection, key); if (!String.IsNullOrEmpty(val)) { return val; } return GetEnvironmentVariableValueWithFallback(key); } public void DeleteValue(string key) { // Note that this only applies to persisted per-site settings _settings.DeleteValue(DeploymentSettingsSection, key); } private string GetEnvironmentVariableValueWithFallback(string key) { // Note that we only look for environment variables if they match a default setting if (!_defaultSettings.ContainsKey(key)) return null; string val = System.Environment.GetEnvironmentVariable(EnvVariablePrefix + key); if (String.IsNullOrEmpty(val)) { // Fall back to the default val = _defaultSettings[key]; } return val; } } }
using System.Collections.Generic; using System.Linq; using Kudu.Contracts.Settings; using XmlSettings; namespace Kudu.Core.Settings { public class DeploymentSettingsManager : IDeploymentSettingsManager { private const string DeploymentSettingsSection = "deployment"; private readonly ISettings _settings; public DeploymentSettingsManager(ISettings settings) { _settings = settings; } public void SetValue(string key, string value) { _settings.SetValue(DeploymentSettingsSection, key, value); } public IEnumerable<KeyValuePair<string, string>> GetValues() { var values = _settings.GetValues(DeploymentSettingsSection); if (values == null) { return Enumerable.Empty<KeyValuePair<string, string>>(); } return values; } public string GetValue(string key) { return _settings.GetValue(DeploymentSettingsSection, key); } public void DeleteValue(string key) { _settings.DeleteValue(DeploymentSettingsSection, key); } } }
apache-2.0
C#
e233d3b9ee294417c869930895501e0a1cbd33b6
Add failing test covering host disposal when never `Run()`
peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework
osu.Framework.Tests/Platform/HeadlessGameHostTest.cs
osu.Framework.Tests/Platform/HeadlessGameHostTest.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Threading; using System.Threading.Tasks; using NUnit.Framework; using osu.Framework.Platform; using osu.Framework.Tests.IO; namespace osu.Framework.Tests.Platform { [TestFixture] public class HeadlessGameHostTest { [Test] public void TestGameHostDisposalWhenNeverRun() { using (var host = new HeadlessGameHost(nameof(TestGameHostDisposalWhenNeverRun), true)) { // never call host.Run() } } [Test] public void TestIpc() { using (var server = new BackgroundGameHeadlessGameHost(@"server", true)) using (var client = new BackgroundGameHeadlessGameHost(@"client", true)) { Assert.IsTrue(server.IsPrimaryInstance, @"Server wasn't able to bind"); Assert.IsFalse(client.IsPrimaryInstance, @"Client was able to bind when it shouldn't have been able to"); var serverChannel = new IpcChannel<Foobar>(server); var clientChannel = new IpcChannel<Foobar>(client); void waitAction() { using (var received = new ManualResetEventSlim(false)) { serverChannel.MessageReceived += message => { Assert.AreEqual("example", message.Bar); // ReSharper disable once AccessToDisposedClosure received.Set(); }; clientChannel.SendMessageAsync(new Foobar { Bar = "example" }).Wait(); received.Wait(); } } Assert.IsTrue(Task.Run(waitAction).Wait(10000), @"Message was not received in a timely fashion"); } } private class Foobar { public string Bar; } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Threading; using System.Threading.Tasks; using NUnit.Framework; using osu.Framework.Platform; using osu.Framework.Tests.IO; namespace osu.Framework.Tests.Platform { [TestFixture] public class HeadlessGameHostTest { [Test] public void TestIpc() { using (var server = new BackgroundGameHeadlessGameHost(@"server", true)) using (var client = new BackgroundGameHeadlessGameHost(@"client", true)) { Assert.IsTrue(server.IsPrimaryInstance, @"Server wasn't able to bind"); Assert.IsFalse(client.IsPrimaryInstance, @"Client was able to bind when it shouldn't have been able to"); var serverChannel = new IpcChannel<Foobar>(server); var clientChannel = new IpcChannel<Foobar>(client); void waitAction() { using (var received = new ManualResetEventSlim(false)) { serverChannel.MessageReceived += message => { Assert.AreEqual("example", message.Bar); // ReSharper disable once AccessToDisposedClosure received.Set(); }; clientChannel.SendMessageAsync(new Foobar { Bar = "example" }).Wait(); received.Wait(); } } Assert.IsTrue(Task.Run(waitAction).Wait(10000), @"Message was not received in a timely fashion"); } } private class Foobar { public string Bar; } } }
mit
C#
010b1a5596025c25eef89a611a9c2b0c484b6e98
Use 'nameof'
onionhammer/dataseed
Wivuu.DataSeed.Tests/DataMigrations/AddDepartments.cs
Wivuu.DataSeed.Tests/DataMigrations/AddDepartments.cs
using System; using System.Collections.Generic; using System.Linq; using Wivuu.DataSeed.Tests.Domain; namespace Wivuu.DataSeed.Tests.DataMigrations { public class AddDepartments : DataMigration<DataSeedTestContext> { public override bool AlwaysRun => true; public override int Order => 1; protected override void Apply(DataSeedTestContext db) { var random = new Random(0x3); var school = db.Schools.First(); var scienceDeptId = random.NextGuid(); db.Departments.Find(scienceDeptId) .Update(new Dictionary<string, object> { [nameof(Department.Name)] = "Science", [nameof(Department.School)] = school }) .Default(() => db.Departments.Add(new Department { Id = scienceDeptId })); db.SaveChanges(); } } }
using System; using System.Collections.Generic; using System.Linq; using Wivuu.DataSeed.Tests.Domain; namespace Wivuu.DataSeed.Tests.DataMigrations { public class AddDepartments : DataMigration<DataSeedTestContext> { public override bool AlwaysRun => true; public override int Order => 1; protected override void Apply(DataSeedTestContext db) { var random = new Random(0x3); var school = db.Schools.First(); var scienceDeptId = random.NextGuid(); db.Departments.Find(scienceDeptId) .Update(new Dictionary<string, object> { ["Name"] = "Science", ["School"] = school }) .Default(() => db.Departments.Add(new Department { Id = scienceDeptId })); db.SaveChanges(); } } }
mit
C#
e28711619b8f424c370ef82ae477e33cdb9a5fc5
Create a database initializer with a url for the github project
marciotoshio/MyPersonalShortner,marciotoshio/MyPersonalShortner
Lib/Infrastructure/EntityFramework/EFContext.cs
Lib/Infrastructure/EntityFramework/EFContext.cs
using System.Data.Entity; using MyPersonalShortner.Lib.Domain.Url; namespace MyPersonalShortner.Lib.Infrastructure.EntityFramework { public class EFContext : DbContext { public EFContext() : base("MyPersonalShortner") { Database.SetInitializer(new MyPersonalSHortnerInitializer()); } public DbSet<LongUrl> Urls { get; set; } private class MyPersonalSHortnerInitializer : DropCreateDatabaseIfModelChanges<EFContext> { protected override void Seed(EFContext context) { context.Urls.Add(new LongUrl { Url = "https://github.com/marciotoshio/MyPersonalShortner" }); context.SaveChanges(); base.Seed(context); } } } }
using System.Data.Entity; using MyPersonalShortner.Lib.Domain.Url; namespace MyPersonalShortner.Lib.Infrastructure.EntityFramework { public class EFContext : DbContext { public EFContext() : base("MyPersonalShortner") { // TODO: Remove In Prod Database.CreateIfNotExists(); Database.SetInitializer(new DropCreateDatabaseIfModelChanges<EFContext>()); } public DbSet<LongUrl> Urls { get; set; } } }
mit
C#
8edb3a818996795a8308f0b619c2cfd2e408e135
use pattern matching
aluxnimm/outlookcaldavsynchronizer
CalDavSynchronizer/Ui/Options/Views/OptionsWindow.xaml.cs
CalDavSynchronizer/Ui/Options/Views/OptionsWindow.xaml.cs
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/) // Copyright (c) 2015 Gerhard Zehetbauer // Copyright (c) 2015 Alexander Nimmervoll // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.ComponentModel; using System.Windows; using CalDavSynchronizer.Ui.Options.ViewModels; namespace CalDavSynchronizer.Ui.Options.Views { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class OptionsWindow : Window { public OptionsWindow() { InitializeComponent(); DataContextChanged += OptionsWindow_DataContextChanged; Closing += OnWindowClosing; } private void OptionsWindow_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (e.NewValue is OptionsCollectionViewModel newViewModel) { newViewModel.CloseRequested += ViewModel_CloseRequested; } if (e.OldValue is OptionsCollectionViewModel oldViewModel) { oldViewModel.CloseRequested -= ViewModel_CloseRequested; } } private void ViewModel_CloseRequested(object sender, CloseEventArgs e) { DialogResult = e.IsAcceptedByUser; } public void OnWindowClosing(object sender, CancelEventArgs e) { if (DataContext is OptionsCollectionViewModel viewModel) { if (!DialogResult.HasValue) { var result = MessageBox.Show("Dou you want to save profiles?", ComponentContainer.MessageBoxTitle, MessageBoxButton.YesNo); DialogResult = (result == MessageBoxResult.Yes); } if (DialogResult.Value) { e.Cancel = viewModel.ShouldCloseBeCanceled(); } } } } }
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/) // Copyright (c) 2015 Gerhard Zehetbauer // Copyright (c) 2015 Alexander Nimmervoll // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.ComponentModel; using System.Windows; using CalDavSynchronizer.Ui.Options.ViewModels; namespace CalDavSynchronizer.Ui.Options.Views { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class OptionsWindow : Window { public OptionsWindow() { InitializeComponent(); DataContextChanged += OptionsWindow_DataContextChanged; Closing += OnWindowClosing; } private void OptionsWindow_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (e.NewValue is OptionsCollectionViewModel newViewModel) { newViewModel.CloseRequested += ViewModel_CloseRequested; } if (e.OldValue is OptionsCollectionViewModel oldViewModel) { oldViewModel.CloseRequested -= ViewModel_CloseRequested; } } private void ViewModel_CloseRequested(object sender, CloseEventArgs e) { DialogResult = e.IsAcceptedByUser; } public void OnWindowClosing(object sender, CancelEventArgs e) { var viewModel = DataContext as OptionsCollectionViewModel; if (viewModel != null) { if (!DialogResult.HasValue) { var result = MessageBox.Show("Dou you want to save profiles?", ComponentContainer.MessageBoxTitle, MessageBoxButton.YesNo); DialogResult = (result == MessageBoxResult.Yes); } if (DialogResult.Value) { e.Cancel = viewModel.ShouldCloseBeCanceled(); } } } } }
agpl-3.0
C#
8f272a4f0e3dcdcb1a9fb87c8d56298007222f60
Update assembly info for development of the next version
nanathan/ManeuverNodeSplitter
ManeuverNodeSplitter/Properties/AssemblyInfo.cs
ManeuverNodeSplitter/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ManeuverNodeSplitter")] [assembly: AssemblyDescription("")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ManeuverNodeSplitter")] [assembly: AssemblyCopyright("Copyright © 2016 nanathan")] [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("cd8998f3-feab-4d6f-839d-595e305e3aff")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4")] [assembly: AssemblyFileVersion("1.4.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ManeuverNodeSplitter")] [assembly: AssemblyDescription("")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ManeuverNodeSplitter")] [assembly: AssemblyCopyright("Copyright © 2016 nanathan")] [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("cd8998f3-feab-4d6f-839d-595e305e3aff")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3")] [assembly: AssemblyFileVersion("1.3.0")]
mit
C#
755d2737d0bc1836f3c4acae35bb88962a4edc11
Improve OsuTextFlowContainer with framework.
UselessToucan/osu,naoey/osu,peppy/osu,naoey/osu,Frontear/osuKyzer,DrabWeb/osu,peppy/osu-new,2yangk23/osu,smoogipooo/osu,EVAST9919/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,DrabWeb/osu,smoogipoo/osu,ppy/osu,naoey/osu,johnneijzen/osu,2yangk23/osu,UselessToucan/osu,ppy/osu,peppy/osu,ZLima12/osu,johnneijzen/osu,ppy/osu,ZLima12/osu,Damnae/osu,NeoAdonis/osu,EVAST9919/osu,smoogipoo/osu,Nabile-Rahmani/osu,DrabWeb/osu,smoogipoo/osu,NeoAdonis/osu,Drezi126/osu
osu.Game/Graphics/Containers/OsuTextFlowContainer.cs
osu.Game/Graphics/Containers/OsuTextFlowContainer.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.Collections.Generic; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.Containers { public class OsuTextFlowContainer : TextFlowContainer { public OsuTextFlowContainer(Action<SpriteText> defaultCreationParameters = null) : base(defaultCreationParameters) { } protected override SpriteText CreateSpriteText() => new OsuSpriteText(); public IEnumerable<SpriteText> AddTextAwesome(FontAwesome icon, Action<SpriteText> creationParameters = null) => AddText(((char)icon).ToString(), creationParameters); } }
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.Collections.Generic; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.Containers { public class OsuTextFlowContainer: TextFlowContainer { protected override SpriteText CreateSpriteText() => new OsuSpriteText(); public IEnumerable<SpriteText> AddTextAwesome(FontAwesome icon, Action<SpriteText> creationParameters = null) => AddText(((char)icon).ToString(), creationParameters); } }
mit
C#
a3eb8239fdb2fd54136237e38e01a25deada947d
Update ejemploExceps.cs
Beelzenef/GestionMenu
ejemplosClase/ejemploExceps.cs
ejemplosClase/ejemploExceps.cs
using System; namespace egb.progExcepciones { class ExcPropiaException : Exception { } class ContadorCeroException : Exception { public ContadorCeroException() : base() { } public ContadorCeroException(string msg) : base(msg) { } } class Clase1 { public static void M1() { try { Console.WriteLine ("Clase1.M1(); - tryOverflowException"); Clase2.M2(); } catch (OverflowException e1) { Console.WriteLine ("Clase1.M1(); - catchOverflowException"); } catch (Exception e2) { Console.WriteLine ("Clase1.M1(); - catchGenerico"); } finally { Console.WriteLine ("Clase1.M1(); - FINALLY"); } } } class Clase2 { public static void M2() { try { Console.WriteLine ("Clase2.M2(); - tryOverflowException"); throw new ExcPropiaException(); Console.WriteLine ("Esta línea nunca verá la luz :("); } catch (OverflowException e1) { Console.WriteLine ("Clase2.M2(); - catchOverflowException"); } catch (Exception e2) { Console.WriteLine ("Clase2.M2(); - catchGenerico"); } finally { Console.WriteLine ("Clase2.M2(); - FINALLY"); } } } class Inicio { static void Main() { try { Console.WriteLine ("TRY en Main"); Clase1.M1(); return; } catch (ExcPropiaException ex) { Console.WriteLine ("CATCH de mi propia Excepcion"); } catch (Exception ex) { Console.WriteLine ("CATCH en Main"); } finally { Console.WriteLine ("FINALLY en Main"); } try { throw new ContadorCeroException("CERO NOPE"); } catch (ContadorCeroException ex) { Console.WriteLine (ex.Message); } Console.ReadLine (); } } }
using System; namespace egb.progExcepciones { class ExcPropiaException : Exception { } class Clase1 { public static void M1() { try { Console.WriteLine ("Clase1.M1(); - tryOverflowException"); Clase2.M2(); } catch (OverflowException e1) { Console.WriteLine ("Clase1.M1(); - catchOverflowException"); } catch (Exception e2) { Console.WriteLine ("Clase1.M1(); - catchGenerico"); } finally { Console.WriteLine ("Clase1.M1(); - FINALLY"); } } } class Clase2 { public static void M2() { try { Console.WriteLine ("Clase2.M2(); - tryOverflowException"); throw new ExcPropiaException(); Console.WriteLine ("Esta línea nunca verá la luz :("); } catch (OverflowException e1) { Console.WriteLine ("Clase2.M2(); - catchOverflowException"); } catch (Exception e2) { Console.WriteLine ("Clase2.M2(); - catchGenerico"); } finally { Console.WriteLine ("Clase2.M2(); - FINALLY"); } } } class Inicio { static void Main() { try { Console.WriteLine ("TRY en Main"); Clase1.M1(); return; } catch (ExcPropiaException ex) { Console.WriteLine ("CATCH de mi propia Excepcion"); } catch (Exception ex) { Console.WriteLine ("CATCH en Main"); } finally { Console.WriteLine ("FINALLY en Main"); } Console.ReadLine (); } } }
mit
C#
25f5a13722aa9200633dd11663389d245a92d68d
Add Email test for ReadState.
ottoetc/OttoMail,ottoetc/OttoMail,ottoetc/OttoMail
OttoMail/OttoMail.Tests/ModelTests/EmailTest.cs
OttoMail/OttoMail.Tests/ModelTests/EmailTest.cs
using OttoMail.Models; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Xunit; namespace OttoMail.Tests { public class EmailTest { [Fact] public void GetSubjectTest() { //Arrange var email = new Email(); email.Subject = "Test"; //Act var result = email.Subject; //Assert Assert.Equal("Test", result); } [Fact] public void GetBodyTest() { var email = new Email(); email.Body = "Test"; var result = email.Body; Assert.Equal("Test", result); } [Fact] public void GetDateTest() { var email = new Email(); var result = email.Date; Assert.Equal(DateTime.Now, result); } [Fact] public void GetReadStateTest() { var email = new Email(); var result = email.Read; Assert.Equal(false, result); } } }
using OttoMail.Models; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Xunit; namespace OttoMail.Tests { public class EmailTest { [Fact] public void GetSubjectTest() { //Arrange var email = new Email(); email.Subject = "Test"; //Act var result = email.Subject; //Assert Assert.Equal("Test", result); } [Fact] public void GetBodyTest() { var email = new Email(); email.Body = "Test"; var result = email.Body; Assert.Equal("Test", result); } [Fact] public void GetDateTest() { var email = new Email(); var result = email.Date; Assert.Equal(DateTime.Now, result); } } }
mit
C#
53ec934cbf12990b09447df5bf32974765f021d3
Remove unnecessary casts.
tmat/roslyn,Inverness/roslyn,SeriaWei/roslyn,jeffanders/roslyn,panopticoncentral/roslyn,vslsnap/roslyn,huoxudong125/roslyn,lorcanmooney/roslyn,heejaechang/roslyn,MatthieuMEZIL/roslyn,KiloBravoLima/roslyn,natidea/roslyn,nguerrera/roslyn,jcouv/roslyn,MattWindsor91/roslyn,yjfxfjch/roslyn,swaroop-sridhar/roslyn,robinsedlaczek/roslyn,physhi/roslyn,TyOverby/roslyn,gafter/roslyn,MichalStrehovsky/roslyn,KiloBravoLima/roslyn,xasx/roslyn,YOTOV-LIMITED/roslyn,reaction1989/roslyn,russpowers/roslyn,devharis/roslyn,antiufo/roslyn,kienct89/roslyn,sharwell/roslyn,nemec/roslyn,reaction1989/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,thomaslevesque/roslyn,budcribar/roslyn,stephentoub/roslyn,brettfo/roslyn,jamesqo/roslyn,rgani/roslyn,shyamnamboodiripad/roslyn,enginekit/roslyn,pjmagee/roslyn,FICTURE7/roslyn,ilyes14/roslyn,GuilhermeSa/roslyn,YOTOV-LIMITED/roslyn,eriawan/roslyn,mattscheffer/roslyn,OmarTawfik/roslyn,vslsnap/roslyn,davkean/roslyn,antonssonj/roslyn,natidea/roslyn,AArnott/roslyn,dovzhikova/roslyn,Shiney/roslyn,bbarry/roslyn,Maxwe11/roslyn,jeffanders/roslyn,AArnott/roslyn,kienct89/roslyn,swaroop-sridhar/roslyn,brettfo/roslyn,VShangxiao/roslyn,DustinCampbell/roslyn,rgani/roslyn,bartdesmet/roslyn,pdelvo/roslyn,taylorjonl/roslyn,aelij/roslyn,a-ctor/roslyn,aanshibudhiraja/Roslyn,CaptainHayashi/roslyn,KamalRathnayake/roslyn,bkoelman/roslyn,zmaruo/roslyn,bbarry/roslyn,bartdesmet/roslyn,OmarTawfik/roslyn,supriyantomaftuh/roslyn,abock/roslyn,bkoelman/roslyn,RipCurrent/roslyn,jbhensley/roslyn,orthoxerox/roslyn,natgla/roslyn,natgla/roslyn,CyrusNajmabadi/roslyn,jcouv/roslyn,v-codeel/roslyn,genlu/roslyn,jonatassaraiva/roslyn,MatthieuMEZIL/roslyn,stephentoub/roslyn,devharis/roslyn,dpoeschl/roslyn,KamalRathnayake/roslyn,danielcweber/roslyn,YOTOV-LIMITED/roslyn,amcasey/roslyn,MatthieuMEZIL/roslyn,Hosch250/roslyn,yeaicc/roslyn,doconnell565/roslyn,DustinCampbell/roslyn,MattWindsor91/roslyn,eriawan/roslyn,jaredpar/roslyn,agocke/roslyn,VPashkov/roslyn,VitalyTVA/roslyn,agocke/roslyn,managed-commons/roslyn,tannergooding/roslyn,heejaechang/roslyn,diryboy/roslyn,robinsedlaczek/roslyn,EricArndt/roslyn,krishnarajbb/roslyn,evilc0des/roslyn,ericfe-ms/roslyn,leppie/roslyn,aelij/roslyn,KamalRathnayake/roslyn,khyperia/roslyn,genlu/roslyn,taylorjonl/roslyn,pjmagee/roslyn,Inverness/roslyn,cston/roslyn,krishnarajbb/roslyn,zmaruo/roslyn,huoxudong125/roslyn,ValentinRueda/roslyn,sharadagrawal/Roslyn,jroggeman/roslyn,lorcanmooney/roslyn,jasonmalinowski/roslyn,budcribar/roslyn,dotnet/roslyn,KevinH-MS/roslyn,MattWindsor91/roslyn,lisong521/roslyn,enginekit/roslyn,TyOverby/roslyn,v-codeel/roslyn,khellang/roslyn,jhendrixMSFT/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,zooba/roslyn,pjmagee/roslyn,balajikris/roslyn,lisong521/roslyn,AmadeusW/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,srivatsn/roslyn,abock/roslyn,Pvlerick/roslyn,jeffanders/roslyn,mgoertz-msft/roslyn,yjfxfjch/roslyn,TyOverby/roslyn,AlexisArce/roslyn,AlexisArce/roslyn,MihaMarkic/roslyn-prank,tannergooding/roslyn,davkean/roslyn,drognanar/roslyn,zmaruo/roslyn,cston/roslyn,sharwell/roslyn,MichalStrehovsky/roslyn,jaredpar/roslyn,leppie/roslyn,antiufo/roslyn,VPashkov/roslyn,jkotas/roslyn,panopticoncentral/roslyn,HellBrick/roslyn,ericfe-ms/roslyn,mattscheffer/roslyn,Giftednewt/roslyn,KiloBravoLima/roslyn,mgoertz-msft/roslyn,jbhensley/roslyn,basoundr/roslyn,panopticoncentral/roslyn,budcribar/roslyn,basoundr/roslyn,tvand7093/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,eriawan/roslyn,weltkante/roslyn,physhi/roslyn,pdelvo/roslyn,zooba/roslyn,moozzyk/roslyn,natgla/roslyn,EricArndt/roslyn,weltkante/roslyn,dpoeschl/roslyn,mseamari/Stuff,mattscheffer/roslyn,yeaicc/roslyn,yjfxfjch/roslyn,KevinRansom/roslyn,heejaechang/roslyn,mattwar/roslyn,diryboy/roslyn,stephentoub/roslyn,AArnott/roslyn,orthoxerox/roslyn,ljw1004/roslyn,ErikSchierboom/roslyn,tannergooding/roslyn,jkotas/roslyn,mmitche/roslyn,VSadov/roslyn,a-ctor/roslyn,michalhosala/roslyn,KirillOsenkov/roslyn,danielcweber/roslyn,srivatsn/roslyn,akrisiun/roslyn,mmitche/roslyn,nguerrera/roslyn,yeaicc/roslyn,antiufo/roslyn,oocx/roslyn,orthoxerox/roslyn,kelltrick/roslyn,amcasey/roslyn,paulvanbrenk/roslyn,balajikris/roslyn,nemec/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,brettfo/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,Inverness/roslyn,3F/roslyn,aanshibudhiraja/Roslyn,antonssonj/roslyn,vslsnap/roslyn,Giftednewt/roslyn,HellBrick/roslyn,russpowers/roslyn,nguerrera/roslyn,bbarry/roslyn,Giftednewt/roslyn,basoundr/roslyn,amcasey/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,jkotas/roslyn,kienct89/roslyn,jcouv/roslyn,managed-commons/roslyn,mattwar/roslyn,jmarolf/roslyn,mavasani/roslyn,MattWindsor91/roslyn,AnthonyDGreen/roslyn,mseamari/Stuff,jbhensley/roslyn,ErikSchierboom/roslyn,xasx/roslyn,akrisiun/roslyn,oocx/roslyn,ericfe-ms/roslyn,3F/roslyn,jasonmalinowski/roslyn,jmarolf/roslyn,ValentinRueda/roslyn,doconnell565/roslyn,Hosch250/roslyn,KirillOsenkov/roslyn,managed-commons/roslyn,ValentinRueda/roslyn,jamesqo/roslyn,GuilhermeSa/roslyn,AlekseyTs/roslyn,michalhosala/roslyn,khellang/roslyn,dotnet/roslyn,ljw1004/roslyn,mattwar/roslyn,CaptainHayashi/roslyn,gafter/roslyn,supriyantomaftuh/roslyn,tmeschter/roslyn,CyrusNajmabadi/roslyn,VSadov/roslyn,zooba/roslyn,tvand7093/roslyn,AmadeusW/roslyn,AnthonyDGreen/roslyn,leppie/roslyn,bkoelman/roslyn,genlu/roslyn,grianggrai/roslyn,vcsjones/roslyn,khyperia/roslyn,RipCurrent/roslyn,EricArndt/roslyn,CaptainHayashi/roslyn,michalhosala/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,VShangxiao/roslyn,weltkante/roslyn,rgani/roslyn,nemec/roslyn,SeriaWei/roslyn,lorcanmooney/roslyn,paulvanbrenk/roslyn,AlekseyTs/roslyn,antonssonj/roslyn,thomaslevesque/roslyn,doconnell565/roslyn,mgoertz-msft/roslyn,drognanar/roslyn,tmeschter/roslyn,jmarolf/roslyn,a-ctor/roslyn,FICTURE7/roslyn,cston/roslyn,jroggeman/roslyn,Pvlerick/roslyn,DustinCampbell/roslyn,mseamari/Stuff,Hosch250/roslyn,jaredpar/roslyn,natidea/roslyn,jhendrixMSFT/roslyn,AnthonyDGreen/roslyn,balajikris/roslyn,Shiney/roslyn,khyperia/roslyn,diryboy/roslyn,GuilhermeSa/roslyn,MichalStrehovsky/roslyn,AmadeusW/roslyn,FICTURE7/roslyn,agocke/roslyn,magicbing/roslyn,VitalyTVA/roslyn,AlexisArce/roslyn,xasx/roslyn,jamesqo/roslyn,mavasani/roslyn,evilc0des/roslyn,abock/roslyn,huoxudong125/roslyn,jhendrixMSFT/roslyn,grianggrai/roslyn,davkean/roslyn,3F/roslyn,HellBrick/roslyn,russpowers/roslyn,v-codeel/roslyn,dpoeschl/roslyn,evilc0des/roslyn,devharis/roslyn,taylorjonl/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,magicbing/roslyn,MihaMarkic/roslyn-prank,VitalyTVA/roslyn,tvand7093/roslyn,Shiney/roslyn,sharadagrawal/Roslyn,RipCurrent/roslyn,ljw1004/roslyn,srivatsn/roslyn,xoofx/roslyn,VSadov/roslyn,jroggeman/roslyn,wvdd007/roslyn,krishnarajbb/roslyn,khellang/roslyn,magicbing/roslyn,KevinRansom/roslyn,Pvlerick/roslyn,aanshibudhiraja/Roslyn,aelij/roslyn,physhi/roslyn,mmitche/roslyn,MihaMarkic/roslyn-prank,AlekseyTs/roslyn,wvdd007/roslyn,kelltrick/roslyn,enginekit/roslyn,VPashkov/roslyn,paulvanbrenk/roslyn,OmarTawfik/roslyn,akrisiun/roslyn,jonatassaraiva/roslyn,Maxwe11/roslyn,danielcweber/roslyn,drognanar/roslyn,kelltrick/roslyn,thomaslevesque/roslyn,tmat/roslyn,dovzhikova/roslyn,jonatassaraiva/roslyn,ilyes14/roslyn,SeriaWei/roslyn,xoofx/roslyn,sharadagrawal/Roslyn,KevinH-MS/roslyn,KevinH-MS/roslyn,dovzhikova/roslyn,xoofx/roslyn,swaroop-sridhar/roslyn,VShangxiao/roslyn,robinsedlaczek/roslyn,Maxwe11/roslyn,ilyes14/roslyn,tmat/roslyn,tmeschter/roslyn,dotnet/roslyn,vcsjones/roslyn,gafter/roslyn,moozzyk/roslyn,vcsjones/roslyn,oocx/roslyn,lisong521/roslyn,moozzyk/roslyn,supriyantomaftuh/roslyn,grianggrai/roslyn,pdelvo/roslyn
src/Workspaces/Core/Portable/CaseCorrection/AbstractCaseCorrectionService.cs
src/Workspaces/Core/Portable/CaseCorrection/AbstractCaseCorrectionService.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Shared; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.CaseCorrection { internal abstract partial class AbstractCaseCorrectionService : ICaseCorrectionService { protected abstract void AddReplacements(SemanticModel semanticModel, SyntaxNode root, IEnumerable<TextSpan> spans, Workspace workspace, ConcurrentDictionary<SyntaxToken, SyntaxToken> replacements, CancellationToken cancellationToken); public async Task<Document> CaseCorrectAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken) { var d = document; if (!spans.Any()) { return document; } var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetSemanticModelForSpanAsync(spans.Collapse(), cancellationToken).ConfigureAwait(false); var newRoot = CaseCorrect(semanticModel, root, spans, document.Project.Solution.Workspace, cancellationToken); return (root == newRoot) ? document : document.WithSyntaxRoot(newRoot); } public SyntaxNode CaseCorrect(SyntaxNode root, IEnumerable<TextSpan> spans, Workspace workspace, CancellationToken cancellationToken) { return CaseCorrect(null, root, spans, workspace, cancellationToken); } private SyntaxNode CaseCorrect(SemanticModel semanticModel, SyntaxNode root, IEnumerable<TextSpan> spans, Workspace workspace, CancellationToken cancellationToken) { using (Logger.LogBlock(FunctionId.CaseCorrection_CaseCorrect, cancellationToken)) { var normalizedSpanCollection = new NormalizedTextSpanCollection(spans); var replacements = new ConcurrentDictionary<SyntaxToken, SyntaxToken>(); using (Logger.LogBlock(FunctionId.CaseCorrection_AddReplacements, cancellationToken)) { AddReplacements(semanticModel, root, normalizedSpanCollection, workspace, replacements, cancellationToken); } using (Logger.LogBlock(FunctionId.CaseCorrection_ReplaceTokens, cancellationToken)) { return root.ReplaceTokens(replacements.Keys, (oldToken, _) => replacements[oldToken]); } } } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Shared; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.CaseCorrection { internal abstract partial class AbstractCaseCorrectionService : ICaseCorrectionService { protected abstract void AddReplacements(SemanticModel semanticModel, SyntaxNode root, IEnumerable<TextSpan> spans, Workspace workspace, ConcurrentDictionary<SyntaxToken, SyntaxToken> replacements, CancellationToken cancellationToken); public async Task<Document> CaseCorrectAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken) { if (!spans.Any()) { return document; } var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetSemanticModelForSpanAsync(spans.Collapse(), cancellationToken).ConfigureAwait(false); var newRoot = CaseCorrect(semanticModel, root, spans, document.Project.Solution.Workspace, cancellationToken); return (root == newRoot) ? document : document.WithSyntaxRoot(newRoot); } public SyntaxNode CaseCorrect(SyntaxNode root, IEnumerable<TextSpan> spans, Workspace workspace, CancellationToken cancellationToken) { return CaseCorrect(null, root, spans, workspace, cancellationToken); } private SyntaxNode CaseCorrect(SemanticModel semanticModel, SyntaxNode root, IEnumerable<TextSpan> spans, Workspace workspace, CancellationToken cancellationToken) { using (Logger.LogBlock(FunctionId.CaseCorrection_CaseCorrect, cancellationToken)) { var normalizedSpanCollection = new NormalizedTextSpanCollection(spans); var replacements = new ConcurrentDictionary<SyntaxToken, SyntaxToken>(); using (Logger.LogBlock(FunctionId.CaseCorrection_AddReplacements, cancellationToken)) { AddReplacements(semanticModel, root, normalizedSpanCollection, workspace, replacements, cancellationToken); } using (Logger.LogBlock(FunctionId.CaseCorrection_ReplaceTokens, cancellationToken)) { return root.ReplaceTokens(replacements.Keys, (oldToken, _) => replacements[oldToken]); } } } } }
apache-2.0
C#
790199671aa500659e69ab9beea780ce90116c68
use correct mssql instance on appveyor
MySoftwarepark/Sql.Migrations
PlainSql.Migrations.Tests/MsSqlMigratorTests.cs
PlainSql.Migrations.Tests/MsSqlMigratorTests.cs
using System; using System.Data; using System.Data.SqlClient; namespace PlainSql.Migrations.Tests { public class MsSqlMigratorTests : AbstractMigratorTests { protected override IDbConnection Connection { get { var connectionString = GetConnectionString(); var c = new SqlConnection(connectionString); c.Open(); return c; } } protected string GetConnectionString() { var connectionStringFromEnvironment = Environment.GetEnvironmentVariable("PLAIN_SQL_MIGRATIONS_MS_SQL"); if (!String.IsNullOrWhiteSpace(connectionStringFromEnvironment)) { return connectionStringFromEnvironment; } var IsAppVeyor = Environment.GetEnvironmentVariable("Appveyor")?.ToUpperInvariant() == "TRUE"; if (IsAppVeyor) { return @"Server=(local)\SQL2019;Database=tempdb;User ID=sa;Password=Password12!"; } return "Data Source=localhost;Initial Catalog=PlainSqlMigrations;User id=SA;Password=test123!;"; } } }
using System; using System.Data; using System.Data.SqlClient; namespace PlainSql.Migrations.Tests { public class MsSqlMigratorTests : AbstractMigratorTests { protected override IDbConnection Connection { get { var connectionString = GetConnectionString(); var c = new SqlConnection(connectionString); c.Open(); return c; } } protected string GetConnectionString() { var connectionStringFromEnvironment = Environment.GetEnvironmentVariable("PLAIN_SQL_MIGRATIONS_MS_SQL"); if (!String.IsNullOrWhiteSpace(connectionStringFromEnvironment)) { return connectionStringFromEnvironment; } var IsAppVeyor = Environment.GetEnvironmentVariable("Appveyor")?.ToUpperInvariant() == "TRUE"; if (IsAppVeyor) { return @"Server=(local)\SQL2016;Database=tempdb;User ID=sa;Password=Password12!"; } return "Data Source=localhost;Initial Catalog=PlainSqlMigrations;User id=SA;Password=test123!;"; } } }
mit
C#
687602ad6b5081b90b59bfbc476cebe101e4acc2
Fix obsolete contructor call warning
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
R7.University.Tests/DefaultPortalConfigTests.cs
R7.University.Tests/DefaultPortalConfigTests.cs
// // DefaultPortalConfigTests.cs // // Author: // Roman M. Yagodin <[email protected]> // // Copyright (c) 2016-2017 Roman M. Yagodin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using R7.University.Components; using Xunit; using System.IO; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization; namespace R7.University.Tests { public class DefaultPortalConfigTests { [Fact] public void PortalConfigDeserializationTest () { var defaultConfigFile = Path.Combine ("..", "..", "..", "R7.University", "R7.University.yml"); using (var configReader = new StringReader (File.ReadAllText (defaultConfigFile))) { var deserializer = new DeserializerBuilder ().WithNamingConvention (new HyphenatedNamingConvention ()).Build (); Assert.NotNull (deserializer.Deserialize<UniversityPortalConfig> (configReader)); } } } }
// // DefaultPortalConfigTests.cs // // Author: // Roman M. Yagodin <[email protected]> // // Copyright (c) 2016 Roman M. Yagodin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using R7.University.Components; using Xunit; using System.IO; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization; namespace R7.University.Tests { public class DefaultPortalConfigTests { [Fact] public void PortalConfigDeserializationTest () { var defaultConfigFile = Path.Combine ("..", "..", "..", "R7.University", "R7.University.yml"); using (var configReader = new StringReader (File.ReadAllText (defaultConfigFile))) { var deserializer = new Deserializer (namingConvention: new HyphenatedNamingConvention ()); Assert.NotNull (deserializer.Deserialize<UniversityPortalConfig> (configReader)); } } } }
agpl-3.0
C#
82f301f33d5c3421bf24563e32cbc34271c29a8e
Add styles and scripts to admin Layout.
alastairs/cgowebsite,alastairs/cgowebsite
src/CGO.Web/Areas/Admin/Views/Shared/_Layout.cshtml
src/CGO.Web/Areas/Admin/Views/Shared/_Layout.cshtml
<!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> @Styles.Render("~/Content/bootstrap.min.css") @Styles.Render("~/Content/bootstrap-responsive.min.css") @Styles.Render("~/bundles/font-awesome") <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/modernizr") @Scripts.Render("~/bundles/knockout") <script type="text/javascript"> Modernizr.load({ test: Modernizr.input.placeholder, nope: '/scripts/placeholder.js' }); Modernizr.load({ test: Modernizr.inputtypes.date, nope: '/scripts/datepicker.js' }); </script> </head> <body> <div> @RenderBody() </div> @RenderSection("Scripts", false) </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> @Styles.Render("~/Content/bootstrap.min.css") </head> <body> <div> @RenderBody() </div> @RenderSection("Scripts", false) </body> </html>
mit
C#
b6eb5ff4dbbcde3de262d66605289e94c7265764
Update TextShapeControl.xaml.cs
wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D
src/Core2D.UI/Views/Shapes/TextShapeControl.xaml.cs
src/Core2D.UI/Views/Shapes/TextShapeControl.xaml.cs
using Avalonia.Controls; using Avalonia.Markup.Xaml; using Core2D.Editor; using Core2D.Editors; using Core2D.Shapes; using Core2D.UI.Views.Editors; namespace Core2D.UI.Views.Shapes { /// <summary> /// Interaction logic for <see cref="TextShapeControl"/> xaml. /// </summary> public class TextShapeControl : UserControl { /// <summary> /// Initializes a new instance of the <see cref="TextShapeControl"/> class. /// </summary> public TextShapeControl() { InitializeComponent(); } /// <summary> /// Initialize the Xaml components. /// </summary> private void InitializeComponent() { AvaloniaXamlLoader.Load(this); } /// <summary> /// Edit shape text binding. /// </summary> public void OnEditTextBinding(object shape) { if (this.VisualRoot is TopLevel topLevel && topLevel.DataContext is IProjectEditor editor && shape is ITextShape text) { var window = new TextBindingEditorWindow() { DataContext = new TextBindingEditor() { Editor = editor, Text = text } }; window.ShowDialog(topLevel as Window); } } } }
using Avalonia.Controls; using Avalonia.Markup.Xaml; using Core2D.Editor; using Core2D.Editors; using Core2D.Shapes; using Core2D.UI.Views.Editors; namespace Core2D.UI.Views.Shapes { /// <summary> /// Interaction logic for <see cref="TextShapeControl"/> xaml. /// </summary> public class TextShapeControl : UserControl { /// <summary> /// Initializes a new instance of the <see cref="TextShapeControl"/> class. /// </summary> public TextShapeControl() { InitializeComponent(); } /// <summary> /// Initialize the Xaml components. /// </summary> private void InitializeComponent() { AvaloniaXamlLoader.Load(this); } /// <summary> /// Edit shape text binding. /// </summary> public void OnEditTextBinding(object shape) { if (this.VisualRoot is TopLevel topLevel && topLevel.DataContext is IProjectEditor editor && shape is ITextShape text) { var window = new TextBindingEditorWindow() { DataContext = new TextBindingEditor() { Editor = editor, Text = text, CaretIndex = text.Text.Length } }; window.ShowDialog(topLevel as Window); } } } }
mit
C#
416f5f92285112bbc78936b377e76eb290a6f3e0
verify more text and added click api
ProtoTest/ProtoTest.Golem,ProtoTest/ProtoTest.Golem
Golem.PageObjects.Cael/Portfolios/PreviewPortfolioPage.cs
Golem.PageObjects.Cael/Portfolios/PreviewPortfolioPage.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Golem.Framework; using OpenQA.Selenium; namespace Golem.PageObjects.Cael { public class PreviewPortfolioPage : BasePageObject { public Element CourseTitle_Link = new Element("Course Title Link", By.Id("p_lt_ctl02_pageplaceholder_p_lt_ctl00_LC_PreviewPortfolio_courseTitleHyperLink")); public Element CourseSchool_Link = new Element("Schol LInk", By.Id("p_lt_ctl02_pageplaceholder_p_lt_ctl00_LC_PreviewPortfolio_schoolNameHyperLink")); public Element LearningOutcomes_Text = new Element("Learning Outcomes Text", By.ClassName("credits-padding")); public Element LearningOutcomes_Link = new Element("Learning Outcomes Link", By.Id("p_lt_ctl02_pageplaceholder_p_lt_ctl00_LC_PreviewPortfolio_learningNarrativeHyperLink")); public Element Credits_Text = new Element("Credits Text", By.Id("p_lt_ctl02_pageplaceholder_p_lt_ctl00_LC_PreviewPortfolio_creditsLabel")); public Element Submit_Btn = new Element("Submit Portfolio Button", By.Id("btnSubmit")); public SubmitPortfolioPage SubmitPortfolio() { Submit_Btn.Click(); return new SubmitPortfolioPage(); } public override void WaitForElements() { CourseTitle_Link.VerifyVisible(30); CourseSchool_Link.VerifyVisible(30); LearningOutcomes_Link.VerifyVisible(30); LearningOutcomes_Text.VerifyVisible(30); Credits_Text.VerifyVisible(30); Submit_Btn.VerifyVisible(30).VerifyValue("Submit Portfolio For Assessment"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Golem.Framework; using OpenQA.Selenium; namespace Golem.PageObjects.Cael { public class PreviewPortfolioPage : BasePageObject { public Element CourseTitle_Link = new Element("Course Title Link", By.Id("p_lt_ctl02_pageplaceholder_p_lt_ctl00_LC_PreviewPortfolio_courseTitleHyperLink")); public Element CourseSchool_Link = new Element("Schol LInk", By.Id("p_lt_ctl02_pageplaceholder_p_lt_ctl00_LC_PreviewPortfolio_schoolNameHyperLink")); public Element LearningOutcomes_Text = new Element("Learning Outcomes Text", By.ClassName("credits-padding")); public Element LearningOutcomes_Link = new Element("Learning Outcomes Link", By.Id("p_lt_ctl02_pageplaceholder_p_lt_ctl00_LC_PreviewPortfolio_learningNarrativeHyperLink")); public Element Credits_Text = new Element("Credits Text", By.Id("p_lt_ctl02_pageplaceholder_p_lt_ctl00_LC_PreviewPortfolio_creditsLabel")); public override void WaitForElements() { CourseTitle_Link.VerifyVisible(30); CourseSchool_Link.VerifyVisible(30); LearningOutcomes_Link.VerifyVisible(30); LearningOutcomes_Text.VerifyVisible(30); Credits_Text.VerifyVisible(30); } } }
apache-2.0
C#
9f9107b84748bc95d0cb04a29760461557d7739c
Add gray background.
ppy/osu,2yangk23/osu,DrabWeb/osu,NeoAdonis/osu,ZLima12/osu,naoey/osu,Drezi126/osu,smoogipoo/osu,2yangk23/osu,DrabWeb/osu,Damnae/osu,naoey/osu,DrabWeb/osu,EVAST9919/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,peppy/osu-new,peppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,johnneijzen/osu,peppy/osu,Frontear/osuKyzer,ZLima12/osu,NeoAdonis/osu,UselessToucan/osu,Nabile-Rahmani/osu,UselessToucan/osu,johnneijzen/osu,EVAST9919/osu,smoogipoo/osu,NeoAdonis/osu,naoey/osu
osu.Game/Users/UserProfile.cs
osu.Game/Users/UserProfile.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Users.Profile; namespace osu.Game.Users { public class UserProfile : FocusedOverlayContainer { private readonly User user; private ProfileSection lastSection; public const float CONTENT_X_MARGIN = 50; public UserProfile(User user) { this.user = user; var tab = new OsuTabControl<ProfileSection>(); var sections = new ProfileSection[] { }; Add(new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.2f) }); var sectionsContainer = new SectionsContainer { RelativeSizeAxes = Axes.Both, ExpandableHeader = new UserPageHeader(user), FixedHeader = tab, Sections = sections }; Add(sectionsContainer); sectionsContainer.SelectedSection.ValueChanged += s => { if (lastSection != s) { lastSection = s as ProfileSection; tab.Current.Value = lastSection; } }; tab.Current.ValueChanged += s => { if (lastSection != s) { lastSection = s; sectionsContainer.ScrollContainer.ScrollIntoView(lastSection); } }; } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Users.Profile; namespace osu.Game.Users { public class UserProfile : FocusedOverlayContainer { private readonly User user; private ProfileSection lastSection; public const float CONTENT_X_MARGIN = 50; public UserProfile(User user) { this.user = user; var tab = new OsuTabControl<ProfileSection>(); var sections = new ProfileSection[] { }; var sectionsContainer = new SectionsContainer { RelativeSizeAxes = Axes.Both, ExpandableHeader = new UserPageHeader(user), FixedHeader = tab, Sections = sections }; Add(sectionsContainer); sectionsContainer.SelectedSection.ValueChanged += s => { if (lastSection != s) { lastSection = s as ProfileSection; tab.Current.Value = lastSection; } }; tab.Current.ValueChanged += s => { if (lastSection != s) { lastSection = s; sectionsContainer.ScrollContainer.ScrollIntoView(lastSection); } }; } } }
mit
C#
742f439e815f384ce4f9d96e80977192b583a68d
Change Id to AccountLegalEntityId
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EAS.Portal.Client/Types/Organisation.cs
src/SFA.DAS.EAS.Portal.Client/Types/Organisation.cs
using Newtonsoft.Json; using System.Collections.Generic; namespace SFA.DAS.EAS.Portal.Client.Types { public class Organisation { [JsonConstructor] public Organisation() { Providers = new List<Provider>(); Reservations = new List<Reservation>(); Cohorts = new List<Cohort>(); Agreements = new List<Agreement>(); } [JsonProperty("id")] public long AccountLegalEntityId { get; set; } [JsonProperty("name")] public string Name { get; set; } [JsonProperty("providers")] public ICollection<Provider> Providers { get; set; } [JsonProperty("reservations")] public ICollection<Reservation> Reservations { get; set; } [JsonProperty("cohorts")] public ICollection<Cohort> Cohorts { get; set; } [JsonProperty("agreements")] public ICollection<Agreement> Agreements { get; set; } } }
using Newtonsoft.Json; using System.Collections.Generic; namespace SFA.DAS.EAS.Portal.Client.Types { public class Organisation { [JsonConstructor] public Organisation() { Providers = new List<Provider>(); Reservations = new List<Reservation>(); Cohorts = new List<Cohort>(); Agreements = new List<Agreement>(); } [JsonProperty("id")] public long Id { get; set; } [JsonProperty("name")] public string Name { get; set; } [JsonProperty("providers")] public ICollection<Provider> Providers { get; set; } [JsonProperty("reservations")] public ICollection<Reservation> Reservations { get; set; } [JsonProperty("cohorts")] public ICollection<Cohort> Cohorts { get; set; } [JsonProperty("agreements")] public ICollection<Agreement> Agreements { get; set; } } }
mit
C#
9cf0f20f3c7039bc0af795c0e6f3ecff272a45e3
return consistent messaging
DynamoDS/DynamoSamples
src/SampleLibraryZeroTouch/Utils/SampleUtilities.cs
src/SampleLibraryZeroTouch/Utils/SampleUtilities.cs
using Autodesk.DesignScript.Runtime; namespace SampleLibraryZeroTouch { /// <summary> /// A utility library containing methods that can be called /// from NodeModel nodes, or used as nodes in Dynamo. /// </summary> public static class SampleUtilities { [IsVisibleInDynamoLibrary(false)] public static double MultiplyInputByNumber(double input) { return input * 10; } [IsVisibleInDynamoLibrary(false)] public static string DescribeButtonMessage(string input) { return "Button displays: " + input; } [IsVisibleInDynamoLibrary(false)] public static string DescribeWindowMessage(string GUID, string input) { return "Window displays: Data bridge callback of node " + GUID.Substring(0, 5) + ": " + input; } } }
using Autodesk.DesignScript.Runtime; namespace SampleLibraryZeroTouch { /// <summary> /// A utility library containing methods that can be called /// from NodeModel nodes, or used as nodes in Dynamo. /// </summary> public static class SampleUtilities { [IsVisibleInDynamoLibrary(false)] public static double MultiplyInputByNumber(double input) { return input * 10; } [IsVisibleInDynamoLibrary(false)] public static string DescribeButtonMessage(string input) { return "Button displays: " + input; } [IsVisibleInDynamoLibrary(false)] public static string DescribeWindowMessage(string GUID, string input) { return "Data bridge callback of node " + GUID.Substring(0, 5) + ": " + input; } } }
mit
C#
b05f95363934060f394cea6721c20a3b9e4008db
Bump version to 0.8
FatturaElettronicaPA/FatturaElettronicaPA.Forms
Properties/AssemblyInfo.cs
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("FatturaElettronica.Forms")] [assembly: AssemblyDescription("Windows.Forms per FatturaElettronica.NET")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nicola Iarocci, CIR2000")] [assembly: AssemblyProduct("FatturaElettronica.Forms")] [assembly: AssemblyCopyright("Copyright © CIR2000 2017-2018")] [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("a82cf38b-b7fe-42ae-b114-dc8fed8bd718")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.8.0.0")] [assembly: AssemblyFileVersion("0.8.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("FatturaElettronica.Forms")] [assembly: AssemblyDescription("Windows.Forms per FatturaElettronica.NET")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nicola Iarocci, CIR2000")] [assembly: AssemblyProduct("FatturaElettronica.Forms")] [assembly: AssemblyCopyright("Copyright © CIR2000 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a82cf38b-b7fe-42ae-b114-dc8fed8bd718")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.7.2.0")] [assembly: AssemblyFileVersion("0.7.2.0")]
bsd-3-clause
C#
7d4fb249691fa840f17335656435b64358fea330
Apply license terms uniformly
Lightstreamer/Lightstreamer-example-StockList-client-winrt,Weswit/Lightstreamer-example-StockList-client-winrt
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Lightstreamer WinRT Demo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Weswit Srl")] [assembly: AssemblyProduct("Lightstreamer WinRT Demo")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ComVisible(false)]
#region License /* * Copyright 2013 Weswit Srl * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #endregion License using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Lightstreamer WinRT Demo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Weswit Srl")] [assembly: AssemblyProduct("Lightstreamer WinRT Demo")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ComVisible(false)]
apache-2.0
C#
5d99d8b0a068c8384a09dde0f72d12e7c1f5efb1
bump version
sebtoun/DumpKinectSkeleton,sebtoun/DumpKinectSkeleton
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using CommandLine; // Les informations générales relatives à un assembly dépendent de // l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations // associées à un assembly. [assembly: AssemblyTitle( "DumpKinectSkeleton" )] [assembly: AssemblyDescription( "" )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "" )] [assembly: AssemblyProduct( "DumpKinectSkeleton" )] [assembly: AssemblyCopyright( "Copyright © 2016 Sébastien Andary" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de // COM, affectez la valeur true à l'attribut ComVisible sur ce type. [assembly: ComVisible( false )] // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM [assembly: Guid( "923976b8-c255-44e6-b3ed-594478359d47" )] // Les informations de version pour un assembly se composent des quatre valeurs suivantes : // // Version principale // Version secondaire // Numéro de build // Révision // // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut // en utilisant '*', comme indiqué ci-dessous : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion( "3.1.*" )] [assembly: AssemblyFileVersion( "3.1.*" )] // from .NET class library [assembly: AssemblyInformationalVersionAttribute( "3.1" )] // from CommandLineParser.Text [assembly: AssemblyLicense( "This is free software. You may redistribute copies of it under the terms of", "the MIT License <http://www.opensource.org/licenses/mit-license.php>." )] [assembly: AssemblyUsage( "Usage: DumpKinectSkeleton [--help] [-v|--video] [-s|--synchronize] [--prefix PREFIX]" )]
using System.Reflection; using System.Runtime.InteropServices; using CommandLine; // Les informations générales relatives à un assembly dépendent de // l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations // associées à un assembly. [assembly: AssemblyTitle( "DumpKinectSkeleton" )] [assembly: AssemblyDescription( "" )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "" )] [assembly: AssemblyProduct( "DumpKinectSkeleton" )] [assembly: AssemblyCopyright( "Copyright © 2016 Sébastien Andary" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de // COM, affectez la valeur true à l'attribut ComVisible sur ce type. [assembly: ComVisible( false )] // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM [assembly: Guid( "923976b8-c255-44e6-b3ed-594478359d47" )] // Les informations de version pour un assembly se composent des quatre valeurs suivantes : // // Version principale // Version secondaire // Numéro de build // Révision // // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut // en utilisant '*', comme indiqué ci-dessous : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion( "3.0.*" )] [assembly: AssemblyFileVersion( "3.0.*" )] // from .NET class library [assembly: AssemblyInformationalVersionAttribute( "3.0" )] // from CommandLineParser.Text [assembly: AssemblyLicense( "This is free software. You may redistribute copies of it under the terms of", "the MIT License <http://www.opensource.org/licenses/mit-license.php>." )] [assembly: AssemblyUsage( "Usage: DumpKinectSkeleton [--help] [-v|--video] [-s|--synchronize] [--prefix PREFIX]" )]
mit
C#
726067cd3aaa071aa669945c85d7df314d448e84
Fix Search
Silphid/Silphid.Unity,Silphid/Silphid.Unity
Sources/Silphid.Showzup/Sources/Controls/Control.cs
Sources/Silphid.Showzup/Sources/Controls/Control.cs
using System.Collections.Generic; using System.Linq; using Silphid.Extensions; using UniRx; using UnityEngine; using UnityEngine.EventSystems; namespace Silphid.Showzup { public abstract class Control : MonoBehaviour, ISelectHandler, IDeselectHandler { protected readonly ReactiveProperty<bool> IsSelected = new ReactiveProperty<bool>(); protected virtual void RemoveAllViews(GameObject container, GameObject except = null) { if (container) container.Children().Where(x => x != except).ForEach(RemoveView); } protected void RemoveViews(GameObject viewObject, IEnumerable<IView> views) { foreach (var view in views) RemoveView(view?.GameObject); //FIXME [jsricard] views contains sometime a liste of null } protected virtual void RemoveView(GameObject viewObject) { if (viewObject != null) Destroy(viewObject); } protected virtual void SetViewParent(GameObject container, GameObject viewObject) { viewObject.transform.SetParent(container.transform, false); } protected virtual void ReplaceView(GameObject container, IView view) { AddView(container, view); RemoveAllViews(container, view?.GameObject); } protected virtual void AddView(GameObject container, IView view) { if (view == null) return; SetViewParent(container, view.GameObject); view.IsActive = true; } protected virtual void InsertView(GameObject container, int index, IView view) { if (view == null) return; SetViewParent(container, view.GameObject); view.GameObject.transform.SetSiblingIndex(index); view.IsActive = true; } public virtual void OnSelect(BaseEventData eventData) { IsSelected.Value = true; } public virtual void OnDeselect(BaseEventData eventData) { IsSelected.Value = false; } } }
using System.Collections.Generic; using System.Linq; using Silphid.Extensions; using UniRx; using UnityEngine; using UnityEngine.EventSystems; namespace Silphid.Showzup { public abstract class Control : MonoBehaviour, ISelectHandler, IDeselectHandler { protected readonly ReactiveProperty<bool> IsSelected = new ReactiveProperty<bool>(); protected virtual void RemoveAllViews(GameObject container, GameObject except = null) { if (container) container.Children().Where(x => x != except).ForEach(RemoveView); } protected void RemoveViews(GameObject viewObject, IEnumerable<IView> views) { foreach (var view in views) RemoveView(view.GameObject); } protected virtual void RemoveView(GameObject viewObject) { Destroy(viewObject); } protected virtual void SetViewParent(GameObject container, GameObject viewObject) { viewObject.transform.SetParent(container.transform, false); } protected virtual void ReplaceView(GameObject container, IView view) { AddView(container, view); RemoveAllViews(container, view?.GameObject); } protected virtual void AddView(GameObject container, IView view) { if (view == null) return; SetViewParent(container, view.GameObject); view.IsActive = true; } protected virtual void InsertView(GameObject container, int index, IView view) { if (view == null) return; SetViewParent(container, view.GameObject); view.GameObject.transform.SetSiblingIndex(index); view.IsActive = true; } public virtual void OnSelect(BaseEventData eventData) { IsSelected.Value = true; } public virtual void OnDeselect(BaseEventData eventData) { IsSelected.Value = false; } } }
mit
C#
1287cd11b9bdab74f1e1f77ce7e607151f52b1d3
fix for password input not showing the entered value after save
CityofSantaMonica/Orchard.Socrata
Views/EditorTemplates/Parts.Socrata.Settings.cshtml
Views/EditorTemplates/Parts.Socrata.Settings.cshtml
@model CSM.Socrata.Models.SocrataSettingsPart <fieldset> <legend>Socrata Connection Settings</legend> <div> @Html.LabelFor(m => m.Host, T("Socrata host")) <strong>https://</strong>@Html.TextBoxFor(m => m.Host, new { @class = "text medium" }) </div> <div> @Html.LabelFor(m => m.AppToken, T("SODA App Token")) @Html.TextBoxFor(m => m.AppToken, new { @class = "text medium" }) <span class="hint">See the <a href="http://dev.socrata.com/docs/app-tokens.html" target="_blank">SODA App Token documentation</a> for more info.</span> </div> <div> @Html.LabelFor(m => m.Username, T("Socrata user account")) @Html.TextBoxFor(m => m.Username, new { @class = "text medium" }) </div> <div> @Html.LabelFor(m => m.Password, T("Socrata user account password")) @Html.TextBoxFor(m => m.Password, new { @class = "text medium", type = "password" }) </div> <p class="hint">Account credentials are required for performing write operations on Socrata datasets and for reading private resources.</p> </fieldset>
@model CSM.Socrata.Models.SocrataSettingsPart <fieldset> <legend>Socrata Connection Settings</legend> <div> @Html.LabelFor(m => m.Host, T("Socrata host")) <strong>https://</strong>@Html.TextBoxFor(m => m.Host, new { @class = "text medium" }) </div> <div> @Html.LabelFor(m => m.AppToken, T("SODA App Token")) @Html.TextBoxFor(m => m.AppToken, new { @class = "text medium" }) <span class="hint">See the <a href="http://dev.socrata.com/docs/app-tokens.html" target="_blank">SODA App Token documentation</a> for more info.</span> </div> <div> @Html.LabelFor(m => m.Username, T("Socrata user account")) @Html.TextBoxFor(m => m.Username, new { @class = "text medium" }) </div> <div> @Html.LabelFor(m => m.Password, T("Socrata user account password")) @Html.PasswordFor(m => m.Password, new { @class = "text medium" }) </div> <p class="hint">Account credentials are required for performing write operations on Socrata datasets and for reading private resources.</p> </fieldset>
mit
C#
0e9b2fdecf343852fc34ee85aac76759b8f75848
Test data whitespace fixes (from tabs to spaces)
r2i-sitecore/dotless,rytmis/dotless,modulexcite/dotless,rytmis/dotless,dotless/dotless,rytmis/dotless,r2i-sitecore/dotless,modulexcite/dotless,modulexcite/dotless,rytmis/dotless,rytmis/dotless,r2i-sitecore/dotless,r2i-sitecore/dotless,rytmis/dotless,dotless/dotless,modulexcite/dotless,rytmis/dotless,modulexcite/dotless,r2i-sitecore/dotless,r2i-sitecore/dotless,r2i-sitecore/dotless,modulexcite/dotless,modulexcite/dotless
src/dotless.Test/Specs/Functions/ExtractFixture.cs
src/dotless.Test/Specs/Functions/ExtractFixture.cs
namespace dotless.Test.Specs.Functions { using NUnit.Framework; public class ExtractFixture : SpecFixtureBase { [Test] public void TestExtractFromCommaSeparatedList() { var input = @" @list: ""Arial"", ""Helvetica""; .someClass { font-family: e(extract(@list, 2)); }"; var expected = @" .someClass { font-family: Helvetica; }"; AssertLess(input, expected); } [Test] public void TestExtractFromSpaceSeparatedList() { var input = @" @list: 1px solid blue; .someClass { border: e(extract(@list, 2)); }"; var expected = @" .someClass { border: solid; }"; AssertLess(input, expected); } } }
namespace dotless.Test.Specs.Functions { using NUnit.Framework; public class ExtractFixture : SpecFixtureBase { [Test] public void TestExtractFromCommaSeparatedList() { var input = @" @list: ""Arial"", ""Helvetica""; .someClass { font-family: e(extract(@list, 2)); }"; var expected = @" .someClass { font-family: Helvetica; }"; AssertLess(input, expected); } [Test] public void TestExtractFromSpaceSeparatedList() { var input = @" @list: 1px solid blue; .someClass { border: e(extract(@list, 2)); }"; var expected = @" .someClass { border: solid; }"; AssertLess(input, expected); } } }
apache-2.0
C#
53950312a5db1553b2df1e51df1d6ec26a0818c5
Update SmsController.cs
TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets
quickstart/csharp/sms/receive-sms/SmsController.cs
quickstart/csharp/sms/receive-sms/SmsController.cs
// Code sample for ASP.NET MVC on .NET Framework 4.6.1+ // In Package Manager, run: // Install-Package Twilio.AspNet.Mvc -DependencyVersion HighestMinor using System.Web.Mvc; using Twilio.AspNet.Mvc; using Twilio.TwiML; namespace YourNewWebProject.Controllers { public class SmsController : TwilioController { [HttpPost] public TwiMLResult Index() { var messagingResponse = new MessagingResponse(); messagingResponse.Message("The Robots are coming! Head for the hills!"); return TwiML(messagingResponse); } } }
// In Package Manager, run: // Install-Package Twilio.AspNet.Mvc -DependencyVersion HighestMinor using System.Web.Mvc; using Twilio.AspNet.Mvc; using Twilio.TwiML; namespace YourNewWebProject.Controllers { public class SmsController : TwilioController { [HttpPost] public TwiMLResult Index() { var messagingResponse = new MessagingResponse(); messagingResponse.Message("The Robots are coming! Head for the hills!"); return TwiML(messagingResponse); } } }
mit
C#
fd20bc3c34d55193191e7d282f575a9e0001e733
Add a test to validate sensitivity on OSX (#27959)
Jiayili1/corefx,ericstj/corefx,shimingsg/corefx,mmitche/corefx,mmitche/corefx,Jiayili1/corefx,wtgodbe/corefx,wtgodbe/corefx,ptoonen/corefx,ViktorHofer/corefx,wtgodbe/corefx,ericstj/corefx,ViktorHofer/corefx,BrennanConroy/corefx,wtgodbe/corefx,ViktorHofer/corefx,wtgodbe/corefx,ptoonen/corefx,Jiayili1/corefx,shimingsg/corefx,shimingsg/corefx,Jiayili1/corefx,shimingsg/corefx,ViktorHofer/corefx,shimingsg/corefx,wtgodbe/corefx,ericstj/corefx,ericstj/corefx,ptoonen/corefx,mmitche/corefx,mmitche/corefx,ViktorHofer/corefx,mmitche/corefx,mmitche/corefx,mmitche/corefx,shimingsg/corefx,Jiayili1/corefx,Jiayili1/corefx,ptoonen/corefx,Jiayili1/corefx,ericstj/corefx,ericstj/corefx,BrennanConroy/corefx,shimingsg/corefx,ViktorHofer/corefx,ptoonen/corefx,ptoonen/corefx,ptoonen/corefx,BrennanConroy/corefx,ViktorHofer/corefx,ericstj/corefx,wtgodbe/corefx
src/Common/tests/Tests/System/IO/PathInternal.Unix.Tests.cs
src/Common/tests/Tests/System/IO/PathInternal.Unix.Tests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.IO; using Xunit; namespace Tests.System.IO { [PlatformSpecific(TestPlatforms.AnyUnix)] public class PathInternalTests_Unix { [Theory, InlineData(@"", @""), InlineData(null, null), InlineData(@"/", @"/"), InlineData(@"//", @"/"), InlineData(@"///", @"/"), InlineData(@"\", @"\"), InlineData(@"\\", @"\\"), InlineData(@"\\\", @"\\\"), InlineData(@"\/", @"\/"), InlineData(@"\/\", @"\/\"), InlineData(@"a/a", @"a/a"), InlineData(@"a//a", @"a/a"), InlineData(@"a\\a", @"a\\a"), InlineData(@"/a", @"/a"), InlineData(@"//a", @"/a"), InlineData(@"\\a", @"\\a"), InlineData(@"a/", @"a/"), InlineData(@"a//", @"a/"), InlineData(@"a\\", @"a\\"), ] [PlatformSpecific(TestPlatforms.AnyUnix)] public void NormalizeDirectorySeparatorTests(string path, string expected) { string result = PathInternal.NormalizeDirectorySeparators(path); Assert.Equal(expected, result); if (string.Equals(path, expected, StringComparison.Ordinal)) Assert.Same(path, result); } [Fact] [PlatformSpecific(TestPlatforms.OSX)] public void IsCaseInsensitive_OSX() { // There have been reports of casing handling not being appropriate on MacOS // https://github.com/dotnet/corefx/issues/26797 Assert.False(PathInternal.IsCaseSensitive); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.IO; using Xunit; namespace Tests.System.IO { [PlatformSpecific(TestPlatforms.AnyUnix)] public class PathInternalTests_Unix { [Theory, InlineData(@"", @""), InlineData(null, null), InlineData(@"/", @"/"), InlineData(@"//", @"/"), InlineData(@"///", @"/"), InlineData(@"\", @"\"), InlineData(@"\\", @"\\"), InlineData(@"\\\", @"\\\"), InlineData(@"\/", @"\/"), InlineData(@"\/\", @"\/\"), InlineData(@"a/a", @"a/a"), InlineData(@"a//a", @"a/a"), InlineData(@"a\\a", @"a\\a"), InlineData(@"/a", @"/a"), InlineData(@"//a", @"/a"), InlineData(@"\\a", @"\\a"), InlineData(@"a/", @"a/"), InlineData(@"a//", @"a/"), InlineData(@"a\\", @"a\\"), ] [PlatformSpecific(TestPlatforms.AnyUnix)] public void NormalizeDirectorySeparatorTests(string path, string expected) { string result = PathInternal.NormalizeDirectorySeparators(path); Assert.Equal(expected, result); if (string.Equals(path, expected, StringComparison.Ordinal)) Assert.Same(path, result); } } }
mit
C#
f278822a2c6f913c9d45ea90172079fefc9b318b
Update UserStore.cs
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNet.Identity.AspNetCoreCompat/UserStore.cs
src/Microsoft.AspNet.Identity.AspNetCoreCompat/UserStore.cs
// Copyright (c) Microsoft Corporation, Inc. All rights reserved. // Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. using System; using System.Data.Entity; using Microsoft.AspNet.Identity.EntityFramework; namespace Microsoft.AspNet.Identity.CoreCompat { public class UserStore<TUser> : UserStore<TUser, IdentityRole, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>, IUserStore<TUser> where TUser : IdentityUser { /// <summary> /// Default constuctor which uses a new instance of a default EntityDbContext. /// </summary> public UserStore() : this(new IdentityDbContext<TUser>()) { DisposeContext = true; } /// <summary> /// Constructor /// </summary> /// <param name="context"></param> public UserStore(DbContext context) : base(context) { } } public class UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> : EntityFramework.UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> where TKey : IEquatable<TKey> where TUser : IdentityUser<TKey, TUserLogin, TUserRole, TUserClaim> where TRole : IdentityRole<TKey, TUserRole> where TUserLogin : IdentityUserLogin<TKey>, new() where TUserRole : IdentityUserRole<TKey>, new() where TUserClaim : IdentityUserClaim<TKey>, new() { /// <summary> /// Constructor /// </summary> /// <param name="context"></param> public UserStore(DbContext context) : base(context) { } } }
// Copyright (c) Microsoft Corporation, Inc. All rights reserved. // Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information. using System; using System.Data.Entity; using Microsoft.AspNet.Identity.EntityFramework; namespace Microsoft.AspNet.Identity.CoreCompat { public class UserStore<TUser> : UserStore<TUser, IdentityRole, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>, IUserStore<TUser> where TUser : IdentityUser { /// <summary> /// Default constuctor which uses a new instance of a default EntityDbContext /// </summary> public UserStore() : this(new IdentityDbContext<TUser>()) { DisposeContext = true; } /// <summary> /// Constructor /// </summary> /// <param name="context"></param> public UserStore(DbContext context) : base(context) { } } public class UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> : EntityFramework.UserStore<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> where TKey : IEquatable<TKey> where TUser : IdentityUser<TKey, TUserLogin, TUserRole, TUserClaim> where TRole : IdentityRole<TKey, TUserRole> where TUserLogin : IdentityUserLogin<TKey>, new() where TUserRole : IdentityUserRole<TKey>, new() where TUserClaim : IdentityUserClaim<TKey>, new() { /// <summary> /// Constructor /// </summary> /// <param name="context"></param> public UserStore(DbContext context) : base(context) { } } }
apache-2.0
C#
e317052b7e01c3bde30231bdc61a1955d0f90ace
store and get mapping function
aoancea/runtime-mapper
src/Runtime.Mapper/Mapper.cs
src/Runtime.Mapper/Mapper.cs
using System; using System.Collections.Concurrent; namespace Runtime.Mapper { public static class Mapper { private static ConcurrentDictionary<Tuple<Type, Type>, Func<object, object, object>> mappingFunctions = new ConcurrentDictionary<Tuple<Type, Type>, Func<object, object, object>>(); public static TDestination DeepCopyTo<TDestination>(this object source) { Type sourceType = source.GetType(); Type destinationType = typeof(TDestination); Tuple<Type, Type> key = new Tuple<Type, Type>(sourceType, destinationType); Func<object, object, object> mappingFunction = mappingFunctions.GetOrAdd(key, GetMappingFunction()); return (TDestination)mappingFunction(source, null); } public static void Map<TSource, TDestination>(TSource source, TDestination destination) { Type sourceType = source.GetType(); Type destinationType = typeof(TDestination); Tuple<Type, Type> key = new Tuple<Type, Type>(sourceType, destinationType); Func<object, object, object> mappingFunction = mappingFunctions.GetOrAdd(key, GetMappingFunction()); mappingFunction(source, destination); } private static Func<object, object, object> GetMappingFunction() { return null; } } }
using System; using System.Collections.Generic; namespace Runtime.Mapper { public static class Mapper { private static Dictionary<Tuple<Type, Type>, Func<object, object, object>> mappingFunctions = new Dictionary<Tuple<Type, Type>, Func<object, object, object>>(); public static TDestination DeepCopyTo<TDestination>(this object source) { return default(TDestination); } public static void Map<TSource, TDestination>(TSource source, TDestination destination) { } } }
mit
C#
4b6cd4ac6920cc8d001f15b38510224cbd8ad6c8
Index ext method
wasphub/RElmah,wasphub/RElmah
relmah/src/RElmah/Extensions/EnumerableExtensions.cs
relmah/src/RElmah/Extensions/EnumerableExtensions.cs
using System; using System.Collections.Generic; using System.Linq; namespace RElmah.Extensions { public static class EnumerableExtensions { public static IEnumerable<T> Each<T>(this IEnumerable<T> source, Action<T> action) { if (source != null) { var e = source.GetEnumerator(); while (e.MoveNext()) { action(e.Current); } } return source; } public static IEnumerable<T> ToSingleton<T>(this T source) { return new[] {source}; } public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> source) { return source ?? Enumerable.Empty<T>(); } public static IEnumerable<KeyValuePair<int, T>> Index<T>(this IEnumerable<T> source) { var e = source.GetEnumerator(); var i = 0; while (e.MoveNext()) { yield return new KeyValuePair<int, T>(i++, e.Current); } } } }
using System; using System.Collections.Generic; using System.Linq; namespace RElmah.Extensions { public static class EnumerableExtensions { public static IEnumerable<T> Each<T>(this IEnumerable<T> source, Action<T> action) { if (source != null) { var e = source.GetEnumerator(); while (e.MoveNext()) { action(e.Current); } } return source; } public static IEnumerable<T> ToSingleton<T>(this T source) { return new[] {source}; } public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> source) { return source ?? Enumerable.Empty<T>(); } } }
apache-2.0
C#
906265fb8513a35d8c47d17a3f1576af6b782085
Edit it
sta/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp
websocket-sharp/Server/IWebSocketSession.cs
websocket-sharp/Server/IWebSocketSession.cs
#region License /* * IWebSocketSession.cs * * The MIT License * * Copyright (c) 2013-2014 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion using System; using WebSocketSharp.Net.WebSockets; namespace WebSocketSharp.Server { /// <summary> /// Exposes the access to the information in a WebSocket session. /// </summary> public interface IWebSocketSession { #region Properties /// <summary> /// Gets the current state of the WebSocket connection for the session. /// </summary> /// <value> /// <para> /// One of the <see cref="WebSocketState"/> enum values. /// </para> /// <para> /// It indicates the current state of the connection. /// </para> /// </value> WebSocketState ConnectionState { get; } /// <summary> /// Gets the information in the WebSocket handshake request. /// </summary> /// <value> /// A <see cref="WebSocketContext"/> instance that provides the access to /// the information in the handshake request. /// </value> WebSocketContext Context { get; } /// <summary> /// Gets the unique ID of the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the unique ID of the session. /// </value> string ID { get; } /// <summary> /// Gets the name of the WebSocket subprotocol for the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the name of the subprotocol /// if present. /// </value> string Protocol { get; } /// <summary> /// Gets the time that the session has started. /// </summary> /// <value> /// A <see cref="DateTime"/> that represents the time that the session /// has started. /// </value> DateTime StartTime { get; } #endregion } }
#region License /* * IWebSocketSession.cs * * The MIT License * * Copyright (c) 2013-2014 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion using System; using WebSocketSharp.Net.WebSockets; namespace WebSocketSharp.Server { /// <summary> /// Exposes the access to the information in a WebSocket session. /// </summary> public interface IWebSocketSession { #region Properties /// <summary> /// Gets the current state of the WebSocket connection for the session. /// </summary> /// <value> /// <para> /// One of the <see cref="WebSocketState"/> enum values. /// </para> /// <para> /// It indicates the current state of the connection. /// </para> /// </value> WebSocketState ConnectionState { get; } /// <summary> /// Gets the information in the WebSocket handshake request. /// </summary> /// <value> /// A <see cref="WebSocketContext"/> instance that provides the access to /// the information in the handshake request. /// </value> WebSocketContext Context { get; } /// <summary> /// Gets the unique ID of the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the unique ID of the session. /// </value> string ID { get; } /// <summary> /// Gets the name of the WebSocket subprotocol used in the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the name of the subprotocol /// if present. /// </value> string Protocol { get; } /// <summary> /// Gets the time that the session has started. /// </summary> /// <value> /// A <see cref="DateTime"/> that represents the time that the session /// has started. /// </value> DateTime StartTime { get; } #endregion } }
mit
C#
22eeb8d7a77f04e9895c19596776efb96fa2249d
Refactor context to not use vars
ajlopez/ClojSharp
Src/ClojSharp.Core/Context.cs
Src/ClojSharp.Core/Context.cs
namespace ClojSharp.Core { using System; using System.Collections.Generic; using System.Linq; using System.Text; using ClojSharp.Core.Language; public class Context : ClojSharp.Core.IContext { private IDictionary<string, object> values = new Dictionary<string, object>(); private IContext parent; private VarContext topcontext; public Context() : this(null) { } public Context(IContext parent) { this.parent = parent; if (parent != null) this.topcontext = parent.TopContext; } public VarContext TopContext { get { return this.topcontext; } } public void SetValue(string name, object value) { this.values[name] = value; } public object GetValue(string name) { if (this.values.ContainsKey(name)) return this.values[name]; if (this.parent != null) return this.parent.GetValue(name); return null; } } }
namespace ClojSharp.Core { using System; using System.Collections.Generic; using System.Linq; using System.Text; using ClojSharp.Core.Language; public class Context : ClojSharp.Core.IContext { private IDictionary<string, object> values = new Dictionary<string, object>(); private IContext parent; private VarContext topcontext; public Context() : this(null) { } public Context(IContext parent) { this.parent = parent; if (parent != null) this.topcontext = parent.TopContext; } public VarContext TopContext { get { return this.topcontext; } } public void SetValue(string name, object value) { if (this.parent == null) this.values[name] = new Var(name, value); else this.values[name] = value; } public object GetValue(string name) { if (this.values.ContainsKey(name)) if (this.parent == null) return ((Var)this.values[name]).Value; else return this.values[name]; if (this.parent != null) return this.parent.GetValue(name); return null; } } }
mit
C#
5cf37eec2701b8ddc6c47272078ca471d4e12a73
Fix asset bundle
litsungyi/Camus
Scripts/ResourceSystems/AssetBundleLoader.cs
Scripts/ResourceSystems/AssetBundleLoader.cs
using System.Collections.Generic; using System.IO; using Camus.Projects; using UnityEngine; namespace Camus.ResourceSystems { public static class AssetBundleLoader { private static IDictionary<string, AssetBundle> Bundles { get; } = new Dictionary<string, AssetBundle>(); public static AssetBundle LoadAssetBundle(AssetBundleInfo bundleInfo) { return LoadAssetBundle(bundleInfo.Name); } public static AssetBundle LoadAssetBundle(string bundleName) { if (Bundles.TryGetValue(bundleName, out var assetBundle)) { return assetBundle; } assetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, bundleName)); if (assetBundle == null) { return null; } Bundles.Add(bundleName, assetBundle); return assetBundle; } public static void UnloadAssetBundle(AssetBundleInfo bundleInfo, bool unloadAllLoadedObjects = false) { UnloadAssetBundle(bundleInfo.Name, unloadAllLoadedObjects); } public static void UnloadAssetBundle(string bundleName, bool unloadAllLoadedObjects = false) { if (!Bundles.TryGetValue(bundleName, out var assetBundle)) { return; } assetBundle.Unload(unloadAllLoadedObjects); } public static T LoadResource<T>(AssetBundleInfo bundleInfo, string assetName) where T : MonoBehaviour { return LoadResource<T>(bundleInfo.Name, assetName); } public static T LoadResource<T>(string bundleName, string assetName) where T : MonoBehaviour { var bundle = LoadAssetBundle(bundleName); if (bundle == null) { Debug.Log("Failed to load AssetBundle!"); return null; } var path = $"Assets/Prefabs/UI/{assetName}.prefab"; var instance = bundle.LoadAsset<GameObject>(path); return instance.GetComponent<T>(); } } }
using System.IO; using UnityEngine; namespace Camus.ResourceSystems { public static class AssetBundleLoader { public static T LoadResource<T>(string bundleName, string assetName) where T : MonoBehaviour { var bundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, bundleName)); return bundle.LoadAsset<T>(assetName); } } }
mit
C#
99df93ff44d809bc58f5951e2bdb530519449087
Bump version 1.1
Kableado/VAR.UrlCompressor
VAR.UrlCompressor/Properties/AssemblyInfo.cs
VAR.UrlCompressor/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("VAR.UrlCompressor")] [assembly: AssemblyDescription(".Net library for compressing URLs")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("VAR")] [assembly: AssemblyProduct("VAR.UrlCompressor")] [assembly: AssemblyCopyright("Copyright © VAR 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("016ae05d-12af-40c6-8d0c-064970004f0b")] [assembly: AssemblyVersion("1.1.*")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("VAR.UrlCompressor")] [assembly: AssemblyDescription(".Net library for compressing URLs")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("VAR")] [assembly: AssemblyProduct("VAR.UrlCompressor")] [assembly: AssemblyCopyright("Copyright © VAR 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("016ae05d-12af-40c6-8d0c-064970004f0b")] [assembly: AssemblyVersion("1.0.*")]
mit
C#
1862bb5820a9cfa68703a35af3ba39d3c109f1d8
Use Trace instead of Console
SnowmanTackler/SamSeifert.Utilities,SnowmanTackler/SamSeifert.Utilities
Logger.cs
Logger.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SamSeifert.Utilities { public static class Logger { public static Action<String> WriteLine = (String s) => { Trace.WriteLine(s); }; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SamSeifert.Utilities { public static class Logger { public static Action<String> WriteLine = (String s) => { Console.WriteLine(s); }; } }
mit
C#
d4eb4705655bb2d23a807ec0faeeb102070c5bf5
Add Provider property to ILogger interface
RockFramework/Rock.Logging
RockLib.Logging/ILogger.cs
RockLib.Logging/ILogger.cs
using System.Collections.Generic; using System.Runtime.CompilerServices; namespace RockLib.Logging { /// <summary> /// Defines an object used for logging. /// </summary> public interface ILogger { /// <summary> /// Gets the name of the logger. /// </summary> string Name { get; } /// <summary> /// Gets a value indicating whether the logger is disabled. /// </summary> bool IsDisabled { get; } /// <summary> /// Gets the logging level of the logger. /// </summary> /// <remarks> /// Log entries with a level lower than the value of this property should /// not be logged by this logger. /// </remarks> LogLevel Level { get; } /// <summary> /// Gets the collection of <see cref="ILogProvider"/> objects used by this logger. /// </summary> IReadOnlyCollection<ILogProvider> Providers { get; } /// <summary> /// Logs the specified log entry. /// </summary> /// <param name="logEntry">The log entry to log.</param> /// <param name="callerMemberName">The method or property name of the caller.</param> /// <param name="callerFilePath">The path of the source file that contains the caller.</param> /// <param name="callerLineNumber">The line number in the source file at which this method is called.</param> void Log( LogEntry logEntry, [CallerMemberName] string callerMemberName = null, [CallerFilePath] string callerFilePath = null, [CallerLineNumber] int callerLineNumber = 0); } }
using System.Runtime.CompilerServices; namespace RockLib.Logging { /// <summary> /// Defines an object used for logging. /// </summary> public interface ILogger { /// <summary> /// Gets the name of the logger. /// </summary> string Name { get; } /// <summary> /// Gets a value indicating whether the logger is disabled. /// </summary> bool IsDisabled { get; } /// <summary> /// Gets the logging level of the logger. /// </summary> /// <remarks> /// Log entries with a level lower than the value of this property should /// not be logged by this logger. /// </remarks> LogLevel Level { get; } /// <summary> /// Logs the specified log entry. /// </summary> /// <param name="logEntry">The log entry to log.</param> /// <param name="callerMemberName">The method or property name of the caller.</param> /// <param name="callerFilePath">The path of the source file that contains the caller.</param> /// <param name="callerLineNumber">The line number in the source file at which this method is called.</param> void Log( LogEntry logEntry, [CallerMemberName] string callerMemberName = null, [CallerFilePath] string callerFilePath = null, [CallerLineNumber] int callerLineNumber = 0); } }
mit
C#
c3cbfa9e61083008f7b21097a2e97b0e10691737
use attributes for those
tugberkugurlu/AspNetCore.Identity.MongoDB,miltador/AspNetCore.Identity.DynamoDB,tugberkugurlu/AspNetCore.Identity.MongoDB,miltador/AspNetCore.Identity.DynamoDB
src/AspNetCore.Identity.MongoDB/Models/Occurrence.cs
src/AspNetCore.Identity.MongoDB/Models/Occurrence.cs
using System; using System.Diagnostics.CodeAnalysis; namespace AspNetCore.Identity.MongoDB.Models { [SuppressMessage("ReSharper", "AutoPropertyCanBeMadeGetOnly.Local", Justification = "MongoDB serialization needs private setters")] public class Occurrence { public Occurrence() : this(DateTime.UtcNow) { } public Occurrence(DateTime occuranceInstantUtc) { Instant = occuranceInstantUtc; } public DateTime Instant { get; private set; } protected bool Equals(Occurrence other) { return Instant.Equals(other.Instant); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; if (obj.GetType() != this.GetType()) return false; return Equals((Occurrence) obj); } [SuppressMessage("ReSharper", "NonReadonlyMemberInGetHashCode", Justification = "MongoDB serialization needs private setters")] public override int GetHashCode() { return Instant.GetHashCode(); } } }
using System; namespace AspNetCore.Identity.MongoDB.Models { public class Occurrence { public Occurrence() : this(DateTime.UtcNow) { } public Occurrence(DateTime occuranceInstantUtc) { Instant = occuranceInstantUtc; } // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Local public DateTime Instant { get; private set; } protected bool Equals(Occurrence other) { return Instant.Equals(other.Instant); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; if (obj.GetType() != this.GetType()) return false; return Equals((Occurrence) obj); } public override int GetHashCode() { // ReSharper disable once NonReadonlyMemberInGetHashCode return Instant.GetHashCode(); } } }
mit
C#
abd5f6d11e3311a601c36b0f4d980a2840957447
update customer from post class
Doozie7/ExampleConfigServer
src/ConfigService.Api/ViewModels/CustomerFromPost.cs
src/ConfigService.Api/ViewModels/CustomerFromPost.cs
namespace ConfigService.Api.ViewModels { /// <summary> /// The required information to create a new customer /// </summary> public class CustomerFromPost { /// <summary> /// The name of the customer /// </summary> public string Name { get; set; } /// <summary> /// The description of the customer /// </summary> public string Description { get; set; } /// <summary> /// Is the customer enabled at firt creation time /// </summary> public bool Enabled { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace ConfigService.Api.ViewModels { /// <summary> /// The required information to create a new customer /// </summary> public class CustomerFromPost { /// <summary> /// The name of the customer /// </summary> public string Name { get; set; } /// <summary> /// The description of the customer /// </summary> public string Description { get; set; } /// <summary> /// Is the customer enabled at firt creation time /// </summary> public bool Enabled { get; set; } } }
mit
C#
285054a2914dda0a0c97659f5928f8e57511726d
Initialize BuildCommand with dependencies
appharbor/appharbor-cli
src/AppHarbor/Commands/BuildCommand.cs
src/AppHarbor/Commands/BuildCommand.cs
using System; using System.IO; namespace AppHarbor.Commands { public class BuildCommand : ICommand { private readonly IApplicationConfiguration _applicationConfiguration; private readonly IAppHarborClient _appharborClient; private readonly TextWriter _writer; public BuildCommand(IApplicationConfiguration applicationConfiguration, IAppHarborClient appharborClient, TextWriter writer) { _applicationConfiguration = applicationConfiguration; _appharborClient = appharborClient; _writer = writer; } public void Execute(string[] arguments) { throw new NotImplementedException(); } } }
using System; namespace AppHarbor.Commands { public class BuildCommand : ICommand { public void Execute(string[] arguments) { throw new NotImplementedException(); } } }
mit
C#
6c9b03476be540be1d80cc4a863fc55c931d766a
Fix location for GlenSarti
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/GlennSarti.cs
src/Firehose.Web/Authors/GlennSarti.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class GlennSarti : IAmACommunityMember, IFilterMyBlogPosts { public string FirstName => "Glenn"; public string LastName => "Sarti"; public string ShortBioOrTagLine => "is a Senior Software Developer for HashiCorp."; public string StateOrRegion => "Perth, Australia"; public string EmailAddress => ""; public string TwitterHandle => "glennsarti"; public string GravatarHash => "aac3dafaab7a7c2063d2526ba5936305"; public Uri WebSite => new Uri("https:/sarti.dev/"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://sarti.dev/feed.xml"); } } public string FeedLanguageCode => "en"; public string GitHubHandle => "glennsarti"; public bool Filter(SyndicationItem item) { return item.Categories?.Any(c => c.Name.ToLowerInvariant().Contains("powershell")) ?? false; } public GeoPosition Position => new GeoPosition(-31.9523,115.8613); } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class GlennSarti : IAmACommunityMember, IFilterMyBlogPosts { public string FirstName => "Glenn"; public string LastName => "Sarti"; public string ShortBioOrTagLine => "is a Senior Software Developer for HashiCorp."; public string StateOrRegion => "Perth WA, Australia"; public string EmailAddress => ""; public string TwitterHandle => "glennsarti"; public string GravatarHash => "aac3dafaab7a7c2063d2526ba5936305"; public Uri WebSite => new Uri("https:/sarti.dev/"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://sarti.dev/feed.xml"); } } public string FeedLanguageCode => "en"; public string GitHubHandle => "glennsarti"; public bool Filter(SyndicationItem item) { return item.Categories?.Any(c => c.Name.ToLowerInvariant().Contains("powershell")) ?? false; } public GeoPosition Position => new GeoPosition(-31.9523,115.8613); } }
mit
C#
6d9d05d181bd0d85dce443370a0bb64a0137a6b8
Fix issue when WebException with ProtocolError status has empty response
patchkit-net/patchkit-library-dotnet,patchkit-net/patchkit-library-dotnet
src/PatchKit.Api/WrapHttpWebRequest.cs
src/PatchKit.Api/WrapHttpWebRequest.cs
using System; using System.Net; namespace PatchKit.Api { public class WrapHttpWebRequest : IHttpWebRequest { private readonly HttpWebRequest _httpWebRequest; public int Timeout { get { return _httpWebRequest.Timeout; } set { _httpWebRequest.Timeout = value; } } public Uri Address { get { return _httpWebRequest.Address; } } public WrapHttpWebRequest(HttpWebRequest httpWebRequest) { _httpWebRequest = httpWebRequest; } public IHttpWebResponse GetResponse() { return new WrapHttpWebResponse(GetHttpResponse()); } private HttpWebResponse GetHttpResponse() { try { return (HttpWebResponse) _httpWebRequest.GetResponse(); } catch (WebException webException) { if (webException.Status == WebExceptionStatus.ProtocolError && webException.Response != null) { return (HttpWebResponse) webException.Response; } throw; } } } }
using System; using System.Net; namespace PatchKit.Api { public class WrapHttpWebRequest : IHttpWebRequest { private readonly HttpWebRequest _httpWebRequest; public int Timeout { get { return _httpWebRequest.Timeout; } set { _httpWebRequest.Timeout = value; } } public Uri Address { get { return _httpWebRequest.Address; } } public WrapHttpWebRequest(HttpWebRequest httpWebRequest) { _httpWebRequest = httpWebRequest; } public IHttpWebResponse GetResponse() { return new WrapHttpWebResponse(GetHttpResponse()); } private HttpWebResponse GetHttpResponse() { try { return (HttpWebResponse) _httpWebRequest.GetResponse(); } catch (WebException webException) { if (webException.Status == WebExceptionStatus.ProtocolError) { return (HttpWebResponse) webException.Response; } throw; } } } }
mit
C#
909cc655cbf8e07c9eb6d76ecc051fb50a11e6e3
Prepare add IsValid for book borrow record
alvachien/achihapi
src/hihapi/Models/Library/LibraryBookBorrowRecord.cs
src/hihapi/Models/Library/LibraryBookBorrowRecord.cs
using System; using System.Collections.Generic; using System.Linq; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace hihapi.Models.Library { [Table("T_LIB_BOOK_BORROW_RECORD")] public class LibraryBookBorrowRecord: BaseModel { [Key] [Required] [Column("ID", TypeName = "INT")] public Int32 Id { get; set; } [Required] [Column("HID", TypeName = "INT")] public Int32 HomeID { get; set; } [Required] [Column("BOOK_ID", TypeName = "INT")] public int BookId { get; set; } [Required] [MaxLength(50)] [Column("USER", TypeName = "NVARCHAR(40)")] public String User { get; set; } [Column("FROMORG", TypeName = "INT")] public int? FromOrganization { get; set; } [Column("FROMDATE", TypeName = "DATE")] [DataType(DataType.Date)] public DateTime? FromDate { get; set; } [Column("TODATE", TypeName = "DATE")] [DataType(DataType.Date)] public DateTime? ToDate { get; set; } [Required] [Column("ISRETURNED", TypeName = "BIT")] public Boolean IsReturned { get; set; } [Column("COMMENT", TypeName = "NVARCHAR(50)")] [MaxLength(50)] public String Comment { get; set; } public override bool IsValid(hihDataContext context) { bool isvalid = base.IsValid(context); if (isvalid) { } return isvalid; } } }
using System; using System.Collections.Generic; using System.Linq; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace hihapi.Models.Library { [Table("T_LIB_BOOK_BORROW_RECORD")] public class LibraryBookBorrowRecord: BaseModel { [Key] [Required] [Column("ID", TypeName = "INT")] public Int32 Id { get; set; } [Required] [Column("HID", TypeName = "INT")] public Int32 HomeID { get; set; } [Required] [Column("BOOK_ID", TypeName = "INT")] public int BookId { get; set; } [Required] [MaxLength(50)] [Column("USER", TypeName = "NVARCHAR(40)")] public String User { get; set; } [Column("FROMORG", TypeName = "INT")] public int? FromOrganization { get; set; } [Column("FROMDATE", TypeName = "DATE")] [DataType(DataType.Date)] public DateTime? FromDate { get; set; } [Column("TODATE", TypeName = "DATE")] [DataType(DataType.Date)] public DateTime? ToDate { get; set; } [Required] [Column("ISRETURNED", TypeName = "BIT")] public Boolean IsReturned { get; set; } [Column("COMMENT", TypeName = "NVARCHAR(50)")] [MaxLength(50)] public String Comment { get; set; } } }
mit
C#
fd675ffca0833b4f63e05a08947c152123e08b27
Enable ReadLocalTime by default since its the behavior the most .Net developers would expect.
mongodb-csharp/mongodb-csharp,samus/mongodb-csharp,zh-huan/mongodb
source/MongoDB/Configuration/MongoConfiguration.cs
source/MongoDB/Configuration/MongoConfiguration.cs
using MongoDB.Configuration.Mapping; using MongoDB.Serialization; namespace MongoDB.Configuration { /// <summary> /// /// </summary> public class MongoConfiguration { /// <summary> /// MongoDB-CSharp default configuration. /// </summary> public static readonly MongoConfiguration Default = new MongoConfiguration(); /// <summary> /// Initializes a new instance of the <see cref="MongoConfiguration"/> class. /// </summary> public MongoConfiguration(){ ConnectionString = string.Empty; MappingStore = new AutoMappingStore(); SerializationFactory = new SerializationFactory(this); ReadLocalTime = true; } /// <summary> /// Gets or sets the connection string. /// </summary> /// <value>The connection string.</value> public string ConnectionString { get; set; } /// <summary> /// Gets or sets the serialization factory. /// </summary> /// <value>The serialization factory.</value> public ISerializationFactory SerializationFactory { get; set; } /// <summary> /// Gets or sets the mapping store. /// </summary> /// <value>The mapping store.</value> public IMappingStore MappingStore { get; set; } /// <summary> /// Reads DataTime from server as local time. /// </summary> /// <value><c>true</c> if [read local time]; otherwise, <c>false</c>.</value> /// <remarks> /// MongoDB stores all time values in UTC timezone. If true the /// time is converted from UTC to local timezone after is was read. /// </remarks> public bool ReadLocalTime { get; set; } /// <summary> /// Validates this instance. /// </summary> public void Validate(){ if(ConnectionString == null) throw new MongoException("ConnectionString can not be null"); if(MappingStore == null) throw new MongoException("MappingStore can not be null"); if(SerializationFactory == null) throw new MongoException("SerializationFactory can not be null"); } } }
using MongoDB.Configuration.Mapping; using MongoDB.Serialization; namespace MongoDB.Configuration { /// <summary> /// /// </summary> public class MongoConfiguration { /// <summary> /// MongoDB-CSharp default configuration. /// </summary> public static readonly MongoConfiguration Default = new MongoConfiguration(); /// <summary> /// Initializes a new instance of the <see cref="MongoConfiguration"/> class. /// </summary> public MongoConfiguration(){ ConnectionString = string.Empty; MappingStore = new AutoMappingStore(); SerializationFactory = new SerializationFactory(this); } /// <summary> /// Gets or sets the connection string. /// </summary> /// <value>The connection string.</value> public string ConnectionString { get; set; } /// <summary> /// Gets or sets the serialization factory. /// </summary> /// <value>The serialization factory.</value> public ISerializationFactory SerializationFactory { get; set; } /// <summary> /// Gets or sets the mapping store. /// </summary> /// <value>The mapping store.</value> public IMappingStore MappingStore { get; set; } /// <summary> /// Reads DataTime from server as local time. /// </summary> /// <value><c>true</c> if [read local time]; otherwise, <c>false</c>.</value> /// <remarks> /// MongoDB stores all time values in UTC timezone. If true the /// time is converted from UTC to local timezone after is was read. /// </remarks> public bool ReadLocalTime { get; set; } /// <summary> /// Validates this instance. /// </summary> public void Validate(){ if(ConnectionString == null) throw new MongoException("ConnectionString can not be null"); if(MappingStore == null) throw new MongoException("MappingStore can not be null"); if(SerializationFactory == null) throw new MongoException("SerializationFactory can not be null"); } } }
apache-2.0
C#
57bff87f7185fc0fb968648bd8ff9b599b9d8985
Make the event steam static again
jbrianskog/EventSourcingTodo,jbrianskog/EventSourcingTodo,jbrianskog/EventSourcingTodo
src/EventSourcingTodo/Domain/TodoListRepository.cs
src/EventSourcingTodo/Domain/TodoListRepository.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace EventSourcingTodo.Domain { public interface ITodoListRepository { IList<Event> Events { get; } TodoList Get(); void PostChanges(TodoList todoList); } public class TodoListRepository : ITodoListRepository { // Global event stream for single global TodoList. Replace with something like Event Store. private static List<Event> _events = new List<Event>(); public IList<Event> Events { get { lock (_events) { return _events; } } } public TodoList Get() { lock (_events) { return new TodoList(_events); } } public void PostChanges(TodoList todoList) { lock (_events) { _events.AddRange(todoList.UncommittedChanges); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace EventSourcingTodo.Domain { public interface ITodoListRepository { IList<Event> Events { get; } TodoList Get(); void PostChanges(TodoList todoList); } public class TodoListRepository : ITodoListRepository { // Global event stream for single global TodoList. Replace with something like Event Store. private List<Event> _events = new List<Event>(); public IList<Event> Events { get { lock (_events) { return _events; } } } public TodoList Get() { lock (_events) { return new TodoList(_events); } } public void PostChanges(TodoList todoList) { lock (_events) { _events.AddRange(todoList.UncommittedChanges); } } } }
mit
C#
3fe5d0b70f5ea0d71066eaaba572697352cb08ac
Set Landmarks on Trainingstrials
xfleckx/BeMoBI,xfleckx/BeMoBI
Assets/Paradigms/MultiMazePathRetrieval/Training.cs
Assets/Paradigms/MultiMazePathRetrieval/Training.cs
using UnityEngine; using System.Collections; using System; using System.Linq; public class Training : Trial { /// <summary> /// A Trial Start may caused from external source (e.g. a key press) /// </summary> public override void StartTrial() { base.StartTrial(); var instruction = new Instruction(); instruction.DisplayTime = 30f; instruction.Text = "Remember the given path for this labyrinth"; if(hud.enabled) hud.StartDisplaying(instruction); path.SetLandmarks(true); } public override void OnMazeUnitEvent(MazeUnitEvent obj) { if (obj.MazeUnitEventType == MazeUnitEventType.Entering) { Debug.Log("Training Trial Instance recieved MazeUnitEvent: Entering"); } } }
using UnityEngine; using System.Collections; using System; using System.Linq; public class Training : Trial { /// <summary> /// A Trial Start may caused from external source (e.g. a key press) /// </summary> public override void StartTrial() { var instruction = new Instruction(); instruction.DisplayTime = 30f; instruction.Text = "Remember the given path for this labyrinth"; if(hud.enabled) hud.StartDisplaying(instruction); } public override void OnMazeUnitEvent(MazeUnitEvent obj) { if (obj.MazeUnitEventType == MazeUnitEventType.Entering) { Debug.Log("Training Trial Instance recieved MazeUnitEvent: Entering"); } } }
mit
C#
9b9163613e12fe40c3c48b7ccd29923c61579c9c
Include timestamp in Android impl
orand/Xamarin.Mobile,moljac/Xamarin.Mobile,haithemaraissia/Xamarin.Mobile,nexussays/Xamarin.Mobile,xamarin/Xamarin.Mobile,xamarin/Xamarin.Mobile
MonoDroid/MonoMobile.Extensions/GeolocationSingleListener.cs
MonoDroid/MonoMobile.Extensions/GeolocationSingleListener.cs
using System; using System.Threading.Tasks; using Android.Locations; using Android.OS; namespace MonoMobile.Extensions { internal class GeolocationSingleListener : Java.Lang.Object, ILocationListener { public GeolocationSingleListener (LocationManager manager) { if (manager == null) throw new ArgumentNullException ("manager"); this.manager = manager; this.manager.AddTestProvider ("test", true, true, false, false, false, false, true, 0, 10); } public Task<Position> Task { get { return this.completionSource.Task; } } public void OnLocationChanged (Location location) { StopListening(); var p = new Position(); if (location.HasAccuracy) p.Accuracy = location.Accuracy; if (location.HasAltitude) p.Altitude = location.Altitude; if (location.HasBearing) p.Heading = location.Bearing; if (location.HasSpeed) p.Speed = location.Speed; p.Longitude = location.Longitude; p.Latitude = location.Latitude; p.Timestamp = new DateTimeOffset (new DateTime (TimeSpan.TicksPerMillisecond * location.Time, DateTimeKind.Utc)); this.completionSource.TrySetResult (p); } public void OnProviderDisabled (string provider) { StopListening(); this.completionSource.TrySetCanceled(); } public void OnProviderEnabled (string provider) { } public void OnStatusChanged (string provider, int status, Bundle extras) { Availability av = (Availability) status; switch (av) { case Availability.OutOfService: case Availability.TemporarilyUnavailable: StopListening(); this.completionSource.SetCanceled(); break; } } private readonly LocationManager manager; private readonly TaskCompletionSource<Position> completionSource = new TaskCompletionSource<Position>(); private void StopListening() { this.manager.RemoveUpdates (this); } } }
using System; using System.Threading.Tasks; using Android.Locations; using Android.OS; namespace MonoMobile.Extensions { internal class GeolocationSingleListener : Java.Lang.Object, ILocationListener { public GeolocationSingleListener (LocationManager manager) { if (manager == null) throw new ArgumentNullException ("manager"); this.manager = manager; this.manager.AddTestProvider ("test", true, true, false, false, false, false, true, 0, 10); } public Task<Position> Task { get { return this.completionSource.Task; } } public void OnLocationChanged (Location location) { StopListening(); var p = new Position(); if (location.HasAccuracy) p.Accuracy = location.Accuracy; if (location.HasAltitude) p.Altitude = location.Altitude; if (location.HasBearing) p.Heading = location.Bearing; if (location.HasSpeed) p.Speed = location.Speed; p.Longitude = location.Longitude; p.Latitude = location.Latitude; this.completionSource.TrySetResult (p); } public void OnProviderDisabled (string provider) { StopListening(); this.completionSource.TrySetCanceled(); } public void OnProviderEnabled (string provider) { } public void OnStatusChanged (string provider, int status, Bundle extras) { Availability av = (Availability) status; switch (av) { case Availability.OutOfService: case Availability.TemporarilyUnavailable: StopListening(); this.completionSource.SetCanceled(); break; } } private readonly LocationManager manager; private readonly TaskCompletionSource<Position> completionSource = new TaskCompletionSource<Position>(); private void StopListening() { this.manager.RemoveUpdates (this); } } }
apache-2.0
C#
2285b51656fd3bb1f39831779614af98b05de127
Update AlphaStreamsSlippageModel.cs
jameschch/Lean,jameschch/Lean,AlexCatarino/Lean,JKarathiya/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,QuantConnect/Lean,AlexCatarino/Lean,JKarathiya/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,jameschch/Lean,JKarathiya/Lean,QuantConnect/Lean,JKarathiya/Lean,jameschch/Lean,StefanoRaggi/Lean,AlexCatarino/Lean,jameschch/Lean,QuantConnect/Lean,StefanoRaggi/Lean,QuantConnect/Lean
Common/Orders/Slippage/AlphaStreamsSlippageModel.cs
Common/Orders/Slippage/AlphaStreamsSlippageModel.cs
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * 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 QuantConnect.Securities; ​ namespace QuantConnect.Orders.Slippage { /// <summary> /// Represents a slippage model that uses a constant percentage of slip /// </summary> public class AlphaStreamsSlippageModel : ISlippageModel { private const decimal _slippagePercent = 0.001m; ​ /// <summary> /// SReturn a decimal cash slippage approximation on the order. /// </summary> public decimal GetSlippageApproximation(Security asset, Order order) { if (asset.Type != SecurityType.Equity) { return 0; } ​ return _slippagePercent * asset.GetLastData()?.Value ?? 0; } } }
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * 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 QuantConnect.Securities; using QuantConnect.Data.Market; namespace QuantConnect.Orders.Slippage { /// <summary> /// Represents a slippage model that uses a constant percentage of slip /// </summary> public class AlphaStreamsSlippageModel : ISlippageModel { private readonly decimal _slippagePercent = 0.001m; /// <summary> /// Initializes a new instance of the <see cref="ConstantSlippageModel"/> class /// </summary> /// <param name="slippagePercent">The slippage percent for each order. Percent is ranged 0 to 1.</param> public AlphaStreamsSlippageModel() {} /// <summary> /// Slippage Model. Return a decimal cash slippage approximation on the order. /// </summary> public decimal GetSlippageApproximation(Security asset, Order order) { if (asset.Type != SecurityType.Equity) { return 0; } return _slippagePercent * asset.GetLastData()?.Value ?? 0; } } }
apache-2.0
C#
2b0b82d469f81c6da1946621d5c6a78369f68460
Fix empty MatrixPositionFIlter SetPosition method
krille90/unitystation,fomalsd/unitystation,Necromunger/unitystation,krille90/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation,krille90/unitystation,Necromunger/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation
UnityProject/Assets/Scripts/Shuttles/MatrixPositionFilter.cs
UnityProject/Assets/Scripts/Shuttles/MatrixPositionFilter.cs
using System; using UnityEngine; /// <summary> /// Handles the clamping / filtering of matrix move position to make PPRT shaders not flicker so much. /// </summary> public class MatrixPositionFilter { private Vector3 mPreviousPosition; private Vector2 mPreviousFilteredPosition; /// <summary> /// Updates the transform's position to be filtered / clamped. Invoke this when transform position changes to ensure /// it wil. /// </summary> /// <param name="toClamp">transform whose position should be filtered</param> /// <param name="curPosition">unfiltered position of the transform</param> /// <param name="flyingDirection">current flying direction</param> public void FilterPosition(Transform toClamp, Vector3 curPosition, Orientation flyingDirection) { Vector2 filteredPos = LightingSystem.GetPixelPerfectPosition(curPosition, mPreviousPosition, mPreviousFilteredPosition); //pixel perfect position can induce lateral movement at the beginning of motion, so we must prevent that if (flyingDirection == Orientation.Right || flyingDirection == Orientation.Left) { filteredPos.y = (float) Math.Round(filteredPos.y); } else { filteredPos.x = (float) Math.Round(filteredPos.x); } toClamp.position = filteredPos; mPreviousPosition = curPosition; mPreviousFilteredPosition = toClamp.position; } /// <summary> /// Sets the saved positions manually to the specified value. Used for start / stop. /// TODO: I'm not sure why this logic even exists but it was there in MatrixMove /// </summary> /// <param name="position"></param> public void SetPosition(Vector3 position) { mPreviousPosition = position; mPreviousFilteredPosition = position; } }
using System; using UnityEngine; /// <summary> /// Handles the clamping / filtering of matrix move position to make PPRT shaders not flicker so much. /// </summary> public class MatrixPositionFilter { private Vector3 mPreviousPosition; private Vector2 mPreviousFilteredPosition; /// <summary> /// Updates the transform's position to be filtered / clamped. Invoke this when transform position changes to ensure /// it wil. /// </summary> /// <param name="toClamp">transform whose position should be filtered</param> /// <param name="curPosition">unfiltered position of the transform</param> /// <param name="flyingDirection">current flying direction</param> public void FilterPosition(Transform toClamp, Vector3 curPosition, Orientation flyingDirection) { Vector2 filteredPos = LightingSystem.GetPixelPerfectPosition(curPosition, mPreviousPosition, mPreviousFilteredPosition); //pixel perfect position can induce lateral movement at the beginning of motion, so we must prevent that if (flyingDirection == Orientation.Right || flyingDirection == Orientation.Left) { filteredPos.y = (float) Math.Round(filteredPos.y); } else { filteredPos.x = (float) Math.Round(filteredPos.x); } toClamp.position = filteredPos; mPreviousPosition = curPosition; mPreviousFilteredPosition = toClamp.position; } /// <summary> /// Sets the saved positions manually to the specified value. Used for start / stop. /// TODO: I'm not sure why this logic even exists but it was there in MatrixMove /// </summary> /// <param name="position"></param> public void SetPosition(Vector3 position) { } }
agpl-3.0
C#
1ddda534534cedb1e264daac8250f48ed07ec178
hide configurations with '@' prefix from scan
Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek
core/Engine/Engine/Rules/Creation/RulesLoader.cs
core/Engine/Engine/Rules/Creation/RulesLoader.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Engine.Core; using Engine.Core.Rules; using Engine.DataTypes; using Engine.Drivers.Rules; using LanguageExt; using static Engine.Core.Utils.TraceHelpers; namespace Engine.Rules.Creation { public delegate IRuleParser GetRuleParser(string format); public static class RulesLoader { public static async Task<Func<(RulesRepository, PathExpander)>> Factory(IRulesDriver driver, GetRuleParser parserResolver) { var instance = Parse(await driver.GetAllRules(), parserResolver); driver.OnRulesChange += (newRules) => { using (TraceTime("loading new rules")) { instance = Parse(newRules, parserResolver); } }; return () => instance; } public static (RulesRepository, PathExpander) Parse(IDictionary<string, RuleDefinition> rules, GetRuleParser parserResolver) { var tree = new RadixTree<IRule>(rules.ToDictionary(x => x.Key.ToLower(), x => parserResolver(x.Value.Format).Parse(x.Value.Payload))); Option<IRule> RulesRepository(ConfigurationPath path) => tree.TryGetValue(path, out var rule) ? Option<IRule>.Some(rule) : Option<IRule>.None; IEnumerable<ConfigurationPath> PathExpander(ConfigurationPath path) { if (!path.IsScan) return new[] { path }; var keys = path == ConfigurationPath.FullScan ? tree.AllKeys() : tree.ListPrefix($"{path.Folder}/").Select(c => c.key); var folderLength = path.Folder.Length; return keys.Where(x => x.IndexOf("@", folderLength, StringComparison.Ordinal) < 0).Select(ConfigurationPath.New); } return (RulesRepository, PathExpander); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Engine.Core; using Engine.Core.Rules; using Engine.DataTypes; using Engine.Drivers.Rules; using LanguageExt; using static Engine.Core.Utils.TraceHelpers; namespace Engine.Rules.Creation { public delegate IRuleParser GetRuleParser(string format); public static class RulesLoader { public static async Task<Func<(RulesRepository, PathExpander)>> Factory(IRulesDriver driver, GetRuleParser parserResolver) { var instance = Parse(await driver.GetAllRules(), parserResolver); driver.OnRulesChange += (newRules) => { using (TraceTime("loading new rules")) { instance = Parse(newRules, parserResolver); } }; return () => instance; } public static (RulesRepository, PathExpander) Parse(IDictionary<string, RuleDefinition> rules, GetRuleParser parserResolver) { var tree = new RadixTree<IRule>(rules.ToDictionary(x => x.Key.ToLower(), x => parserResolver(x.Value.Format).Parse(x.Value.Payload))); Option<IRule> RulesRepository(ConfigurationPath path) => tree.TryGetValue(path, out var rule) ? Option<IRule>.Some(rule) : Option<IRule>.None; IEnumerable<ConfigurationPath> PathExpander(ConfigurationPath path) { if (path == ConfigurationPath.FullScan) { return tree.AllKeys().Select(ConfigurationPath.New); } if (path.IsScan) { return tree.ListPrefix($"{path.Folder}/").Select(c => c.key).Select(ConfigurationPath.New); } return new []{ path }; } return (RulesRepository, PathExpander); } } }
mit
C#
352004e1769a2d25f2b2deb96ee3ab9b58193d98
tidy & comments
biste5/xamarin-forms-samples-1,biste5/xamarin-forms-samples-1,pabloescribanoloza/xamarin-forms-samples-1,KiranKumarAlugonda/xamarin-forms-samples,fabianwilliams/xamarin-forms-samples,conceptdev/xamarin-forms-samples,conceptdev/xamarin-forms-samples,fabianwilliams/xamarin-forms-samples,teefresh/xamarin-forms-samples-1,JakeShanley/xamarin-forms-samples,JakeShanley/xamarin-forms-samples,reverence12389/xamarin-forms-samples-1,williamsrz/xamarin-forms-samples,reverence12389/xamarin-forms-samples-1,KiranKumarAlugonda/xamarin-forms-samples,teefresh/xamarin-forms-samples-1,pabloescribanoloza/xamarin-forms-samples-1,williamsrz/xamarin-forms-samples
UITestDemo/iOS/AppDelegate.cs
UITestDemo/iOS/AppDelegate.cs
using System; using System.Collections.Generic; using System.Linq; using MonoTouch.Foundation; using MonoTouch.UIKit; using Xamarin.Forms; using MonoTouch.ObjCRuntime; namespace UITestDemo { [Register ("AppDelegate")] public partial class AppDelegate : UIApplicationDelegate { UIWindow window; static readonly IntPtr setAccessibilityIdentifier_Handle = Selector.GetHandle("setAccessibilityIdentifier:"); public override bool FinishedLaunching (UIApplication app, NSDictionary options) { Forms.Init (); // http://forums.xamarin.com/discussion/21148/calabash-and-xamarin-forms-what-am-i-missing Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) => { // http://developer.xamarin.com/recipes/testcloud/set-accessibilityidentifier-ios/ if (null != e.View.StyleId) { e.NativeView.AccessibilityIdentifier = e.View.StyleId; Console.WriteLine("Set AccessibilityIdentifier: " + e.View.StyleId); } }; window = new UIWindow (UIScreen.MainScreen.Bounds); window.RootViewController = App.GetMainPage ().CreateViewController (); window.MakeKeyAndVisible (); #if DEBUG // requires Xamarin Test Cloud Agent component Xamarin.Calabash.Start(); #endif return true; } } }
using System; using System.Collections.Generic; using System.Linq; using MonoTouch.Foundation; using MonoTouch.UIKit; using Xamarin.Forms; using MonoTouch.ObjCRuntime; namespace UITestDemo { [Register ("AppDelegate")] public partial class AppDelegate : UIApplicationDelegate { UIWindow window; static readonly IntPtr setAccessibilityIdentifier_Handle = Selector.GetHandle("setAccessibilityIdentifier:"); public override bool FinishedLaunching (UIApplication app, NSDictionary options) { Forms.Init (); // http://forums.xamarin.com/discussion/21148/calabash-and-xamarin-forms-what-am-i-missing Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) => { if (null != e.View.StyleId) { e.NativeView.AccessibilityIdentifier = e.View.StyleId; // var intPtr = NSString.CreateNative(e.View.StyleId); // Messaging.void_objc_msgSend_IntPtr(e.NativeView.Handle, setAccessibilityIdentifier_Handle, intPtr); // NSString.ReleaseNative(intPtr); Console.WriteLine("Set AccessibilityIdentifier: " + e.View.StyleId); } }; window = new UIWindow (UIScreen.MainScreen.Bounds); window.RootViewController = App.GetMainPage ().CreateViewController (); window.MakeKeyAndVisible (); #if DEBUG Xamarin.Calabash.Start(); #endif return true; } } }
mit
C#
40d8aeee9d2d34d5a9c93bccb9abd87b1e3daad1
Hide occurrence members that should be handled via Times now
RajOpteamix/moq,tectronics/moq
Source/Language/IOccurrence.cs
Source/Language/IOccurrence.cs
//Copyright (c) 2007, Moq Team //http://code.google.com/p/moq/ //All rights reserved. //Redistribution and use in source and binary forms, //with or without modification, are permitted provided //that the following conditions are met: // * Redistributions of source code must retain the // above copyright notice, this list of conditions and // the following disclaimer. // * Redistributions in binary form must reproduce // the above copyright notice, this list of conditions // and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of the Moq Team nor the // names of its contributors may be used to endorse // or promote products derived from this software // without specific prior written permission. //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND //CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, //INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF //MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE //DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR //CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, //SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR //SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS //INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE //OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF //SUCH DAMAGE. //[This is the BSD license, see // http://www.opensource.org/licenses/bsd-license.php] using System.ComponentModel; namespace Moq.Language { /// <summary> /// Defines occurrence members to constraint setups. /// </summary> [EditorBrowsable(EditorBrowsableState.Never)] public interface IOccurrence : IHideObjectMembers { /// <summary> /// The expected invocation can happen at most once. /// </summary> /// <example> /// <code> /// var mock = new Mock&lt;ICommand&gt;(); /// mock.Setup(foo => foo.Execute("ping")) /// .AtMostOnce(); /// </code> /// </example> [EditorBrowsable(EditorBrowsableState.Never)] IVerifies AtMostOnce(); /// <summary> /// The expected invocation can happen at most specified number of times. /// </summary> /// <example> /// <code> /// var mock = new Mock&lt;ICommand&gt;(); /// mock.Setup(foo => foo.Execute("ping")) /// .AtMost( 5 ); /// </code> /// </example> [EditorBrowsable(EditorBrowsableState.Never)] IVerifies AtMost(int callCount); } }
//Copyright (c) 2007, Moq Team //http://code.google.com/p/moq/ //All rights reserved. //Redistribution and use in source and binary forms, //with or without modification, are permitted provided //that the following conditions are met: // * Redistributions of source code must retain the // above copyright notice, this list of conditions and // the following disclaimer. // * Redistributions in binary form must reproduce // the above copyright notice, this list of conditions // and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of the Moq Team nor the // names of its contributors may be used to endorse // or promote products derived from this software // without specific prior written permission. //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND //CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, //INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF //MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE //DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR //CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, //SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR //SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS //INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, //WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE //OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF //SUCH DAMAGE. //[This is the BSD license, see // http://www.opensource.org/licenses/bsd-license.php] using System.ComponentModel; namespace Moq.Language { /// <summary> /// Defines occurrence members to constraint setups. /// </summary> [EditorBrowsable(EditorBrowsableState.Never)] public interface IOccurrence : IHideObjectMembers { /// <summary> /// The expected invocation can happen at most once. /// </summary> /// <example> /// <code> /// var mock = new Mock&lt;ICommand&gt;(); /// mock.Setup(foo => foo.Execute("ping")) /// .AtMostOnce(); /// </code> /// </example> IVerifies AtMostOnce(); /// <summary> /// The expected invocation can happen at most specified number of times. /// </summary> /// <example> /// <code> /// var mock = new Mock&lt;ICommand&gt;(); /// mock.Setup(foo => foo.Execute("ping")) /// .AtMost( 5 ); /// </code> /// </example> IVerifies AtMost( int callCount); } }
bsd-3-clause
C#
e6ae002ce0dcea90f24392e7b2e12634f18837c5
Remove unused Items property from PoEStash
jcmoyer/Yeena
Yeena/PathOfExile/PoEStash.cs
Yeena/PathOfExile/PoEStash.cs
// Copyright 2013 J.C. Moyer // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Collections.Generic; namespace Yeena.PathOfExile { class PoEStash { private readonly List<PoEStashTab> _tabs; public PoEStash(IEnumerable<PoEStashTab> tabs) { _tabs = new List<PoEStashTab>(tabs); } public IReadOnlyList<PoEStashTab> Tabs { get { return _tabs; } } public PoEStashTab GetContainingTab(PoEItem item) { foreach (var tab in _tabs) { foreach (var tabItem in tab) { if (item == tabItem) return tab; } } return null; } } }
// Copyright 2013 J.C. Moyer // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Collections.Generic; namespace Yeena.PathOfExile { class PoEStash { private readonly List<PoEStashTab> _tabs; public PoEStash(IEnumerable<PoEStashTab> tabs) { _tabs = new List<PoEStashTab>(tabs); } public IReadOnlyList<PoEStashTab> Tabs { get { return _tabs; } } public IReadOnlyList<PoEItem> Items { get { var items = new List<PoEItem>(); foreach (var tab in _tabs) { items.AddRange(tab); } return items; } } public PoEStashTab GetContainingTab(PoEItem item) { foreach (var tab in _tabs) { foreach (var tabItem in tab) { if (item == tabItem) return tab; } } return null; } } }
apache-2.0
C#
053ca51a9fc1bc7632395bf584198efb026606c5
Implement IReadOnlyList<PoEStashTab> instead
jcmoyer/Yeena
Yeena/PathOfExile/PoEStash.cs
Yeena/PathOfExile/PoEStash.cs
// Copyright 2013 J.C. Moyer // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Collections; using System.Collections.Generic; namespace Yeena.PathOfExile { class PoEStash : IReadOnlyList<PoEStashTab> { private readonly List<PoEStashTab> _tabs; public PoEStash(IEnumerable<PoEStashTab> tabs) { _tabs = new List<PoEStashTab>(tabs); } public IReadOnlyList<PoEStashTab> Tabs { get { return _tabs; } } public PoEStashTab GetContainingTab(PoEItem item) { foreach (var tab in _tabs) { foreach (var tabItem in tab) { if (item == tabItem) return tab; } } return null; } public IEnumerator<PoEStashTab> GetEnumerator() { return Tabs.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public int Count { get { return Tabs.Count; } } public PoEStashTab this[int index] { get { return Tabs[index]; } } } }
// Copyright 2013 J.C. Moyer // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Collections; using System.Collections.Generic; namespace Yeena.PathOfExile { class PoEStash : IEnumerable<PoEStashTab> { private readonly List<PoEStashTab> _tabs; public PoEStash(IEnumerable<PoEStashTab> tabs) { _tabs = new List<PoEStashTab>(tabs); } public IReadOnlyList<PoEStashTab> Tabs { get { return _tabs; } } public PoEStashTab GetContainingTab(PoEItem item) { foreach (var tab in _tabs) { foreach (var tabItem in tab) { if (item == tabItem) return tab; } } return null; } public IEnumerator<PoEStashTab> GetEnumerator() { return Tabs.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } }
apache-2.0
C#
6d1d384b96e59c48c2da3ce41455796a0266bf77
Return standard vertex string on error
yishn/GTPWrapper
GTPWrapper/DataTypes/Vertex.cs
GTPWrapper/DataTypes/Vertex.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GTPWrapper.DataTypes { /// <summary> /// Represents a Go board coordinate. /// </summary> public struct Vertex { /// <summary> /// The letters in a vertex string, i.e. the letters A to Z, excluding I. /// </summary> public static string Letters = "ABCDEFGHJKLMNOPQRSTUVWXYZ"; /// <summary> /// Gets or sets the x coordinate of the point. /// </summary> public int X; /// <summary> /// Gets or sets the y coordinate of the point. /// </summary> public int Y; /// <summary> /// Initializes a new instance of the Vertex class with the given coordinates. /// </summary> /// <param name="x">The horizontal position of the point.</param> /// <param name="y">The vertical position of the point.</param> public Vertex(int x, int y) { this.X = x; this.Y = y; } /// <summary> /// Initializes a new instance of the Vertex class with the given coordinate. /// </summary> /// <param name="vertex">The board coordinate consisting of one letter and one number.</param> public Vertex(string vertex) { this.Y = Vertex.Letters.IndexOf(vertex.ToUpper()[0]) + 1; if (this.Y == 0 || !int.TryParse(vertex.Substring(1), out this.X)) throw new System.FormatException("This is not a valid vertex string."); } /// <summary> /// Returns the vertex string. /// </summary> public override string ToString() { if (this.Y >= Vertex.Letters.Length) return ""; return Vertex.Letters[this.Y - 1] + this.X.ToString(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GTPWrapper.DataTypes { /// <summary> /// Represents a Go board coordinate. /// </summary> public struct Vertex { /// <summary> /// The letters in a vertex string, i.e. the letters A to Z, excluding I. /// </summary> public static string Letters = "ABCDEFGHJKLMNOPQRSTUVWXYZ"; /// <summary> /// Gets or sets the x coordinate of the point. /// </summary> public int X; /// <summary> /// Gets or sets the y coordinate of the point. /// </summary> public int Y; /// <summary> /// Initializes a new instance of the Vertex class with the given coordinates. /// </summary> /// <param name="x">The horizontal position of the point.</param> /// <param name="y">The vertical position of the point.</param> public Vertex(int x, int y) { this.X = x; this.Y = y; } /// <summary> /// Initializes a new instance of the Vertex class with the given coordinate. /// </summary> /// <param name="vertex">The board coordinate consisting of one letter and one number.</param> public Vertex(string vertex) { this.Y = Vertex.Letters.IndexOf(vertex.ToUpper()[0]) + 1; if (this.Y == 0 || !int.TryParse(vertex.Substring(1), out this.X)) throw new System.FormatException("This is not a valid vertex string."); } /// <summary> /// Returns the vertex string. /// </summary> public override string ToString() { if (this.Y >= Vertex.Letters.Length) throw new System.FormatException("This is not a valid vertex string."); return Vertex.Letters[this.Y - 1] + this.X.ToString(); } } }
mit
C#
2d15b3c77b91d57ac32b70574d1e9ffe63e87cb2
Format code
caronyan/CSharpRecipe
CSharpRecipe/Recipe.ClassAndGeneric/ListExtension.cs
CSharpRecipe/Recipe.ClassAndGeneric/ListExtension.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Recipe.ClassAndGeneric { static class ListExtension { public static IEnumerable<T> GetAll<T>(this List<T> myList, T searchValue) => myList.Where(t => t.Equals(searchValue)); public static T[] BinarySearchGetAll<T>(this List<T> myList, T searchValue) { List<T> retObjs = new List<T>(); int center = myList.BinarySearch(searchValue); if (center > 0) { retObjs.Add(myList[center]); int left = center; while (left > 0 && myList[left - 1].Equals(searchValue)) { left -= 1; retObjs.Add(myList[center]); } int right = center; while (right < (myList.Count - 1) && myList[right + 1].Equals(searchValue)) { right += 1; retObjs.Add(myList[center]); } } return retObjs.ToArray(); } public static int CountAll<T>(this List<T> myList, T searchValue) => myList.GetAll(searchValue).Count(); public static int BinarySearchCountAll<T>(this List<T> myList, T searchValue) => BinarySearchGetAll(myList, searchValue).Count(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Recipe.ClassAndGeneric { static class ListExtension { public static IEnumerable<T> GetAll<T>(this List<T> myList, T searchValue) => myList.Where(t => t.Equals(searchValue)); public static T[] BinarySearchGetAll<T>(this List<T> myList, T searchValue) { List<T> retObjs = new List<T>(); int center = myList.BinarySearch(searchValue); if (center>0) { retObjs.Add(myList[center]); int left = center; while (left>0&&myList[left-1].Equals(searchValue)) { left -= 1; retObjs.Add(myList[center]); } int right = center; while (right<(myList.Count-1)&&myList[right+1].Equals(searchValue)) { right += 1; retObjs.Add(myList[center]); } } return retObjs.ToArray(); } public static int CountAll<T>(this List<T> myList, T searchValue) => myList.GetAll(searchValue).Count(); public static int BinarySearchCountAll<T>(this List<T> myList, T searchValue) => BinarySearchGetAll(myList, searchValue).Count(); } }
mit
C#
29e253ac805f675a340f3ca33951866deae52583
fix fxcop warning
synel/syndll2
Syndll2/InvalidCrcException.cs
Syndll2/InvalidCrcException.cs
using System; namespace Syndll2 { /// <summary> /// Exception that is thrown when a CRC could not be verified /// </summary> [Serializable] public class InvalidCrcException : Exception { public InvalidCrcException(string message) : base(message) { } } }
using System; namespace Syndll2 { /// <summary> /// Exception that is thrown when a CRC could not be verified /// </summary> public class InvalidCrcException : Exception { public InvalidCrcException(string message) : base(message) { } } }
mit
C#
8465e5f7f26a620068cd7081c6842f1315f27be9
Add comment
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Services/Terminate/TerminateService.cs
WalletWasabi/Services/Terminate/TerminateService.cs
using System; using System.Threading; using System.Threading.Tasks; using WalletWasabi.Logging; namespace WalletWasabi.Services.Terminate { public class TerminateService { private Func<Task> _terminateApplicationAsync; private const long TerminateStatusIdle = 0; private const long TerminateStatusInProgress = 1; private const long TerminateFinished = 2; private long _terminateStatus; public TerminateService(Func<Task> terminateApplicationAsync) { _terminateApplicationAsync = terminateApplicationAsync; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; Console.CancelKeyPress += Console_CancelKeyPress; } private void CurrentDomain_ProcessExit(object? sender, EventArgs e) { Logger.LogDebug("ProcessExit was called."); // This must be a blocking call because after this the OS will terminate Wasabi process if exists. Terminate(); } private void Console_CancelKeyPress(object? sender, ConsoleCancelEventArgs e) { Logger.LogWarning("Process was signaled for termination."); // This must be a blocking call because after this the OS will terminate Wasabi process if exists. // In some cases CurrentDomain_ProcessExit is called after this by the OS. Terminate(); } /// <summary> /// This will terminate the application. This is a blocking method and no return after this call as it will exit the application. /// </summary> public void Terminate(int exitCode = 0) { var prevValue = Interlocked.CompareExchange(ref _terminateStatus, TerminateStatusInProgress, TerminateStatusIdle); Logger.LogTrace($"Terminate was called from ThreadId: {Thread.CurrentThread.ManagedThreadId}"); if (prevValue != TerminateStatusIdle) { // Secondary callers will be blocked until the end of the termination. while (_terminateStatus != TerminateFinished) { } return; } // First caller starts the terminate procedure. Logger.LogDebug("Terminate application was started."); // Async termination has to be started on another thread otherwise there is a possibility of deadlock. // We still need to block the caller so ManualResetEvent applied. using ManualResetEvent resetEvent = new ManualResetEvent(false); Task.Run(async () => await _terminateApplicationAsync.Invoke().ContinueWith((arg) => { if (arg?.Exception is { } ex) { Logger.LogWarning(ex.ToTypeMessageString()); } resetEvent.Set(); })); resetEvent.WaitOne(); Dispose(); // Indicate that the termination procedure finished. So other callers can return. Interlocked.Exchange(ref _terminateStatus, TerminateFinished); Environment.Exit(exitCode); } public bool IsTerminateRequested => Interlocked.Read(ref _terminateStatus) > TerminateStatusIdle; private void Dispose() { AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; Console.CancelKeyPress -= Console_CancelKeyPress; } } }
using System; using System.Threading; using System.Threading.Tasks; using WalletWasabi.Logging; namespace WalletWasabi.Services.Terminate { public class TerminateService { private Func<Task> _terminateApplicationAsync; private const long TerminateStatusIdle = 0; private const long TerminateStatusInProgress = 1; private const long TerminateFinished = 2; private long _terminateStatus; public TerminateService(Func<Task> terminateApplicationAsync) { _terminateApplicationAsync = terminateApplicationAsync; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; Console.CancelKeyPress += Console_CancelKeyPress; } private void CurrentDomain_ProcessExit(object? sender, EventArgs e) { Logger.LogDebug("ProcessExit was called."); // This must be a blocking call because after this the OS will terminate Wasabi process if exists. Terminate(); } private void Console_CancelKeyPress(object? sender, ConsoleCancelEventArgs e) { Logger.LogWarning("Process was signaled for termination."); // This must be a blocking call because after this the OS will terminate Wasabi process if exists. // In some cases CurrentDomain_ProcessExit is called after this by the OS. Terminate(); } /// <summary> /// This will terminate the application. This is a blocking method and no return after this call as it will exit the application. /// </summary> public void Terminate(int exitCode = 0) { var prevValue = Interlocked.CompareExchange(ref _terminateStatus, TerminateStatusInProgress, TerminateStatusIdle); if (prevValue != TerminateStatusIdle) { // Secondary callers will be blocked until the end of the termination. while (_terminateStatus != TerminateFinished) { } return; } // First caller starts the terminate procedure. Logger.LogDebug("Terminate application was started."); // Async termination has to be started on another thread otherwise there is a possibility of deadlock. // We still need to block the caller so ManualResetEvent applied. using ManualResetEvent resetEvent = new ManualResetEvent(false); Task.Run(async () => await _terminateApplicationAsync.Invoke().ContinueWith((arg) => { if (arg?.Exception is { } ex) { Logger.LogWarning(ex.ToTypeMessageString()); } resetEvent.Set(); })); resetEvent.WaitOne(); Dispose(); // Indicate that the termination procedure finished. So other callers can return. Interlocked.Exchange(ref _terminateStatus, TerminateFinished); Environment.Exit(exitCode); } public bool IsTerminateRequested => Interlocked.Read(ref _terminateStatus) > TerminateStatusIdle; private void Dispose() { AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; Console.CancelKeyPress -= Console_CancelKeyPress; } } }
mit
C#
71d99d65622b575109f20ca37a5ec500ef79411f
Remove the cursor dot
EvanHahn/Unity-RTS-camera
RTSCamera.cs
RTSCamera.cs
using UnityEngine; using System.Collections; public class RTSCamera : MonoBehaviour { public Color selectColor = Color.green; public float selectLineWidth = 2f; private readonly string[] INPUT_MOUSE_BUTTONS = {"Mouse Look", "Mouse Select"}; private bool[] isDragging = new bool[2]; private Vector3 selectStartPosition; private Texture2D pixel; void Start() { setPixel(selectColor); } void Update() { updateDragging(); updateLook(); } void OnGUI() { updateSelect(); } private void updateDragging() { for (int index = 0; index <= 1; index ++) { if (isClicking(index) && !isDragging[index]) { isDragging[index] = true; if (index == 1) { selectStartPosition = getMousePosition(); } } else if (!isClicking(index) && isDragging[index]) { isDragging[index] = false; } } } private void updateLook() { if (!isDragging[0]) { return; } var newPosition = transform.position; var mousePosition = getMouseMovement(); newPosition.x = newPosition.x - mousePosition.x; newPosition.y = newPosition.y - mousePosition.y; transform.position = newPosition; } private void updateSelect() { if (!isDragging[1]) { return; } var x = selectStartPosition.x; var y = selectStartPosition.y; var width = getMousePosition().x - selectStartPosition.x; var height = getMousePosition().y - selectStartPosition.y; GUI.DrawTexture(new Rect(x, y, width, selectLineWidth), pixel); GUI.DrawTexture(new Rect(x, y, selectLineWidth, height), pixel); GUI.DrawTexture(new Rect(x, y + height, width, selectLineWidth), pixel); GUI.DrawTexture(new Rect(x + width, y, selectLineWidth, height), pixel); } private bool isClicking(int index) { return Input.GetAxis(INPUT_MOUSE_BUTTONS[index]) == 1; } private Vector2 getMouseMovement() { return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); } private void setPixel(Color color) { pixel = new Texture2D(1, 1); pixel.SetPixel(0, 0, color); pixel.Apply(); } private Vector3 getMousePosition() { var result = Input.mousePosition; result.y = Screen.height - result.y; return result; } }
using UnityEngine; using System.Collections; public class RTSCamera : MonoBehaviour { public Color selectColor = Color.green; public float selectLineWidth = 2f; private readonly string[] INPUT_MOUSE_BUTTONS = {"Mouse Look", "Mouse Select"}; private bool[] isDragging = new bool[2]; private Vector3 selectStartPosition; private Texture2D pixel; void Start() { setPixel(selectColor); } void Update() { updateDragging(); updateLook(); } void OnGUI() { updateSelect(); } private void updateDragging() { for (int index = 0; index <= 1; index ++) { if (isClicking(index) && !isDragging[index]) { isDragging[index] = true; if (index == 1) { selectStartPosition = getMousePosition(); } } else if (!isClicking(index) && isDragging[index]) { isDragging[index] = false; } } } private void updateLook() { if (!isDragging[0]) { return; } var newPosition = transform.position; var mousePosition = getMouseMovement(); newPosition.x = newPosition.x - mousePosition.x; newPosition.y = newPosition.y - mousePosition.y; transform.position = newPosition; } private void updateSelect() { if (!isDragging[1]) { return; } var x = selectStartPosition.x; var y = selectStartPosition.y; var width = getMousePosition().x - selectStartPosition.x; var height = getMousePosition().y - selectStartPosition.y; GUI.DrawTexture(new Rect(x, y, width, selectLineWidth), pixel); GUI.DrawTexture(new Rect(x, y, selectLineWidth, height), pixel); GUI.DrawTexture(new Rect(x, y + height, width, selectLineWidth), pixel); GUI.DrawTexture(new Rect(x + width, y, selectLineWidth, height), pixel); GUI.DrawTexture(new Rect(x + width - 3, y + height - 3, 6, 6), pixel); } private bool isClicking(int index) { return Input.GetAxis(INPUT_MOUSE_BUTTONS[index]) == 1; } private Vector2 getMouseMovement() { return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); } private void setPixel(Color color) { pixel = new Texture2D(1, 1); pixel.SetPixel(0, 0, color); pixel.Apply(); } private Vector3 getMousePosition() { var result = Input.mousePosition; result.y = Screen.height - result.y; return result; } }
mit
C#
0ba8df0dc09dcafa4e7d60b27e4ecb5f519323f8
Remove old SQL code
jamesmontemagno/MyShoppe
MyShopAdmin.iOS/AppDelegate.cs
MyShopAdmin.iOS/AppDelegate.cs
using System; using System.Collections.Generic; using System.Linq; using Foundation; using UIKit; using ImageCircle.Forms.Plugin.iOS; namespace MyShopAdmin.iOS { [Register ("AppDelegate")] public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate { public override bool FinishedLaunching (UIApplication app, NSDictionary options) { UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(43, 132, 211); //bar background UINavigationBar.Appearance.TintColor = UIColor.White; //Tint color of button items UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes() { Font = UIFont.FromName("HelveticaNeue-Light", (nfloat)20f), TextColor = UIColor.White }); global::Xamarin.Forms.Forms.Init (); Xamarin.FormsMaps.Init(); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); ImageCircleRenderer.Init(); LoadApplication (new App ()); return base.FinishedLaunching (app, options); } } }
using System; using System.Collections.Generic; using System.Linq; using Foundation; using UIKit; using ImageCircle.Forms.Plugin.iOS; namespace MyShopAdmin.iOS { [Register ("AppDelegate")] public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate { public override bool FinishedLaunching (UIApplication app, NSDictionary options) { UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(43, 132, 211); //bar background UINavigationBar.Appearance.TintColor = UIColor.White; //Tint color of button items UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes() { Font = UIFont.FromName("HelveticaNeue-Light", (nfloat)20f), TextColor = UIColor.White }); global::Xamarin.Forms.Forms.Init (); Xamarin.FormsMaps.Init(); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); SQLitePCL.CurrentPlatform.Init(); ImageCircleRenderer.Init(); LoadApplication (new App ()); return base.FinishedLaunching (app, options); } } }
mit
C#
4fff13f9cc51aa2a31c67f6fdc5c32a71d569546
Replace public with private
bartlomiejwolk/AnimationPathAnimator
PathEvents/Editor/PropertyDrawers/NodeEventDrawer.cs
PathEvents/Editor/PropertyDrawers/NodeEventDrawer.cs
using UnityEngine; using System.Collections; using UnityEditor; namespace ATP.SimplePathAnimator.Events { [CustomPropertyDrawer(typeof(NodeEvent))] public class NodeEventDrawer : PropertyDrawer { // How many rows (properties) will be displayed. private static int Rows { get { return 2; } } // Hight of a single property. private static int PropHeight { get { return 16; } } // Margin between properties. private static int PropMargin { get { return 4; } } private static int RowsSpace { get { return 8; } } // Overall hight of the serialized property. public override float GetPropertyHeight( SerializedProperty property, GUIContent label) { return base.GetPropertyHeight(property, label) * Rows // Each row is 16 px high. + (Rows - 1) * RowsSpace; // Add 4 px for each spece between rows. } public override void OnGUI( Rect pos, SerializedProperty prop, GUIContent label) { SerializedProperty methodName = prop.FindPropertyRelative("methodName"); SerializedProperty methodArg = prop.FindPropertyRelative("methodArg"); EditorGUIUtility.labelWidth = 55; EditorGUI.PropertyField( new Rect(pos.x, pos.y, pos.width, PropHeight), methodName, new GUIContent("Method", "")); EditorGUI.PropertyField( new Rect( pos.x, pos.y + 1 * (PropHeight + PropMargin), pos.width, PropHeight), methodArg, new GUIContent("Arg.", "")); } } }
using UnityEngine; using System.Collections; using UnityEditor; namespace ATP.SimplePathAnimator.Events { [CustomPropertyDrawer(typeof(NodeEvent))] public class NodeEventDrawer : PropertyDrawer { // How many rows (properties) will be displayed. public static int Rows { get { return 2; } } // Hight of a single property. public static int PropHeight { get { return 16; } } // Margin between properties. public static int PropMargin { get { return 4; } } public static int RowsSpace { get { return 8; } } // Overall hight of the serialized property. public override float GetPropertyHeight( SerializedProperty property, GUIContent label) { return base.GetPropertyHeight(property, label) * Rows // Each row is 16 px high. + (Rows - 1) * RowsSpace; // Add 4 px for each spece between rows. } public override void OnGUI( Rect pos, SerializedProperty prop, GUIContent label) { SerializedProperty methodName = prop.FindPropertyRelative("methodName"); SerializedProperty methodArg = prop.FindPropertyRelative("methodArg"); EditorGUIUtility.labelWidth = 55; EditorGUI.PropertyField( new Rect(pos.x, pos.y, pos.width, PropHeight), methodName, new GUIContent("Method", "")); EditorGUI.PropertyField( new Rect( pos.x, pos.y + 1 * (PropHeight + PropMargin), pos.width, PropHeight), methodArg, new GUIContent("Arg.", "")); } } }
mit
C#
0f07db297904b07e9aa450d1b0a7f0685ac60b71
Allow global mouse bindings to work with OverlayContainers
ppy/osu-framework,Tom94/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,default0/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,default0/osu-framework,Tom94/osu-framework,Nabile-Rahmani/osu-framework,ZLima12/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework
osu.Framework/Graphics/Containers/OverlayContainer.cs
osu.Framework/Graphics/Containers/OverlayContainer.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Collections.Generic; using osu.Framework.Input; using OpenTK; namespace osu.Framework.Graphics.Containers { /// <summary> /// An element which starts hidden and can be toggled to visible. /// </summary> public abstract class OverlayContainer : VisibilityContainer { /// <summary> /// Whether we should block any mouse input from interacting with things behind us. /// </summary> protected virtual bool BlockPassThroughMouse => true; /// <summary> /// Whether we should block any keyboard input from interacting with things behind us. /// </summary> protected virtual bool BlockPassThroughKeyboard => false; internal override bool BuildKeyboardInputQueue(List<Drawable> queue) { if (CanReceiveInput && BlockPassThroughKeyboard) { // when blocking keyboard input behind us, we still want to make sure the global handlers receive events // but we don't want other drawables behind us handling them. queue.RemoveAll(d => !(d is IHandleGlobalInput)); } return base.BuildKeyboardInputQueue(queue); } internal override bool BuildMouseInputQueue(Vector2 screenSpaceMousePos, List<Drawable> queue) { if (CanReceiveInput && BlockPassThroughMouse && ReceiveMouseInputAt(screenSpaceMousePos)) { // when blocking mouse input behind us, we still want to make sure the global handlers receive events // but we don't want other drawables behind us handling them. queue.RemoveAll(d => !(d is IHandleGlobalInput)); } return base.BuildMouseInputQueue(screenSpaceMousePos, queue); } } public enum Visibility { Hidden, Visible } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Collections.Generic; using osu.Framework.Input; namespace osu.Framework.Graphics.Containers { /// <summary> /// An element which starts hidden and can be toggled to visible. /// </summary> public abstract class OverlayContainer : VisibilityContainer { /// <summary> /// Whether we should block any mouse input from interacting with things behind us. /// </summary> protected virtual bool BlockPassThroughMouse => true; /// <summary> /// Whether we should block any keyboard input from interacting with things behind us. /// </summary> protected virtual bool BlockPassThroughKeyboard => false; protected override bool OnHover(InputState state) => BlockPassThroughMouse; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => BlockPassThroughMouse; protected override bool OnClick(InputState state) => BlockPassThroughMouse; protected override bool OnDragStart(InputState state) => BlockPassThroughMouse; protected override bool OnWheel(InputState state) => BlockPassThroughMouse; internal override bool BuildKeyboardInputQueue(List<Drawable> queue) { if (CanReceiveInput && BlockPassThroughKeyboard) { // when blocking keyboard input behind us, we still want to make sure the global handlers receive events // but we don't want other drawables behind us handling them. queue.RemoveAll(d => !(d is IHandleGlobalInput)); } return base.BuildKeyboardInputQueue(queue); } } public enum Visibility { Hidden, Visible } }
mit
C#
1d529a6f830d5d81978cec1c43d80050e01cb9cd
Add help to New-SPOWeb -InheritNavigation
rgueldenpfennig/PnP,baldswede/PnP,durayakar/PnP,dalehhirt/PnP,kevhoyt/PnP,BartSnyckers/PnP,vnathalye/PnP,IvanTheBearable/PnP,tomvr2610/PnP,rgueldenpfennig/PnP,durayakar/PnP,8v060htwyc/PnP,OfficeDev/PnP,sandhyagaddipati/PnPSamples,aammiitt2/PnP,bstenberg64/PnP,shankargurav/PnP,srirams007/PnP,RickVanRousselt/PnP,OneBitSoftware/PnP,yagoto/PnP,jeroenvanlieshout/PnP,dalehhirt/PnP,jlsfernandez/PnP,shankargurav/PnP,joaopcoliveira/PnP,OneBitSoftware/PnP,aammiitt2/PnP,OzMakka/PnP,lamills1/PnP,rahulsuryawanshi/PnP,rgueldenpfennig/PnP,MaurizioPz/PnP,rroman81/PnP,brennaman/PnP,ivanvagunin/PnP,vman/PnP,NexploreDev/PnP-PowerShell,russgove/PnP,rbarten/PnP,brennaman/PnP,Anil-Lakhagoudar/PnP,r0ddney/PnP,srirams007/PnP,chrisobriensp/PnP,bstenberg64/PnP,mauricionr/PnP,JonathanHuss/PnP,timschoch/PnP,jeroenvanlieshout/PnP,OneBitSoftware/PnP,NavaneethaDev/PnP,brennaman/PnP,perolof/PnP,jlsfernandez/PnP,levesquesamuel/PnP,JilleFloridor/PnP,vman/PnP,sndkr/PnP,rahulsuryawanshi/PnP,edrohler/PnP,PieterVeenstra/PnP,Arknev/PnP,srirams007/PnP,Rick-Kirkham/PnP,spdavid/PnP,briankinsella/PnP,rencoreab/PnP,rbarten/PnP,lamills1/PnP,sjuppuh/PnP,JBeerens/PnP,patrick-rodgers/PnP,baldswede/PnP,narval32/Shp,russgove/PnP,bbojilov/PnP,JBeerens/PnP,GSoft-SharePoint/PnP,Arknev/PnP,worksofwisdom/PnP,kevhoyt/PnP,Chowdarysandhya/PnPTest,SPDoctor/PnP,gavinbarron/PnP,werocool/PnP,mauricionr/PnP,biste5/PnP,joaopcoliveira/PnP,timschoch/PnP,pbjorklund/PnP,pdfshareforms/PnP,machadosantos/PnP,yagoto/PnP,yagoto/PnP,weshackett/PnP,zrahui/PnP,zrahui/PnP,pdfshareforms/PnP,bhoeijmakers/PnP,edrohler/PnP,ebbypeter/PnP,ivanvagunin/PnP,rencoreab/PnP,Chowdarysandhya/PnPTest,GSoft-SharePoint/PnP,PaoloPia/PnP,MaurizioPz/PnP,OfficeDev/PnP,sandhyagaddipati/PnPSamples,selossej/PnP,comblox/PnP,Rick-Kirkham/PnP,spdavid/PnP,8v060htwyc/PnP,IvanTheBearable/PnP,narval32/Shp,ivanvagunin/PnP,valt83/PnP,rroman81/PnP,nishantpunetha/PnP,perolof/PnP,OzMakka/PnP,markcandelora/PnP,NavaneethaDev/PnP,ifaham/Test,ifaham/Test,andreasblueher/PnP,JilleFloridor/PnP,valt83/PnP,gautekramvik/PnP,8v060htwyc/PnP,machadosantos/PnP,tomvr2610/PnP,pbjorklund/PnP,nishantpunetha/PnP,valt83/PnP,Claire-Hindhaugh/PnP,SPDoctor/PnP,timothydonato/PnP,pdfshareforms/PnP,Anil-Lakhagoudar/PnP,weshackett/PnP,briankinsella/PnP,IDTimlin/PnP,worksofwisdom/PnP,andreasblueher/PnP,markcandelora/PnP,mauricionr/PnP,GeiloStylo/PnP,rbarten/PnP,jeroenvanlieshout/PnP,BartSnyckers/PnP,briankinsella/PnP,ivanvagunin/PnP,selossej/PnP,narval32/Shp,r0ddney/PnP,russgove/PnP,edrohler/PnP,afsandeberg/PnP,SPDoctor/PnP,JBeerens/PnP,patrick-rodgers/PnP,MaurizioPz/PnP,durayakar/PnP,darei-fr/PnP,sandhyagaddipati/PnPSamples,yagoto/PnP,JonathanHuss/PnP,GSoft-SharePoint/PnP,OzMakka/PnP,SuryaArup/PnP,chrisobriensp/PnP,SteenMolberg/PnP,Claire-Hindhaugh/PnP,levesquesamuel/PnP,SimonDoy/PnP,RickVanRousselt/PnP,svarukala/PnP,spdavid/PnP,gautekramvik/PnP,kendomen/PnP,PaoloPia/PnP,pbjorklund/PnP,PieterVeenstra/PnP,pascalberger/PnP,aammiitt2/PnP,lamills1/PnP,bstenberg64/PnP,SuryaArup/PnP,zrahui/PnP,patrick-rodgers/PnP,pascalberger/PnP,baldswede/PnP,8v060htwyc/PnP,miksteri/OfficeDevPnP,r0ddney/PnP,selossej/PnP,kendomen/PnP,PaoloPia/PnP,bbojilov/PnP,gavinbarron/PnP,nishantpunetha/PnP,PaoloPia/PnP,bbojilov/PnP,Rick-Kirkham/PnP,darei-fr/PnP,NexploreDev/PnP-PowerShell,pascalberger/PnP,erwinvanhunen/PnP,erwinvanhunen/PnP,NexploreDev/PnP-PowerShell,gavinbarron/PnP,levesquesamuel/PnP,sndkr/PnP,machadosantos/PnP,GeiloStylo/PnP,weshackett/PnP,hildabarbara/PnP,erwinvanhunen/PnP,ifaham/Test,vman/PnP,JilleFloridor/PnP,sjuppuh/PnP,tomvr2610/PnP,SteenMolberg/PnP,SteenMolberg/PnP,rroman81/PnP,timothydonato/PnP,hildabarbara/PnP,kevhoyt/PnP,IDTimlin/PnP,SimonDoy/PnP,PieterVeenstra/PnP,shankargurav/PnP,kendomen/PnP,timschoch/PnP,werocool/PnP,markcandelora/PnP,bhoeijmakers/PnP,SimonDoy/PnP,Arknev/PnP,comblox/PnP,comblox/PnP,svarukala/PnP,werocool/PnP,biste5/PnP,GeiloStylo/PnP,sndkr/PnP,andreasblueher/PnP,vnathalye/PnP,joaopcoliveira/PnP,Chowdarysandhya/PnPTest,RickVanRousselt/PnP,worksofwisdom/PnP,perolof/PnP,OneBitSoftware/PnP,vnathalye/PnP,BartSnyckers/PnP,timothydonato/PnP,JonathanHuss/PnP,kendomen/PnP,rencoreab/PnP,IvanTheBearable/PnP,afsandeberg/PnP,sjuppuh/PnP,chrisobriensp/PnP,JonathanHuss/PnP,biste5/PnP,bhoeijmakers/PnP,ebbypeter/PnP,afsandeberg/PnP,pbjorklund/PnP,svarukala/PnP,Anil-Lakhagoudar/PnP,miksteri/OfficeDevPnP,SuryaArup/PnP,IDTimlin/PnP,ebbypeter/PnP,bbojilov/PnP,NavaneethaDev/PnP,dalehhirt/PnP,hildabarbara/PnP,OfficeDev/PnP,rencoreab/PnP,Claire-Hindhaugh/PnP,OfficeDev/PnP,gautekramvik/PnP,jlsfernandez/PnP,miksteri/OfficeDevPnP,rahulsuryawanshi/PnP,darei-fr/PnP,Arknev/PnP
Solutions/PowerShell.Commands/Commands/Web/NewWeb.cs
Solutions/PowerShell.Commands/Commands/Web/NewWeb.cs
using OfficeDevPnP.PowerShell.Commands.Base; using Microsoft.SharePoint.Client; using System.Management.Automation; using OfficeDevPnP.Core.Entities; using OfficeDevPnP.PowerShell.CmdletHelpAttributes; namespace OfficeDevPnP.PowerShell.Commands { [Cmdlet(VerbsCommon.New, "SPOWeb")] [CmdletHelp("Creates a new subweb to the current web")] [CmdletExample(Code = @" PS:> New-SPOWeb -Title ""Project A Web"" -Url projectA -Description ""Information about Project A"" -Locale 1033 -Template ""STS#0""", Remarks = "Creates a new subweb under the current web with url projectA", SortOrder = 1)] public class NewWeb : SPOWebCmdlet { [Parameter(Mandatory = true, HelpMessage="The title of the new web")] public string Title; [Parameter(Mandatory = true, HelpMessage="The Url of the new web")] public string Url; [Parameter(Mandatory = false, HelpMessage="The description of the new web")] public string Description = string.Empty; [Parameter(Mandatory = false)] public int Locale = 1033; [Parameter(Mandatory = true, HelpMessage="The site definition template to use for the new web, e.g. STS#0")] public string Template = string.Empty; [Parameter(Mandatory = false, HelpMessage="By default the subweb will inherit its security from its parent, specify this switch to break this inheritance")] public SwitchParameter BreakInheritance = false; [Parameter(Mandatory = false, HelpMessage="Specifies whether the site inherits navigation.")] public SwitchParameter InheritNavigation = true; protected override void ExecuteCmdlet() { this.SelectedWeb.CreateWeb(Title, Url, Description, Template, Locale, !BreakInheritance,InheritNavigation); WriteVerbose(string.Format(Properties.Resources.Web0CreatedAt1, Title, Url)); } } }
using OfficeDevPnP.PowerShell.Commands.Base; using Microsoft.SharePoint.Client; using System.Management.Automation; using OfficeDevPnP.Core.Entities; using OfficeDevPnP.PowerShell.CmdletHelpAttributes; namespace OfficeDevPnP.PowerShell.Commands { [Cmdlet(VerbsCommon.New, "SPOWeb")] [CmdletHelp("Creates a new subweb to the current web")] [CmdletExample(Code = @" PS:> New-SPOWeb -Title ""Project A Web"" -Url projectA -Description ""Information about Project A"" -Locale 1033 -Template ""STS#0""", Remarks = "Creates a new subweb under the current web with url projectA", SortOrder = 1)] public class NewWeb : SPOWebCmdlet { [Parameter(Mandatory = true, HelpMessage="The title of the new web")] public string Title; [Parameter(Mandatory = true, HelpMessage="The Url of the new web")] public string Url; [Parameter(Mandatory = false, HelpMessage="The description of the new web")] public string Description = string.Empty; [Parameter(Mandatory = false)] public int Locale = 1033; [Parameter(Mandatory = true, HelpMessage="The site definition template to use for the new web, e.g. STS#0")] public string Template = string.Empty; [Parameter(Mandatory = false, HelpMessage="By default the subweb will inherit its security from its parent, specify this switch to break this inheritance")] public SwitchParameter BreakInheritance = false; [Parameter(Mandatory = false)] public SwitchParameter InheritNavigation = true; protected override void ExecuteCmdlet() { this.SelectedWeb.CreateWeb(Title, Url, Description, Template, Locale, !BreakInheritance,InheritNavigation); WriteVerbose(string.Format(Properties.Resources.Web0CreatedAt1, Title, Url)); } } }
apache-2.0
C#
c345783b9407281134be0386152cf91b51eecf76
Refactor default GetElapsed to use static readonly instance
brian-dot-net/writeasync,brian-dot-net/writeasync,brian-dot-net/writeasync
projects/EventHandlerSample/source/EventHandlerSample.Core/LoopingScheduler.cs
projects/EventHandlerSample/source/EventHandlerSample.Core/LoopingScheduler.cs
//----------------------------------------------------------------------- // <copyright file="LoopingScheduler.cs" company="Brian Rogers"> // Copyright (c) Brian Rogers. All rights reserved. // </copyright> //----------------------------------------------------------------------- namespace EventHandlerSample { using System; using System.Diagnostics; using System.Threading.Tasks; public class LoopingScheduler { private static readonly Stopwatch DefaultStopwatch = Stopwatch.StartNew(); private static readonly Func<TimeSpan> InitialGetElapsed = DefaultGetElapsed; private readonly Func<Task> doAsync; public LoopingScheduler(Func<Task> doAsync) { this.doAsync = doAsync; this.GetElapsed = InitialGetElapsed; } public event EventHandler Paused; public Func<TimeSpan> GetElapsed { get; set; } public async Task RunAsync(TimeSpan pauseInterval) { TimeSpan start = this.GetElapsed(); while (true) { await this.doAsync(); start = this.CheckPauseInterval(start, pauseInterval); } } private static TimeSpan DefaultGetElapsed() { return DefaultStopwatch.Elapsed; } private TimeSpan CheckPauseInterval(TimeSpan start, TimeSpan pauseInterval) { TimeSpan elapsed = this.GetElapsed() - start; if (elapsed >= pauseInterval) { start = elapsed; this.Raise(this.Paused); } return start; } private void Raise(EventHandler handler) { if (handler != null) { handler(this, EventArgs.Empty); } } } }
//----------------------------------------------------------------------- // <copyright file="LoopingScheduler.cs" company="Brian Rogers"> // Copyright (c) Brian Rogers. All rights reserved. // </copyright> //----------------------------------------------------------------------- namespace EventHandlerSample { using System; using System.Diagnostics; using System.Threading.Tasks; public class LoopingScheduler { private readonly Func<Task> doAsync; private readonly Stopwatch stopwatch; public LoopingScheduler(Func<Task> doAsync) { this.doAsync = doAsync; this.stopwatch = Stopwatch.StartNew(); this.GetElapsed = this.DefaultGetElapsed; } public event EventHandler Paused; public Func<TimeSpan> GetElapsed { get; set; } public async Task RunAsync(TimeSpan pauseInterval) { TimeSpan start = this.GetElapsed(); while (true) { await this.doAsync(); start = this.CheckPauseInterval(start, pauseInterval); } } private TimeSpan CheckPauseInterval(TimeSpan start, TimeSpan pauseInterval) { TimeSpan elapsed = this.GetElapsed() - start; if (elapsed >= pauseInterval) { start = elapsed; this.Raise(this.Paused); } return start; } private void Raise(EventHandler handler) { if (handler != null) { handler(this, EventArgs.Empty); } } private TimeSpan DefaultGetElapsed() { return this.stopwatch.Elapsed; } } }
unlicense
C#
36280d078bc5748f7f0239db747076f3cd5d2129
Remove unused fields in JukeboxMessageHandler
ethanmoffat/EndlessClient
EOLib/PacketHandlers/Jukebox/JukeboxMessageHandler.cs
EOLib/PacketHandlers/Jukebox/JukeboxMessageHandler.cs
using AutomaticTypeMapper; using EOLib.Domain.Login; using EOLib.Domain.Map; using EOLib.Domain.Notifiers; using EOLib.Net; using EOLib.Net.Handlers; using System.Collections.Generic; namespace EOLib.PacketHandlers.Jukebox { [AutoMappedType] public class JukeboxMessageHandler : InGameOnlyPacketHandler { private readonly ICurrentMapStateRepository _currentMapStateRepository; private readonly IEnumerable<IOtherCharacterAnimationNotifier> _otherCharacterAnimationNotifiers; public override PacketFamily Family => PacketFamily.JukeBox; public override PacketAction Action => PacketAction.Message; public JukeboxMessageHandler(IPlayerInfoProvider playerInfoProvider, ICurrentMapStateRepository currentMapStateRepository, IEnumerable<IOtherCharacterAnimationNotifier> otherCharacterAnimationNotifiers) : base(playerInfoProvider) { _currentMapStateRepository = currentMapStateRepository; _otherCharacterAnimationNotifiers = otherCharacterAnimationNotifiers; } public override bool HandlePacket(IPacket packet) { var playerId = packet.ReadShort(); var direction = (EODirection)packet.ReadChar(); var instrument = packet.ReadChar(); var note = packet.ReadChar(); if (_currentMapStateRepository.Characters.ContainsKey(playerId)) { var c = _currentMapStateRepository.Characters[playerId]; if (c.RenderProperties.WeaponGraphic == instrument) { c = c.WithRenderProperties(c.RenderProperties.WithDirection(direction)); _currentMapStateRepository.Characters[playerId] = c; foreach (var notifier in _otherCharacterAnimationNotifiers) notifier.StartOtherCharacterAttackAnimation(playerId, note - 1); } } else { _currentMapStateRepository.UnknownPlayerIDs.Add(playerId); } return true; } } }
using AutomaticTypeMapper; using EOLib.Domain.Character; using EOLib.Domain.Login; using EOLib.Domain.Map; using EOLib.Domain.Notifiers; using EOLib.Net; using EOLib.Net.Handlers; using System.Collections.Generic; namespace EOLib.PacketHandlers.Jukebox { [AutoMappedType] public class JukeboxMessageHandler : InGameOnlyPacketHandler { private readonly ICharacterRepository _characterRepository; private readonly ICurrentMapStateRepository _currentMapStateRepository; private readonly IEnumerable<IMainCharacterEventNotifier> _mainCharacterEventNotifiers; private readonly IEnumerable<IOtherCharacterAnimationNotifier> _otherCharacterAnimationNotifiers; public override PacketFamily Family => PacketFamily.JukeBox; public override PacketAction Action => PacketAction.Message; public JukeboxMessageHandler(IPlayerInfoProvider playerInfoProvider, ICurrentMapStateRepository currentMapStateRepository, IEnumerable<IOtherCharacterAnimationNotifier> otherCharacterAnimationNotifiers) : base(playerInfoProvider) { _currentMapStateRepository = currentMapStateRepository; _otherCharacterAnimationNotifiers = otherCharacterAnimationNotifiers; } public override bool HandlePacket(IPacket packet) { var playerId = packet.ReadShort(); var direction = (EODirection)packet.ReadChar(); var instrument = packet.ReadChar(); var note = packet.ReadChar(); if (_currentMapStateRepository.Characters.ContainsKey(playerId)) { var c = _currentMapStateRepository.Characters[playerId]; if (c.RenderProperties.WeaponGraphic == instrument) { c = c.WithRenderProperties(c.RenderProperties.WithDirection(direction)); _currentMapStateRepository.Characters[playerId] = c; foreach (var notifier in _otherCharacterAnimationNotifiers) notifier.StartOtherCharacterAttackAnimation(playerId, note - 1); } } else { _currentMapStateRepository.UnknownPlayerIDs.Add(playerId); } return true; } } }
mit
C#
4382e8ebbe86db97d8e54b67325a585f748b41b4
Update App.cs
jamesmontemagno/MyShoppe
MyShop/App.cs
MyShop/App.cs
using MyShop.Services; using System; using System.Linq; using Xamarin.Forms; namespace MyShop { public static class ViewModelLocator { static bool UseDesignTime => false; static FeedbackViewModel feedbackVM; public static FeedbackViewModel FeedbackViewModel => feedbackVM ?? (feedbackVM = new FeedbackViewModel(null)); static StoresViewModel storesViewModel; public static StoresViewModel StoresViewModel { get { if(!UseDesignTime) return null; if (storesViewModel != null) return storesViewModel; storesViewModel = new StoresViewModel(null); storesViewModel.GetStoresCommand.Execute(null); return storesViewModel; } } static StoreViewModel storeViewModel; public static StoreViewModel StoreViewModel { get { if(!UseDesignTime) return null; if (storeViewModel != null) return storeViewModel; var offline = new OfflineDataStore(); var task = offline.GetStoresAsync(); task.Wait(); var store = task.Result.First(); storeViewModel = new StoreViewModel(store, null); return storeViewModel; } } } public class App : Application { public App () { // The root page of your application MainPage = new NavigationPage(new HomePage()) { BarTextColor = Color.White, BarBackgroundColor = Color.FromHex("#2B84D3") }; } protected override void OnStart () { // Handle when your app starts } protected override void OnSleep () { // Handle when your app sleeps } protected override void OnResume () { // Handle when your app resumes } } }
using MyShop.Services; using System; using System.Linq; using Xamarin.Forms; namespace MyShop { public static class ViewModelLocator { static FeedbackViewModel feedbackVM; public static FeedbackViewModel FeedbackViewModel => feedbackVM ?? (feedbackVM = new FeedbackViewModel(null)); static StoresViewModel storesViewModel; public static StoresViewModel StoresViewModel { get { if (storesViewModel != null) return storesViewModel; storesViewModel = new StoresViewModel(null); storesViewModel.GetStoresCommand.Execute(null); return storesViewModel; } } static StoreViewModel storeViewModel; public static StoreViewModel StoreViewModel { get { if (storeViewModel != null) return storeViewModel; var offline = new OfflineDataStore(); var task = offline.GetStoresAsync(); task.Wait(); var store = task.Result.First(); storeViewModel = new StoreViewModel(store, null); return storeViewModel; } } } public class App : Application { public App () { // The root page of your application MainPage = new NavigationPage(new HomePage()) { BarTextColor = Color.White, BarBackgroundColor = Color.FromHex("#2B84D3") }; } protected override void OnStart () { // Handle when your app starts } protected override void OnSleep () { // Handle when your app sleeps } protected override void OnResume () { // Handle when your app resumes } } }
mit
C#
ea3e4cb0a2fd3c9695ce411af5016ef66c04afbf
Increment the assembly version.
ladimolnar/BitcoinBlockchain
Sources/BitcoinBlockchain/Properties/AssemblyInfo.cs
Sources/BitcoinBlockchain/Properties/AssemblyInfo.cs
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs"> // Copyright © Ladislau Molnar. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("BitcoinBlockchain")] [assembly: AssemblyDescription("A .NET Class Library that provides parsing functionality over files containing the Bitcoin blockchain.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ladislau Molnar")] [assembly: AssemblyProduct("BitcoinBlockchain")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(false)] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4d8ebb2b-d182-4106-8d15-5fb864de6706")] // 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.2.2.0")] [assembly: AssemblyFileVersion("1.2.2.0")]
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs"> // Copyright © Ladislau Molnar. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("BitcoinBlockchain")] [assembly: AssemblyDescription("A .NET Class Library that provides parsing functionality over files containing the Bitcoin blockchain.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ladislau Molnar")] [assembly: AssemblyProduct("BitcoinBlockchain")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(false)] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4d8ebb2b-d182-4106-8d15-5fb864de6706")] // 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.2.1.0")] [assembly: AssemblyFileVersion("1.2.1.0")]
apache-2.0
C#
95cccf5eba28f6889e5a67f98afe21d2175ddd9d
fix logger category
bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core
src/Admin/Jobs/DatabaseRebuildlIndexesJob.cs
src/Admin/Jobs/DatabaseRebuildlIndexesJob.cs
using System; using System.Threading.Tasks; using Bit.Core.Jobs; using Bit.Core.Repositories; using Microsoft.Extensions.Logging; using Quartz; namespace Bit.Admin.Jobs { public class DatabaseRebuildlIndexesJob : BaseJob { private readonly IMaintenanceRepository _maintenanceRepository; public DatabaseRebuildlIndexesJob( IMaintenanceRepository maintenanceRepository, ILogger<DatabaseRebuildlIndexesJob> logger) : base(logger) { _maintenanceRepository = maintenanceRepository; } protected async override Task ExecuteJobAsync(IJobExecutionContext context) { await _maintenanceRepository.RebuildIndexesAsync(); } } }
using System; using System.Threading.Tasks; using Bit.Core.Jobs; using Bit.Core.Repositories; using Microsoft.Extensions.Logging; using Quartz; namespace Bit.Admin.Jobs { public class DatabaseRebuildlIndexesJob : BaseJob { private readonly IMaintenanceRepository _maintenanceRepository; public DatabaseRebuildlIndexesJob( IMaintenanceRepository maintenanceRepository, ILogger<DatabaseUpdateStatisticsJob> logger) : base(logger) { _maintenanceRepository = maintenanceRepository; } protected async override Task ExecuteJobAsync(IJobExecutionContext context) { await _maintenanceRepository.RebuildIndexesAsync(); } } }
agpl-3.0
C#
5f606e44bd136f6ef1062af28f536f56427e24e9
Fix write bug when jsonMediaTypes are null
visualeyes/halcyon,IsaacSanch/APIology.HAL,IsaacSanch/halcyon
src/Halcyon/HAL/JsonHALMediaTypeFormatter.cs
src/Halcyon/HAL/JsonHALMediaTypeFormatter.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Formatting; using System.Net.Http.Headers; using System.Threading.Tasks; using System.Web; namespace Halcyon.HAL { public class JsonHALMediaTypeFormatter : JsonMediaTypeFormatter { private const string HalJsonType = "application/hal+json"; private readonly string[] jsonMediaTypes; public JsonHALMediaTypeFormatter(string[] halJsonMedaiTypes = null, string[] jsonMediaTypes = null) : base() { if (halJsonMedaiTypes == null) halJsonMedaiTypes = new string[] { HalJsonType }; if (jsonMediaTypes == null) halJsonMedaiTypes = new string[] { }; this.jsonMediaTypes = jsonMediaTypes; foreach (var mediaType in halJsonMedaiTypes) { SupportedMediaTypes.Add(new MediaTypeHeaderValue(mediaType)); } foreach (var mediaType in jsonMediaTypes.Where(t => t != JsonMediaTypeFormatter.DefaultMediaType.MediaType)) { SupportedMediaTypes.Add(new MediaTypeHeaderValue(mediaType)); } } public override bool CanReadType(Type type) { return base.CanReadType(type); } public override bool CanWriteType(Type type) { return type == typeof(HALModel) || base.CanWriteType(type); } public override Task<object> ReadFromStreamAsync(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger) { return base.ReadFromStreamAsync(type, readStream, content, formatterLogger); } public override Task WriteToStreamAsync(Type type, object value, Stream writeStream, HttpContent content, TransportContext transportContext) { // If it is a HAL response but set to application/json - convert to a plain response if(type == typeof(HALModel) && value != null) { var halResponse = ((HALModel)value); string mediaType = content.Headers.ContentType.MediaType; if (!halResponse.Config.ForceHAL && (jsonMediaTypes.Contains(mediaType) || mediaType == JsonMediaTypeFormatter.DefaultMediaType.MediaType)) { value = halResponse.ToPlainResponse(); } } return base.WriteToStreamAsync(type, value, writeStream, content, transportContext); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Formatting; using System.Net.Http.Headers; using System.Threading.Tasks; using System.Web; namespace Halcyon.HAL { public class JsonHALMediaTypeFormatter : JsonMediaTypeFormatter { private const string HalJsonType = "application/hal+json"; private readonly string[] jsonMediaTypes; public JsonHALMediaTypeFormatter(string[] halJsonMedaiTypes = null, string[] jsonMediaTypes = null) : base() { if (halJsonMedaiTypes == null) { halJsonMedaiTypes = new string[] { HalJsonType }; } foreach (var mediaType in halJsonMedaiTypes) { SupportedMediaTypes.Add(new MediaTypeHeaderValue(mediaType)); } if (jsonMediaTypes != null) { foreach (var mediaType in jsonMediaTypes.Where(t => t != JsonMediaTypeFormatter.DefaultMediaType.MediaType)) { SupportedMediaTypes.Add(new MediaTypeHeaderValue(mediaType)); } } this.jsonMediaTypes = jsonMediaTypes; } public override bool CanReadType(Type type) { return base.CanReadType(type); } public override bool CanWriteType(Type type) { return type == typeof(HALModel) || base.CanWriteType(type); } public override Task<object> ReadFromStreamAsync(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger) { return base.ReadFromStreamAsync(type, readStream, content, formatterLogger); } public override Task WriteToStreamAsync(Type type, object value, Stream writeStream, HttpContent content, TransportContext transportContext) { // If it is a HAL response but set to application/json - convert to a plain response if(type == typeof(HALModel) && value != null) { var halResponse = ((HALModel)value); string mediaType = content.Headers.ContentType.MediaType; if (!halResponse.Config.ForceHAL && (jsonMediaTypes.Contains(mediaType) || mediaType == JsonMediaTypeFormatter.DefaultMediaType.MediaType)) { value = halResponse.ToPlainResponse(); } } return base.WriteToStreamAsync(type, value, writeStream, content, transportContext); } } }
mit
C#
94fbf4d0ea1972e06777edef3989bcdd5bbca2ad
Revert change contract id on projection version handler
Elders/Cronus,Elders/Cronus
src/Elders.Cronus/Projections/Versioning/Handlers/ProjectionVersionsHandler.cs
src/Elders.Cronus/Projections/Versioning/Handlers/ProjectionVersionsHandler.cs
using System.Runtime.Serialization; using Elders.Cronus.Projections.Snapshotting; namespace Elders.Cronus.Projections.Versioning { [DataContract(Name = ContractId)] public class ProjectionVersionsHandler : ProjectionDefinition<ProjectionVersionsHandlerState, ProjectionVersionManagerId>, IAmNotSnapshotable, ISystemProjection, INonVersionableProjection, IEventHandler<ProjectionVersionRequested>, IEventHandler<NewProjectionVersionIsNowLive>, IEventHandler<ProjectionVersionRequestCanceled>, IEventHandler<ProjectionVersionRequestTimedout> { public const string ContractId = "f1469a8e-9fc8-47f5-b057-d5394ed33b4c"; public ProjectionVersionsHandler() { Subscribe<ProjectionVersionRequested>(x => x.Id); Subscribe<NewProjectionVersionIsNowLive>(x => x.Id); Subscribe<ProjectionVersionRequestCanceled>(x => x.Id); Subscribe<ProjectionVersionRequestTimedout>(x => x.Id); } public void Handle(ProjectionVersionRequested @event) { State.Id = @event.Id; State.AllVersions.Add(@event.Version); } public void Handle(NewProjectionVersionIsNowLive @event) { State.Id = @event.Id; State.AllVersions.Add(@event.ProjectionVersion); } public void Handle(ProjectionVersionRequestCanceled @event) { State.Id = @event.Id; State.AllVersions.Add(@event.Version); } public void Handle(ProjectionVersionRequestTimedout @event) { State.Id = @event.Id; State.AllVersions.Add(@event.Version); } } public class ProjectionVersionsHandlerState { public ProjectionVersionsHandlerState() { AllVersions = new ProjectionVersions(); } public ProjectionVersionManagerId Id { get; set; } public ProjectionVersion Live { get { return AllVersions.GetLive(); } } public ProjectionVersions AllVersions { get; set; } } }
using System.Runtime.Serialization; using Elders.Cronus.Projections.Snapshotting; namespace Elders.Cronus.Projections.Versioning { [DataContract(Name = ContractId)] public class ProjectionVersionsHandler : ProjectionDefinition<ProjectionVersionsHandlerState, ProjectionVersionManagerId>, IAmNotSnapshotable, ISystemProjection, INonVersionableProjection, IEventHandler<ProjectionVersionRequested>, IEventHandler<NewProjectionVersionIsNowLive>, IEventHandler<ProjectionVersionRequestCanceled>, IEventHandler<ProjectionVersionRequestTimedout> { public const string ContractId = "ac8e4ba0-b351-4a91-8943-dee9465002a8"; public ProjectionVersionsHandler() { Subscribe<ProjectionVersionRequested>(x => x.Id); Subscribe<NewProjectionVersionIsNowLive>(x => x.Id); Subscribe<ProjectionVersionRequestCanceled>(x => x.Id); Subscribe<ProjectionVersionRequestTimedout>(x => x.Id); } public void Handle(ProjectionVersionRequested @event) { State.Id = @event.Id; State.AllVersions.Add(@event.Version); } public void Handle(NewProjectionVersionIsNowLive @event) { State.Id = @event.Id; State.AllVersions.Add(@event.ProjectionVersion); } public void Handle(ProjectionVersionRequestCanceled @event) { State.Id = @event.Id; State.AllVersions.Add(@event.Version); } public void Handle(ProjectionVersionRequestTimedout @event) { State.Id = @event.Id; State.AllVersions.Add(@event.Version); } } public class ProjectionVersionsHandlerState { public ProjectionVersionsHandlerState() { AllVersions = new ProjectionVersions(); } public ProjectionVersionManagerId Id { get; set; } public ProjectionVersion Live { get { return AllVersions.GetLive(); } } public ProjectionVersions AllVersions { get; set; } } }
apache-2.0
C#
d13e8ae7d9906865b4c0b1a8bbf4d210da74a37e
Update Power.cs
CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos
source/Cosmos.System2/Power.cs
source/Cosmos.System2/Power.cs
using sysIO = System.IO; namespace Cosmos.System { /// <summary> /// Power class. /// </summary> public static class Power { /// <summary> /// Reboot with CPU. /// </summary> public static void Reboot() { HAL.Power.CPUReboot(); } /// <summary> /// Shutdown the ACPI. /// </summary> /// <exception cref="sysIO.IOException">Thrown on IO error.</exception> public static void Shutdown() { HAL.Power.ACPIShutdown(); } } }
using Cosmos.Core; using sysIO = System.IO; namespace Cosmos.System { /// <summary> /// Power class. /// </summary> public static class Power { /// <summary> /// Reboot with CPU. /// </summary> public static void Reboot() { // ACPI reset not done yet // ACPI.Reboot(); Core.Global.CPU.Reboot(); } /// <summary> /// Shutdown the ACPI. /// </summary> /// <exception cref="sysIO.IOException">Thrown on IO error.</exception> public static void Shutdown() { ACPI.Shutdown(); } } }
bsd-3-clause
C#
2d25c70ab5543c688c00f1a495955f7ef5fde6cd
Update MockDesktopSpinLock.cs
panopticoncentral/roslyn,bartdesmet/roslyn,wvdd007/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,gafter/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,panopticoncentral/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,gafter/roslyn,dotnet/roslyn,eriawan/roslyn,diryboy/roslyn,tmat/roslyn,dotnet/roslyn,tannergooding/roslyn,physhi/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,KirillOsenkov/roslyn,wvdd007/roslyn,AmadeusW/roslyn,wvdd007/roslyn,KirillOsenkov/roslyn,weltkante/roslyn,tmat/roslyn,AmadeusW/roslyn,dotnet/roslyn,genlu/roslyn,panopticoncentral/roslyn,physhi/roslyn,sharwell/roslyn,stephentoub/roslyn,mgoertz-msft/roslyn,CyrusNajmabadi/roslyn,aelij/roslyn,genlu/roslyn,tmat/roslyn,genlu/roslyn,brettfo/roslyn,tannergooding/roslyn,brettfo/roslyn,mavasani/roslyn,sharwell/roslyn,ErikSchierboom/roslyn,eriawan/roslyn,bartdesmet/roslyn,AlekseyTs/roslyn,diryboy/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,ErikSchierboom/roslyn,sharwell/roslyn,diryboy/roslyn,aelij/roslyn,mgoertz-msft/roslyn,AlekseyTs/roslyn,jasonmalinowski/roslyn,ErikSchierboom/roslyn,KevinRansom/roslyn,aelij/roslyn,shyamnamboodiripad/roslyn,heejaechang/roslyn,shyamnamboodiripad/roslyn,gafter/roslyn,heejaechang/roslyn,stephentoub/roslyn,brettfo/roslyn,physhi/roslyn,eriawan/roslyn,KevinRansom/roslyn,AmadeusW/roslyn
src/Scripting/CoreTestUtilities/ObjectFormatterFixtures/MockDesktopSpinLock.cs
src/Scripting/CoreTestUtilities/ObjectFormatterFixtures/MockDesktopSpinLock.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Diagnostics; using System.Threading; namespace ObjectFormatterFixtures { /// <summary> /// Follows the shape of the Desktop version of <see cref="SpinLock"/> relevant for debugger display. /// </summary> [DebuggerTypeProxy(typeof(SpinLockDebugView))] [DebuggerDisplay("IsHeld = {IsHeld}")] internal struct MockDesktopSpinLock { #pragma warning disable IDE0044 // Add readonly modifier - See https://github.com/dotnet/roslyn/issues/47225 private volatile int m_owner; #pragma warning restore IDE0044 // Add readonly modifier public MockDesktopSpinLock(bool enableThreadOwnerTracking) { m_owner = enableThreadOwnerTracking ? 0 : int.MinValue; } public bool IsHeld => false; public bool IsHeldByCurrentThread => IsThreadOwnerTrackingEnabled ? true : throw new InvalidOperationException("Error"); public bool IsThreadOwnerTrackingEnabled => (m_owner & int.MinValue) == 0; internal class SpinLockDebugView { private MockDesktopSpinLock m_spinLock; public bool? IsHeldByCurrentThread => m_spinLock.IsHeldByCurrentThread; public int? OwnerThreadID => m_spinLock.IsThreadOwnerTrackingEnabled ? m_spinLock.m_owner : (int?)null; public bool IsHeld => m_spinLock.IsHeld; public SpinLockDebugView(MockDesktopSpinLock spinLock) { m_spinLock = spinLock; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Diagnostics; using System.Threading; namespace ObjectFormatterFixtures { /// <summary> /// Follows the shape of the Desktop version of <see cref="SpinLock"/> relevant for debugger display. /// </summary> [DebuggerTypeProxy(typeof(SpinLockDebugView))] [DebuggerDisplay("IsHeld = {IsHeld}")] internal struct MockDesktopSpinLock { #pragma warning disable IDE0044 ' Add readonly modifier - See https://github.com/dotnet/roslyn/issues/47225 private volatile int m_owner; #pragma warning restore IDE0044 ' Add readonly modifier public MockDesktopSpinLock(bool enableThreadOwnerTracking) { m_owner = enableThreadOwnerTracking ? 0 : int.MinValue; } public bool IsHeld => false; public bool IsHeldByCurrentThread => IsThreadOwnerTrackingEnabled ? true : throw new InvalidOperationException("Error"); public bool IsThreadOwnerTrackingEnabled => (m_owner & int.MinValue) == 0; internal class SpinLockDebugView { private MockDesktopSpinLock m_spinLock; public bool? IsHeldByCurrentThread => m_spinLock.IsHeldByCurrentThread; public int? OwnerThreadID => m_spinLock.IsThreadOwnerTrackingEnabled ? m_spinLock.m_owner : (int?)null; public bool IsHeld => m_spinLock.IsHeld; public SpinLockDebugView(MockDesktopSpinLock spinLock) { m_spinLock = spinLock; } } } }
mit
C#
2996dbc26eed47313cb9d04c299c76cd229ec493
Use readonly
stephentoub/roslyn,tmat/roslyn,tannergooding/roslyn,weltkante/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,wvdd007/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,KevinRansom/roslyn,panopticoncentral/roslyn,shyamnamboodiripad/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,wvdd007/roslyn,physhi/roslyn,eriawan/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,stephentoub/roslyn,AmadeusW/roslyn,tmat/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,physhi/roslyn,mavasani/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,panopticoncentral/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,ErikSchierboom/roslyn,sharwell/roslyn,heejaechang/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,KirillOsenkov/roslyn,diryboy/roslyn,heejaechang/roslyn,bartdesmet/roslyn,tannergooding/roslyn,KevinRansom/roslyn,mavasani/roslyn,gafter/roslyn,physhi/roslyn,tannergooding/roslyn,tmat/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,mgoertz-msft/roslyn,sharwell/roslyn,AlekseyTs/roslyn,gafter/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,mavasani/roslyn,stephentoub/roslyn,eriawan/roslyn,AlekseyTs/roslyn,gafter/roslyn,AlekseyTs/roslyn,bartdesmet/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn
src/Scripting/CoreTestUtilities/ObjectFormatterFixtures/MockDesktopSpinLock.cs
src/Scripting/CoreTestUtilities/ObjectFormatterFixtures/MockDesktopSpinLock.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Diagnostics; using System.Threading; namespace ObjectFormatterFixtures { /// <summary> /// Follows the shape of the Desktop version of <see cref="SpinLock"/> relevant for debugger display. /// </summary> [DebuggerTypeProxy(typeof(SpinLockDebugView))] [DebuggerDisplay("IsHeld = {IsHeld}")] internal struct MockDesktopSpinLock { private readonly int m_owner; public MockDesktopSpinLock(bool enableThreadOwnerTracking) { m_owner = enableThreadOwnerTracking ? 0 : int.MinValue; } public bool IsHeld => false; public bool IsHeldByCurrentThread => IsThreadOwnerTrackingEnabled ? true : throw new InvalidOperationException("Error"); public bool IsThreadOwnerTrackingEnabled => (m_owner & int.MinValue) == 0; internal class SpinLockDebugView { private MockDesktopSpinLock m_spinLock; public bool? IsHeldByCurrentThread => m_spinLock.IsHeldByCurrentThread; public int? OwnerThreadID => m_spinLock.IsThreadOwnerTrackingEnabled ? m_spinLock.m_owner : (int?)null; public bool IsHeld => m_spinLock.IsHeld; public SpinLockDebugView(MockDesktopSpinLock spinLock) { m_spinLock = spinLock; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Diagnostics; using System.Threading; namespace ObjectFormatterFixtures { /// <summary> /// Follows the shape of the Desktop version of <see cref="SpinLock"/> relevant for debugger display. /// </summary> [DebuggerTypeProxy(typeof(SpinLockDebugView))] [DebuggerDisplay("IsHeld = {IsHeld}")] internal struct MockDesktopSpinLock { private volatile int m_owner; public MockDesktopSpinLock(bool enableThreadOwnerTracking) { m_owner = enableThreadOwnerTracking ? 0 : int.MinValue; } public bool IsHeld => false; public bool IsHeldByCurrentThread => IsThreadOwnerTrackingEnabled ? true : throw new InvalidOperationException("Error"); public bool IsThreadOwnerTrackingEnabled => (m_owner & int.MinValue) == 0; internal class SpinLockDebugView { private MockDesktopSpinLock m_spinLock; public bool? IsHeldByCurrentThread => m_spinLock.IsHeldByCurrentThread; public int? OwnerThreadID => m_spinLock.IsThreadOwnerTrackingEnabled ? m_spinLock.m_owner : (int?)null; public bool IsHeld => m_spinLock.IsHeld; public SpinLockDebugView(MockDesktopSpinLock spinLock) { m_spinLock = spinLock; } } } }
mit
C#
736dd845d1846090de8941126022a4340d03435a
Fix copyright notice
Simution/NServiceBus.Recoverability.RetrySuccessNotification
src/RetrySuccessNotification/AssemblyInfo.cs
src/RetrySuccessNotification/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("NServiceBus.Recoverability.RetrySuccessNotification")] [assembly: AssemblyCopyright("Copyright Simution, Inc. All rights reserved")] [assembly: AssemblyProduct("NServiceBus.Recoverability.RetrySucessNotification")] [assembly: ComVisible(false)] [assembly: InternalsVisibleTo("NServiceBus.Recoverability.RetrySucessNotification.ComponentTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("NServiceBus.Recoverability.RetrySuccessNotification")] [assembly: AssemblyCopyright("Copyright Bob Langley. All rights reserved")] [assembly: AssemblyProduct("NServiceBus.Recoverability.RetrySucessNotification")] [assembly: ComVisible(false)] [assembly: InternalsVisibleTo("NServiceBus.Recoverability.RetrySucessNotification.ComponentTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92")]
mit
C#
8ddeee0a829a307454e32b58fc2b5d1850a62703
Fix spelling in error message
amweiss/dark-sky-core
src/Services/JsonNetJsonSerializerService.cs
src/Services/JsonNetJsonSerializerService.cs
namespace DarkSky.Services { using System; using System.Threading.Tasks; using Newtonsoft.Json; /// <summary> /// Interface to use for handling JSON serialization via Json.NET /// </summary> public class JsonNetJsonSerializerService : IJsonSerializerService { JsonSerializerSettings _jsonSettings = new JsonSerializerSettings(); /// <summary> /// The method to use when deserializing a JSON object. /// </summary> /// <param name="json">The JSON string to deserialize.</param> /// <returns>The resulting object from <paramref name="json" />.</returns> public async Task<T> DeserializeJsonAsync<T>(Task<string> json) { try { return (json != null) ? JsonConvert.DeserializeObject<T>(await json.ConfigureAwait(false), _jsonSettings) : default; } catch (JsonReaderException e) { throw new FormatException("Json Parsing Error", e); } } } }
namespace DarkSky.Services { using System; using System.Threading.Tasks; using Newtonsoft.Json; /// <summary> /// Interface to use for handling JSON serialization via Json.NET /// </summary> public class JsonNetJsonSerializerService : IJsonSerializerService { JsonSerializerSettings _jsonSettings = new JsonSerializerSettings(); /// <summary> /// The method to use when deserializing a JSON object. /// </summary> /// <param name="json">The JSON string to deserialize.</param> /// <returns>The resulting object from <paramref name="json" />.</returns> public async Task<T> DeserializeJsonAsync<T>(Task<string> json) { try { return (json != null) ? JsonConvert.DeserializeObject<T>(await json.ConfigureAwait(false), _jsonSettings) : default; } catch (JsonReaderException e) { throw new FormatException("Json Parsing Erorr", e); } } } }
mit
C#
7f4fd03a5f74429039ee6ea5429e121081ce8106
Remove unused IFunction interface
manisero/DSLExecutor
dev/Manisero.DSLExecutor/Domain/FunctionsDomain/IFunction.cs
dev/Manisero.DSLExecutor/Domain/FunctionsDomain/IFunction.cs
namespace Manisero.DSLExecutor.Domain.FunctionsDomain { public interface IFunction<TResult> { } }
namespace Manisero.DSLExecutor.Domain.FunctionsDomain { public interface IFunction { } public interface IFunction<TResult> : IFunction { } }
mit
C#
fbf9b56a41fd0b32a3440f48dbb0722e6a6d75bd
test suite: rename key to name
stephenlautier/.netcore-labs
experimental/Slabs.Experimental.Console/TestSuite.cs
experimental/Slabs.Experimental.Console/TestSuite.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Slabs.Experimental.ConsoleClient { internal class TestSuiteBuilder { private readonly string _name; private List<List<TestEntity>> TestGroups { get; } private List<TestEntity> _currentParallelGroup; public TestSuiteBuilder(string name) { TestGroups = new List<List<TestEntity>>(); _name = name; } public TestSuite Build() { return new TestSuite(_name, TestGroups); } internal TestSuiteBuilder Add<TTest>(string name) where TTest : ITest, new() { var group = new List<TestEntity> { ToTestEntity(name, typeof(TTest)) }; TestGroups.Add(group); _currentParallelGroup = null; return this; } public TestSuiteBuilder AddParallel<TTest>(string name) where TTest : ITest, new() { var testEntity = ToTestEntity(name, typeof(TTest)); if (_currentParallelGroup == null) { var group = new List<TestEntity> { testEntity }; TestGroups.Add(group); _currentParallelGroup = group; } else { _currentParallelGroup.Add(testEntity); } return this; } static TestEntity ToTestEntity(string key, Type type) { return new TestEntity { Name = key, Type = type }; } } internal class TestSuite { public string Name { get; } private readonly List<List<TestEntity>> _tests; public TestSuite(string name, List<List<TestEntity>> tests) { Name = name; _tests = tests; } public async Task Run() { Console.WriteLine($"[TestSuite] Running test suite '{Name}'"); foreach (var testGroup in _tests) { IList<Task> promises = new List<Task>(); foreach (var testEntity in testGroup) { Console.WriteLine($"[TestSuite] Running '{testEntity.Name}'"); var test = (ITest)Activator.CreateInstance(testEntity.Type); var task = test.Execute(); promises.Add(task); } // parallized test groups await Task.WhenAll(promises); } } } internal interface ITest { Task Execute(); } internal class TestEntity { public string Name { get; set; } public Type Type { get; set; } } }
using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Slabs.Experimental.ConsoleClient { internal class TestSuiteBuilder { private readonly string _name; private List<List<TestEntity>> TestGroups { get; } private List<TestEntity> _currentParallelGroup; public TestSuiteBuilder(string name) { TestGroups = new List<List<TestEntity>>(); _name = name; } public TestSuite Build() { return new TestSuite(_name, TestGroups); } internal TestSuiteBuilder Add<TTest>(string key) where TTest : ITest, new() { var group = new List<TestEntity> { ToTestEntity(key, typeof(TTest)) }; TestGroups.Add(group); _currentParallelGroup = null; return this; } public TestSuiteBuilder AddParallel<TTest>(string key) where TTest : ITest, new() { var testEntity = ToTestEntity(key, typeof(TTest)); if (_currentParallelGroup == null) { var group = new List<TestEntity> { testEntity }; TestGroups.Add(group); _currentParallelGroup = group; } else { _currentParallelGroup.Add(testEntity); } return this; } static TestEntity ToTestEntity(string key, Type type) { return new TestEntity { Key = key, Type = type }; } } internal class TestSuite { public string Name { get; } private readonly List<List<TestEntity>> _tests; public TestSuite(string name, List<List<TestEntity>> tests) { Name = name; _tests = tests; } public async Task Run() { Console.WriteLine($"[TestSuite] Running test suite '{Name}'"); foreach (var testGroup in _tests) { IList<Task> promises = new List<Task>(); foreach (var testEntity in testGroup) { Console.WriteLine($"[TestSuite] Running '{testEntity.Key}'"); var test = (ITest)Activator.CreateInstance(testEntity.Type); var task = test.Execute(); promises.Add(task); } // parallized test groups await Task.WhenAll(promises); } } } internal interface ITest { //string Key { get; } Task Execute(); } internal class TestEntity { public string Key { get; set; } public Type Type { get; set; } } }
mit
C#