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
acea76b7b8feb31c00dd86d3222ff9382773d859
Fix SO
zooba/PTVS,int19h/PTVS,zooba/PTVS,zooba/PTVS,int19h/PTVS,huguesv/PTVS,Microsoft/PTVS,Microsoft/PTVS,zooba/PTVS,int19h/PTVS,huguesv/PTVS,int19h/PTVS,huguesv/PTVS,int19h/PTVS,Microsoft/PTVS,zooba/PTVS,Microsoft/PTVS,zooba/PTVS,int19h/PTVS,Microsoft/PTVS,huguesv/PTVS,Microsoft/PTVS,huguesv/PTVS,huguesv/PTVS
Python/Product/Analysis/Infrastructure/EnumerableExtensions.cs
Python/Product/Analysis/Infrastructure/EnumerableExtensions.cs
// Python Tools for Visual Studio // Copyright(c) Microsoft Corporation // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the License); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS // OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY // IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, // MERCHANTABLITY OR NON-INFRINGEMENT. // // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. using System; using System.Collections.Generic; using System.Linq; namespace Microsoft.PythonTools.Analysis.Infrastructure { static class EnumerableExtensions { public static bool IsNullOrEmpty<T>(this IEnumerable<T> source) => source == null || !source.Any(); public static T[] MaybeEnumerate<T>(this T[] source) { return source ?? Array.Empty<T>(); } public static IEnumerable<T> MaybeEnumerate<T>(this IEnumerable<T> source) { return source ?? Enumerable.Empty<T>(); } private static T Identity<T>(T source) { return source; } public static IEnumerable<T> SelectMany<T>(this IEnumerable<IEnumerable<T>> source) { return source.SelectMany(Identity); } public static IEnumerable<T> Ordered<T>(this IEnumerable<T> source) { return source.OrderBy(Identity); } private static bool NotNull<T>(T obj) where T : class => obj != null; public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> source) where T : class { return source.Where(NotNull); } public static bool SetEquals<T>(this IEnumerable<T> source, IEnumerable<T> other, IEqualityComparer<T> comparer = null) where T : class { var set1 = new HashSet<T>(source, comparer); var set2 = new HashSet<T>(other, comparer); return set1.SetEquals(set2); } } }
// Python Tools for Visual Studio // Copyright(c) Microsoft Corporation // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the License); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS // OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY // IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, // MERCHANTABLITY OR NON-INFRINGEMENT. // // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. using System; using System.Collections.Generic; using System.Linq; namespace Microsoft.PythonTools.Analysis.Infrastructure { static class EnumerableExtensions { public static bool IsNullOrEmpty<T>(this IEnumerable<T> source) => source == null || !source.Any(); public static T[] MaybeEnumerate<T>(this T[] source) { return source ?? Array.Empty<T>(); } public static IEnumerable<T> MaybeEnumerate<T>(this IEnumerable<T> source) { return source ?? Enumerable.Empty<T>(); } private static T Identity<T>(T source) { return source; } public static IEnumerable<T> SelectMany<T>(this IEnumerable<IEnumerable<T>> source) { return source.SelectMany(Identity); } public static IEnumerable<T> Ordered<T>(this IEnumerable<T> source) { return source.OrderBy(Identity); } private static bool NotNull<T>(T obj) where T : class => obj != null; public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> source) where T : class { return source.Where(NotNull); } public static bool SetEquals<T>(this IEnumerable<T> source, IEnumerable<T> other, IComparer<T> comparer = null) where T : class { var set1 = new HashSet<T>(source); var set2 = new HashSet<T>(other); return set1.SetEquals(set2, comparer); } } }
apache-2.0
C#
03e6330e88e955f9cd938ff2b619a023dffe0439
Add comment that design time data does not work with {x:Bind}
jbe2277/waf
src/NewsReader/NewsReader.Presentation/DesignData/SampleFeedItemListViewModel.cs
src/NewsReader/NewsReader.Presentation/DesignData/SampleFeedItemListViewModel.cs
using Jbe.NewsReader.Applications.ViewModels; using Jbe.NewsReader.Applications.Views; namespace Jbe.NewsReader.Presentation.DesignData { public class SampleFeedItemListViewModel : FeedItemListViewModel { public SampleFeedItemListViewModel() : base(new MockFeedItemListView(), null) { // Note: Design time data does not work with {x:Bind} } private class MockFeedItemListView : IFeedItemListView { public object DataContext { get; set; } } } }
using Jbe.NewsReader.Applications.ViewModels; using Jbe.NewsReader.Applications.Views; namespace Jbe.NewsReader.Presentation.DesignData { public class SampleFeedItemListViewModel : FeedItemListViewModel { public SampleFeedItemListViewModel() : base(new MockFeedItemListView(), null) { } private class MockFeedItemListView : IFeedItemListView { public object DataContext { get; set; } } } }
mit
C#
082b07614c6ac224eac53e4e15c8f75f53f0a95c
use Task.Delay for timeout
tim-hoff/Xamarin.Plugins,labdogg1003/Xamarin.Plugins,LostBalloon1/Xamarin.Plugins,JC-Chris/Xamarin.Plugins,monostefan/Xamarin.Plugins,predictive-technology-laboratory/Xamarin.Plugins,jamesmontemagno/Xamarin.Plugins
Geolocator/Geolocator/Geolocator.Plugin.WindowsPhone81/Timeout.cs
Geolocator/Geolocator/Geolocator.Plugin.WindowsPhone81/Timeout.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; using System.Threading.Tasks; namespace Geolocator.Plugin { internal class Timeout { public Timeout(int timeout, Action timesup) { if (timeout == Infite) return; // nothing to do if (timeout < 0) throw new ArgumentOutOfRangeException("timeout"); if (timesup == null) throw new ArgumentNullException("timesup"); this.canceller = new CancellationTokenSource(); Task.Delay(TimeSpan.FromSeconds(timeout), this.canceller.Token) .ContinueWith(t => { if (!t.IsCanceled) timesup(); }); } public void Cancel() { this.canceller.Cancel(); } private volatile readonly CancellationTokenSource canceller; public const int Infite = -1; } }
// // 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; namespace Geolocator.Plugin { internal class Timeout { public Timeout(int timeout, Action timesup) { if (timeout == Infite) return; // nothing to do if (timeout < 0) throw new ArgumentOutOfRangeException("timeout"); if (timesup == null) throw new ArgumentNullException("timesup"); this.timeout = TimeSpan.FromMilliseconds(timeout); this.timesup = timesup; Task.Factory.StartNew(Runner, TaskCreationOptions.LongRunning); } public void Cancel() { this.canceled = true; } private readonly TimeSpan timeout; private readonly Action timesup; private volatile bool canceled; private void Runner() { DateTime start = DateTime.Now; while (!this.canceled) { if (DateTime.Now - start < this.timeout) { Task.Delay(1).Wait(); continue; } this.timesup(); return; } } public const int Infite = -1; } }
mit
C#
6efa18aa9ed26b01362a4346ae81c060830857c3
fix StringReader returning -1 instead of 0 on end-of-stream
dot42/api
System/IO/StringReader.cs
System/IO/StringReader.cs
// Copyright (C) 2014 dot42 // // Original filename: StringReader.cs // // 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. namespace System.IO { public class StringReader : TextReader { private Java.Io.StringReader _reader; /// <summary> /// Default constructor /// </summary> public StringReader(string s) { _reader= new Java.Io.StringReader(s); } public override int Peek() { _reader.Mark(1); int ret = _reader.Read(); _reader.Reset(); return ret; } public override int Read() { return _reader.Read(); } public override int Read(char[] buffer, int index, int count) { var read = _reader.Read(buffer, index, count); return read == -1 ? 0 : read; } } }
// Copyright (C) 2014 dot42 // // Original filename: StringReader.cs // // 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. namespace System.IO { public class StringReader : TextReader { private Java.Io.StringReader _reader; /// <summary> /// Default constructor /// </summary> public StringReader(string s) { _reader= new Java.Io.StringReader(s); } public override int Peek() { _reader.Mark(1); int ret = _reader.Read(); _reader.Reset(); return ret; } public override int Read() { return _reader.Read(); } public override int Read(char[] buffer, int index, int count) { return _reader.Read(buffer, index, count); } } }
apache-2.0
C#
a4af9232893879de24b9f5310f5cea0861efd164
add pathway to fix test build issue
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerApprenticeshipsService.Domain/Models/Payments/PaymentTransactionLine.cs
src/SFA.DAS.EmployerApprenticeshipsService.Domain/Models/Payments/PaymentTransactionLine.cs
using System; using System.Collections.Generic; using System.Linq; using SFA.DAS.EAS.Domain.Models.Transaction; namespace SFA.DAS.EAS.Domain.Models.Payments { public class PaymentTransactionLine : TransactionLine { public Guid? PaymentId { get; set; } public long UkPrn { get; set; } public string PeriodEnd { get; set; } public string ProviderName { get; set; } public decimal LineAmount { get; set; } public string CourseName { get; set; } public int? CourseLevel { get; set; } public string PathwayName { get; set; } public DateTime? CourseStartDate { get; set; } public string ApprenticeName { get; set; } public string ApprenticeNINumber { get; set; } public decimal SfaCoInvestmentAmount { get; set; } public decimal EmployerCoInvestmentAmount { get; set; } public bool IsCoInvested => SfaCoInvestmentAmount != 0 || EmployerCoInvestmentAmount != 0; public ICollection<PaymentTransactionLine> SubPayments => SubTransactions?.OfType<PaymentTransactionLine>().ToList() ?? new List<PaymentTransactionLine>(); } }
using System; using System.Collections.Generic; using System.Linq; using SFA.DAS.EAS.Domain.Models.Transaction; namespace SFA.DAS.EAS.Domain.Models.Payments { public class PaymentTransactionLine : TransactionLine { public Guid? PaymentId { get; set; } public long UkPrn { get; set; } public string PeriodEnd { get; set; } public string ProviderName { get; set; } public decimal LineAmount { get; set; } public string CourseName { get; set; } public int? CourseLevel { get; set; } public DateTime? CourseStartDate { get; set; } public string ApprenticeName { get; set; } public string ApprenticeNINumber { get; set; } public decimal SfaCoInvestmentAmount { get; set; } public decimal EmployerCoInvestmentAmount { get; set; } public bool IsCoInvested => SfaCoInvestmentAmount != 0 || EmployerCoInvestmentAmount != 0; public ICollection<PaymentTransactionLine> SubPayments => SubTransactions?.OfType<PaymentTransactionLine>().ToList() ?? new List<PaymentTransactionLine>(); } }
mit
C#
9759ad83911da143912adbacec1c3936facaf520
Add async Main snippet
lerthe61/Snippets,lerthe61/Snippets
dotNet/Tasks/AsyncMain.cs
dotNet/Tasks/AsyncMain.cs
class Program { static void Main(string[] args) { Task.Run(async () => { // Do any async anything you need here without worry }).GetAwaiter().GetResult(); } } // OR private static int Main(string[] args) { var cts = new CancellationTokenSource(); Console.CancelKeyPress += (s, e) => { e.Cancel = !cts.IsCancellationRequested; cts.Cancel(); }; try { return MainAsync(args, cts.Token).GetAwaiter().GetResult(); } catch (OperationCanceledException) { return 1223; // Cancelled. } } private static async Task<int> MainAsync(string[] args, CancellationToken cancellationToken) { // Your code... return await Task.FromResult(0); // Success. }
class Program { static void Main(string[] args) { Task.Run(async () => { // Do any async anything you need here without worry }).GetAwaiter().GetResult(); } }
unlicense
C#
0f8cc9d9968baa029716bfed5ef39ccd3ad85482
test commit for merge understanding
lukevp/CSharpBoy,lukevp/CSharpBoy
CSharpBoy/GPU.cs
CSharpBoy/GPU.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CSharpBoy { class GPU {/* TODO: IMPLEMENT THE GPU HERE....... This is totally new block of comments */ byte[] RAM = new byte[0x2000]; int[][] screen = new int [144][]; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CSharpBoy { class GPU { /* GB GPU * VRAM: 8K */ byte[] RAM = new byte[0x2000]; int[][] screen = new int [144][]; } }
mit
C#
68a81e0eb0f813fc3710ea09aa273d75ac2b8671
Fix follow point transforms not working after rewind
smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,johnneijzen/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,smoogipooo/osu,UselessToucan/osu,peppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,EVAST9919/osu,johnneijzen/osu,UselessToucan/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,2yangk23/osu,EVAST9919/osu,ppy/osu,peppy/osu
osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs
osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osuTK; using osuTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { public class FollowPoint : Container { private const float width = 8; public override bool RemoveWhenNotAlive => false; public override bool RemoveCompletedTransforms => false; public FollowPoint() { Origin = Anchor.Centre; Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.FollowPoint), _ => new Container { Masking = true, AutoSizeAxes = Axes.Both, CornerRadius = width / 2, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, Colour = Color4.White.Opacity(0.2f), Radius = 4, }, Child = new Box { Size = new Vector2(width), Blending = BlendingParameters.Additive, Origin = Anchor.Centre, Anchor = Anchor.Centre, Alpha = 0.5f, } }, confineMode: ConfineMode.NoScaling); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osuTK; using osuTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { public class FollowPoint : Container { private const float width = 8; public override bool RemoveWhenNotAlive => false; public FollowPoint() { Origin = Anchor.Centre; Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.FollowPoint), _ => new Container { Masking = true, AutoSizeAxes = Axes.Both, CornerRadius = width / 2, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, Colour = Color4.White.Opacity(0.2f), Radius = 4, }, Child = new Box { Size = new Vector2(width), Blending = BlendingParameters.Additive, Origin = Anchor.Centre, Anchor = Anchor.Centre, Alpha = 0.5f, } }, confineMode: ConfineMode.NoScaling); } } }
mit
C#
920bc1f3f8cf8066abbb2fdab1efe8520a162d9a
Add FileSystemProvider xUnit test for issue 120
JamesWTruher/PowerShell-1,TravisEz13/PowerShell,kmosher/PowerShell,kmosher/PowerShell,PaulHigin/PowerShell,PaulHigin/PowerShell,bingbing8/PowerShell,KarolKaczmarek/PowerShell,KarolKaczmarek/PowerShell,daxian-dbw/PowerShell,bingbing8/PowerShell,bmanikm/PowerShell,KarolKaczmarek/PowerShell,jsoref/PowerShell,TravisEz13/PowerShell,daxian-dbw/PowerShell,KarolKaczmarek/PowerShell,bmanikm/PowerShell,kmosher/PowerShell,jsoref/PowerShell,JamesWTruher/PowerShell-1,JamesWTruher/PowerShell-1,bingbing8/PowerShell,bmanikm/PowerShell,jsoref/PowerShell,bingbing8/PowerShell,TravisEz13/PowerShell,daxian-dbw/PowerShell,jsoref/PowerShell,PaulHigin/PowerShell,jsoref/PowerShell,bmanikm/PowerShell,bmanikm/PowerShell,kmosher/PowerShell,TravisEz13/PowerShell,bingbing8/PowerShell,JamesWTruher/PowerShell-1,KarolKaczmarek/PowerShell,daxian-dbw/PowerShell,kmosher/PowerShell,PaulHigin/PowerShell
test/csharp/test_FileSystemProvider.cs
test/csharp/test_FileSystemProvider.cs
using Xunit; using System; using System.Collections.ObjectModel; using System.IO; using System.Management.Automation; using System.Management.Automation.Provider; using Microsoft.PowerShell.Commands; namespace PSTests { [Collection("AssemblyLoadContext")] public static class FileSystemProviderTests { [Fact] public static void TestCreateJunctionFails() { Assert.False(InternalSymbolicLinkLinkCodeMethods.CreateJunction("","")); } [Fact] public static void TestGetHelpMaml() { FileSystemProvider fileSystemProvider = new FileSystemProvider(); Assert.Equal(fileSystemProvider.GetHelpMaml(String.Empty,String.Empty),String.Empty); Assert.Equal(fileSystemProvider.GetHelpMaml("helpItemName",String.Empty),String.Empty); Assert.Equal(fileSystemProvider.GetHelpMaml(String.Empty,"path"),String.Empty); } [Fact] public static void TestMode() { Assert.Equal(FileSystemProvider.Mode(null),String.Empty); FileSystemInfo fileSystemObject = new DirectoryInfo(@"/"); Assert.NotEqual(FileSystemProvider.Mode(PSObject.AsPSObject(fileSystemObject)),String.Empty); } [Fact] public static void TestGetProperty() { FileSystemProvider fileSystemProvider = new FileSystemProvider(); fileSystemProvider.GetProperty(@"/", new Collection<string>(){"Attributes"}); } [Fact] public static void TestSetProperty() { //FileSystemProvider fileSystemProvider = new FileSystemProvider(); //fileSystemProvider.SetProperty(@"/root", PSObject.AsPSObject(propertyToSet)); } [Fact] public static void TestClearProperty() { // FileSystemProvider fileSystemProvider = new FileSystemProvider(); // fileSystemProvider.ClearProperty(@"/test", new Collection<string>(){"Attributes"}); } [Fact] public static void TestGetContentReader() { // FileSystemProvider fileSystemProvider = new FileSystemProvider(); // IContentReader contentReader = fileSystemProvider.GetContentReader(@"/test"); // Assert.NotNull(contentReader); } [Fact] public static void TestGetContentWriter() { // FileSystemProvider fileSystemProvider = new FileSystemProvider(); // IContentWriter contentWriter = fileSystemProvider.GetContentWriter(@"/test"); // Assert.NotNull(contentWriter); } [Fact] public static void TestClearContent() { //FileSystemProvider fileSystemProvider = new FileSystemProvider(); //fileSystemProvider.ClearContent(@"/test"); } } }
using Xunit; using System; using System.Management.Automation; using Microsoft.PowerShell.Commands; namespace PSTests { [Collection("AssemblyLoadContext")] public static class FileSystemProviderTests { [Fact] public static void TestCreateJunctionFails() { Assert.False(InternalSymbolicLinkLinkCodeMethods.CreateJunction("","")); } } }
mit
C#
1963060edc26ca2d32d531c75257d4b197b325ad
Update annotations for types implementing IDiscardSymbol
shyamnamboodiripad/roslyn,agocke/roslyn,eriawan/roslyn,diryboy/roslyn,heejaechang/roslyn,weltkante/roslyn,panopticoncentral/roslyn,abock/roslyn,genlu/roslyn,brettfo/roslyn,davkean/roslyn,KevinRansom/roslyn,davkean/roslyn,sharwell/roslyn,aelij/roslyn,stephentoub/roslyn,tmat/roslyn,AlekseyTs/roslyn,ErikSchierboom/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,agocke/roslyn,eriawan/roslyn,dotnet/roslyn,stephentoub/roslyn,stephentoub/roslyn,sharwell/roslyn,sharwell/roslyn,reaction1989/roslyn,weltkante/roslyn,reaction1989/roslyn,brettfo/roslyn,tannergooding/roslyn,physhi/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,gafter/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,bartdesmet/roslyn,mgoertz-msft/roslyn,eriawan/roslyn,KirillOsenkov/roslyn,AlekseyTs/roslyn,weltkante/roslyn,panopticoncentral/roslyn,physhi/roslyn,genlu/roslyn,KevinRansom/roslyn,dotnet/roslyn,gafter/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,abock/roslyn,mavasani/roslyn,panopticoncentral/roslyn,tmat/roslyn,tmat/roslyn,AmadeusW/roslyn,mavasani/roslyn,bartdesmet/roslyn,mavasani/roslyn,wvdd007/roslyn,heejaechang/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,aelij/roslyn,dotnet/roslyn,genlu/roslyn,jmarolf/roslyn,physhi/roslyn,abock/roslyn,wvdd007/roslyn,gafter/roslyn,AmadeusW/roslyn,agocke/roslyn,shyamnamboodiripad/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,aelij/roslyn,heejaechang/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,AmadeusW/roslyn,mgoertz-msft/roslyn,tannergooding/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,wvdd007/roslyn,brettfo/roslyn,reaction1989/roslyn,davkean/roslyn,diryboy/roslyn,jmarolf/roslyn,mgoertz-msft/roslyn
src/Compilers/CSharp/Portable/Symbols/PublicModel/DiscardSymbol.cs
src/Compilers/CSharp/Portable/Symbols/PublicModel/DiscardSymbol.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. #nullable enable using System.Diagnostics.CodeAnalysis; using System.Threading; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel { internal sealed class DiscardSymbol : Symbol, IDiscardSymbol { private readonly Symbols.DiscardSymbol _underlying; private ITypeSymbol? _lazyType; public DiscardSymbol(Symbols.DiscardSymbol underlying) { RoslynDebug.Assert(underlying != null); _underlying = underlying; } internal override CSharp.Symbol UnderlyingSymbol => _underlying; ITypeSymbol IDiscardSymbol.Type { get { if (_lazyType is null) { Interlocked.CompareExchange(ref _lazyType, _underlying.TypeWithAnnotations.GetPublicSymbol(), null); } return _lazyType; } } CodeAnalysis.NullableAnnotation IDiscardSymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation(); protected override void Accept(SymbolVisitor visitor) => visitor.VisitDiscard(this); [return: MaybeNull] protected override TResult Accept<TResult>(SymbolVisitor<TResult> visitor) => visitor.VisitDiscard(this); } }
// 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.Diagnostics; using System.Threading; namespace Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel { internal sealed class DiscardSymbol : Symbol, IDiscardSymbol { private readonly Symbols.DiscardSymbol _underlying; private ITypeSymbol _lazyType; public DiscardSymbol(Symbols.DiscardSymbol underlying) { Debug.Assert(underlying != null); _underlying = underlying; } internal override CSharp.Symbol UnderlyingSymbol => _underlying; ITypeSymbol IDiscardSymbol.Type { get { if (_lazyType is null) { Interlocked.CompareExchange(ref _lazyType, _underlying.TypeWithAnnotations.GetPublicSymbol(), null); } return _lazyType; } } CodeAnalysis.NullableAnnotation IDiscardSymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation(); protected override void Accept(SymbolVisitor visitor) => visitor.VisitDiscard(this); protected override TResult Accept<TResult>(SymbolVisitor<TResult> visitor) => visitor.VisitDiscard(this); } }
mit
C#
07210adb0ac1f873912b250029665dcec55b9d01
Fix looking up referenced mechanics
HearthSim/HearthDb
HearthDb/Card.cs
HearthDb/Card.cs
#region using System; using System.Linq; using HearthDb.CardDefs; using HearthDb.Enums; using static HearthDb.Enums.GameTag; #endregion namespace HearthDb { public class Card { internal Card(Entity entity) { Entity = entity; } public Entity Entity { get; } public string Id => Entity.CardId; public int DbfId => Entity.DbfId; public string Name => GetLocName(DefaultLanguage); public string Text => GetLocText(DefaultLanguage); public string FlavorText => GetLocFlavorText(DefaultLanguage); public CardClass Class => (CardClass)Entity.GetTag(CLASS); public Rarity Rarity => (Rarity)Entity.GetTag(RARITY); public CardType Type => (CardType)Entity.GetTag(CARDTYPE); public Race Race => (Race)Entity.GetTag(CARDRACE); public CardSet Set => (CardSet)Entity.GetTag(CARD_SET); public Faction Faction => (Faction)Entity.GetTag(FACTION); public int Cost => Entity.GetTag(COST); public int Attack => Entity.GetTag(ATK); public int Health => Entity.GetTag(HEALTH); public int Durability => Entity.GetTag(DURABILITY); public int Armor => Entity.GetTag(ARMOR); public string[] Mechanics { get { var mechanics = Dictionaries.Mechanics.Keys.Where(mechanic => Entity.GetTag(mechanic) > 0).Select(x => Dictionaries.Mechanics[x]); var refMechanics = Dictionaries.ReferencedMechanics.Keys.Where(mechanic => Entity.GetReferencedTag(mechanic) > 0) .Select(x => Dictionaries.ReferencedMechanics[x]); return mechanics.Concat(refMechanics).ToArray(); } } public string ArtistName => Entity.GetInnerValue(ARTISTNAME); public string[] EntourageCardIds => Entity.EntourageCards.Select(x => x.CardId).ToArray(); public Locale DefaultLanguage { get; set; } = Locale.enUS; public bool Collectible => Convert.ToBoolean(Entity.GetTag(COLLECTIBLE)); public string GetLocName(Locale lang) => Entity.GetLocString(CARDNAME, lang); public string GetLocText(Locale lang) { var text = Entity.GetLocString(CARDTEXT_INHAND, lang)?.Replace("_", "\u00A0").Trim(); if(text == null) return null; var index = text.IndexOf('@'); return index > 0 ? text.Substring(index + 1) : text; } public string GetLocFlavorText(Locale lang) => Entity.GetLocString(FLAVORTEXT, lang); } }
#region using System; using System.Linq; using HearthDb.CardDefs; using HearthDb.Enums; using static HearthDb.Enums.GameTag; #endregion namespace HearthDb { public class Card { internal Card(Entity entity) { Entity = entity; } public Entity Entity { get; } public string Id => Entity.CardId; public int DbfId => Entity.DbfId; public string Name => GetLocName(DefaultLanguage); public string Text => GetLocText(DefaultLanguage); public string FlavorText => GetLocFlavorText(DefaultLanguage); public CardClass Class => (CardClass)Entity.GetTag(CLASS); public Rarity Rarity => (Rarity)Entity.GetTag(RARITY); public CardType Type => (CardType)Entity.GetTag(CARDTYPE); public Race Race => (Race)Entity.GetTag(CARDRACE); public CardSet Set => (CardSet)Entity.GetTag(CARD_SET); public Faction Faction => (Faction)Entity.GetTag(FACTION); public int Cost => Entity.GetTag(COST); public int Attack => Entity.GetTag(ATK); public int Health => Entity.GetTag(HEALTH); public int Durability => Entity.GetTag(DURABILITY); public int Armor => Entity.GetTag(ARMOR); public string[] Mechanics { get { var mechanics = Dictionaries.Mechanics.Keys.Where(mechanic => Entity.GetTag(mechanic) > 0).Select(x => Dictionaries.Mechanics[x]); var refMechanics = Dictionaries.ReferencedMechanics.Keys.Where(mechanic => Entity.GetTag(mechanic) > 0) .Select(x => Dictionaries.ReferencedMechanics[x]); return mechanics.Concat(refMechanics).ToArray(); } } public string ArtistName => Entity.GetInnerValue(ARTISTNAME); public string[] EntourageCardIds => Entity.EntourageCards.Select(x => x.CardId).ToArray(); public Locale DefaultLanguage { get; set; } = Locale.enUS; public bool Collectible => Convert.ToBoolean(Entity.GetTag(COLLECTIBLE)); public string GetLocName(Locale lang) => Entity.GetLocString(CARDNAME, lang); public string GetLocText(Locale lang) { var text = Entity.GetLocString(CARDTEXT_INHAND, lang)?.Replace("_", "\u00A0").Trim(); if(text == null) return null; var index = text.IndexOf('@'); return index > 0 ? text.Substring(index + 1) : text; } public string GetLocFlavorText(Locale lang) => Entity.GetLocString(FLAVORTEXT, lang); } }
mit
C#
abc278c0a59380970a3bd3c11347eaa81335722e
Fix spinner
cra0zy/xwt,mono/xwt,hwthomas/xwt,hamekoz/xwt,mminns/xwt,steffenWi/xwt,residuum/xwt,sevoku/xwt,TheBrainTech/xwt,mminns/xwt,directhex/xwt,lytico/xwt,antmicro/xwt,iainx/xwt,akrisiun/xwt
Xwt.Gtk/Xwt.GtkBackend/SpinnerBackend.cs
Xwt.Gtk/Xwt.GtkBackend/SpinnerBackend.cs
// // SpinnerBackend.cs // // Author: // Jérémie Laval <jeremie.laval@xamarin.com> // // Copyright (c) 2012 Xamarin, Inc. using System; using System.Runtime.InteropServices; using Xwt.Backends; namespace Xwt.GtkBackend { public class SpinnerBackend : WidgetBackend, ISpinnerBackend { public SpinnerBackend () { Widget = new Spinner (); Widget.Show (); } protected new Spinner Widget { get { return (Spinner)base.Widget; } set { base.Widget = value; } } public void StartAnimation () { Widget.Start (); } public void StopAnimation () { Widget.Stop (); } public bool IsAnimating { get { return Widget.Active; } } } public class Spinner : Gtk.Widget { [Obsolete] protected Spinner(GLib.GType gtype) : base(gtype) {} [DllImport ("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gtk_spinner_new(); public Spinner () : base(IntPtr.Zero) { if (GetType () != typeof(Spinner)) { this.CreateNativeObject (new string[0], new GLib.Value[0]); return; } this.Raw = Spinner.gtk_spinner_new (); } [GLib.Property ("active")] public bool Active { get { GLib.Value val = GetProperty ("active"); bool ret = (bool) val; val.Dispose (); return ret; } set { GLib.Value val = new GLib.Value(value); SetProperty("active", val); val.Dispose (); } } [DllImport ("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gtk_spinner_start(IntPtr raw); public void Start() { gtk_spinner_start(Handle); } [DllImport ("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gtk_spinner_stop(IntPtr raw); public void Stop () { gtk_spinner_stop(Handle); } [DllImport("libgtk-win32-2.0-0.dll")] static extern IntPtr gtk_spinner_get_type(); public static new GLib.GType GType { get { IntPtr raw_ret = gtk_spinner_get_type(); GLib.GType ret = new GLib.GType(raw_ret); return ret; } } } }
// // SpinnerBackend.cs // // Author: // Jérémie Laval <jeremie.laval@xamarin.com> // // Copyright (c) 2012 Xamarin, Inc. using System; using System.Runtime.InteropServices; using Xwt.Backends; namespace Xwt.GtkBackend { public class SpinnerBackend : WidgetBackend, ISpinnerBackend { public SpinnerBackend () { Widget = new Spinner (); Widget.Show (); } protected new Spinner Widget { get { return (Spinner)base.Widget; } set { base.Widget = value; } } public void StartAnimation () { Widget.Start (); } public void StopAnimation () { Widget.Stop (); } public bool IsAnimating { get { return Widget.Active; } } } public class Spinner : Gtk.DrawingArea { [Obsolete] protected Spinner(GLib.GType gtype) : base(gtype) {} [DllImport ("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gtk_spinner_new(); public Spinner () : base(IntPtr.Zero) { if (base.GetType () != typeof(Spinner)) { this.CreateNativeObject (new string[0], new GLib.Value[0]); return; } this.Raw = Spinner.gtk_spinner_new (); } [GLib.Property ("active")] public bool Active { get { GLib.Value val = GetProperty ("active"); bool ret = (bool) val; val.Dispose (); return ret; } set { GLib.Value val = new GLib.Value(value); SetProperty("active", val); val.Dispose (); } } [DllImport ("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gtk_spinner_start(IntPtr raw); public void Start() { gtk_spinner_start(Handle); } [DllImport ("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gtk_spinner_stop(IntPtr raw); public void Stop () { gtk_spinner_stop(Handle); } } }
mit
C#
29903cd6265968b24f687766bed9ed033b7bc27a
Update AssemblyInfo.cs
justinyoo/EntityFramework.Testing,scott-xu/EntityFramework.Testing,justinyoo/EntityFramework.Testing
src/EntityFramework.Testing.Moq.Ninject/Properties/AssemblyInfo.cs
src/EntityFramework.Testing.Moq.Ninject/Properties/AssemblyInfo.cs
//----------------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="Scott Xu"> // Copyright (c) 2014 Scott Xu. // </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("EntityFramework.Testing.Moq.Ninject")] [assembly: AssemblyDescription("Testing helpers for using Ninject.MockingKernel.Moq with EntityFramework.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Scott Xu")] [assembly: AssemblyProduct("EntityFramework.Testing.Moq.Ninject")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(true)] // 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("2667643d-7830-421c-b495-7545da9f42c7")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
//----------------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="Scott Xu"> // Copyright (c) 2014 Scott Xu. // </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("EntityFramework.Testing.Moq.Ninject")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EntityFramework.Testing.Moq.Ninject")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(true)] // 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("2667643d-7830-421c-b495-7545da9f42c7")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
0b1bdce92cd1fd24365dfdb32f9a03d4ee7ccddd
Fix part of serialization issue with 0x07 block list packet
HelloKitty/Booma.Proxy
src/Booma.Proxy.Packets.ShipServer/Payloads/Server/ShipBlockListEventPayload.cs
src/Booma.Proxy.Packets.ShipServer/Payloads/Server/ShipBlockListEventPayload.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma.Proxy { //TODO: Sometimes A0 is used and sometimes 07 is used. We should create a DTO for both. /// <summary> /// Contains the block list for menu rendering. /// </summary> [WireDataContract] [GameServerPacketPayload(GameNetworkOperationCode.BLOCK_LIST_TYPE)] public sealed class ShipBlockListEventPayload : PSOBBGamePacketPayloadServer, ISerializationEventListener { //Disable flags serialization so that the ship can get the 4 byte length and //handle writing the 4 bytes length /// <inheritdoc /> public override bool isFlagsSerialized { get; } = false; //They include ShipSelect and Ship name in this listing //PSOBB sends 4 byte Flags with the entry count. We disable Flags though to steal the 4 bytes [SendSize(SendSizeAttribute.SizeType.Int32, 1)] //for some reason they send 1 less than the actual size [WireMember(1)] private MenuListing[] _Blocks { get; set; } //settable for removing the garbage entry /// <summary> /// The ship menu models. /// </summary> public IEnumerable<MenuListing> Blocks => _Blocks; //TODO: Failing test cases for mismatch size. The reason it is happening is public Teth sends 8 extra padding bytes that it doesn't need. //Serializer ctor private ShipBlockListEventPayload() { } /// <inheritdoc /> public void OnBeforeSerialization() { } /// <inheritdoc /> public void OnAfterDeserialization() { //Remove the first entry, it's garbage //_Blocks = _Blocks.Skip(1).ToArray(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma.Proxy { //TODO: Sometimes A0 is used and sometimes 07 is used. We should create a DTO for both. /// <summary> /// Contains the block list for menu rendering. /// </summary> [WireDataContract] [GameServerPacketPayload(GameNetworkOperationCode.BLOCK_LIST_TYPE)] public sealed class ShipBlockListEventPayload : PSOBBGamePacketPayloadServer, ISerializationEventListener { //Disable flags serialization so that the ship can get the 4 byte length and //handle writing the 4 bytes length /// <inheritdoc /> public override bool isFlagsSerialized { get; } = false; //PSOBB sends 4 byte Flags with the entry count. We disable Flags though to steal the 4 bytes [SendSize(SendSizeAttribute.SizeType.Int32, 1)] //for some reason they send 1 less than the actual size [WireMember(1)] private MenuListing[] _Blocks { get; set; } //settable for removing the garbage entry /// <summary> /// The ship menu models. /// </summary> public IEnumerable<MenuListing> Blocks => _Blocks; //Serializer ctor private ShipBlockListEventPayload() { } /// <inheritdoc /> public void OnBeforeSerialization() { //TODO: Deal with the bullshit the server adds for some reason } /// <inheritdoc /> public void OnAfterDeserialization() { //Remove the first entry, it's garbage _Blocks = _Blocks.Skip(1).ToArray(); } } }
agpl-3.0
C#
b57ed808ceb0b3637865a70ae01402ecf296baef
Rename method to get semaphore
justinjstark/Verdeler,justinjstark/Delivered
Verdeler/ConcurrencyLimiter.cs
Verdeler/ConcurrencyLimiter.cs
using System; using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; namespace Verdeler { internal class ConcurrencyLimiter<TSubject> { private readonly Func<TSubject, object> _subjectReductionMap; private readonly int _concurrencyLimit; private readonly ConcurrentDictionary<object, SemaphoreSlim> _semaphores = new ConcurrentDictionary<object, SemaphoreSlim>(); public ConcurrencyLimiter(Func<TSubject, object> subjectReductionMap, int concurrencyLimit) { if (concurrencyLimit <= 0) { throw new ArgumentException(@"Concurrency limit must be greater than 0.", nameof(concurrencyLimit)); } _subjectReductionMap = subjectReductionMap; _concurrencyLimit = concurrencyLimit; } public async Task WaitFor(TSubject subject) { var semaphore = GetSemaphoreForReducedSubject(subject); await semaphore.WaitAsync(); } public void Release(TSubject subject) { var semaphore = GetSemaphoreForReducedSubject(subject); semaphore.Release(); } private SemaphoreSlim GetSemaphoreForReducedSubject(TSubject subject) { var reducedSubject = _subjectReductionMap.Invoke(subject); var semaphore = _semaphores.GetOrAdd(reducedSubject, new SemaphoreSlim(_concurrencyLimit)); return semaphore; } } }
using System; using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; namespace Verdeler { internal class ConcurrencyLimiter<TSubject> { private readonly Func<TSubject, object> _subjectReductionMap; private readonly int _concurrencyLimit; private readonly ConcurrentDictionary<object, SemaphoreSlim> _semaphores = new ConcurrentDictionary<object, SemaphoreSlim>(); public ConcurrencyLimiter(Func<TSubject, object> subjectReductionMap, int concurrencyLimit) { if (concurrencyLimit <= 0) { throw new ArgumentException(@"Concurrency limit must be greater than 0.", nameof(concurrencyLimit)); } _subjectReductionMap = subjectReductionMap; _concurrencyLimit = concurrencyLimit; } public async Task WaitFor(TSubject subject) { var semaphore = GetSemaphoreForReduction(subject); await semaphore.WaitAsync(); } public void Release(TSubject subject) { var semaphore = GetSemaphoreForReduction(subject); semaphore.Release(); } private SemaphoreSlim GetSemaphoreForReduction(TSubject subject) { var reducedSubject = _subjectReductionMap.Invoke(subject); var semaphore = _semaphores.GetOrAdd(reducedSubject, new SemaphoreSlim(_concurrencyLimit)); return semaphore; } } }
mit
C#
c7287b43cb52060b5467aad229983f0ab693a57a
Use Task.CompletedTask to reduce allocations (#3243)
IdentityServer/IdentityServer4,IdentityServer/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4
src/AspNetIdentity/src/SecurityStampValidatorCallback.cs
src/AspNetIdentity/src/SecurityStampValidatorCallback.cs
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using Microsoft.AspNetCore.Identity; using System.Threading.Tasks; using System.Linq; namespace IdentityServer4.AspNetIdentity { /// <summary> /// Implements callback for SecurityStampValidator's OnRefreshingPrincipal event. /// </summary> public class SecurityStampValidatorCallback { /// <summary> /// Maintains the claims captured at login time that are not being created by ASP.NET Identity. /// This is needed to preserve claims such as idp, auth_time, amr. /// </summary> /// <param name="context">The context.</param> /// <returns></returns> public static Task UpdatePrincipal(SecurityStampRefreshingPrincipalContext context) { var newClaimTypes = context.NewPrincipal.Claims.Select(x => x.Type).ToArray(); var currentClaimsToKeep = context.CurrentPrincipal.Claims.Where(x => !newClaimTypes.Contains(x.Type)).ToArray(); var id = context.NewPrincipal.Identities.First(); id.AddClaims(currentClaimsToKeep); return Task.CompletedTask; } } }
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using Microsoft.AspNetCore.Identity; using System.Threading.Tasks; using System.Linq; namespace IdentityServer4.AspNetIdentity { /// <summary> /// Implements callback for SecurityStampValidator's OnRefreshingPrincipal event. /// </summary> public class SecurityStampValidatorCallback { /// <summary> /// Maintains the claims captured at login time that are not being created by ASP.NET Identity. /// This is needed to preserve claims such as idp, auth_time, amr. /// </summary> /// <param name="context">The context.</param> /// <returns></returns> public static Task UpdatePrincipal(SecurityStampRefreshingPrincipalContext context) { var newClaimTypes = context.NewPrincipal.Claims.Select(x=>x.Type).ToArray(); var currentClaimsToKeep = context.CurrentPrincipal.Claims.Where(x => !newClaimTypes.Contains(x.Type)).ToArray(); var id = context.NewPrincipal.Identities.First(); id.AddClaims(currentClaimsToKeep); return Task.FromResult(0); } } }
apache-2.0
C#
239befd6a051924074ff1838294d4d61c172f3aa
Set assembly description to GitHub repo.
ASOIU/GitHub2FAuth
GitHub2FAuth/Properties/AssemblyInfo.cs
GitHub2FAuth/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("GitHub2FAuth")] [assembly: AssemblyDescription("https://github.com/ASOIU/GitHub2FAuth")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ZiroCorp & ASOIU")] [assembly: AssemblyProduct("GitHub2FAuth")] [assembly: AssemblyCopyright("(CC) ZiroCorp & ASOIU 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: NeutralResourcesLanguageAttribute("en")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("GitHub2FAuth")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ZiroCorp & ASOIU")] [assembly: AssemblyProduct("GitHub2FAuth")] [assembly: AssemblyCopyright("(CC) ZiroCorp & ASOIU 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: NeutralResourcesLanguageAttribute("en")]
mit
C#
7602cd269e265c1e7327a487a4aacc859e182a40
remove ticks
jefking/King.Service.ServiceBus
King.Service.ServiceBus/Timing/Sleep.cs
King.Service.ServiceBus/Timing/Sleep.cs
namespace King.Service.ServiceBus.Timing { using System; using System.Threading; /// <summary> /// Sleep /// </summary> public class Sleep : ISleep { #region Methods /// <summary> /// Until /// </summary> /// <param name="time">Time</param> public void Until(DateTime time) { if (time > DateTime.UtcNow) { var reset = new ManualResetEvent(false); reset.WaitOne(time.Subtract(DateTime.UtcNow)); while (time >= DateTime.UtcNow) { } //Ensure release is made after specified timing } } #endregion } }
namespace King.Service.ServiceBus.Timing { using System; using System.Threading; /// <summary> /// Sleep /// </summary> public class Sleep : ISleep { #region Methods /// <summary> /// Until /// </summary> /// <param name="time">Time</param> public void Until(DateTime time) { if (time > DateTime.UtcNow) { var reset = new ManualResetEvent(false); reset.WaitOne(time.Subtract(DateTime.UtcNow.AddTicks(-1))); while (time >= DateTime.UtcNow) { } //Ensure release is made after specified timing } } #endregion } }
mit
C#
a3ad9686d6cfd0afd5b12ac4d7acf0f102d01919
Remove reference to Nullables
fredericDelaporte/nhibernate-core,livioc/nhibernate-core,livioc/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,livioc/nhibernate-core,gliljas/nhibernate-core,nkreipke/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,hazzik/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,hazzik/nhibernate-core,hazzik/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,lnu/nhibernate-core,lnu/nhibernate-core,RogerKratz/nhibernate-core,lnu/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,alobakov/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,alobakov/nhibernate-core,RogerKratz/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,nkreipke/nhibernate-core,gliljas/nhibernate-core
src/NHibernate.UserTypes.Tests/SerializabilityFixture.cs
src/NHibernate.UserTypes.Tests/SerializabilityFixture.cs
using System; using System.Reflection; using NHibernate.Type; using NHibernate.UserTypes.SqlTypes; using NUnit.Framework; namespace NHibernate.UserTypes.Tests { [TestFixture] public class SerializabilityFixture { public static void CheckITypesInAssembly(Assembly assembly) { foreach (System.Type type in assembly.GetTypes()) { if (type.IsClass && !type.IsAbstract && typeof(IType).IsAssignableFrom(type)) { Assert.IsTrue(type.IsSerializable, "Type {0} should be serializable", type); } } } [Test] public void SqlTypes() { CheckITypesInAssembly(typeof(SqlInt32Type).Assembly); } }
using System; using System.Reflection; using NHibernate.Type; using NHibernate.UserTypes.SqlTypes; using Nullables.NHibernate; using NUnit.Framework; namespace NHibernate.UserTypes.Tests { [TestFixture] public class SerializabilityFixture { public static void CheckITypesInAssembly(Assembly assembly) { foreach (System.Type type in assembly.GetTypes()) { if (type.IsClass && !type.IsAbstract && typeof(IType).IsAssignableFrom(type)) { Assert.IsTrue(type.IsSerializable, "Type {0} should be serializable", type); } } } [Test] public void SqlTypes() { CheckITypesInAssembly(typeof(SqlInt32Type).Assembly); } [Test] public void NullableTypes() { CheckITypesInAssembly(typeof(NullableInt32Type).Assembly); } } }
lgpl-2.1
C#
6ceb7253e2685e039e446787cb6f8c1162dff327
Use "error: path" in the ToString method of ChildSchemaValidationError too.
NJsonSchema/NJsonSchema,RSuter/NJsonSchema
src/NJsonSchema/Validation/ChildSchemaValidationError.cs
src/NJsonSchema/Validation/ChildSchemaValidationError.cs
//----------------------------------------------------------------------- // <copyright file="ChildSchemaValidationError.cs" company="NJsonSchema"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System.Collections.Generic; namespace NJsonSchema.Validation { /// <summary>A subschema validation error. </summary> public class ChildSchemaValidationError : ValidationError { /// <summary>Initializes a new instance of the <see cref="ValidationError"/> class. </summary> /// <param name="kind">The error kind. </param> /// <param name="property">The property name. </param> /// <param name="path">The property path. </param> /// <param name="errors">The error list. </param> public ChildSchemaValidationError(ValidationErrorKind kind, string property, string path, IReadOnlyDictionary<JsonSchema4, ICollection<ValidationError>> errors) : base(kind, property, path) { Errors = errors; } /// <summary>Gets the errors for each validated subschema. </summary> public IReadOnlyDictionary<JsonSchema4, ICollection<ValidationError>> Errors { get; private set; } /// <summary>Returns a string that represents the current object.</summary> /// <returns>A string that represents the current object.</returns> /// <filterpriority>2</filterpriority> public override string ToString() { var output = string.Format("{0}: {1}\n", Kind, Path); foreach (var error in Errors) { output += "{\n"; foreach (var validationError in error.Value) { output += string.Format(" {0}\n", validationError.ToString().Replace("\n", "\n ")); } output += "}\n"; } return output; } } }
//----------------------------------------------------------------------- // <copyright file="ChildSchemaValidationError.cs" company="NJsonSchema"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System.Collections.Generic; namespace NJsonSchema.Validation { /// <summary>A subschema validation error. </summary> public class ChildSchemaValidationError : ValidationError { /// <summary>Initializes a new instance of the <see cref="ValidationError"/> class. </summary> /// <param name="kind">The error kind. </param> /// <param name="property">The property name. </param> /// <param name="path">The property path. </param> /// <param name="errors">The error list. </param> public ChildSchemaValidationError(ValidationErrorKind kind, string property, string path, IReadOnlyDictionary<JsonSchema4, ICollection<ValidationError>> errors) : base(kind, property, path) { Errors = errors; } /// <summary>Gets the errors for each validated subschema. </summary> public IReadOnlyDictionary<JsonSchema4, ICollection<ValidationError>> Errors { get; private set; } /// <summary>Returns a string that represents the current object.</summary> /// <returns>A string that represents the current object.</returns> /// <filterpriority>2</filterpriority> public override string ToString() { var output = string.Format("{0} error in {1}:\n", Kind, Path); foreach (var error in Errors) { output += "{\n"; foreach (var validationError in error.Value) { output += string.Format(" {0}\n", validationError.ToString().Replace("\n", "\n ")); } output += "}\n"; } return output; } } }
mit
C#
b5bb1fdb261656c9af69da03274a051f28c5a3ba
bump version number
martin2250/OpenCNCPilot
OpenCNCPilot/Properties/AssemblyInfo.cs
OpenCNCPilot/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenCNCPilot")] [assembly: AssemblyDescription("GCode Sender and AutoLeveller")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("martin2250")] [assembly: AssemblyProduct("OpenCNCPilot")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.10.0")] [assembly: AssemblyFileVersion("1.5.10.0")]
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenCNCPilot")] [assembly: AssemblyDescription("GCode Sender and AutoLeveller")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("martin2250")] [assembly: AssemblyProduct("OpenCNCPilot")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.9.0")] [assembly: AssemblyFileVersion("1.5.9.0")]
mit
C#
d5acbd9fa7e17f286152e0b031e5263eb0d19bda
make select editor non-abstract
WasimAhmad/Serenity,linpiero/Serenity,TukekeSoft/Serenity,dfaruque/Serenity,dfaruque/Serenity,linpiero/Serenity,TukekeSoft/Serenity,volkanceylan/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,TukekeSoft/Serenity,linpiero/Serenity,rolembergfilho/Serenity,dfaruque/Serenity,linpiero/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,dfaruque/Serenity,linpiero/Serenity,TukekeSoft/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity
Serenity.Script.UI/Editor/SelectEditor.cs
Serenity.Script.UI/Editor/SelectEditor.cs
using jQueryApi; using Serenity.ComponentModel; using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; namespace Serenity { [Editor, DisplayName("Açılır Liste"), OptionsType(typeof(SelectEditorOptions))] [Element("<input type=\"hidden\"/>")] public class SelectEditor : Select2Editor<SelectEditorOptions, Select2Item>, IStringValue { public SelectEditor(jQueryObject hidden, SelectEditorOptions opt) : base(hidden, opt) { UpdateItems(); } protected virtual List<object> GetItems() { return options.Items ?? new List<object>(); } protected override string EmptyItemText() { return options.EmptyOptionText; } protected virtual void UpdateItems() { var items = GetItems(); ClearItems(); if (items.Count > 0) { bool isStrings = Script.TypeOf(items[0]) == "string"; foreach (dynamic item in items) { string key = isStrings ? item : item[0]; string text = isStrings ? item : item[1] ?? item[0]; AddItem(key, text, item); } } } } [Serializable, Reflectable] public class SelectEditorOptions { public SelectEditorOptions() { EmptyOptionText = "--seçiniz--"; Items = new List<object>(); } [Hidden] public List<object> Items { get; set; } [DisplayName("Boş Eleman Metni")] public string EmptyOptionText { get; set; } } }
using jQueryApi; using Serenity.ComponentModel; using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; namespace Serenity { [Editor, DisplayName("Açılır Liste"), OptionsType(typeof(SelectEditorOptions))] [Element("<input type=\"hidden\"/>")] public abstract class SelectEditor : Select2Editor<SelectEditorOptions, Select2Item>, IStringValue { public SelectEditor(jQueryObject hidden, SelectEditorOptions opt) : base(hidden, opt) { UpdateItems(); } protected virtual List<object> GetItems() { return options.Items ?? new List<object>(); } protected override string EmptyItemText() { return options.EmptyOptionText; } protected virtual void UpdateItems() { var items = GetItems(); ClearItems(); if (items.Count > 0) { bool isStrings = Script.TypeOf(items[0]) == "string"; foreach (dynamic item in items) { string key = isStrings ? item : item[0]; string text = isStrings ? item : item[1] ?? item[0]; AddItem(key, text, item); } } } } [Serializable, Reflectable] public class SelectEditorOptions { public SelectEditorOptions() { EmptyOptionText = "--seçiniz--"; Items = new List<object>(); } [Hidden] public List<object> Items { get; set; } [DisplayName("Boş Eleman Metni")] public string EmptyOptionText { get; set; } } }
mit
C#
42b50bdaad6bea615f4ca9a478af27da99ca9051
Upgrade version to 1.3.4
tangxuehua/equeue,tangxuehua/equeue,tangxuehua/equeue,Aaron-Liu/equeue,geffzhang/equeue,geffzhang/equeue,Aaron-Liu/equeue
src/EQueue/Properties/AssemblyInfo.cs
src/EQueue/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的常规信息通过以下 // 特性集控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("EQueue")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EQueue")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.4")] [assembly: AssemblyFileVersion("1.3.4")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的常规信息通过以下 // 特性集控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("EQueue")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EQueue")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.3")] [assembly: AssemblyFileVersion("1.3.3")]
mit
C#
dfa066dca9be9f0797de42f459293c67c612fb1f
Add doc comments for `DiffLine`
github/VisualStudio,github/VisualStudio,github/VisualStudio
src/GitHub.Exports/Models/DiffLine.cs
src/GitHub.Exports/Models/DiffLine.cs
using System; namespace GitHub.Models { public class DiffLine { /// <summary> /// Was the line added, deleted or unchanged. /// </summary> public DiffChangeType Type { get; set; } /// <summary> /// Gets the old 1-based line number. /// </summary> public int OldLineNumber { get; set; } = -1; /// <summary> /// Gets the new 1-based line number. /// </summary> public int NewLineNumber { get; set; } = -1; /// <summary> /// Gets the unified diff line number where the first chunk header is line 0. /// </summary> public int DiffLineNumber { get; set; } = -1; /// <summary> /// Gets the content of the diff line (including +, - or space). /// </summary> public string Content { get; set; } public override string ToString() => Content; } }
using System; namespace GitHub.Models { public class DiffLine { public DiffChangeType Type { get; set; } public int OldLineNumber { get; set; } = -1; public int NewLineNumber { get; set; } = -1; public int DiffLineNumber { get; set; } = -1; public string Content { get; set; } public override string ToString() => Content; } }
mit
C#
6452cc632aac0a99e34ad369cd5c539f01423010
Add registration to the serive
zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype
src/Glimpse.Common/GlimpseServices.cs
src/Glimpse.Common/GlimpseServices.cs
using Glimpse; using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection; using System.Collections.Generic; namespace Glimpse { public class GlimpseServices { public static IEnumerable<IServiceDescriptor> GetDefaultServices() { return GetDefaultServices(new Configuration()); } public static IEnumerable<IServiceDescriptor> GetDefaultServices(IConfiguration configuration) { var describe = new ServiceDescriber(configuration); // // Discovery & Reflection. // yield return describe.Transient<ITypeActivator, DefaultTypeActivator>(); yield return describe.Transient<ITypeSelector, DefaultTypeSelector>(); yield return describe.Transient<IAssemblyProvider, DefaultAssemblyProvider>(); yield return describe.Transient<ITypeService, DefaultTypeService>(); yield return describe.Transient(typeof(IDiscoverableCollection<>), typeof(ReflectionDiscoverableCollection<>)); // // Broker // yield return describe.Singleton<IMessageBus, DefaultMessageBus>(); } } }
using Glimpse; using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.DependencyInjection; using System.Collections.Generic; namespace Glimpse { public class GlimpseServices { public static IEnumerable<IServiceDescriptor> GetDefaultServices() { return GetDefaultServices(new Configuration()); } public static IEnumerable<IServiceDescriptor> GetDefaultServices(IConfiguration configuration) { var describe = new ServiceDescriber(configuration); // // Discovery & Reflection. // yield return describe.Transient<ITypeActivator, DefaultTypeActivator>(); yield return describe.Transient<ITypeSelector, DefaultTypeSelector>(); yield return describe.Transient<IAssemblyProvider, DefaultAssemblyProvider>(); yield return describe.Transient<ITypeService, DefaultTypeService>(); yield return describe.Transient(typeof(IDiscoverableCollection<>), typeof(ReflectionDiscoverableCollection<>)); } } }
mit
C#
040f5c41caf12484ec32c357c2dfb2d6af46233a
Add Get in FibonachiGenerator
prifio/Assignment2
Assignment2Application/Assignment2Application/FibonacciGenerator.cs
Assignment2Application/Assignment2Application/FibonacciGenerator.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Assignment2Application { public class FibonacciGenerator { /// <summary> /// Return n-th Fibonacci number. /// </summary> /// <param name="n"></param> /// <returns></returns> List<long> F; public FibonacciGenerator() { F = new List<long>(); F.Add(1); F.Add(1); } public long Get(int n) { if (n < F.Count) return F[n]; long res = Get(n - 1) + Get(n - 2); F.Add(res); return res; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Assignment2Application { public class FibonacciGenerator { /// <summary> /// Return n-th Fibonacci number. /// </summary> /// <param name="n"></param> /// <returns></returns> public long Get(int n) { // Enter you code here return 0; } } }
mit
C#
a32855838c3931d463eb0e50f6f5523aa50e4296
Remove reference to old library name.
christophediericx/ArduinoSketchUploader
Source/ArduinoSketchUploader/Program.cs
Source/ArduinoSketchUploader/Program.cs
using ArduinoUploader; namespace ArduinoSketchUploader { /// <summary> /// The ArduinoSketchUploader can upload a compiled (Intel) HEX file directly to an attached Arduino. /// </summary> internal class Program { private static void Main(string[] args) { var commandLineOptions = new CommandLineOptions(); if (!CommandLine.Parser.Default.ParseArguments(args, commandLineOptions)) return; var options = new ArduinoSketchUploaderOptions { PortName = commandLineOptions.PortName, FileName = commandLineOptions.FileName, ArduinoModel = commandLineOptions.ArduinoModel }; var uploader = new ArduinoUploader.ArduinoSketchUploader(options); uploader.UploadSketch(); } } }
using ArduinoUploader; namespace ArduinoSketchUploader { /// <summary> /// The ArduinoLibCSharp SketchUploader can upload a compiled (Intel) HEX file directly to an attached Arduino. /// </summary> internal class Program { private static void Main(string[] args) { var commandLineOptions = new CommandLineOptions(); if (!CommandLine.Parser.Default.ParseArguments(args, commandLineOptions)) return; var options = new ArduinoSketchUploaderOptions { PortName = commandLineOptions.PortName, FileName = commandLineOptions.FileName, ArduinoModel = commandLineOptions.ArduinoModel }; var uploader = new ArduinoUploader.ArduinoSketchUploader(options); uploader.UploadSketch(); } } }
mit
C#
f8417df6a8b33c876fe21ac0816dfbfebcc26b67
Update 103_Resolving_base_class_dependencies.cs
z4kn4fein/stashbox
test/IssueTests/103_Resolving_base_class_dependencies.cs
test/IssueTests/103_Resolving_base_class_dependencies.cs
using Stashbox.Attributes; using Xunit; namespace Stashbox.Tests.IssueTests { public class A { } public class B { } public class BaseClass { [Dependency] public A A { get; set; } public bool DoneA { get; set; } [InjectionMethod] public void InjectA() { DoneA = true; } } public class MainClass : BaseClass { [Dependency] public B B { get; set; } public bool DoneB { get; set; } [InjectionMethod] public void InjectB() { DoneB = true; } } public class BaseClassMethod { [Fact] public void Test() { var container = new StashboxContainer(); container.Register<A>().Register<B>().Register<MainClass>(); var main = container.Resolve<MainClass>(); Assert.IsType<B>(main.B); Assert.IsType<A>(main.A); Assert.True(main.DoneA); Assert.True(main.DoneB); } } }
using Stashbox.Attributes; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace Stashbox.Tests.IssueTests { public class A { } public class B { } public class BaseClass { [Dependency] public A A { get; set; } public bool DoneA { get; set; } [InjectionMethod] public void InjectA() { DoneA = true; } } public class MainClass : BaseClass { [Dependency] public B B { get; set; } public bool DoneB { get; set; } [InjectionMethod] public void InjectB() { DoneB = true; } } public class BaseClassMethod { [Fact] public void Test() { var container = new StashboxContainer(); container.Register<A>().Register<B>().Register<MainClass>(); var main = container.Resolve<MainClass>(); Assert.IsType<B>(main.B); Assert.IsType<A>(main.A); Assert.True(main.DoneA); Assert.True(main.DoneB); } } }
mit
C#
d64b6ff2276eda8703181deecb3e0ecd6b18c87a
Fix merge conflict
BitSetsNet/BitSetsNet
Source/Utility.cs
Source/Utility.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BitsetsNET { class Utility { public static short GetHighBits(int x) { uint u = (uint)(x); return (short) (u >> 16); } public static short GetLowBits(int x) { return (short)(x & 0xFFFF); } public static int toIntUnsigned(short x) { return x & 0xFFFF; } public static int unsignedBinarySearch(short[] array, int begin, int end, short k) { int ikey = toIntUnsigned(k); //optimizes for the case where the value is inserted at the end if ((end > 0) && (toIntUnsigned(array[end - 1]) < ikey)) { return -end - 1; } int low = begin; int high = end - 1; while (low <= high) { //convert to uint to shift unsigned by one, then convert back int middleIndex = (int)((uint)(low + high) >> 1); int middleValue = toIntUnsigned(array[middleIndex]); if (middleIndex < ikey) { low = middleIndex + 1; } else if (middleValue > ikey) { high = middleIndex - 1; } else { return middleIndex; } return -(low + 1); } return 0; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BitsetsNET { class Utility { public static short GetHighBits(int x) { uint u = (uint)(x); return (short) (u >> 16); } public static short GetLowBits(int x) { return (short)(x & 0xFFFF); } public static int toIntUnsigned(short x) { return x & 0xFFFF; } public static int unsignedBinarySearch(short[] array, int begin, int end, short k) { int ikey = toIntUnsigned(k); //optimizes for the case where the value is inserted at the end if ((end > 0) && (toIntUnsigned(array[end - 1]) < ikey)) { return -end - 1; } int low = begin; int high = end - 1; while (low <= high) { //convert to uint to shift unsigned by one, then convert back int middleIndex = (int)((uint)(low + high) >> 1); int middleValue = toIntUnsigned(array[middleIndex]); if (middleIndex < ikey) { low = middleIndex + 1; } else if (middleValue > ikey) { high = middleIndex - 1; } else { return middleIndex; } return -(low + 1); } return 0; } protected static int toIntUnsigned(short x) { return x & 0xFFFF; } } }
apache-2.0
C#
ba477c5b6648ae5cab39928c20e1680c3a23fc24
Update detection of the peverify.exe executable
jorisvergeer/Envify,Fody/Stamp
Tests/Verifier.cs
Tests/Verifier.cs
using System; using System.Diagnostics; using System.IO; using System.Text.RegularExpressions; using NUnit.Framework; public static class Verifier { public static void Verify(string beforeAssemblyPath, string afterAssemblyPath) { var before = Validate(beforeAssemblyPath); var after = Validate(afterAssemblyPath); var message = $"Failed processing {Path.GetFileName(afterAssemblyPath)}\r\n{after}"; Assert.AreEqual(TrimLineNumbers(before), TrimLineNumbers(after), message); } public static string Validate(string assemblyPath2) { var exePath = GetPathToPEVerify(); var process = Process.Start(new ProcessStartInfo(exePath, "\"" + assemblyPath2 + "\"") { RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true }); process.WaitForExit(10000); return process.StandardOutput.ReadToEnd().Trim().Replace(assemblyPath2, ""); } static string GetPathToPEVerify() { var windowsSdkFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"Microsoft SDKs\Windows"); if (!Directory.Exists(windowsSdkFolder)) { throw new DirectoryNotFoundException("Could not find the Windows SDK directory"); } foreach (var version in Directory.GetDirectories(windowsSdkFolder)) { // Find the .NETFX tools folder foreach (var dotNetFolder in Directory.GetDirectories(Path.Combine(version, "bin"), "NETFX*")) { string peVerify = Path.Combine(dotNetFolder, "PEVerify.exe"); if(File.Exists(peVerify)) { return peVerify; } } } throw new FileNotFoundException("Could not find PEVerify.exe"); } static string TrimLineNumbers(string foo) { return Regex.Replace(foo, @"0x.*]", ""); } }
using System; using System.Diagnostics; using System.IO; using System.Text.RegularExpressions; using NUnit.Framework; public static class Verifier { public static void Verify(string beforeAssemblyPath, string afterAssemblyPath) { var before = Validate(beforeAssemblyPath); var after = Validate(afterAssemblyPath); var message = $"Failed processing {Path.GetFileName(afterAssemblyPath)}\r\n{after}"; Assert.AreEqual(TrimLineNumbers(before), TrimLineNumbers(after), message); } public static string Validate(string assemblyPath2) { var exePath = GetPathToPEVerify(); var process = Process.Start(new ProcessStartInfo(exePath, "\"" + assemblyPath2 + "\"") { RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true }); process.WaitForExit(10000); return process.StandardOutput.ReadToEnd().Trim().Replace(assemblyPath2, ""); } static string GetPathToPEVerify() { var exePath = Environment.ExpandEnvironmentVariables(@"%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\PEVerify.exe"); if (!File.Exists(exePath)) { exePath = Environment.ExpandEnvironmentVariables(@"%programfiles(x86)%\Microsoft SDKs\Windows\v8.0A\Bin\NETFX 4.0 Tools\PEVerify.exe"); } return exePath; } static string TrimLineNumbers(string foo) { return Regex.Replace(foo, @"0x.*]", ""); } }
mit
C#
93361a75f007b87d39a0678e59b5f75d8f2f28e5
remove double
Appleseed/base,Appleseed/base
Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/SolrResponseItem.cs
Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/SolrResponseItem.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Appleseed.Base.Alerts.Model { class SolrResponseItem { public string id { get; set; } public string item_type { get; set; } public string address_1 { get; set; } public string city { get; set; } public string state { get; set; } public string classification { get; set; } public string country { get; set; } public string postal_code { get; set; } public string product_description { get; set; } public string product_quantity { get; set; } public string product_type { get; set; } public string code_info { get; set; } public string reason_for_recall { get; set; } public DateTime recall_initiation_date { get; set; } public string recall_number { get; set; } public string recalling_firm { get; set; } public string voluntary_mandated { get; set; } public DateTime report_date { get; set; } public string status { get; set; } public DateTime date_last_indexed { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Appleseed.Base.Alerts.Model { class SolrResponseItem { public string id { get; set; } public string item_type { get; set; } public string address_1 { get; set; } public string city { get; set; } public string state { get; set; } public string classification { get; set; } public string country { get; set; } public string postal_code { get; set; } public string product_description { get; set; } public string product_quantity { get; set; } public string product_type { get; set; } public string code_info { get; set; } public string reason_for_recall { get; set; } public DateTime recall_initiation_date { get; set; } public string recall_number { get; set; } public string recalling_firm { get; set; } public string voluntary_mandated { get; set; } public DateTime report_date { get; set; } public string status { get; set; } public DateTime date_last_indexed { get; set; } public DateTime date_last_indexed { get; set; } }
apache-2.0
C#
628c9ac5ed6fd92ed67fb5add64e629111ffb45a
remove code that causes bug where eg ViewBag.Title conflicts with property Title of model being rendered
mcintyre321/FormFactory,mcintyre321/FormFactory,mcintyre321/FormFactory
FormFactory.Templates/Views/Shared/FormFactory/Form.Property.cshtml
FormFactory.Templates/Views/Shared/FormFactory/Form.Property.cshtml
@using System.ComponentModel.DataAnnotations @using FormFactory @model PropertyVm @{ var dataAttributes = Model.GetCustomAttributes().OfType<DataTypeAttribute>(); if (dataAttributes.Any(da => da.CustomDataType == "Hidden")) { <input name="@Model.Name" type="hidden" value="@Model.Value" /> } else { if (ViewBag.Inline ?? false) { Html.RenderPartial("FormFactory/Form.Property.Inline", Model, ViewData); } else { Html.RenderPartial("FormFactory/Form.Property.Block", Model, ViewData); } } }
@using System.ComponentModel.DataAnnotations @using FormFactory @model PropertyVm @{ var dataAttributes = Model.GetCustomAttributes().OfType<DataTypeAttribute>(); if (dataAttributes.Any(da => da.CustomDataType == "Hidden")) { <input name="@Model.Name" type="hidden" value="@Model.Value" /> } else { if (ViewData[Model.Name] != null) { <input type="hidden" name="@Model.Name" value="@ViewData[Model.Name]"/> } else { if (ViewBag.Inline ?? false) { Html.RenderPartial("FormFactory/Form.Property.Inline", Model, ViewData); } else { Html.RenderPartial("FormFactory/Form.Property.Block", Model, ViewData); } } } }
mit
C#
221ef2e2a7e3e7eff46643e78f3411c347ec1fea
Update Naos.Recipes.ItsDomain.Authorization with auto generated info and other stuff to play nice as an injected file as well as making internal.
NaosProject/Naos.Recipes
Naos.Recipes.ItsDomain.Authorization/.Naos.Recipes/Authorization.cs
Naos.Recipes.ItsDomain.Authorization/.Naos.Recipes/Authorization.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="Authorization.cs" company="Naos"> // Copyright 2015 Naos // </copyright> // <auto-generated> // Sourced from NuGet package. Will be overwritten with package update except in Naos.Recipes source. // </auto-generated> // -------------------------------------------------------------------------------------------------------------------- namespace Naos.Recipes.ItsDomain { using System.Security.Principal; using System.Threading; using Microsoft.Its.Domain.Authorization; /// <summary> /// Helper for authorization needs of Its.Domain. /// </summary> [System.Diagnostics.DebuggerStepThrough] [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [System.CodeDom.Compiler.GeneratedCode("Naos.Recipes", "See package version number")] internal static class Authorization<T> where T : class { static Authorization() { AuthorizationFor<AlwaysIsInRolePrincipal>.ToApplyAnyCommand.ToA<T>.Requires((principal, acct) => true); } /// <summary> /// Register the current principal to always allow. /// </summary> public static void AuthorizeAllCommands() { Thread.CurrentPrincipal = new AlwaysIsInRolePrincipal(); } /// <summary> /// Implementation of <see cref="IPrincipal"/> that always returns true for role membership. /// </summary> public class AlwaysIsInRolePrincipal : IPrincipal { /// <inheritdoc /> public bool IsInRole(string role) { return true; } /// <inheritdoc /> public IIdentity Identity { get; private set; } } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="Authorization.cs" company="Naos"> // Copyright 2015 Naos // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace Naos.Recipes.ItsDomain { using System.Security.Principal; using System.Threading; using Microsoft.Its.Domain.Authorization; /// <summary> /// Helper for authorization needs of Its.Domain. /// </summary> public static class Authorization<T> where T : class { static Authorization() { AuthorizationFor<AlwaysIsInRolePrincipal>.ToApplyAnyCommand.ToA<T>.Requires((principal, acct) => true); } /// <summary> /// Register the current principal to always allow. /// </summary> public static void AuthorizeAllCommands() { Thread.CurrentPrincipal = new AlwaysIsInRolePrincipal(); } /// <summary> /// Implementation of <see cref="IPrincipal"/> that always returns true for role membership. /// </summary> public class AlwaysIsInRolePrincipal : IPrincipal { /// <inheritdoc /> public bool IsInRole(string role) { return true; } /// <inheritdoc /> public IIdentity Identity { get; private set; } } } }
mit
C#
48afbd6bc10deece1ef98c1f93e05b50c77c61f7
Update database table size analysis report test to abstract report test
ChristopherJennings/KInspector,Kentico/KInspector,Kentico/KInspector,Kentico/KInspector,ChristopherJennings/KInspector,Kentico/KInspector,ChristopherJennings/KInspector,ChristopherJennings/KInspector
KenticoInspector.Reports.Tests/DatabaseTableSizeAnalysisTest.cs
KenticoInspector.Reports.Tests/DatabaseTableSizeAnalysisTest.cs
using KenticoInspector.Core.Constants; using KenticoInspector.Reports.DatabaseTableSizeAnalysis; using KenticoInspector.Reports.DatabaseTableSizeAnalysis.Models; using KenticoInspector.Reports.Tests.Helpers; using NUnit.Framework; using System.Collections.Generic; namespace KenticoInspector.Reports.Tests { [TestFixture(10)] [TestFixture(11)] [TestFixture(12)] public class DatabaseTableSizeAnalysisTest : AbstractReportTest<Report, Terms> { private Report _mockReport; public DatabaseTableSizeAnalysisTest(int majorVersion) : base(majorVersion) { _mockReport = new Report(_mockDatabaseService.Object, _mockReportMetadataService.Object); } [Test] public void Should_ReturnInformationStatus() { // Arrange IEnumerable<DatabaseTableSizeResult> dbResults = GetCleanResults(); _mockDatabaseService .Setup(p => p.ExecuteSqlFromFile<DatabaseTableSizeResult>(Scripts.GetTop25LargestTables)) .Returns(dbResults); // Act var results = _mockReport.GetResults(); // Assert Assert.That(results.Data.Rows.Count == 25); Assert.That(results.Status == ReportResultsStatus.Information); } private List<DatabaseTableSizeResult> GetCleanResults() { var results = new List<DatabaseTableSizeResult>(); for (var i = 0; i < 25; i++) { results.Add(new DatabaseTableSizeResult() { TableName = $"table {i}", Rows = i, BytesPerRow = i, SizeInMB = i }); } return results; } } }
using KenticoInspector.Core.Constants; using KenticoInspector.Core.Models; using KenticoInspector.Core.Services.Interfaces; using KenticoInspector.Reports.DatabaseTableSizeAnalysis; using KenticoInspector.Reports.DatabaseTableSizeAnalysis.Models; using KenticoInspector.Reports.Tests.Helpers; using Moq; using NUnit.Framework; using System.Collections.Generic; namespace KenticoInspector.Reports.Tests { [TestFixture(10)] [TestFixture(11)] [TestFixture(12)] public class DatabaseTableSizeAnalysisTest { private InstanceDetails _mockInstanceDetails; private Mock<IDatabaseService> _mockDatabaseService; private Mock<IReportMetadataService> _mockReportMetadataService; private Report _mockReport; public DatabaseTableSizeAnalysisTest(int majorVersion) { InitializeCommonMocks(majorVersion); _mockReportMetadataService = MockReportMetadataServiceHelper.GetReportMetadataService(); _mockReport = new Report(_mockDatabaseService.Object, _mockReportMetadataService.Object); MockReportMetadataServiceHelper.SetupReportMetadataService<Terms>(_mockReportMetadataService, _mockReport); } [Test] public void Should_ReturnInformationStatus() { // Arrange IEnumerable<DatabaseTableSizeResult> dbResults = GetCleanResults(); _mockDatabaseService .Setup(p => p.ExecuteSqlFromFile<DatabaseTableSizeResult>(Scripts.GetTop25LargestTables)) .Returns(dbResults); // Act var results = _mockReport.GetResults(); // Assert Assert.That(results.Data.Rows.Count == 25); Assert.That(results.Status == ReportResultsStatus.Information); } private List<DatabaseTableSizeResult> GetCleanResults() { var results = new List<DatabaseTableSizeResult>(); for (var i = 0; i < 25; i++) { results.Add(new DatabaseTableSizeResult() { TableName = $"table {i}", Rows = i, BytesPerRow = i, SizeInMB = i }); } return results; } private void InitializeCommonMocks(int majorVersion) { var mockInstance = MockInstances.Get(majorVersion); _mockInstanceDetails = MockInstanceDetails.Get(majorVersion, mockInstance); _mockDatabaseService = MockDatabaseServiceHelper.SetupMockDatabaseService(mockInstance); } } }
mit
C#
7a728edddc07db0c527d556152ed049403eb10b4
rename list_counter
bitzhuwei/CSharpGL,bitzhuwei/CSharpGL,bitzhuwei/CSharpGL
Demos/OrderIndependentTransparency/OITNode.build_lists.cs
Demos/OrderIndependentTransparency/OITNode.build_lists.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using CSharpGL; namespace OrderIndependentTransparency { public partial class OITNode : PickableNode { private const string buildListsVert = @"#version 330 in vec3 inPosition; in vec3 inNormal; uniform mat4 mvpMatrix; uniform float minAlpha = 0.5f; out vec4 passColor; void main(void) { vec3 color = inNormal; if (color.r < 0) { color.r = -color.r; } if (color.g < 0) { color.g = -color.g; } if (color.b < 0) { color.b = -color.b; } vec3 normalized = normalize(color); float variance = (normalized.r - normalized.g) * (normalized.r - normalized.g); variance += (normalized.g - normalized.b) * (normalized.g - normalized.b); variance += (normalized.b - normalized.r) * (normalized.b - normalized.r); variance = variance / 2.0f;// range from 0.0f - 1.0f float a = (0.75f - minAlpha) * (1.0f - variance) + minAlpha; passColor = vec4(normalized, a); gl_Position = mvpMatrix * vec4(inPosition, 1.0f); } "; private const string buildListsFrag = @"#version 420 core layout (early_fragment_tests) in; layout (binding = 0, offset = 0) uniform atomic_uint atomicCounter; layout (binding = 0, r32ui) uniform uimage2D head_pointer_image; layout (binding = 1, rgba32ui) uniform writeonly uimageBuffer list_buffer; in vec4 passColor; layout (location = 0) out vec4 color; void main(void) { uint index; uint old_head; uvec4 item; index = atomicCounterIncrement(atomicCounter); old_head = imageAtomicExchange(head_pointer_image, ivec2(gl_FragCoord.xy), uint(index)); item.x = old_head; item.y = packUnorm4x8(passColor); item.z = floatBitsToUint(gl_FragCoord.z); item.w = 255 / 4; imageStore(list_buffer, int(index), item); //color = passColor; discard; } "; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using CSharpGL; namespace OrderIndependentTransparency { public partial class OITNode : PickableNode { private const string buildListsVert = @"#version 330 in vec3 inPosition; in vec3 inNormal; uniform mat4 mvpMatrix; uniform float minAlpha = 0.5f; out vec4 passColor; void main(void) { vec3 color = inNormal; if (color.r < 0) { color.r = -color.r; } if (color.g < 0) { color.g = -color.g; } if (color.b < 0) { color.b = -color.b; } vec3 normalized = normalize(color); float variance = (normalized.r - normalized.g) * (normalized.r - normalized.g); variance += (normalized.g - normalized.b) * (normalized.g - normalized.b); variance += (normalized.b - normalized.r) * (normalized.b - normalized.r); variance = variance / 2.0f;// range from 0.0f - 1.0f float a = (0.75f - minAlpha) * (1.0f - variance) + minAlpha; passColor = vec4(normalized, a); gl_Position = mvpMatrix * vec4(inPosition, 1.0f); } "; private const string buildListsFrag = @"#version 420 core layout (early_fragment_tests) in; layout (binding = 0, offset = 0) uniform atomic_uint list_counter; layout (binding = 0, r32ui) uniform uimage2D head_pointer_image; layout (binding = 1, rgba32ui) uniform writeonly uimageBuffer list_buffer; in vec4 passColor; layout (location = 0) out vec4 color; void main(void) { uint index; uint old_head; uvec4 item; index = atomicCounterIncrement(list_counter); old_head = imageAtomicExchange(head_pointer_image, ivec2(gl_FragCoord.xy), uint(index)); item.x = old_head; item.y = packUnorm4x8(passColor); item.z = floatBitsToUint(gl_FragCoord.z); item.w = 255 / 4; imageStore(list_buffer, int(index), item); //color = passColor; discard; } "; } }
mit
C#
ea3deb024c84e2e680d4809e60fde5c75db2a495
include default assets
Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen
Dashen/View.cs
Dashen/View.cs
using System.Collections.Generic; using System.Linq; using System.Text; using Dashen.Assets; using Dashen.Infrastructure; namespace Dashen { public class View { private readonly List<AssetInfo> _assets; public View() { _assets = new List<AssetInfo>(); _assets.Add(new JavaScriptAssetInfo("static/js/react.min.js")); _assets.Add(new JavaScriptAssetInfo("static/js/JSXTransformer.js")); } public void AddAsset(AssetInfo asset) { _assets.Add(asset); } private void Include(StringBuilder sb, AssetLocations location) { _assets .Where(asset => asset.Location == location) .ForEach(asset => sb.AppendLine(asset.ToString())); } public string Render() { var sb = new StringBuilder(); sb.AppendLine("<html>"); sb.AppendLine("<head>"); Include(sb, AssetLocations.PreHead); Include(sb, AssetLocations.PostHead); sb.AppendLine("</head>"); sb.AppendLine("<body>"); Include(sb, AssetLocations.PreBody); Include(sb, AssetLocations.PostBody); sb.AppendLine("</body>"); sb.AppendLine("</html>"); return sb.ToString(); } } }
using System.Collections.Generic; using System.Linq; using System.Text; using Dashen.Infrastructure; namespace Dashen { public class View { private readonly List<AssetInfo> _assets; public View() { _assets = new List<AssetInfo>(); } public void AddAsset(AssetInfo asset) { _assets.Add(asset); } private void Include(StringBuilder sb, AssetLocations location) { _assets .Where(asset => asset.Location == location) .ForEach(asset => sb.AppendLine(asset.ToString())); } public string Render() { var sb = new StringBuilder(); sb.AppendLine("<html>"); sb.AppendLine("<head>"); Include(sb, AssetLocations.PreHead); Include(sb, AssetLocations.PostHead); sb.AppendLine("</head>"); sb.AppendLine("<body>"); Include(sb, AssetLocations.PreBody); Include(sb, AssetLocations.PostBody); sb.AppendLine("</body>"); sb.AppendLine("</html>"); return sb.ToString(); } } }
lgpl-2.1
C#
0de4018e88ca2762f88389c79ec1535b0407781d
Modify ILogger.cs for sytlecop compliance.
dingjimmy/primer
Primer/ILogger.cs
Primer/ILogger.cs
//----------------------------------------------------------------------- // <copyright file="ILogger.cs" company="James Dingle"> // Copyright (c) James Dingle // </copyright> //----------------------------------------------------------------------- namespace Primer { using System; /// <summary> /// Provides a mechanism for logging data about the operation of an application and its components. /// </summary> public interface ILogger { /// <summary> /// Log a Trace event. Use this to record very detailed and fine-grained information such as performance and feature-usage statistics. /// </summary> /// <param name="eventId">A code that uniquely identifies the information being recorded. </param> /// <param name="state">The object that the information is related to.</param> /// <param name="ex">Any <see cref="Exception"/> that may have been thrown.</param> void Trace(int eventId, object state, Exception ex); /// <summary> /// Log an event related to application debugging. Use this to record detailed information that could be of use to developers when investigating or fixing a problem. /// </summary> /// <param name="eventId">A code that uniquely identifies the debug event being recorded. </param> /// <param name="state">The object that the information is related to.</param> /// <param name="ex">Any <see cref="Exception"/> that may have been thrown.</param> void Debug(int eventId, object state, Exception ex); /// <summary> /// Log an informational event. /// </summary> /// <param name="eventId">A code that uniquely identifies the information being recorded.</param> /// <param name="state">The object that the warning is related to.</param> /// <param name="ex">The <see cref="Exception"/> that has been thrown, if any.</param> void Info(int eventId, object state, Exception ex); /// <summary> /// Log a warning. Use this when something bad, but not serious and that is reversible or repairable happens. For example, an user has performed an action against recommendation, or an object is in an inconsistent sate. /// </summary> /// <param name="eventId">A code that uniquely identifies the warning being recorded. </param> /// <param name="state">The object that the warning is related to.</param> /// <param name="ex">The <see cref="Exception"/> that has been thrown, if any.</param> void Warning(int eventId, object state, Exception ex); /// <summary> /// Log an error. Use this when something bad, serious and probably un-reversible or un-repairable happens. /// </summary> /// <param name="eventId">A code that uniquely identifies the specific error that has occurred. </param> /// <param name="state">The object where the error was caught.</param> /// <param name="ex">The <see cref="Exception"/> that has been thrown, if any.</param> void Error(int eventId, object state, Exception ex); /// <summary> /// Log a Fatal Error. Use this when something very bad has happened and the application can no longer continue. /// </summary> /// <param name="eventId">A code that uniquely identifies the specific error that has occurred. </param> /// <param name="state">The object where the error was caught.</param> /// <param name="ex">The <see cref="Exception"/> that has been thrown, if any.</param> void Fatal(int eventId, object state, Exception ex); #region Potential Future Methods ////void Trace(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); ////void Debug(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); ////void Info(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); ////void Warning(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); ////void Error(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); ////void Fatal(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); #endregion } }
// Copyright (c) James Dingle using System; namespace Primer { public interface ILogger { void Trace(int eventId, object state, Exception ex); //void Trace(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); void Debug(int eventId, object state, Exception ex); //void Debug(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); void Info(int eventId, object state, Exception ex); //void Info(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); void Warning(int eventId, object state, Exception ex); //void Warning(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); void Error(int eventId, object state, Exception ex); //void Error(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); void Fatal(int eventId, object state, Exception ex); //void Fatal(int eventId, object state, Exception ex, Func<object, Exception, string> formatter); } }
mit
C#
79ed3318b58816eda84d27ae720c0aeb8fddf404
Update NDemo.csx
demigor/nreact
NReact.Demo.Wpf/Components/NDemo.csx
NReact.Demo.Wpf/Components/NDemo.csx
#if NETFX_CORE using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media; #else using System.Windows; using System.Windows.Controls; using System.Windows.Media; #endif namespace NReact { public partial class NDemo { public override NElement Render() { return <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> <NClock FS={ Props.FontSize } /> <Button Click={ (RoutedEventHandler)ClickMe } Content={"Click me" + ((int)Props.FontSize)} HorizontalAlignment="Center" Foreground="Red" /> <NClock FS={ 60.0 - Props.FontSize } /> </StackPanel>; } } }
#if NETFX_CORE using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media; #else using System.Windows; using System.Windows.Controls; using System.Windows.Media; #endif namespace NReact { public partial class NDemo { public override NElement Render() { return <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> <NClock FS={ Props.FontSize } /> <Button Click={ (RoutedEventHandler)ClickMe } Content={"Click me" + ((int)Props.FontSize)} HorizontalAlignment="Center" Foreground="Red" /> <NClock FS={ 60D - Props.FontSize } /> </StackPanel>; } } }
mit
C#
2765546fd331cc05a37d346145cfa34d284e6a14
Add flag 0x20 to PacketFlags
MrSwiss/PolarisServer,cyberkitsune/PolarisServer,PolarisTeam/PolarisServer,Dreadlow/PolarisServer,lockzag/PolarisServer
PolarisServer/Models/FixedPackets.cs
PolarisServer/Models/FixedPackets.cs
using System; using System.Runtime.InteropServices; using PolarisServer.Models; namespace PolarisServer.Models { public struct PacketHeader { public UInt32 Size; public byte Type; public byte Subtype; public byte Flags1; public byte Flags2; public PacketHeader(int size, byte type, byte subtype, byte flags1, byte flags2) { this.Size = (uint)size; this.Type = type; this.Subtype = subtype; this.Flags1 = flags1; this.Flags2 = flags2; } public PacketHeader(byte type, byte subtype) : this(type, subtype, (byte)0) { } public PacketHeader(byte type, byte subtype, byte flags1) : this(0, type, subtype, flags1, 0) { } public PacketHeader(byte type, byte subtype, PacketFlags packetFlags) : this(type, subtype, (byte)packetFlags) { } } [Flags] public enum PacketFlags : byte { NONE, STREAM_PACKED = 0x4, FLAG_10 = 0x10, FULL_MOVEMENT = 0x20, ENTITY_HEADER = 0x40 } }
using System; using System.Runtime.InteropServices; using PolarisServer.Models; namespace PolarisServer.Models { public struct PacketHeader { public UInt32 Size; public byte Type; public byte Subtype; public byte Flags1; public byte Flags2; public PacketHeader(int size, byte type, byte subtype, byte flags1, byte flags2) { this.Size = (uint)size; this.Type = type; this.Subtype = subtype; this.Flags1 = flags1; this.Flags2 = flags2; } public PacketHeader(byte type, byte subtype) : this(type, subtype, (byte)0) { } public PacketHeader(byte type, byte subtype, byte flags1) : this(0, type, subtype, flags1, 0) { } public PacketHeader(byte type, byte subtype, PacketFlags packetFlags) : this(type, subtype, (byte)packetFlags) { } } [Flags] public enum PacketFlags : byte { NONE, STREAM_PACKED = 0x4, FLAG_10 = 0x10, ENTITY_HEADER = 0x40 } }
agpl-3.0
C#
6f03e71ae0bea53e5b8f2b72bb7c5d96908852fa
Update variable naming.
AkshayHarshe/arcgis-runtime-samples-dotnet,Esri/arcgis-runtime-samples-dotnet,sharifulgeo/arcgis-runtime-samples-dotnet,Esri/arcgis-runtime-samples-dotnet,Arc3D/arcgis-runtime-samples-dotnet,Esri/arcgis-runtime-samples-dotnet
src/Desktop/ArcGISRuntimeSamplesDesktop/Samples/Scene/FeatureLayerFromLocalGeodatabase3d.xaml.cs
src/Desktop/ArcGISRuntimeSamplesDesktop/Samples/Scene/FeatureLayerFromLocalGeodatabase3d.xaml.cs
using Esri.ArcGISRuntime.Controls; using Esri.ArcGISRuntime.Data; using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Layers; using System; using System.Windows; using System.Windows.Controls; namespace ArcGISRuntime.Samples.Desktop { /// <summary> /// This sample shows how to add a FeatureLayer from a local .geodatabase file to the scene. /// </summary> /// <title>3D Feature Layer from Local Geodatabase</title> /// <category>Scene</category> /// <subcategory>Feature Layers</subcategory> public partial class FeatureLayerFromLocalGeodatabase3d : UserControl { private const string GeodatabasePath = @"..\..\..\samples-data\maps\usa.geodatabase"; public FeatureLayerFromLocalGeodatabase3d() { InitializeComponent(); CreateFeatureLayers(); } private async void CreateFeatureLayers() { try { var geodatabase = await Geodatabase.OpenAsync(GeodatabasePath); Envelope extent = null; foreach (var table in geodatabase.FeatureTables) { var featureLayer = new FeatureLayer() { ID = table.Name, DisplayName = table.Name, FeatureTable = table }; if (!Geometry.IsNullOrEmpty(table.ServiceInfo.Extent)) { if (Geometry.IsNullOrEmpty(extent)) extent = table.ServiceInfo.Extent; else extent = extent.Union(table.ServiceInfo.Extent); } MySceneView.Scene.Layers.Add(featureLayer); } await MySceneView.SetViewAsync(new Camera(new MapPoint(-99.343, 26.143, 5881928.401), 2.377, 10.982)); } catch (Exception ex) { MessageBox.Show("Error creating feature layer: " + ex.Message, "Samples"); } } } }
using Esri.ArcGISRuntime.Controls; using Esri.ArcGISRuntime.Data; using Esri.ArcGISRuntime.Geometry; using Esri.ArcGISRuntime.Layers; using System; using System.Windows; using System.Windows.Controls; namespace ArcGISRuntime.Samples.Desktop { /// <summary> /// This sample shows how to add a FeatureLayer from a local .geodatabase file to the scene. /// </summary> /// <title>3D Feature Layer from Local Geodatabase</title> /// <category>Scene</category> /// <subcategory>Feature Layers</subcategory> public partial class FeatureLayerFromLocalGeodatabase3d : UserControl { private const string GDB_PATH = @"..\..\..\samples-data\maps\usa.geodatabase"; /// <summary>Construct FeatureLayerFromLocalGeodatabase sample control</summary> public FeatureLayerFromLocalGeodatabase3d() { InitializeComponent(); CreateFeatureLayers(); } private async void CreateFeatureLayers() { try { var gdb = await Geodatabase.OpenAsync(GDB_PATH); Envelope extent = null; foreach (var table in gdb.FeatureTables) { var flayer = new FeatureLayer() { ID = table.Name, DisplayName = table.Name, FeatureTable = table }; if (!Geometry.IsNullOrEmpty(table.ServiceInfo.Extent)) { if (Geometry.IsNullOrEmpty(extent)) extent = table.ServiceInfo.Extent; else extent = extent.Union(table.ServiceInfo.Extent); } MySceneView.Scene.Layers.Add(flayer); } await MySceneView.SetViewAsync(new Camera(new MapPoint(-99.343, 26.143, 5881928.401), 2.377, 10.982)); } catch (Exception ex) { MessageBox.Show("Error creating feature layer: " + ex.Message, "Samples"); } } } }
apache-2.0
C#
15b29e191c969719ce4dba36683c99900dc6e75c
Update TestFederatedPegBlockDefinition.cs (#3366)
bokobza/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode
src/Stratis.Features.FederatedPeg.IntegrationTests/Utils/TestFederatedPegBlockDefinition.cs
src/Stratis.Features.FederatedPeg.IntegrationTests/Utils/TestFederatedPegBlockDefinition.cs
using Microsoft.Extensions.Logging; using NBitcoin; using Stratis.Bitcoin.Consensus; using Stratis.Bitcoin.Features.Consensus.CoinViews; using Stratis.Bitcoin.Features.MemoryPool; using Stratis.Bitcoin.Features.MemoryPool.Interfaces; using Stratis.Bitcoin.Features.Miner; using Stratis.Bitcoin.Features.SmartContracts; using Stratis.Bitcoin.Features.SmartContracts.PoA; using Stratis.Bitcoin.Mining; using Stratis.Bitcoin.Utilities; using Stratis.SmartContracts.Core; using Stratis.SmartContracts.Core.State; using Stratis.SmartContracts.Core.Util; namespace Stratis.Features.FederatedPeg.IntegrationTests.Utils { /// <summary> /// Exact same as FederatedPegBlockDefinition, just gives the premine to a wallet for convenience. /// </summary> public class TestFederatedPegBlockDefinition : SmartContractPoABlockDefinition { public TestFederatedPegBlockDefinition( IBlockBufferGenerator blockBufferGenerator, ICoinView coinView, IConsensusManager consensusManager, IDateTimeProvider dateTimeProvider, IContractExecutorFactory executorFactory, ILoggerFactory loggerFactory, ITxMempool mempool, MempoolSchedulerLock mempoolLock, Network network, ISenderRetriever senderRetriever, IStateRepositoryRoot stateRoot, MinerSettings minerSettings) : base(blockBufferGenerator, coinView, consensusManager, dateTimeProvider, executorFactory, loggerFactory, mempool, mempoolLock, network, senderRetriever, stateRoot, minerSettings) { } public override BlockTemplate Build(ChainedHeader chainTip, Script scriptPubKey) { return base.Build(chainTip, scriptPubKey); } } }
using Microsoft.Extensions.Logging; using NBitcoin; using Stratis.Bitcoin.Configuration; using Stratis.Bitcoin.Consensus; using Stratis.Bitcoin.Features.Consensus.CoinViews; using Stratis.Bitcoin.Features.MemoryPool; using Stratis.Bitcoin.Features.MemoryPool.Interfaces; using Stratis.Bitcoin.Features.SmartContracts; using Stratis.Bitcoin.Features.SmartContracts.PoA; using Stratis.Bitcoin.Mining; using Stratis.Bitcoin.Utilities; using Stratis.SmartContracts.Core; using Stratis.SmartContracts.Core.State; using Stratis.SmartContracts.Core.Util; namespace Stratis.Features.FederatedPeg.IntegrationTests.Utils { /// <summary> /// Exact same as FederatedPegBlockDefinition, just gives the premine to a wallet for convenience. /// </summary> public class TestFederatedPegBlockDefinition : SmartContractPoABlockDefinition { /// <inheritdoc /> public TestFederatedPegBlockDefinition( IBlockBufferGenerator blockBufferGenerator, ICoinView coinView, IConsensusManager consensusManager, IDateTimeProvider dateTimeProvider, IContractExecutorFactory executorFactory, ILoggerFactory loggerFactory, ITxMempool mempool, MempoolSchedulerLock mempoolLock, Network network, ISenderRetriever senderRetriever, IStateRepositoryRoot stateRoot, NodeSettings nodeSettings) : base(blockBufferGenerator, coinView, consensusManager, dateTimeProvider, executorFactory, loggerFactory, mempool, mempoolLock, network, senderRetriever, stateRoot, nodeSettings) { var federationGatewaySettings = new FederationGatewaySettings(nodeSettings); } public override BlockTemplate Build(ChainedHeader chainTip, Script scriptPubKey) { return base.Build(chainTip, scriptPubKey); } } }
mit
C#
23f0f196d362cbc00a36401e08119a581c5a7ee0
Update WebApiConfig.cs
cayodonatti/TopGearApi
TopGearApi/App_Start/WebApiConfig.cs
TopGearApi/App_Start/WebApiConfig.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web.Http; namespace TopGearApi { public static class WebApiConfig { public static void Register(HttpConfiguration config) { // Web API configuration and services // Web API routes config.MapHttpAttributeRoutes(); /* config.Routes.MapHttpRoute( name: "ActionApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } ); */ config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web.Http; namespace TopGearApi { public static class WebApiConfig { public static void Register(HttpConfiguration config) { // Web API configuration and services // Web API routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "ActionApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } ); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); } } }
mit
C#
bcf529d1c3e0945db12274ca1cba7d640dadf354
Remove EN-us culture from assembly attributes.
provisiondata/Provision.AspNet.Identity.PlainSql
src/Provision.AspNet.Identity.PlainSql/Properties/AssemblyInfo.cs
src/Provision.AspNet.Identity.PlainSql/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Provision.AspNet.Identity.PlainSql")] [assembly: AssemblyDescription("ASP.NET Identity provider for SQL databases")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Provision Data Systems Inc.")] [assembly: AssemblyProduct("Provision.AspNet.Identity.PlainSql")] [assembly: AssemblyCopyright("Copyright © 2016 Provision Data Systems Inc.")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9248deff-4947-481f-ba7c-09e9925e62d2")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Provision.AspNet.Identity.PlainSql")] [assembly: AssemblyDescription("ASP.NET Identity provider for SQL databases")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Provision Data Systems Inc.")] [assembly: AssemblyProduct("Provision.AspNet.Identity.PlainSql")] [assembly: AssemblyCopyright("Copyright © 2016 Provision Data Systems Inc.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("EN-us")] [assembly: ComVisible(false)] [assembly: Guid("9248deff-4947-481f-ba7c-09e9925e62d2")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
mit
C#
284b86ef5c9f8c63efee2e0c0bcda68b303e4f0c
use Path.Combine(...) in place of hard-coded path separators
mrward/monodevelop-nuget-addin
src/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetPackageRestoreCommandLine.cs
src/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetPackageRestoreCommandLine.cs
// // NuGetPackageRestoreCommandLine.cs // // Author: // Matt Ward <ward.matt@gmail.com> // // Copyright (C) 2013 Matthew Ward // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using NuGet; namespace ICSharpCode.PackageManagement { public class NuGetPackageRestoreCommandLine { public NuGetPackageRestoreCommandLine(IPackageManagementSolution solution) { GenerateCommandLine(solution); GenerateWorkingDirectory(solution); } public string Command { get; set; } public string Arguments { get; private set; } public string WorkingDirectory { get; private set; } void GenerateCommandLine(IPackageManagementSolution solution) { if (EnvironmentUtility.IsMonoRuntime) { GenerateMonoCommandLine(solution); } else { GenerateWindowsCommandLine(solution); } } void GenerateMonoCommandLine(IPackageManagementSolution solution) { Arguments = String.Format( "--runtime=v4.0 \"{0}\" restore \"{1}\"", NuGetExePath.GetPath(), solution.FileName); var monoPrefix = MonoDevelop.Core.Assemblies.MonoRuntimeInfo.FromCurrentRuntime().Prefix; Command = Path.Combine(monoPrefix, "bin", "mono"); } void GenerateWindowsCommandLine(IPackageManagementSolution solution) { Arguments = String.Format("restore \"{0}\"", solution.FileName); Command = NuGetExePath.GetPath(); } void GenerateWorkingDirectory(IPackageManagementSolution solution) { WorkingDirectory = Path.GetDirectoryName(solution.FileName); } public override string ToString() { return String.Format("{0} {1}", GetQuotedCommand(), Arguments); } string GetQuotedCommand() { if (Command.Contains(" ")) { return String.Format("\"{0}\"", Command); } return Command; } } }
// // NuGetPackageRestoreCommandLine.cs // // Author: // Matt Ward <ward.matt@gmail.com> // // Copyright (C) 2013 Matthew Ward // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using NuGet; namespace ICSharpCode.PackageManagement { public class NuGetPackageRestoreCommandLine { public NuGetPackageRestoreCommandLine(IPackageManagementSolution solution) { GenerateCommandLine(solution); GenerateWorkingDirectory(solution); } public string Command { get; set; } public string Arguments { get; private set; } public string WorkingDirectory { get; private set; } void GenerateCommandLine(IPackageManagementSolution solution) { if (EnvironmentUtility.IsMonoRuntime) { GenerateMonoCommandLine(solution); } else { GenerateWindowsCommandLine(solution); } } void GenerateMonoCommandLine(IPackageManagementSolution solution) { Arguments = String.Format( "--runtime=v4.0 \"{0}\" restore \"{1}\"", NuGetExePath.GetPath(), solution.FileName); var monoPrefix = MonoDevelop.Core.Assemblies.MonoRuntimeInfo.FromCurrentRuntime().Prefix; Command = monoPrefix + "/bin/mono"; } void GenerateWindowsCommandLine(IPackageManagementSolution solution) { Arguments = String.Format("restore \"{0}\"", solution.FileName); Command = NuGetExePath.GetPath(); } void GenerateWorkingDirectory(IPackageManagementSolution solution) { WorkingDirectory = Path.GetDirectoryName(solution.FileName); } public override string ToString() { return String.Format("{0} {1}", GetQuotedCommand(), Arguments); } string GetQuotedCommand() { if (Command.Contains(" ")) { return String.Format("\"{0}\"", Command); } return Command; } } }
mit
C#
0ba6b7246e63a3fd8ab1d1c530be7f5a4b26523f
Rework extension to spend less time on UI thread
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity
Assets/MixedRealityToolkit.Providers/WindowsMixedReality/Extensions/InteractionSourceExtensions.cs
Assets/MixedRealityToolkit.Providers/WindowsMixedReality/Extensions/InteractionSourceExtensions.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. #if WINDOWS_UWP using Microsoft.MixedReality.Toolkit.Windows.Utilities; using System; using System.Collections.Generic; using UnityEngine.XR.WSA.Input; using Windows.Foundation; using Windows.Perception; using Windows.Storage.Streams; using Windows.UI.Input.Spatial; #endif namespace Microsoft.MixedReality.Toolkit.Windows.Input { /// <summary> /// Extensions for the InteractionSource class to expose the renderable model. /// </summary> public static class InteractionSourceExtensions { #if WINDOWS_UWP public static IAsyncOperation<IRandomAccessStreamWithContentType> TryGetRenderableModelAsync(this InteractionSource interactionSource) { IAsyncOperation<IRandomAccessStreamWithContentType> returnValue = null; if (WindowsApiChecker.UniversalApiContractV5_IsAvailable) { IReadOnlyList<SpatialInteractionSourceState> sources = null; UnityEngine.WSA.Application.InvokeOnUIThread(() => { sources = SpatialInteractionManager.GetForCurrentView()?.GetDetectedSourcesAtTimestamp(PerceptionTimestampHelper.FromHistoricalTargetTime(DateTimeOffset.Now)); }, true); for (var i = 0; i < sources?.Count; i++) { if (sources[i].Source.Id.Equals(interactionSource.id)) { returnValue = sources[i].Source.Controller.TryGetRenderableModelAsync(); } } } return returnValue; } #endif // WINDOWS_UWP } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. #if WINDOWS_UWP using Microsoft.MixedReality.Toolkit.Windows.Utilities; using System; using System.Collections.Generic; using UnityEngine.XR.WSA.Input; using Windows.Foundation; using Windows.Perception; using Windows.Storage.Streams; using Windows.UI.Input.Spatial; #endif namespace Microsoft.MixedReality.Toolkit.Windows.Input { /// <summary> /// Extensions for the InteractionSource class to expose the renderable model. /// </summary> public static class InteractionSourceExtensions { #if WINDOWS_UWP public static IAsyncOperation<IRandomAccessStreamWithContentType> TryGetRenderableModelAsync(this InteractionSource interactionSource) { IAsyncOperation<IRandomAccessStreamWithContentType> returnValue = null; if (WindowsApiChecker.UniversalApiContractV5_IsAvailable) { UnityEngine.WSA.Application.InvokeOnUIThread(() => { IReadOnlyList<SpatialInteractionSourceState> sources = SpatialInteractionManager.GetForCurrentView()?.GetDetectedSourcesAtTimestamp(PerceptionTimestampHelper.FromHistoricalTargetTime(DateTimeOffset.Now)); for (var i = 0; i < sources.Count; i++) { if (sources[i].Source.Id.Equals(interactionSource.id)) { returnValue = sources[i].Source.Controller.TryGetRenderableModelAsync(); } } }, true); } return returnValue; } #endif // WINDOWS_UWP } }
mit
C#
ae016b271bae94d0b4d20ccae76dd1e8d773f405
use 32bit index by default on Unity 2017 or newer
unity3d-jp/AlembicImporter,unity3d-jp/AlembicImporter,unity3d-jp/AlembicImporter
AlembicImporter/Assets/UTJ/Alembic/Scripts/Importer/AlembicSettings.cs
AlembicImporter/Assets/UTJ/Alembic/Scripts/Importer/AlembicSettings.cs
using UnityEngine; namespace UTJ.Alembic { [System.Serializable] public class AlembicStreamSettings { [SerializeField] public AbcAPI.aiNormalsMode normalsMode = AbcAPI.aiNormalsMode.ComputeIfMissing; [SerializeField] public AbcAPI.aiTangentsMode tangentsMode = AbcAPI.aiTangentsMode.Smooth; [SerializeField] public AbcAPI.aiAspectRatioMode aspectRatioMode = AbcAPI.aiAspectRatioMode.CurrentResolution; [SerializeField] public bool swapHandedness = true; [SerializeField] public bool swapFaceWinding = false; [SerializeField] public bool turnQuadEdges = false; [SerializeField] public bool shareVertices = true; [SerializeField] public bool treatVertexExtraDataAsStatics = false; [SerializeField] public bool cacheSamples = false; [SerializeField] public bool use32BitsIndexBuffer = false; public AlembicStreamSettings() { #if UNITY_2017_3_OR_NEWER use32BitsIndexBuffer = true; #endif } } }
using UnityEngine; namespace UTJ.Alembic { [System.Serializable] public class AlembicStreamSettings { [SerializeField] public AbcAPI.aiNormalsMode normalsMode = AbcAPI.aiNormalsMode.ComputeIfMissing; [SerializeField] public AbcAPI.aiTangentsMode tangentsMode = AbcAPI.aiTangentsMode.Smooth; [SerializeField] public AbcAPI.aiAspectRatioMode aspectRatioMode = AbcAPI.aiAspectRatioMode.CurrentResolution; [SerializeField] public bool swapHandedness = true; [SerializeField] public bool swapFaceWinding = false; [SerializeField] public bool turnQuadEdges = false; [SerializeField] public bool shareVertices = true; [SerializeField] public bool treatVertexExtraDataAsStatics = false; [SerializeField] public bool cacheSamples = false; [SerializeField] public bool use32BitsIndexBuffer = false; } }
mit
C#
29d47fdfa9eafa7b048546a967c27098b6947c5e
Fix tests failing
hmemcpy/AgentMulder
src/AgentMulder.ReSharper.Tests/ReSharperTestEnvironmentAssembly.cs
src/AgentMulder.ReSharper.Tests/ReSharperTestEnvironmentAssembly.cs
using System; using JetBrains.Application.BuildScript.Application.Zones; using JetBrains.ReSharper.TestFramework; using JetBrains.TestFramework; using JetBrains.TestFramework.Application.Zones; using NUnit.Framework; [assembly: RequiresSTA] /// <summary> /// Test environment. Must be in the global namespace. /// </summary> // ReSharper disable CheckNamespace [ZoneDefinition] // ReSharper disable once CheckNamespace public class TestEnvironmentZone : ITestsZone, IRequire<PsiFeatureTestZone> { } [SetUpFixture] public class ReSharperTestEnvironmentAssembly : ExtensionTestEnvironmentAssembly<TestEnvironmentZone> { }
using System; using System.Collections.Generic; using JetBrains.Application; using JetBrains.Application.BuildScript.Application; using JetBrains.Application.BuildScript.Application.Zones; using JetBrains.Application.BuildScript.PackageSpecification; using JetBrains.Application.BuildScript.Solution; using JetBrains.Application.Environment; using JetBrains.Application.Environment.HostParameters; using JetBrains.Metadata.Reader.API; using JetBrains.Metadata.Utils; using JetBrains.ReSharper.TestFramework; using JetBrains.TestFramework; using JetBrains.TestFramework.Application.Zones; using NUnit.Framework; /// <summary> /// Test environment. Must be in the global namespace. /// </summary> // ReSharper disable CheckNamespace [ZoneDefinition] // ReSharper disable once CheckNamespace public class TestEnvironmentZone : ITestsZone, IRequire<PsiFeatureTestZone> { } [SetUpFixture] public class ReSharperTestEnvironmentAssembly : ExtensionTestEnvironmentAssembly<TestEnvironmentZone> { }
mit
C#
11ab042c70906072bc88da453d787daa45980413
improve code style.
Faithlife/FaithlifeUtility
src/Faithlife.Utility/ByteUtility.cs
src/Faithlife.Utility/ByteUtility.cs
using System; namespace Faithlife.Utility { /// <summary> /// Provides helper methods for working with <see cref="byte"/>. /// </summary> public static class ByteUtility { /// <summary> /// Converts the specified string representation of bytes into a byte array. /// </summary> /// <param name="value">The byte values; these must be hexadecimal numbers with no padding or separators.</param> /// <returns>A byte array containing the bytes represented in the string.</returns> public static byte[] ToBytes(string value) { if (value == null) throw new ArgumentNullException(nameof(value)); if (value.Length % 2 != 0) throw new ArgumentException("There must be an even number of characters in the string.", nameof(value)); byte[] bytes = new byte[value.Length / 2]; for (int index = 0; index < bytes.Length; index++) bytes[index] = (byte) (ConvertToNibble(value[index * 2]) * 16 + ConvertToNibble(value[index * 2 + 1])); return bytes; } /// <summary> /// Converts the specified byte array to a string of hex digits. /// </summary> /// <param name="bytes">The byte array to convert.</param> /// <returns>A string containing two hexadecimal digits for each input byte.</returns> public static string ToString(byte[] bytes) { if (bytes == null) throw new ArgumentNullException(nameof(bytes)); const string hexDigits = "0123456789ABCDEF"; // allocate char array and fill it with high and low nibbles of each byte char[] chars = new char[bytes.Length * 2]; for (int index = 0; index < chars.Length; index += 2) { byte by = bytes[index / 2]; chars[index] = hexDigits[by / 16]; chars[index + 1] = hexDigits[by % 16]; } return new string(chars); } private static int ConvertToNibble(char ch) { if (ch >= '0' && ch <= '9') return ch - '0'; else if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10; else if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10; else throw new ArgumentOutOfRangeException(nameof(ch)); } } }
using System; namespace Faithlife.Utility { /// <summary> /// Provides helper methods for working with <see cref="byte"/>. /// </summary> public static class ByteUtility { /// <summary> /// Converts the specified string representation of bytes into a byte array. /// </summary> /// <param name="value">The byte values; these must be hexadecimal numbers with no padding or separators.</param> /// <returns>A byte array containing the bytes represented in the string.</returns> public static byte[] ToBytes(string value) { if (value == null) throw new ArgumentNullException(nameof(value)); if (value.Length % 2 != 0) throw new ArgumentException("There must be an even number of characters in the string.", nameof(value)); byte[] bytes = new byte[value.Length / 2]; for (int nByte = 0; nByte < bytes.Length; nByte++) bytes[nByte] = (byte) (ConvertToNibble(value[nByte * 2]) * 16 + ConvertToNibble(value[nByte * 2 + 1])); return bytes; } /// <summary> /// Converts the specified byte array to a string of hex digits. /// </summary> /// <param name="bytes">The byte array to convert.</param> /// <returns>A string containing two hexadecimal digits for each input byte.</returns> public static string ToString(byte[] bytes) { if (bytes == null) throw new ArgumentNullException(nameof(bytes)); const string c_strHexDigits = "0123456789ABCDEF"; // allocate char array and fill it with high and low nibbles of each byte char[] chars = new char[bytes.Length * 2]; for (int nIndex = 0; nIndex < chars.Length; nIndex += 2) { byte by = bytes[nIndex / 2]; chars[nIndex] = c_strHexDigits[by / 16]; chars[nIndex + 1] = c_strHexDigits[by % 16]; } return new string(chars); } private static int ConvertToNibble(char ch) { if (ch >= '0' && ch <= '9') return ch - '0'; else if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10; else if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10; else throw new ArgumentOutOfRangeException(nameof(ch)); } } }
mit
C#
b005dc3756b3d8c09dbba6f2152847b0e97f83b0
add in virtual to be nice
AnthonySteele/SevenDigital.Api.Wrapper,actionshrimp/SevenDigital.Api.Wrapper,danhaller/SevenDigital.Api.Wrapper,minkaotic/SevenDigital.Api.Wrapper,gregsochanik/SevenDigital.Api.Wrapper,emashliles/SevenDigital.Api.Wrapper,bnathyuw/SevenDigital.Api.Wrapper,raoulmillais/SevenDigital.Api.Wrapper,luiseduardohdbackup/SevenDigital.Api.Wrapper,knocte/SevenDigital.Api.Wrapper,danbadge/SevenDigital.Api.Wrapper,bettiolo/SevenDigital.Api.Wrapper,mattgray/SevenDigital.Api.Wrapper
src/SevenDigital.Api.Wrapper/EndpointResolution/EndpointResolver.cs
src/SevenDigital.Api.Wrapper/EndpointResolution/EndpointResolver.cs
using System; using SevenDigital.Api.Wrapper.EndpointResolution.OAuth; using SevenDigital.Api.Wrapper.Utility.Http; using System.Collections.Generic; namespace SevenDigital.Api.Wrapper.EndpointResolution { public class EndpointResolver : IEndpointResolver { private readonly IUrlResolver _urlResolver; private readonly IUrlSigner _urlSigner; private readonly IOAuthCredentials _oAuthCredentials; private readonly IApiUri _apiUri; public EndpointResolver(IUrlResolver urlResolver, IUrlSigner urlSigner, IOAuthCredentials oAuthCredentials, IApiUri apiUri) { _urlResolver = urlResolver; _urlSigner = urlSigner; _oAuthCredentials = oAuthCredentials; _apiUri = apiUri; } public virtual string HitEndpoint(EndPointInfo endPointInfo) { Uri signedUrl = GetSignedUrl(endPointInfo); return _urlResolver.Resolve(signedUrl, endPointInfo.HttpMethod, new Dictionary<string, string>()); } public virtual void HitEndpointAsync(EndPointInfo endPointInfo, Action<string> payload) { Uri signedUrl = GetSignedUrl(endPointInfo); _urlResolver.ResolveAsync(signedUrl, endPointInfo.HttpMethod, new Dictionary<string, string>(), payload); } private Uri GetSignedUrl(EndPointInfo endPointInfo) { string apiUri = _apiUri.Uri; if (endPointInfo.UseHttps) apiUri = apiUri.Replace("http://", "https://"); var uriString = string.Format("{0}/{1}?oauth_consumer_key={2}&{3}", apiUri, endPointInfo.Uri, _oAuthCredentials.ConsumerKey, endPointInfo.Parameters.ToQueryString()).TrimEnd('&'); var signedUrl = new Uri(uriString); if (endPointInfo.IsSigned) signedUrl = _urlSigner.SignUrl(uriString, endPointInfo.UserToken, endPointInfo.UserSecret, _oAuthCredentials); return signedUrl; } } }
using System; using SevenDigital.Api.Wrapper.EndpointResolution.OAuth; using SevenDigital.Api.Wrapper.Utility.Http; using System.Collections.Generic; namespace SevenDigital.Api.Wrapper.EndpointResolution { public class EndpointResolver : IEndpointResolver { private readonly IUrlResolver _urlResolver; private readonly IUrlSigner _urlSigner; private readonly IOAuthCredentials _oAuthCredentials; private readonly IApiUri _apiUri; public EndpointResolver(IUrlResolver urlResolver, IUrlSigner urlSigner, IOAuthCredentials oAuthCredentials, IApiUri apiUri) { _urlResolver = urlResolver; _urlSigner = urlSigner; _oAuthCredentials = oAuthCredentials; _apiUri = apiUri; } public string HitEndpoint(EndPointInfo endPointInfo) { Uri signedUrl = GetSignedUrl(endPointInfo); return _urlResolver.Resolve(signedUrl, endPointInfo.HttpMethod, new Dictionary<string, string>()); } public void HitEndpointAsync(EndPointInfo endPointInfo, Action<string> payload) { Uri signedUrl = GetSignedUrl(endPointInfo); _urlResolver.ResolveAsync(signedUrl, endPointInfo.HttpMethod, new Dictionary<string, string>(), payload); } private Uri GetSignedUrl(EndPointInfo endPointInfo) { string apiUri = _apiUri.Uri; if (endPointInfo.UseHttps) apiUri = apiUri.Replace("http://", "https://"); var uriString = string.Format("{0}/{1}?oauth_consumer_key={2}&{3}", apiUri, endPointInfo.Uri, _oAuthCredentials.ConsumerKey, endPointInfo.Parameters.ToQueryString()).TrimEnd('&'); var signedUrl = new Uri(uriString); if (endPointInfo.IsSigned) signedUrl = _urlSigner.SignUrl(uriString, endPointInfo.UserToken, endPointInfo.UserSecret, _oAuthCredentials); return signedUrl; } } }
mit
C#
295729fb7bd23e592560e408b62771b5b1f8d3f1
Make sure Issues are at correct index
furore-fhir/spark,furore-fhir/spark,furore-fhir/spark
src/Spark.Engine.Test/Extensions/OperationOutcomeInnerErrorsTest.cs
src/Spark.Engine.Test/Extensions/OperationOutcomeInnerErrorsTest.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Hl7.Fhir.Model; using Microsoft.VisualStudio.TestTools.UnitTesting; using Spark.Engine.Extensions; namespace Spark.Engine.Test.Extensions { [TestClass] public class OperationOutcomeInnerErrorsTest { [TestMethod] public void AddAllInnerErrorsTest() { OperationOutcome outcome; try { try { try { throw new Exception("Third error level"); } catch (Exception e3) { throw new Exception("Second error level", e3); } } catch (Exception e2) { throw new Exception("First error level", e2); } } catch (Exception e1) { outcome = new OperationOutcome().AddAllInnerErrors(e1); } Assert.IsTrue(outcome.Issue.FindIndex(i => i.Diagnostics.Equals("Exception: First error level")) == 0, "First error level should be at index 0"); Assert.IsTrue(outcome.Issue.FindIndex(i => i.Diagnostics.Equals("Exception: Second error level")) == 1, "Second error level should be at index 1"); Assert.IsTrue(outcome.Issue.FindIndex(i => i.Diagnostics.Equals("Exception: Third error level")) == 2, "Third error level should be at index 2"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Hl7.Fhir.Model; using Microsoft.VisualStudio.TestTools.UnitTesting; using Spark.Engine.Extensions; namespace Spark.Engine.Test.Extensions { [TestClass] public class OperationOutcomeInnerErrorsTest { [TestMethod] public void AddAllInnerErrorsTest() { OperationOutcome outcome; try { try { try { throw new Exception("Third error level"); } catch (Exception e3) { throw new Exception("Second error level", e3); } } catch (Exception e2) { throw new Exception("First error level", e2); } } catch (Exception e1) { outcome = new OperationOutcome().AddAllInnerErrors(e1); } Assert.IsFalse(!outcome.Issue.Any(i => i.Diagnostics.Equals("Exception: First error level")), "No info about first error"); Assert.IsFalse(!outcome.Issue.Any(i => i.Diagnostics.Equals("Exception: Second error level")), "No info about second error"); Assert.IsFalse(!outcome.Issue.Any(i => i.Diagnostics.Equals("Exception: Third error level")), "No info about third error"); } } }
bsd-3-clause
C#
47255667cfbb4b26c01bb9cf2294079f9b2509cb
Rename method
CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,dotnet/roslyn,mavasani/roslyn
src/Workspaces/Core/Portable/Workspace/Host/HostSolutionServices.cs
src/Workspaces/Core/Portable/Workspace/Host/HostSolutionServices.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; namespace Microsoft.CodeAnalysis.Host { // TODO(cyrusn): Make public. Tracked through https://github.com/dotnet/roslyn/issues/62914 internal sealed class HostSolutionServices { /// <remarks> /// Note: do not expose publicly. <see cref="HostWorkspaceServices"/> exposes a <see /// cref="HostWorkspaceServices.Workspace"/> which we want to avoid doing from our immutable snapshots. /// </remarks> private readonly HostWorkspaceServices _services; // This ensures a single instance of this type associated with each HostWorkspaceServices. [Obsolete("Do not call directly. Use HostWorkspaceServices.SolutionServices to acquire an instance")] internal HostSolutionServices(HostWorkspaceServices services) { _services = services; } /// <inheritdoc cref="HostWorkspaceServices.GetService"/> public TWorkspaceService? GetService<TWorkspaceService>() where TWorkspaceService : IWorkspaceService => _services.GetService<TWorkspaceService>(); /// <inheritdoc cref="HostWorkspaceServices.GetRequiredService"/> public TWorkspaceService GetRequiredService<TWorkspaceService>() where TWorkspaceService : IWorkspaceService => _services.GetRequiredService<TWorkspaceService>(); /// <inheritdoc cref="HostWorkspaceServices.SupportedLanguages"/> public IEnumerable<string> SupportedLanguages => _services.SupportedLanguages; /// <inheritdoc cref="HostWorkspaceServices.IsSupported"/> public bool IsSupported(string languageName) => _services.IsSupported(languageName); /// <summary> /// Gets the <see cref="HostProjectServices"/> for the language name. /// </summary> /// <exception cref="NotSupportedException">Thrown if the language isn't supported.</exception> public HostProjectServices GeProjectServices(string languageName) => _services.GetLanguageServices(languageName).ProjectServices; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; namespace Microsoft.CodeAnalysis.Host { // TODO(cyrusn): Make public. Tracked through https://github.com/dotnet/roslyn/issues/62914 internal sealed class HostSolutionServices { /// <remarks> /// Note: do not expose publicly. <see cref="HostWorkspaceServices"/> exposes a <see /// cref="HostWorkspaceServices.Workspace"/> which we want to avoid doing from our immutable snapshots. /// </remarks> private readonly HostWorkspaceServices _services; // This ensures a single instance of this type associated with each HostWorkspaceServices. [Obsolete("Do not call directly. Use HostWorkspaceServices.SolutionServices to acquire an instance")] internal HostSolutionServices(HostWorkspaceServices services) { _services = services; } /// <inheritdoc cref="HostWorkspaceServices.GetService"/> public TWorkspaceService? GetService<TWorkspaceService>() where TWorkspaceService : IWorkspaceService => _services.GetService<TWorkspaceService>(); /// <inheritdoc cref="HostWorkspaceServices.GetRequiredService"/> public TWorkspaceService GetRequiredService<TWorkspaceService>() where TWorkspaceService : IWorkspaceService => _services.GetRequiredService<TWorkspaceService>(); /// <inheritdoc cref="HostWorkspaceServices.SupportedLanguages"/> public IEnumerable<string> SupportedLanguages => _services.SupportedLanguages; /// <inheritdoc cref="HostWorkspaceServices.IsSupported"/> public bool IsSupported(string languageName) => _services.IsSupported(languageName); /// <summary> /// Gets the <see cref="HostProjectServices"/> for the language name. /// </summary> /// <exception cref="NotSupportedException">Thrown if the language isn't supported.</exception> public HostProjectServices GetLanguageServices(string languageName) => _services.GetLanguageServices(languageName).ProjectServices; } }
mit
C#
2833365c54033311e18ccd7472c18ad23e1f6086
Change interface Tick() signature to match implementation (#33)
Mpdreamz/shellprogressbar
src/ShellProgressBar/IProgressBar.cs
src/ShellProgressBar/IProgressBar.cs
using System; namespace ShellProgressBar { public interface IProgressBar : IDisposable { ChildProgressBar Spawn(int maxTicks, string message, ProgressBarOptions options = null); void Tick(string message = null); int MaxTicks { get; set; } string Message { get; set; } double Percentage { get; } int CurrentTick { get; } ConsoleColor ForeGroundColor { get; } } }
using System; namespace ShellProgressBar { public interface IProgressBar : IDisposable { ChildProgressBar Spawn(int maxTicks, string message, ProgressBarOptions options = null); void Tick(string message = ""); int MaxTicks { get; set; } string Message { get; set; } double Percentage { get; } int CurrentTick { get; } ConsoleColor ForeGroundColor { get; } } }
mit
C#
8e8797e0d8620576955eaeb7dc7f16c4808b33c4
Update test
DaveSenn/Extend
.Src/Extend.Testing/System.Assembly/Assembly.GetDefinedTypes.Test.cs
.Src/Extend.Testing/System.Assembly/Assembly.GetDefinedTypes.Test.cs
#region Usings using System; using System.Linq; using System.Reflection; using FluentAssertions; using Xunit; #endregion namespace Extend.Testing { public partial class AssemblyExTest { [Fact] public void GetDefinedTypesNullValueTest() { Assembly assembly = null; // ReSharper disable once ReturnValueOfPureMethodIsNotUsed // ReSharper disable once AssignNullToNotNullAttribute Action test = () => assembly.GetDefinedTypes(); test.ShouldThrow<ArgumentNullException>(); } /// <summary> /// TODO: Find a clever way to test this method. /// </summary> [Fact] public void GetDefinedTypesTest() { var actual = typeof(ActionEx) .GetDeclaringAssembly() .GetDefinedTypes(); actual.Count() .Should() .Be(274); } } }
#region Usings using System; using System.Linq; using System.Reflection; using FluentAssertions; using Xunit; #endregion namespace Extend.Testing { public partial class AssemblyExTest { [Fact] public void GetDefinedTypesNullValueTest() { Assembly assembly = null; // ReSharper disable once ReturnValueOfPureMethodIsNotUsed // ReSharper disable once AssignNullToNotNullAttribute Action test = () => assembly.GetDefinedTypes(); test.ShouldThrow<ArgumentNullException>(); } /// <summary> /// TODO: Find a clever way to test this method. /// </summary> [Fact] public void GetDefinedTypesTest() { var actual = typeof(ActionEx) .GetDeclaringAssembly() .GetDefinedTypes(); actual.Count() .Should() .Be(267); } } }
mit
C#
6a43ac1b2cd2bbfe048b85de04c0dde5920e69ce
fix tabs
QuinntyneBrown/ContactService,QuinntyneBrown/ContactService,QuinntyneBrown/ContactService,QuinntyneBrown/ContactService
src/ContactService/Data/Model/ContactRequest.cs
src/ContactService/Data/Model/ContactRequest.cs
using System; using System.Collections.Generic; using ContactService.Data.Helpers; using System.ComponentModel.DataAnnotations.Schema; namespace ContactService.Data.Model { [SoftDelete("IsDeleted")] public class ContactRequest: ILoggable { public int Id { get; set; } [ForeignKey("Tenant")] public int? TenantId { get; set; } [Index("NameIndex", IsUnique = false)] [Column(TypeName = "VARCHAR")] public string Name { get; set; } public string Email { get; set; } public string Description { get; set; } public DateTime CreatedOn { get; set; } public DateTime LastModifiedOn { get; set; } public string CreatedBy { get; set; } public string LastModifiedBy { get; set; } public bool IsDeleted { get; set; } public virtual Tenant Tenant { get; set; } } }
using System; using System.Collections.Generic; using ContactService.Data.Helpers; using System.ComponentModel.DataAnnotations.Schema; namespace ContactService.Data.Model { [SoftDelete("IsDeleted")] public class ContactRequest: ILoggable { public int Id { get; set; } [ForeignKey("Tenant")] public int? TenantId { get; set; } [Index("NameIndex", IsUnique = false)] [Column(TypeName = "VARCHAR")] public string Name { get; set; } public string Email { get; set; } public string Description { get; set; } public DateTime CreatedOn { get; set; } public DateTime LastModifiedOn { get; set; } public string CreatedBy { get; set; } public string LastModifiedBy { get; set; } public bool IsDeleted { get; set; } public virtual Tenant Tenant { get; set; } } }
mit
C#
6d64ed8894a6e8692b889b4f93e65d0f2523770c
Bump version to 1.0.2
Ky7m/Roslyn.Utilities
src/Roslyn.Utilities/Properties/AssemblyInfo.cs
src/Roslyn.Utilities/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Roslyn.Utilities")] [assembly: AssemblyProduct("Roslyn.Utilities")] [assembly: AssemblyVersion("1.0.2")] [assembly: AssemblyFileVersion("1.0.2")] [assembly: InternalsVisibleTo("Roslyn.Utilities.Tests")]
using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Roslyn.Utilities")] [assembly: AssemblyProduct("Roslyn.Utilities")] [assembly: AssemblyVersion("1.0.1")] [assembly: AssemblyFileVersion("1.0.1")] [assembly: InternalsVisibleTo("Roslyn.Utilities.Tests")]
apache-2.0
C#
d31ef0fa0b2296de177d4ce23b5d66a67010d3ae
Bump Cake.Recipe from 2.1.0 to 2.2.0
agc93/Cake.BuildSystems.Module,agc93/Cake.BuildSystems.Module
recipe.cake
recipe.cake
#load nuget:?package=Cake.Recipe&version=2.2.0 Environment.SetVariableNames(); var standardNotificationMessage = "Version {0} of {1} has just been released, this will be available here https://www.nuget.org/packages/{1}, once package indexing is complete."; BuildParameters.SetParameters( context: Context, buildSystem: BuildSystem, sourceDirectoryPath: "./src", title: "Cake.BuildSystems.Module", repositoryOwner: "cake-contrib", shouldRunDupFinder: false, // leave this out, for now. shouldRunDotNetCorePack: true, shouldUseDeterministicBuilds: true, gitterMessage: "@/all " + standardNotificationMessage, twitterMessage: standardNotificationMessage); BuildParameters.PrintParameters(Context); ToolSettings.SetToolSettings(context: Context); Build.RunDotNetCore();
#load nuget:?package=Cake.Recipe&version=2.1.0 Environment.SetVariableNames(); var standardNotificationMessage = "Version {0} of {1} has just been released, this will be available here https://www.nuget.org/packages/{1}, once package indexing is complete."; BuildParameters.SetParameters( context: Context, buildSystem: BuildSystem, sourceDirectoryPath: "./src", title: "Cake.BuildSystems.Module", repositoryOwner: "cake-contrib", shouldRunDupFinder: false, // leave this out, for now. shouldRunDotNetCorePack: true, shouldUseDeterministicBuilds: true, gitterMessage: "@/all " + standardNotificationMessage, twitterMessage: standardNotificationMessage); BuildParameters.PrintParameters(Context); ToolSettings.SetToolSettings(context: Context); Build.RunDotNetCore();
mit
C#
cc273aea8fe8fdabfdb68ae3a3f6f308947ea0ad
hide cursor
bschug/CLaUn.vs.SnaKe
Assets/Scripts/Metagame/Intro.cs
Assets/Scripts/Metagame/Intro.cs
using UnityEngine; using System.Collections; using System.Collections.Generic; public class Intro : SingletonMonoBehaviour<Intro> { public GameObject SplashScreen; GameObject LittleClown { get { return PlayerRegistry.Instance.LittleClown; } } GameObject BigClown { get { return PlayerRegistry.Instance.BigClown; } } Dictionary<ClownId, bool> HasThrown = new Dictionary<ClownId, bool>(); public bool TutorialComplete { get { return HasThrown[ClownId.Little] && HasThrown[ClownId.Big]; } } public void BallThrown (ClownId clownId) { HasThrown[clownId] = true; } void Start() { Cursor.visible = false; StartCoroutine( Co_Intro() ); HasThrown[ClownId.Little] = false; HasThrown[ClownId.Big] = false; } IEnumerator Co_Intro() { yield return StartCoroutine( Co_DropClowns() ); StartCoroutine( Co_ShowIntroText() ); } IEnumerator Co_DropClowns() { yield return null; } IEnumerator Co_ShowIntroText() { SplashScreen.SetActive( true ); while (!TutorialComplete) { yield return null; } SplashScreen.SetActive( false ); SnakeFactory.Instance.SpawnSnake(); } }
using UnityEngine; using System.Collections; using System.Collections.Generic; public class Intro : SingletonMonoBehaviour<Intro> { public GameObject SplashScreen; GameObject LittleClown { get { return PlayerRegistry.Instance.LittleClown; } } GameObject BigClown { get { return PlayerRegistry.Instance.BigClown; } } Dictionary<ClownId, bool> HasThrown = new Dictionary<ClownId, bool>(); public bool TutorialComplete { get { return HasThrown[ClownId.Little] && HasThrown[ClownId.Big]; } } public void BallThrown (ClownId clownId) { HasThrown[clownId] = true; } void Start() { StartCoroutine( Co_Intro() ); HasThrown[ClownId.Little] = false; HasThrown[ClownId.Big] = false; } IEnumerator Co_Intro() { yield return StartCoroutine( Co_DropClowns() ); StartCoroutine( Co_ShowIntroText() ); } IEnumerator Co_DropClowns() { yield return null; } IEnumerator Co_ShowIntroText() { SplashScreen.SetActive( true ); while (!TutorialComplete) { yield return null; } SplashScreen.SetActive( false ); SnakeFactory.Instance.SpawnSnake(); } }
mit
C#
503fe7a02d53c0dcaec68914a4f2f4fe967f166e
fix for WCF serialization not supporting properties with no setter
keith-hall/Showcase_CSharp_MunicipalityTaxSchedule
MunicipalityTaxes/MunicipalityTaxes/Entities/TaxScheduleActionResult.cs
MunicipalityTaxes/MunicipalityTaxes/Entities/TaxScheduleActionResult.cs
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace MunicipalityTaxes { [DataContract] public class TaxScheduleActionResult<T> { [DataMember] public TaxScheduleValidationResult Validity;// { get; } [DataMember] public T ActionResult;// { get; } public TaxScheduleActionResult(TaxScheduleValidationResult validityStatus, T actionResult) { Validity = validityStatus; ActionResult = actionResult; } public new string ToString() { return $"Validity: {Validity}, {typeof(T).Name}: {ActionResult}"; } } [DataContract] public enum TaxScheduleInsertionResult { [EnumMember] InsertionNotAttempted, [EnumMember] Success, [EnumMember] TaxScheduleAlreadyExists, [EnumMember] UnknownFailure, } }
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace MunicipalityTaxes { [DataContract] public class TaxScheduleActionResult<T> { [DataMember] public TaxScheduleValidationResult Validity { get; } [DataMember] public T ActionResult { get; } public TaxScheduleActionResult(TaxScheduleValidationResult validityStatus, T actionResult) { Validity = validityStatus; ActionResult = actionResult; } public new string ToString() { return $"Validity: {Validity}, {typeof(T).Name}: {ActionResult}"; } } [DataContract] public enum TaxScheduleInsertionResult { [EnumMember] InsertionNotAttempted, [EnumMember] Success, [EnumMember] TaxScheduleAlreadyExists, [EnumMember] UnknownFailure, } }
mit
C#
b737644208e0008eae06bdbe3a03b5ff9a527d1a
Add mania statistics
ppy/osu,smoogipoo/osu,NeoAdonis/osu,ZLima12/osu,UselessToucan/osu,NeoAdonis/osu,johnneijzen/osu,peppy/osu,peppy/osu,UselessToucan/osu,naoey/osu,2yangk23/osu,naoey/osu,EVAST9919/osu,johnneijzen/osu,peppy/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,ZLima12/osu,EVAST9919/osu,smoogipooo/osu,DrabWeb/osu,naoey/osu,DrabWeb/osu,2yangk23/osu,UselessToucan/osu,peppy/osu-new,DrabWeb/osu,ppy/osu,smoogipoo/osu
osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs
osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.UI; namespace osu.Game.Rulesets.Mania.Beatmaps { public class ManiaBeatmap : Beatmap<ManiaHitObject> { /// <summary> /// The definitions for each stage in a <see cref="ManiaPlayfield"/>. /// </summary> public List<StageDefinition> Stages = new List<StageDefinition>(); /// <summary> /// Total number of columns represented by all stages in this <see cref="ManiaBeatmap"/>. /// </summary> public int TotalColumns => Stages.Sum(g => g.Columns); /// <summary> /// Creates a new <see cref="ManiaBeatmap"/>. /// </summary> /// <param name="defaultStage">The initial stages.</param> public ManiaBeatmap(StageDefinition defaultStage) { Stages.Add(defaultStage); } public override IEnumerable<BeatmapStatistic> GetStatistics() { int holdnotes = HitObjects.Count(s => s is HoldNote); int notes = HitObjects.Count - holdnotes; return new[] { new BeatmapStatistic { Name = @"Object Count", Content = HitObjects.Count.ToString(), Icon = FontAwesome.fa_circle }, new BeatmapStatistic { Name = @"Note Count", Content = notes.ToString(), Icon = FontAwesome.fa_circle_o }, new BeatmapStatistic { Name = @"Hold Note Count", Content = holdnotes.ToString(), Icon = FontAwesome.fa_circle }, }; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.UI; namespace osu.Game.Rulesets.Mania.Beatmaps { public class ManiaBeatmap : Beatmap<ManiaHitObject> { /// <summary> /// The definitions for each stage in a <see cref="ManiaPlayfield"/>. /// </summary> public List<StageDefinition> Stages = new List<StageDefinition>(); /// <summary> /// Total number of columns represented by all stages in this <see cref="ManiaBeatmap"/>. /// </summary> public int TotalColumns => Stages.Sum(g => g.Columns); /// <summary> /// Creates a new <see cref="ManiaBeatmap"/>. /// </summary> /// <param name="defaultStage">The initial stages.</param> public ManiaBeatmap(StageDefinition defaultStage) { Stages.Add(defaultStage); } } }
mit
C#
e5b34aa64159b82d26234643731ae28791d70132
integrate open browser backend
Azure-Samples/MyDriving,Azure-Samples/MyDriving,Azure-Samples/MyDriving
XamarinApp/MyTrips/MyTrips.UWP/Views/SettingsView.xaml.cs
XamarinApp/MyTrips/MyTrips.UWP/Views/SettingsView.xaml.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; using MyTrips.ViewModel; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace MyTrips.UWP.Views { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class SettingsView : Page { SettingsViewModel settingsViewModel; public SettingsView() { this.InitializeComponent(); DataContext = Utils.Settings.Current; settingsViewModel = new SettingsViewModel(); } public void PrivacyPolicyButton_Click(object sender, RoutedEventArgs e) { settingsViewModel.OpenBrowserCommand.Execute(settingsViewModel.PrivacyPolicyUrl); } private void TermsOfUseButton_Click(object sender, RoutedEventArgs e) { settingsViewModel.OpenBrowserCommand.Execute(settingsViewModel.TermsOfUseUrl); } public void OpenSourceNoticeButton_Click(object sender, RoutedEventArgs e) { settingsViewModel.OpenBrowserCommand.Execute(settingsViewModel.OpenSourceNoticeUrl); } public void OpenSourceGitHubButton_Click(object sender, RoutedEventArgs e) { settingsViewModel.OpenBrowserCommand.Execute(settingsViewModel.SourceOnGitHubUrl); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; using MyTrips.ViewModel; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace MyTrips.UWP.Views { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class SettingsView : Page { SettingsViewModel settingsViewModel; public SettingsView() { this.InitializeComponent(); DataContext = Utils.Settings.Current; settingsViewModel = new SettingsViewModel(); } public void PrivacyPolicyButton_Click(object sender, RoutedEventArgs e) { //to do } private void TermsOfUseButton_Click(object sender, RoutedEventArgs e) { //to do } public void OpenSourceNoticeButton_Click(object sender, RoutedEventArgs e) { //to do } public void OpenSourceGitHubButton_Click(object sender, RoutedEventArgs e) { //to do } } }
mit
C#
917032abc0ca2f8ef6d49f511a9e1e90c22803dc
Update LevelTests.cs
HQC-Team-Minesweeper-5/Minesweeper
tests/Minesweeper.Tests/LevelTests.cs
tests/Minesweeper.Tests/LevelTests.cs
namespace Minesweeper.Tests { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Minesweeper.Utils; [TestClass] public class LevelTests { private readonly int numberOfRows = 5; private readonly int numberOfCols = 5; private readonly int numberOfMines = 5; [TestMethod] public void InitializingLevelShouldNotThrow() { var level = new Level(this.numberOfRows, this.numberOfCols, this.numberOfMines); } [TestMethod] public void NumberOfRowsShouldBeInt() { var level = new Level(this.numberOfRows, this.numberOfCols, this.numberOfMines); Assert.IsInstanceOfType(level.NumberOfRows, typeof(int)); } [TestMethod] public void NumberOfColsShouldBeInt() { var level = new Level(this.numberOfRows, this.numberOfCols, this.numberOfMines); Assert.IsInstanceOfType(level.NumberOfCols, typeof(int)); } [TestMethod] public void NumberOfMinesShouldBeInt() { var level = new Level(this.numberOfRows, this.numberOfCols, this.numberOfMines); Assert.IsInstanceOfType(level.NumberOfMines, typeof(int)); } } [TestMethod] public void CreateLevelShouldCreateNewLevel() { var newLevel = new Level(3, 4, 1); Assert.AreEqual(3, newLevel.NumberOfRows); Assert.AreEqual(4, newLevel.NumberOfCols); Assert.AreEqual(1, newLevel.NumberOfMines); } [TestMethod] [ExpectedException(typeof(System.Exception))] public void CreateLevelWithTooLargeNumberOfMinesShouldThrow() { var newLevel = new Level(3, 4, 13); } } }
namespace Minesweeper.Tests { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Minesweeper.Utils; [TestClass] public class LevelTests { [TestMethod] public void CreateLevelShouldCreateNewLevel() { var newLevel = new Level(3, 4, 1); Assert.AreEqual(3, newLevel.NumberOfRows); Assert.AreEqual(4, newLevel.NumberOfCols); Assert.AreEqual(1, newLevel.NumberOfMines); } [TestMethod] [ExpectedException(typeof(System.Exception))] public void CreateLevelWithTooLargeNumberOfMinesShouldThrow() { var newLevel = new Level(3, 4, 13); } } }
mit
C#
6e418e3506682046bf47c50c458cd895f0e2533d
Use TryParseExact instead of ParseExact. Better performance.
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
src/Arkivverket.Arkade/Core/Addml/Definitions/DataTypes/DateDataType.cs
src/Arkivverket.Arkade/Core/Addml/Definitions/DataTypes/DateDataType.cs
using System; using System.Collections.Generic; using System.Globalization; namespace Arkivverket.Arkade.Core.Addml.Definitions.DataTypes { public class DateDataType : DataType { private readonly string _dateTimeFormat; private readonly string _fieldFormat; public DateDataType(string fieldFormat) : this(fieldFormat, null) { } public DateDataType(string fieldFormat, List<string> nullValues) : base(nullValues) { _fieldFormat = fieldFormat; _dateTimeFormat = ConvertToDateTimeFormat(_fieldFormat); } private string ConvertToDateTimeFormat(string fieldFormat) { return fieldFormat; } public DateTimeOffset Parse(string dateTimeString) { DateTimeOffset dto = DateTimeOffset.ParseExact (dateTimeString, _dateTimeFormat, CultureInfo.InvariantCulture); return dto; } protected bool Equals(DateDataType other) { return string.Equals(_fieldFormat, other._fieldFormat); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return false; } if (ReferenceEquals(this, obj)) { return true; } if (obj.GetType() != GetType()) { return false; } return Equals((DateDataType) obj); } public override int GetHashCode() { return _fieldFormat?.GetHashCode() ?? 0; } public override bool IsValid(string s) { DateTimeOffset res; return DateTimeOffset.TryParseExact(s, _dateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out res); } } }
using System; using System.Collections.Generic; using System.Globalization; namespace Arkivverket.Arkade.Core.Addml.Definitions.DataTypes { public class DateDataType : DataType { private readonly string _dateTimeFormat; private readonly string _fieldFormat; public DateDataType(string fieldFormat) : this(fieldFormat, null) { } public DateDataType(string fieldFormat, List<string> nullValues) : base(nullValues) { _fieldFormat = fieldFormat; _dateTimeFormat = ConvertToDateTimeFormat(_fieldFormat); } public DateDataType() { throw new NotImplementedException(); } private string ConvertToDateTimeFormat(string fieldFormat) { // TODO: Do we have to convert ADDML data fieldFormat til .NET format? return fieldFormat; } public DateTimeOffset Parse(string dateTimeString) { DateTimeOffset dto = DateTimeOffset.ParseExact (dateTimeString, _dateTimeFormat, CultureInfo.InvariantCulture); return dto; } protected bool Equals(DateDataType other) { return string.Equals(_fieldFormat, other._fieldFormat); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return false; } if (ReferenceEquals(this, obj)) { return true; } if (obj.GetType() != GetType()) { return false; } return Equals((DateDataType) obj); } public override int GetHashCode() { return _fieldFormat?.GetHashCode() ?? 0; } public override bool IsValid(string s) { try { Parse(s); return true; } catch (FormatException e) { return false; } } } }
agpl-3.0
C#
8ea253560663e26a496f271c385601967d754b2b
add optional param to interface
crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin
SignInCheckIn/MinistryPlatform.Translation/Repositories/Interfaces/IEventRepository.cs
SignInCheckIn/MinistryPlatform.Translation/Repositories/Interfaces/IEventRepository.cs
using System; using System.Collections.Generic; using MinistryPlatform.Translation.Models.DTO; namespace MinistryPlatform.Translation.Repositories.Interfaces { public interface IEventRepository { List<MpEventDto> GetEvents(DateTime startDate, DateTime endDate, int site, bool? includeSubevents); MpEventDto GetEventById(int eventId); MpEventDto CreateSubEvent(string token, MpEventDto mpEventDto); List<MpEventGroupDto> GetEventGroupsForEvent(int eventId); List<MpEventGroupDto> GetEventGroupsForEventRoom(int eventId, int roomId); void DeleteEventGroups(string authenticationToken, IEnumerable<int> eventGroupIds); List<MpEventGroupDto> CreateEventGroups(string authenticationToken, List<MpEventGroupDto> eventGroups); void ResetEventSetup(string authenticationToken, int eventId); void ImportEventSetup(string authenticationToken, int destinationEventId, int sourceEventId); List<MpEventDto> GetEventAndCheckinSubevents(string token, int eventId); List<MpEventDto> GetSubeventsForEvents(List<int> eventIds, int? eventTypeId); } }
using System; using System.Collections.Generic; using MinistryPlatform.Translation.Models.DTO; namespace MinistryPlatform.Translation.Repositories.Interfaces { public interface IEventRepository { List<MpEventDto> GetEvents(DateTime startDate, DateTime endDate, int site); MpEventDto GetEventById(int eventId); MpEventDto CreateSubEvent(string token, MpEventDto mpEventDto); List<MpEventGroupDto> GetEventGroupsForEvent(int eventId); List<MpEventGroupDto> GetEventGroupsForEventRoom(int eventId, int roomId); void DeleteEventGroups(string authenticationToken, IEnumerable<int> eventGroupIds); List<MpEventGroupDto> CreateEventGroups(string authenticationToken, List<MpEventGroupDto> eventGroups); void ResetEventSetup(string authenticationToken, int eventId); void ImportEventSetup(string authenticationToken, int destinationEventId, int sourceEventId); List<MpEventDto> GetEventAndCheckinSubevents(string token, int eventId); List<MpEventDto> GetSubeventsForEvents(List<int> eventIds, int? eventTypeId); } }
bsd-2-clause
C#
157da86cc1c677e5005e44f2fc72f128a5a817dc
disable graphical representation for local players
bddckr/VRTK-PUN-NetworkTest
Assets/Scripts/CameraRigSyncingSetup.cs
Assets/Scripts/CameraRigSyncingSetup.cs
namespace NetworkTest { using UnityEngine; using VRTK; public sealed class CameraRigSyncingSetup : MonoBehaviour { public GameObject HeadsetNetworkRepresentation; public GameObject LeftControllerNetworkRepresentation; public GameObject RightControllerNetworkRepresentation; private void OnEnable() { SetUpTransformFollow(HeadsetNetworkRepresentation, VRTK_DeviceFinder.Devices.Headset); SetUpTransformFollow(LeftControllerNetworkRepresentation, VRTK_DeviceFinder.Devices.LeftController); SetUpTransformFollow(RightControllerNetworkRepresentation, VRTK_DeviceFinder.Devices.RightController); } private static void SetUpTransformFollow(GameObject networkRepresentation, VRTK_DeviceFinder.Devices device) { var photonView = networkRepresentation.GetComponent<PhotonView>(); if (photonView == null) { Debug.LogError(string.Format("The network representation '{0}' has no {1} component on it.", networkRepresentation.name, typeof(PhotonView).Name)); return; } if (!photonView.isMine) { return; } // Disable graphical representation. networkRepresentation.transform.GetChild(0).gameObject.SetActive(false); var transformFollow = networkRepresentation.AddComponent<VRTK_TransformFollow>(); transformFollow.gameObjectToFollow = VRTK_DeviceFinder.DeviceTransform(device).gameObject; transformFollow.followsScale = false; } } }
namespace NetworkTest { using UnityEngine; using VRTK; public sealed class CameraRigSyncingSetup : MonoBehaviour { public GameObject HeadsetNetworkRepresentation; public GameObject LeftControllerNetworkRepresentation; public GameObject RightControllerNetworkRepresentation; private void OnEnable() { SetUpTransformFollow(HeadsetNetworkRepresentation, VRTK_DeviceFinder.Devices.Headset); SetUpTransformFollow(LeftControllerNetworkRepresentation, VRTK_DeviceFinder.Devices.LeftController); SetUpTransformFollow(RightControllerNetworkRepresentation, VRTK_DeviceFinder.Devices.RightController); } private static void SetUpTransformFollow(GameObject networkRepresentation, VRTK_DeviceFinder.Devices device) { var photonView = networkRepresentation.GetComponent<PhotonView>(); if (photonView == null) { Debug.LogError(string.Format("The network representation '{0}' has no {1} component on it.", networkRepresentation.name, typeof(PhotonView).Name)); return; } if (!photonView.isMine) { return; } var transformFollow = networkRepresentation.AddComponent<VRTK_TransformFollow>(); transformFollow.gameObjectToFollow = VRTK_DeviceFinder.DeviceTransform(device).gameObject; transformFollow.followsScale = false; } } }
mit
C#
a0aeccf2322d06c782c9fc15d5eda86d1b15df6b
Fix fallback to default combo colours not working
smoogipooo/osu,2yangk23/osu,2yangk23/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,peppy/osu-new,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,ZLima12/osu,smoogipoo/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu,ZLima12/osu,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,EVAST9919/osu,peppy/osu,peppy/osu,ppy/osu
osu.Game/Skinning/DefaultSkin.cs
osu.Game/Skinning/DefaultSkin.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; using osu.Game.Audio; using osuTK.Graphics; namespace osu.Game.Skinning { public class DefaultSkin : Skin { public DefaultSkin() : base(SkinInfo.Default) { Configuration = new DefaultSkinConfiguration(); } public override Drawable GetDrawableComponent(ISkinComponent component) => null; public override Texture GetTexture(string componentName) => null; public override SampleChannel GetSample(ISampleInfo sampleInfo) => null; public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) { switch (lookup) { case GlobalSkinConfiguration global: switch (global) { case GlobalSkinConfiguration.ComboColours: return SkinUtils.As<TValue>(new Bindable<List<Color4>>(Configuration.ComboColours)); } break; } return null; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; using osu.Game.Audio; namespace osu.Game.Skinning { public class DefaultSkin : Skin { public DefaultSkin() : base(SkinInfo.Default) { Configuration = new DefaultSkinConfiguration(); } public override Drawable GetDrawableComponent(ISkinComponent component) => null; public override Texture GetTexture(string componentName) => null; public override SampleChannel GetSample(ISampleInfo sampleInfo) => null; public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) => null; } }
mit
C#
6312b56988e0333409e6a5092af3ffc27faedbe4
fix hardcoded blob path in theme
Wyamio/Wyam,Wyamio/Wyam,Wyamio/Wyam
themes/Docs/Samson/_BlogLayout.cshtml
themes/Docs/Samson/_BlogLayout.cshtml
@{ Layout = "/_Layout.cshtml"; } @section Sidebar { <li class="header"><i class="fa fa-bookmark"></i> Categories</li> @foreach(string category in Documents[Docs.BlogPosts] .Select(x => x.String(DocsKeys.Category)) .Distinct() .OrderBy(x => x)) { string link = category.Replace(" ", "-").Replace("'", string.Empty); string selected = Model.String(Keys.RelativeFilePath).StartsWith($"{@Context.String(DocsKeys.BlogPath)}/{link}/") ? "selected" : null; <li class="@selected"><a href="@Context.GetLink($"/{@Context.String(DocsKeys.BlogPath)}/{link}")">@category</a></li> } <li class="header"><i class="fa fa-calendar"></i> Archive</li> @foreach(DateTime published in Documents[Docs.BlogPosts] .Select(x => x.Get<DateTime>(DocsKeys.Published)) .Select(x => new DateTime(x.Year, x.Month, 1)) .Distinct() .OrderByDescending(x => x)) { string link = published.ToString("yyyy/MM"); string selected = Model.String(Keys.RelativeFilePath).StartsWith($"blog/archive/{link}/") ? "selected" : null; <li class="@selected"><a href="@Context.GetLink($"/{@Context.String(DocsKeys.BlogPath)}/archive/{link}")">@(published.ToString("MMMM, yyyy"))</a></li> } <li class="header"><i class="fa fa-user"></i> Authors</li> @foreach(string author in Documents[Docs.BlogPosts] .Select(x => x.String(DocsKeys.Author)) .Distinct() .OrderBy(x => x)) { string link = author.Replace(" ", "-").Replace("'", string.Empty); string selected = Model.String(Keys.RelativeFilePath).StartsWith($"{@Context.String(DocsKeys.BlogPath)}/author/{link}/") ? "selected" : null; <li class="@selected"><a href="@Context.GetLink($"/{@Context.String(DocsKeys.BlogPath)}/author/{link}")">@author</a></li> } } @RenderBody()
@{ Layout = "/_Layout.cshtml"; } @section Sidebar { <li class="header"><i class="fa fa-bookmark"></i> Categories</li> @foreach(string category in Documents[Docs.BlogPosts] .Select(x => x.String(DocsKeys.Category)) .Distinct() .OrderBy(x => x)) { string link = category.Replace(" ", "-").Replace("'", string.Empty); string selected = Model.String(Keys.RelativeFilePath).StartsWith($"blog/{link}/") ? "selected" : null; <li class="@selected"><a href="@Context.GetLink("/blog/" + link)">@category</a></li> } <li class="header"><i class="fa fa-calendar"></i> Archive</li> @foreach(DateTime published in Documents[Docs.BlogPosts] .Select(x => x.Get<DateTime>(DocsKeys.Published)) .Select(x => new DateTime(x.Year, x.Month, 1)) .Distinct() .OrderByDescending(x => x)) { string link = published.ToString("yyyy/MM"); string selected = Model.String(Keys.RelativeFilePath).StartsWith($"blog/archive/{link}/") ? "selected" : null; <li class="@selected"><a href="@Context.GetLink("/blog/archive/" + link)">@(published.ToString("MMMM, yyyy"))</a></li> } <li class="header"><i class="fa fa-user"></i> Authors</li> @foreach(string author in Documents[Docs.BlogPosts] .Select(x => x.String(DocsKeys.Author)) .Distinct() .OrderBy(x => x)) { string link = author.Replace(" ", "-").Replace("'", string.Empty); string selected = Model.String(Keys.RelativeFilePath).StartsWith($"blog/author/{link}/") ? "selected" : null; <li class="@selected"><a href="@Context.GetLink("/blog/author/" + link)">@author</a></li> } } @RenderBody()
mit
C#
9b02656c607af9235ff80c5f4488be9be55638ab
Update MandatoryConfigurationValidationStrategy.cs
tiksn/TIKSN-Framework
TIKSN.Core/Configuration/ValidationStrategy/MandatoryConfigurationValidationStrategy.cs
TIKSN.Core/Configuration/ValidationStrategy/MandatoryConfigurationValidationStrategy.cs
using System; using Microsoft.Extensions.DependencyInjection; using TIKSN.Configuration.Validator; namespace TIKSN.Configuration.ValidationStrategy { public class MandatoryConfigurationValidationStrategy<T> : ConfigurationValidationStrategyBase<T> { public MandatoryConfigurationValidationStrategy(IServiceProvider serviceProvider) : base(serviceProvider) { } protected override IPartialConfigurationValidator<T> GetConfigurationValidator() => this._serviceProvider.GetRequiredService<IPartialConfigurationValidator<T>>(); } }
using Microsoft.Extensions.DependencyInjection; using System; using TIKSN.Configuration.Validator; namespace TIKSN.Configuration.ValidationStrategy { public class MandatoryConfigurationValidationStrategy<T> : ConfigurationValidationStrategyBase<T> { public MandatoryConfigurationValidationStrategy(IServiceProvider serviceProvider) : base(serviceProvider) { } protected override IPartialConfigurationValidator<T> GetConfigurationValidator() { return _serviceProvider.GetRequiredService<IPartialConfigurationValidator<T>>(); } } }
mit
C#
9fd15bcf32a646e1564a79a21b1917f2d33ca740
change assembly info
hyonholee/azure-sdk-for-net,nathannfan/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,samtoubia/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,samtoubia/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,olydis/azure-sdk-for-net,markcowl/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,pilor/azure-sdk-for-net,mihymel/azure-sdk-for-net,AzCiS/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,pankajsn/azure-sdk-for-net,jamestao/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,peshen/azure-sdk-for-net,jamestao/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,shutchings/azure-sdk-for-net,mihymel/azure-sdk-for-net,pilor/azure-sdk-for-net,btasdoven/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,btasdoven/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,AzCiS/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,jamestao/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,atpham256/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,hyonholee/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,btasdoven/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,olydis/azure-sdk-for-net,peshen/azure-sdk-for-net,shutchings/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,begoldsm/azure-sdk-for-net,samtoubia/azure-sdk-for-net,samtoubia/azure-sdk-for-net,nathannfan/azure-sdk-for-net,jamestao/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,begoldsm/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,djyou/azure-sdk-for-net,AzCiS/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,pankajsn/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,stankovski/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,shutchings/azure-sdk-for-net,atpham256/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,begoldsm/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,olydis/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,hyonholee/azure-sdk-for-net,nathannfan/azure-sdk-for-net,djyou/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,djyou/azure-sdk-for-net,pilor/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,mihymel/azure-sdk-for-net,hyonholee/azure-sdk-for-net,peshen/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,stankovski/azure-sdk-for-net,hyonholee/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,atpham256/azure-sdk-for-net,pankajsn/azure-sdk-for-net
src/ResourceManagement/Cdn/Microsoft.Azure.Management.Cdn/Properties/AssemblyInfo.cs
src/ResourceManagement/Cdn/Microsoft.Azure.Management.Cdn/Properties/AssemblyInfo.cs
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Microsoft Azure CDN Management Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure CDN.")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Microsoft Azure CDN Management Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure CDN.")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
mit
C#
fe24d414dc914368def2781073c62e8e8641dc25
Migrate GPSTracker sample to WebApplicationBuilder (#7869)
ibondy/orleans,ElanHasson/orleans,dotnet/orleans,hoopsomuah/orleans,dotnet/orleans,waynemunro/orleans,ElanHasson/orleans,hoopsomuah/orleans,waynemunro/orleans,ibondy/orleans
samples/GPSTracker/GPSTracker.Service/Program.cs
samples/GPSTracker/GPSTracker.Service/Program.cs
using Orleans.Hosting; using GPSTracker; using System.Net; var builder = WebApplication.CreateBuilder(args); builder.Host.UseOrleans((ctx, siloBuilder) => { // In order to support multiple hosts forming a cluster, they must listen on different ports. // Use the --InstanceId X option to launch subsequent hosts. var instanceId = ctx.Configuration.GetValue<int>("InstanceId"); siloBuilder.UseLocalhostClustering( siloPort: 11111 + instanceId, gatewayPort: 30000 + instanceId, primarySiloEndpoint: new IPEndPoint(IPAddress.Loopback, 11111)); }); builder.WebHost.ConfigureKestrel((ctx, kestrelOptions) => { // To avoid port conflicts, each Web server must listen on a different port. var instanceId = ctx.Configuration.GetValue<int>("InstanceId"); kestrelOptions.ListenLocalhost(5001 + instanceId); }); builder.Services.AddHostedService<HubListUpdater>(); builder.Services.AddSignalR().AddJsonProtocol(); var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseDefaultFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapHub<LocationHub>("/locationHub"); }); app.Run();
using Orleans.Hosting; using GPSTracker; using System.Net; await Host.CreateDefaultBuilder(args) .UseOrleans((ctx, siloBuilder) => { // In order to support multiple hosts forming a cluster, they must listen on different ports. // Use the --InstanceId X option to launch subsequent hosts. var instanceId = ctx.Configuration.GetValue<int>("InstanceId"); siloBuilder.UseLocalhostClustering( siloPort: 11111 + instanceId, gatewayPort: 30000 + instanceId, primarySiloEndpoint: new IPEndPoint(IPAddress.Loopback, 11111)); }) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); webBuilder.ConfigureKestrel((ctx, kestrelOptions) => { // To avoid port conflicts, each Web server must listen on a different port. var instanceId = ctx.Configuration.GetValue<int>("InstanceId"); kestrelOptions.ListenLocalhost(5001 + instanceId); }); }) .ConfigureServices((ctx, services) => { services.AddHostedService<HubListUpdater>(); }) .RunConsoleAsync(); public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddSignalR().AddJsonProtocol(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseDefaultFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapHub<LocationHub>("/locationHub"); }); } }
mit
C#
c47c9124de5612f86e5dcc11a79db173ce7e4e0b
Bump assembly version to v2.0.1.0
bcemmett/SurveyMonkeyApi
SurveyMonkey/Properties/AssemblyInfo.cs
SurveyMonkey/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("SurveyMonkeyApi")] [assembly: AssemblyDescription("Library for accessing v2 of the Survey Monkey Api")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SurveyMonkeyApi")] [assembly: AssemblyCopyright("Copyright © Ben Emmett")] [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("da9e0373-83cd-4deb-87a5-62b313be61ec")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.1.0")] [assembly: AssemblyFileVersion("2.0.1.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SurveyMonkeyApi")] [assembly: AssemblyDescription("Library for accessing v2 of the Survey Monkey Api")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SurveyMonkeyApi")] [assembly: AssemblyCopyright("Copyright © Ben Emmett")] [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("da9e0373-83cd-4deb-87a5-62b313be61ec")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")]
mit
C#
65888d26240fa056613b12405f2a22e1ad20bcad
add some more suppressbecuse
OBeautifulCode/OBeautifulCode.Build
Analyzers/analyzers/SuppressBecause.cs
Analyzers/analyzers/SuppressBecause.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="SuppressBecause.cs" company="OBeautifulCode"> // Copyright (c) OBeautifulCode 2018. All rights reserved. // </copyright> // <auto-generated> // Sourced from NuGet package. Will be overwritten with package update except in OBeautifulCode.Build source. // </auto-generated> // -------------------------------------------------------------------------------------------------------------------- namespace NAMESPACETOKEN.Internal { using System.CodeDom.Compiler; using System.Diagnostics.CodeAnalysis; /// <summary> /// Standard justifications for analysis suppression. /// </summary> [ExcludeFromCodeCoverage] [GeneratedCode("OBeautifulCode.Build.Analyzers", "See package version number")] internal static class ObcSuppressBecause { /// <summary> /// Console executable does not need the [assembly: CLSCompliant(true)] as it should not be shared as an assembly for reference. /// </summary> public const string CA1014_MarkAssembliesWithClsCompliant_ConsoleExeDoesNotNeedToBeClsCompliant = "Console executable does not need the [assembly: CLSCompliant(true)] as it should not be shared as an assembly for reference."; /// <summary> /// We are optimizing for the logical grouping of types rather than the number of types in a namepace. /// </summary> public const string CA1020_AvoidNamespacesWithFewTypes_OptimizeForLogicalGroupingOfTypes = "We are optimizing for the logical grouping of types rather than the number of types in a namepace."; /// <summary> /// When we need to identify a group of types, we prefer the use of an empty interface over an attribute because it's easier to use and results in cleaner code. /// </summary> public const string CA1040_AvoidEmptyInterfaces_NeedToIdentifyGroupOfTypesAndPreferInterfaceOverAttribute = "When we need to identify a group of types, we prefer the use of an empty interface over an attribute because it's easier to use and results in cleaner code."; /// <summary> /// It's ok to throw NotSupportedException for an unreachable code path. /// </summary> public const string CA1065_DoNotRaiseExceptionsInUnexpectedLocations_ThrowNotSupportedExceptionForUnreachableCodePath = "It's ok to throw NotSupportedException for an unreachable code path."; /// <summary> /// We prefer to read <see cref="System.Guid" />'s string representation as lowercase. /// </summary> public const string CA1308_NormalizeStringsToUppercase_PreferGuidLowercase = "We prefer to read System.Guid's string representation as lowercase."; /// <summary> /// The spelling of the identifier is correct in-context of the domain. /// </summary> public const string CA1704_IdentifiersShouldBeSpelledCorrectly_SpellingIsCorrectInContextOfTheDomain = "The spelling of the identifier is correct in-context of the domain."; /// <summary> /// The public interface of the system associated with this object never exposes this object. /// </summary> public const string CA2227_CollectionPropertiesShouldBeReadOnly_PublicInterfaceNeverExposesTheObject = "The public interface of the system associated with this object never exposes this object."; } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="SuppressBecause.cs" company="OBeautifulCode"> // Copyright (c) OBeautifulCode 2018. All rights reserved. // </copyright> // <auto-generated> // Sourced from NuGet package. Will be overwritten with package update except in OBeautifulCode.Build source. // </auto-generated> // -------------------------------------------------------------------------------------------------------------------- namespace NAMESPACETOKEN.Internal { using System.CodeDom.Compiler; using System.Diagnostics.CodeAnalysis; /// <summary> /// Standard justifications for analysis suppression. /// </summary> [ExcludeFromCodeCoverage] [GeneratedCode("OBeautifulCode.Build.Analyzers", "See package version number")] internal static class ObcSuppressBecause { /// <summary> /// Console executable does not need the [assembly: CLSCompliant(true)] as it should not be shared as an assembly for reference. /// </summary> public const string CA1014_MarkAssembliesWithClsCompliant_ConsoleExeDoesNotNeedToBeClsCompliant = "Console executable does not need the [assembly: CLSCompliant(true)] as it should not be shared as an assembly for reference."; /// <summary> /// We are optimizing for the logical grouping of types rather than the number of types in a namepace. /// </summary> public const string CA1020_AvoidNamespacesWithFewTypes_OptimizeForLogicalGroupingOfTypes = "We are optimizing for the logical grouping of types rather than the number of types in a namepace."; /// <summary> /// When we need to identify a group of types, we prefer the use of an empty interface over an attribute because it's easier to use and results in cleaner code. /// </summary> public const string CA1040_AvoidEmptyInterfaces_NeedToIdentifyGroupOfTypesAndPreferInterfaceOverAttribute = "When we need to identify a group of types, we prefer the use of an empty interface over an attribute because it's easier to use and results in cleaner code."; /// <summary> /// It's ok to throw NotSupportedException for an unreachable code path. /// </summary> public const string CA1065_DoNotRaiseExceptionsInUnexpectedLocations_ThrowNotSupportedExceptionForUnreachableCodePath = "It's ok to throw NotSupportedException for an unreachable code path."; /// <summary> /// We prefer to read <see cref="System.Guid" />'s string representation as lowercase. /// </summary> public const string CA1308_NormalizeStringsToUppercase_PreferGuidLowercase = "We prefer to read System.Guid's string representation as lowercase."; } }
mit
C#
96d6f1ba7943ad9f2585786c9c66d25ce58990cf
prepare next version
maxlmo/outlook-matters,makmu/outlook-matters,maxlmo/outlook-matters,makmu/outlook-matters
GlobalAssemblyInfo.cs
GlobalAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyCompany("outlook-matters project")] [assembly: AssemblyProduct("OutlookMatters Addin")] [assembly: AssemblyDescription("An Outlook-Mattermost Bridge")] [assembly: AssemblyCopyright("Copyright © 2016 by the outlook-matters developers")] [assembly: AssemblyTrademark("This application has no Trademark.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyVersion(Version.Current)] [assembly: AssemblyFileVersion(Version.Current)] [assembly: AssemblyInformationalVersion(Version.FullCurrent)] class Version { // refer to http://semver.org for more information public const string Major = "1"; public const string Minor = "1"; public const string Patch = "0"; public const string Label = ReleaseLabel.Dev; public const string AdditionalReleaseInformation = ""; public const string Current = Major + "." + Minor + "." + Patch; public const string FullCurrent = Current + "-" + Label + AdditionalReleaseInformation; } class ReleaseLabel { public const string Dev = "dev"; public const string ReleaseCandidate = "rc"; public const string Final = "official"; }
using System.Reflection; [assembly: AssemblyCompany("outlook-matters project")] [assembly: AssemblyProduct("OutlookMatters Addin")] [assembly: AssemblyDescription("An Outlook-Mattermost Bridge")] [assembly: AssemblyCopyright("Copyright © 2016 by the outlook-matters developers")] [assembly: AssemblyTrademark("This application has no Trademark.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyVersion(Version.Current)] [assembly: AssemblyFileVersion(Version.Current)] [assembly: AssemblyInformationalVersion(Version.FullCurrent)] class Version { // refer to http://semver.org for more information public const string Major = "1"; public const string Minor = "0"; public const string Patch = "0"; public const string Label = ReleaseLabel.Final; public const string AdditionalReleaseInformation = ""; public const string Current = Major + "." + Minor + "." + Patch; public const string FullCurrent = Current + "-" + Label + AdditionalReleaseInformation; } class ReleaseLabel { public const string Dev = "dev"; public const string ReleaseCandidate = "rc"; public const string Final = "official"; }
mit
C#
d237241a931273584d8b728d1ba5e2abb00af94d
fix product filter script rendering
Kentico/cloud-sample-app-net,Kentico/cloud-sample-app-net,Kentico/Deliver-Dancing-Goat-.NET-MVC,Kentico/Deliver-Dancing-Goat-.NET-MVC,Kentico/cloud-sample-app-net
DancingGoat/Views/Coffees/Index.cshtml
DancingGoat/Views/Coffees/Index.cshtml
@model DancingGoat.Models.CoffeesViewModel @{ Layout = "~/Views/Shared/_StoreLayout.cshtml"; ViewBag.Title = Localizer["Coffees"]; } <div class="product-page row"> <div class="flex"> <aside class="col-md-4 col-lg-3 product-filter"> @using (Html.BeginForm("Filter", "Coffees")) { @await Html.PartialAsync("CoffeeFilter", Model.Filter) } </aside> <div id="product-list" class="col-md-8 col-lg-9 product-list"> @await Html.PartialAsync("ProductListing", Model.Items) </div> </div> </div> @section Scripts { <script src="~/js/formAutoPost.js"></script> <script> $(".js-postback input:checkbox").formAutoPost({ targetContainerSelector: "#product-list" }); </script> }
@model DancingGoat.Models.CoffeesViewModel @{ Layout = "~/Views/Shared/_StoreLayout.cshtml"; ViewBag.Title = Localizer["Coffees"]; } <div class="product-page row"> <div class="flex"> <aside class="col-md-4 col-lg-3 product-filter"> @using (Html.BeginForm("Filter", "Coffees")) { @await Html.PartialAsync("CoffeeFilter", Model.Filter) } </aside> <div id="product-list" class="col-md-8 col-lg-9 product-list"> @await Html.PartialAsync("ProductListing", Model.Items) </div> </div> </div> <script src="~/js/formAutoPost.js"></script> <script> $(".js-postback input:checkbox").formAutoPost({ targetContainerSelector: "#product-list" }); </script>
mit
C#
c02c41dced73796bf9938c28df0d9aaad4368d19
Add a HTML title to error view
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
src/AtomicChessPuzzles/Views/Shared/Error.cshtml
src/AtomicChessPuzzles/Views/Shared/Error.cshtml
@model AtomicChessPuzzles.HttpErrors.HttpError @section Title{@Model.StatusCode @Model.StatusText} <h1>@Model.StatusCode - @Model.StatusText</h1> <p>@Model.Description</p>
@model AtomicChessPuzzles.HttpErrors.HttpError <h1>@Model.StatusCode - @Model.StatusText</h1> <p>@Model.Description</p>
agpl-3.0
C#
4f578b0082055423f7237d1aeacf9a5f9bd3d443
Update Utility.cs
DarkGamer67/ChessWarrior
Assets/Scripts/Utility.cs
Assets/Scripts/Utility.cs
using System; using UnityEngine; /* * * Copyright 2016 Utku Pazarci * * 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. */ public static class Utility { public static T[] ShuffleArray<T>(T[] arrayToShuffle, int seed) { System.Random random = new System.Random(seed); for(int i = 0; i < arrayToShuffle.Length - 1; i++) { int randomNumber = random.Next(i, arrayToShuffle.Length); T tempObject = arrayToShuffle[i]; arrayToShuffle[i] = arrayToShuffle[randomNumber]; arrayToShuffle[randomNumber] = tempObject; } return arrayToShuffle; } public static T[] ShuffleArray<T>(T[] arrayToShuffle) { System.Random random = new System.Random(); for (int i = 0; i < arrayToShuffle.Length - 1; i++) { int randomNumber = random.Next(i, arrayToShuffle.Length); T tempObject = arrayToShuffle[i]; arrayToShuffle[i] = arrayToShuffle[randomNumber]; arrayToShuffle[randomNumber] = tempObject; } return arrayToShuffle; } } [Serializable] public class Coord { public int x; public int y; public Coord(int x, int y) { this.x = x; this.y = y; } public static Vector3 ToVector3(Coord coord) { float tileSize = GameObject.FindObjectOfType<MapGenerator>().GetComponent<MapGenerator>().tileSize; return new Vector3(coord.x * tileSize, 0, coord.y * tileSize); } public static bool operator ==(Coord c1, Coord c2) { return ((c1.x == c2.x) && (c1.y == c2.y)); } public static bool operator !=(Coord c1, Coord c2) { return !(c1 == c2); } }
using System; using UnityEngine; public static class Utility { public static T[] ShuffleArray<T>(T[] arrayToShuffle, int seed) { System.Random random = new System.Random(seed); for(int i = 0; i < arrayToShuffle.Length - 1; i++) { int randomNumber = random.Next(i, arrayToShuffle.Length); T tempObject = arrayToShuffle[i]; arrayToShuffle[i] = arrayToShuffle[randomNumber]; arrayToShuffle[randomNumber] = tempObject; } return arrayToShuffle; } public static T[] ShuffleArray<T>(T[] arrayToShuffle) { System.Random random = new System.Random(); for (int i = 0; i < arrayToShuffle.Length - 1; i++) { int randomNumber = random.Next(i, arrayToShuffle.Length); T tempObject = arrayToShuffle[i]; arrayToShuffle[i] = arrayToShuffle[randomNumber]; arrayToShuffle[randomNumber] = tempObject; } return arrayToShuffle; } } [Serializable] public class Coord { public int x; public int y; public Coord(int x, int y) { this.x = x; this.y = y; } public static Vector3 ToVector3(Coord coord) { float tileSize = GameObject.FindObjectOfType<MapGenerator>().GetComponent<MapGenerator>().tileSize; return new Vector3(coord.x * tileSize, 0, coord.y * tileSize); } public static bool operator ==(Coord c1, Coord c2) { return ((c1.x == c2.x) && (c1.y == c2.y)); } public static bool operator !=(Coord c1, Coord c2) { return !(c1 == c2); } }
apache-2.0
C#
83a334fd249ef0a6bbfa3480223a7605d3ccef64
Add ColumnInfo.Write() method
kiootic/dnlib,yck1509/dnlib,picrap/dnlib,ZixiangBoy/dnlib,Arthur2e5/dnlib,jorik041/dnlib,ilkerhalil/dnlib,0xd4d/dnlib,modulexcite/dnlib
src/DotNet/MD/ColumnInfo.cs
src/DotNet/MD/ColumnInfo.cs
using System; using System.Diagnostics; using System.IO; using dot10.IO; namespace dot10.DotNet.MD { /// <summary> /// Info about one column in a MD table /// </summary> [DebuggerDisplay("{offset} {size} {name}")] public sealed class ColumnInfo { byte offset; ColumnSize columnSize; byte size; string name; /// <summary> /// Returns the column offset within the table row /// </summary> public int Offset { get { return offset; } internal set { offset = (byte)value; } } /// <summary> /// Returns the column size /// </summary> public int Size { get { return size; } internal set { size = (byte)value; } } /// <summary> /// Returns the column name /// </summary> public string Name { get { return name; } } /// <summary> /// Returns the ColumnSize enum value /// </summary> public ColumnSize ColumnSize { get { return columnSize; } } /// <summary> /// Constructor /// </summary> /// <param name="name">The column name</param> /// <param name="columnSize">Column size</param> public ColumnInfo(string name, ColumnSize columnSize) { this.name = name; this.columnSize = columnSize; } /// <summary> /// Reads the column /// </summary> /// <param name="reader">A reader positioned on this column</param> /// <returns>The column value</returns> public uint Read(IBinaryReader reader) { switch (size) { case 1: return reader.ReadByte(); case 2: return reader.ReadUInt16(); case 4: return reader.ReadUInt32(); default: throw new InvalidOperationException("Invalid column size"); } } /// <summary> /// Writes a column /// </summary> /// <param name="writer">The writer position on this column</param> /// <param name="value">The column value</param> public void Write(BinaryWriter writer, uint value) { switch (size) { case 1: writer.Write((byte)value); break; case 2: writer.Write((ushort)value); break; case 4: writer.Write(value); break; default: throw new InvalidOperationException("Invalid column size"); } } } }
using System; using System.Diagnostics; using System.IO; using dot10.IO; namespace dot10.DotNet.MD { /// <summary> /// Info about one column in a MD table /// </summary> [DebuggerDisplay("{offset} {size} {name}")] public sealed class ColumnInfo { byte offset; ColumnSize columnSize; byte size; string name; /// <summary> /// Returns the column offset within the table row /// </summary> public int Offset { get { return offset; } internal set { offset = (byte)value; } } /// <summary> /// Returns the column size /// </summary> public int Size { get { return size; } internal set { size = (byte)value; } } /// <summary> /// Returns the column name /// </summary> public string Name { get { return name; } } /// <summary> /// Returns the ColumnSize enum value /// </summary> public ColumnSize ColumnSize { get { return columnSize; } } /// <summary> /// Constructor /// </summary> /// <param name="name">The column name</param> /// <param name="columnSize">Column size</param> public ColumnInfo(string name, ColumnSize columnSize) { this.name = name; this.columnSize = columnSize; } /// <summary> /// Reads the column /// </summary> /// <param name="reader">A reader positioned on this column</param> /// <returns>The column value</returns> public uint Read(IBinaryReader reader) { switch (size) { case 1: return reader.ReadByte(); case 2: return reader.ReadUInt16(); case 4: return reader.ReadUInt32(); default: throw new InvalidOperationException("Invalid column size"); } } } }
mit
C#
899be9dfc87592aeb311021d71ae4b76f007328f
Add method overload to Schema.Deserialize()
Ackara/Mockaroo.NET
src/Mockaroo.Core/Schema.cs
src/Mockaroo.Core/Schema.cs
using Gigobyte.Mockaroo.Fields; using Gigobyte.Mockaroo.Serialization; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; namespace Gigobyte.Mockaroo { [JsonArray] public class Schema : List<IField>, ISerializable { #region Static Members public static Schema Load(Stream stream) { var schema = new Schema(); schema.Deserialize(stream); return schema; } public static Schema LoadFrom(Type type) { throw new System.NotImplementedException(); } #endregion Static Members public Schema() : base() { } public Schema(int capacity) : base(capacity) { } public Schema(params IField[] fields) : base(fields) { } public Schema(IEnumerable<IField> collection) : base(collection) { } public Stream Serialize() { var memory = new MemoryStream(); var writer = new StreamWriter(memory); var separator = string.Empty; writer.Write('['); for (int i = 0; i < Count; i++) { separator = (i < (Count - 1) ? "," : string.Empty); writer.Write(string.Format("{0}{1}", base[i].ToJson(), separator)); } writer.Write(']'); writer.Flush(); memory.Seek(0, SeekOrigin.Begin); return memory; } public void Deserialize(byte[] data) { Deserialize(new MemoryStream(data)); } public void Deserialize(Stream stream) { } public string ToJson() { using (var reader = new StreamReader(Serialize())) { return reader.ReadToEnd(); } } } }
using Gigobyte.Mockaroo.Fields; using Gigobyte.Mockaroo.Serialization; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; namespace Gigobyte.Mockaroo { [JsonArray] public class Schema : List<IField>, ISerializable { #region Static Members public static Schema Load(Stream stream) { var schema = new Schema(); schema.Deserialize(stream); return schema; } public static Schema LoadFrom(Type type) { throw new System.NotImplementedException(); } #endregion Static Members public Schema() : base() { } public Schema(int capacity) : base(capacity) { } public Schema(params IField[] fields) : base(fields) { } public Schema(IEnumerable<IField> collection) : base(collection) { } public Stream Serialize() { var memory = new MemoryStream(); var writer = new StreamWriter(memory); var separator = string.Empty; writer.Write('['); for (int i = 0; i < Count; i++) { separator = (i < (Count - 1) ? "," : string.Empty); writer.Write(string.Format("{0}{1}", base[i].ToJson(), separator)); } writer.Write(']'); writer.Flush(); memory.Seek(0, SeekOrigin.Begin); return memory; } public void Deserialize(Stream stream) { throw new NotImplementedException(); } public string ToJson() { using (var reader = new StreamReader(Serialize())) { return reader.ReadToEnd(); } } } }
mit
C#
e3c3a2ef6be8a2e4ac1eede62db5b86e7fe615cb
build bug fix
kirillkostrov/andrule
android/Andrule/Andrule/MainActivity.cs
android/Andrule/Andrule/MainActivity.cs
using System; using Android.App; using Android.Content; using Android.Widget; using Android.OS; using Andrule.Views; namespace Andrule { [Activity(Label = "Andrule", MainLauncher = true, ScreenOrientation = Android.Content.PM.ScreenOrientation.Landscape)] public class MainActivity : TabActivity { public static TabHost Tabs { get; private set;} protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); Tabs = TabHost; CreateTab(typeof(SetupActivity), "setup", "SETUP"); CreateTab(typeof(WheelActivity), "wheel", "WHEEL"); } private void CreateTab(Type activityType, string tag, string label) { var intent = new Intent(this, activityType); intent.AddFlags(ActivityFlags.NewTask); var spec = Tabs.NewTabSpec(tag); spec.SetIndicator(label); spec.SetContent(intent); Tabs.AddTab(spec); } } }
using System; using Android.App; using Android.Content; using Android.Widget; using Android.OS; using Andrule.Views; namespace Andrule { [Activity(Label = "Andrule", MainLauncher = true, ScreenOrientation = Android.Content.PM.ScreenOrientation.Landscape)] public class MainActivity : TabActivity { public static TabHost Tabs { get; private set;} protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); Tabs = TabHost; CreateTab(typeof(SetupActivity), "setup", "SETUP"); CreateTab(typeof(WheelActivity), "wheel", "WHEEL"); } private void CreateTab(Type activityType, string tag, string label) { var intent = new Intent(this, activityType); intent.AddFlags(ActivityFlags.NewTask); var spec = Tabs.NewTabSpec(tag); spec.SetIndicator(labe); spec.SetContent(intent); Tabs.AddTab(spec); } } }
apache-2.0
C#
a147a374a10f01ea21e26b9768703fbff8ff3edc
Add comment for SpaFallbackMiddleware
bradyholt/aspnet-core-react-template,bradyholt/aspnet-core-react-template,bradyholt/aspnet-core-react-template,bradyholt/aspnet-core-react-template,bradyholt/aspnet-core-react-template
api/Middleware/SpaFallbackMiddleware.cs
api/Middleware/SpaFallbackMiddleware.cs
using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; namespace aspnetCoreReactTemplate { /* Middleware that will rewrite (not redirect!) nested SPA page requests to the SPA root path. For SPA apps that are using client-side routing, a refresh or direct request for a nested path will be received by the server but the root path page should be actually be served because the client is responsible for routing, not the server. Only those requests not prefixed with options.ApiPathPrefix and not containing a path extention (i.e. image.png, scripts.js) will be rewritten. (SpaFallbackOptions options): ApiPathPrefix - The api path prefix is what requests for the REST api begin with. These will be ignored and not rewritten. So, if this is supplied as 'api', any requests starting with 'api' will not be rewritten. RewritePath - What path to rewrite to (usually '/') Examples: (options.ApiPathPrefix == "api", options.RewritePath="/") http://localhost:5000/api/auth/login => (no rewrite) http://localhost:5000/style.css => (no rewrite) http://localhost:5000/contacts => / http://localhost:5000/contacts/5/edit => / */ public class SpaFallbackMiddleware { private readonly RequestDelegate _next; private readonly ILogger _logger; private SpaFallbackOptions _options; public SpaFallbackMiddleware(RequestDelegate next, ILoggerFactory loggerFactory, SpaFallbackOptions options) { _next = next; _logger = loggerFactory.CreateLogger<SpaFallbackMiddleware>(); _options = options; } public async Task Invoke(HttpContext context) { _logger.LogInformation("Handling request: " + context.Request.Path); // If request path starts with _apiPathPrefix and the path does not have an extension (i.e. .css, .js, .png) if (!context.Request.Path.Value.StartsWith(_options.ApiPathPrefix) && !context.Request.Path.Value.Contains(".")) { _logger.LogInformation($"Rewriting path: {context.Request.Path} > {_options.RewritePath}"); context.Request.Path = _options.RewritePath; } await _next.Invoke(context); _logger.LogInformation("Finished handling request."); } } public static class SpaFallbackExtensions { public static IApplicationBuilder UseSpaFallback(this IApplicationBuilder builder, SpaFallbackOptions options) { if (options == null) { options = new SpaFallbackOptions(); } return builder.UseMiddleware<SpaFallbackMiddleware>(options); } } }
using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; namespace aspnetCoreReactTemplate { public class SpaFallbackMiddleware { private readonly RequestDelegate _next; private readonly ILogger _logger; private SpaFallbackOptions _options; public SpaFallbackMiddleware(RequestDelegate next, ILoggerFactory loggerFactory, SpaFallbackOptions options) { _next = next; _logger = loggerFactory.CreateLogger<SpaFallbackMiddleware>(); _options = options; } public async Task Invoke(HttpContext context) { _logger.LogInformation("Handling request: " + context.Request.Path); // If request path starts with _apiPathPrefix and the path does not have an extension (i.e. .css, .js, .png) if (!context.Request.Path.Value.StartsWith(_options.ApiPathPrefix) && !context.Request.Path.Value.Contains(".")) { _logger.LogInformation($"Rewriting path: {context.Request.Path} > {_options.RewritePath}"); context.Request.Path = _options.RewritePath; } await _next.Invoke(context); _logger.LogInformation("Finished handling request."); } } public static class SpaFallbackExtensions { public static IApplicationBuilder UseSpaFallback(this IApplicationBuilder builder, SpaFallbackOptions options) { if (options == null) { options = new SpaFallbackOptions(); } return builder.UseMiddleware<SpaFallbackMiddleware>(options); } } }
mit
C#
2607d0951a63b88d543c38201e223b26f3d1025e
remove redundant param
adamralph/xbehave.net,xbehave/xbehave.net
src/Xbehave.Execution/ScenarioOutlineTestCase.cs
src/Xbehave.Execution/ScenarioOutlineTestCase.cs
namespace Xbehave.Execution { using System; using System.ComponentModel; using System.Threading; using System.Threading.Tasks; using Xunit.Abstractions; using Xunit.Sdk; public class ScenarioOutlineTestCase : XunitTestCase { public ScenarioOutlineTestCase( IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod) : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod) { } [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("Called by the de-serializer", true)] public ScenarioOutlineTestCase() { } public override async Task<RunSummary> RunAsync( IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource) => await new ScenarioOutlineTestCaseRunner( diagnosticMessageSink, this, this.DisplayName, this.SkipReason, constructorArguments, messageBus, aggregator, cancellationTokenSource) .RunAsync(); } }
namespace Xbehave.Execution { using System; using System.ComponentModel; using System.Threading; using System.Threading.Tasks; using Xunit.Abstractions; using Xunit.Sdk; public class ScenarioOutlineTestCase : XunitTestCase { public ScenarioOutlineTestCase( IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod) : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod, null) { } [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("Called by the de-serializer", true)] public ScenarioOutlineTestCase() { } public override async Task<RunSummary> RunAsync( IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource) => await new ScenarioOutlineTestCaseRunner( diagnosticMessageSink, this, this.DisplayName, this.SkipReason, constructorArguments, messageBus, aggregator, cancellationTokenSource) .RunAsync(); } }
mit
C#
ad8417087abddeaf44f947a733fa2f7edb3af271
Add new repo (fixed) and re-apply ExampleSpawner changes
erebuswolf/LockstepFramework,yanyiyun/LockstepFramework,SnpM/Lockstep-Framework
Example/ExampleSpawner.cs
Example/ExampleSpawner.cs
using UnityEngine; using System.Collections; namespace Lockstep.Example { public class ExampleSpawner : BehaviourHelper { public override ushort ListenInput { get { return InputCodeManager.GetCodeID("Spawn"); } } /* * Command com = new Command (InputCodeManager.GetCodeID ("Spawn")); com.ControllerID = cont.ControllerID; com.Position = position; com.Target = (ushort)AgentController.GetAgentCodeIndex(agentCode); com.Count = count; return com; */ protected FastList<LSAgent> bufferSpawnedAgents = new FastList<LSAgent>(); protected override void OnExecute (Command com) { byte conID = com.ControllerID; Vector2d pos = com.GetData<Vector2d>(); ushort target = (ushort)com.GetData<DefaultData>(0).Value; ushort count = (ushort)com.GetData<DefaultData>(1).Value; AgentController ac = AgentController.InstanceManagers [conID]; string agentCode = AgentController.GetAgentCode (target); for (int i = 0; i < count; i++) { LSAgent agent = ac.CreateAgent (agentCode, pos); bufferSpawnedAgents.Add(agent); } } public static Command GenerateSpawnCommand(AgentController cont, string agentCode, int count, Vector2d position) { Command com = new Command (InputCodeManager.GetCodeID ("Spawn")); com.ControllerID = cont.ControllerID; com.Add<Vector2d>(position); com.Add<DefaultData>(new DefaultData(DataType.UShort,(ushort)AgentController.GetAgentCodeIndex(agentCode))); com.Add<DefaultData>(new DefaultData(DataType.UShort,(ushort)count)); return com; } } }
using UnityEngine; using System.Collections; namespace Lockstep.Example { public class ExampleSpawner : BehaviourHelper { public override ushort ListenInput { get { return InputCodeManager.GetCodeID("Spawn"); } } /* * Command com = new Command (InputCodeManager.GetCodeID ("Spawn")); com.ControllerID = cont.ControllerID; com.Position = position; com.Target = (ushort)AgentController.GetAgentCodeIndex(agentCode); com.Count = count; return com; */ protected override void OnExecute (Command com) { byte conID = com.ControllerID; Vector2d pos = com.GetData<Vector2d>(); ushort target = (ushort)com.GetData<DefaultData>(0).Value; ushort count = (ushort)com.GetData<DefaultData>(1).Value; AgentController ac = AgentController.InstanceManagers [conID]; string agentCode = AgentController.GetAgentCode (target); for (int i = 0; i < count; i++) { ac.CreateAgent (agentCode, pos); } } public static Command GenerateSpawnCommand(AgentController cont, string agentCode, int count, Vector2d position) { Command com = new Command (InputCodeManager.GetCodeID ("Spawn")); com.ControllerID = cont.ControllerID; com.Add<Vector2d>(position); com.Add<DefaultData>(new DefaultData(DataType.UShort,(ushort)AgentController.GetAgentCodeIndex(agentCode))); com.Add<DefaultData>(new DefaultData(DataType.UShort,(ushort)count)); return com; } } }
mit
C#
078aa0a8fe90bfcab69bcf916edc3b14874e1ce0
Modify case handling of entry types
githubpermutation/Flirper
Flirper/ImageListEntry.cs
Flirper/ImageListEntry.cs
using System; using System.IO; namespace Flirper { public class ImageListEntry { public string uri; public string title; public string author; public string extraInfo; public ImageListEntry (string uri, string title, string author, string extraInfo) { this.uri = uri; this.title = title; this.author = author; this.extraInfo = extraInfo; } public bool isHTTP { get { return this.uri.ToLower ().StartsWith ("http:") || this.uri.ToLower ().StartsWith ("https:"); } } public bool isFile { get { return isLocal && !System.IO.Directory.Exists(@uri) && System.IO.File.Exists(@uri); } } public bool isDirectory { get { if (!isLocal || isFile) return false; FileAttributes attr = System.IO.File.GetAttributes (@uri); return (attr & FileAttributes.Directory) == FileAttributes.Directory; } } public bool isLatestSaveGame { get { return this.uri.ToLower ().StartsWith ("savegame"); } } private bool isLocal { get { return !(isHTTP || isLatestSaveGame); } } public bool isValidPath { get { if(!isLocal) return true; try { FileInfo fi = new System.IO.FileInfo(@uri); FileAttributes attr = System.IO.File.GetAttributes (@uri); } catch (Exception ex) { ex.ToString(); return false; } return true; } } } }
using System; using System.IO; namespace Flirper { public class ImageListEntry { public string uri; public string title; public string author; public string extraInfo; public ImageListEntry (string uri, string title, string author, string extraInfo) { this.uri = uri; this.title = title; this.author = author; this.extraInfo = extraInfo; } public bool isHTTP { get { return this.uri.ToLower ().StartsWith ("http:") || this.uri.ToLower ().StartsWith ("https:"); } } public bool isFile { get { if (isHTTP || isLatestSaveGame) return false; return !System.IO.Directory.Exists(@uri) && System.IO.File.Exists(@uri); } } public bool isDirectory { get { if (isHTTP || isLatestSaveGame || isFile) return false; FileAttributes attr = System.IO.File.GetAttributes (@uri); return (attr & FileAttributes.Directory) == FileAttributes.Directory; } } public bool isLatestSaveGame { get { return this.uri.ToLower ().StartsWith ("savegame"); } } public bool isValidPath { get { if(isHTTP || isLatestSaveGame) return true; try { FileInfo fi = new System.IO.FileInfo(@uri); FileAttributes attr = System.IO.File.GetAttributes (@uri); } catch (Exception ex) { ex.ToString(); return false; } return true; } } } }
mit
C#
f141e98a4ef02eb3ce41c06b53180e541257a01e
implement unit tests for block parsing
instilledbee/PSXCardReader.NET
PSXCardPOC/Program.cs
PSXCardPOC/Program.cs
using PSXMMCLibrary; using System; using System.IO; using System.Text; namespace PSXCardPOC { class Program { static void Main(string[] args) { MemoryCard mc = new MemoryCard("ctr.mcr"); Encoding shiftJisEncoding = Encoding.GetEncoding(932); byte[] mBlock = mc.GetHeaderBlock(); Console.WriteLine("Header Block: "); // Values should be "M" "C" Console.WriteLine("Magic values: {0}{1}", (char)(mBlock[0]), (char)(mBlock[1])); // XOR or magic values (should be "OE") Console.WriteLine("Checksum magic values: {0}", mBlock[127].ToString("X2")); Console.ReadKey(); for (int i = 0; i <= 14; ++i) { var directoryFrame = mc.GetDirectoryFrame(i); Console.WriteLine("(#{0}) Directory Frame: ", i + 1); Console.WriteLine("Availability: {0}", directoryFrame.AvailableStatus); Console.WriteLine("Used Blocks Byte: {0}", directoryFrame.BlocksUsed); Console.WriteLine("Link order: {0}", directoryFrame.LinkOrder); Console.WriteLine("Country Code: {0}", directoryFrame.Country); Console.WriteLine("Product Code: {0}", directoryFrame.ProductCode); Console.WriteLine("Identifier: {0}", directoryFrame.Identifier); Console.WriteLine("Checksum: {0}", directoryFrame.CheckSum); Console.ReadKey(); } for (int i = 1; i <= 15; ++i) { var block = mc.GetBlock(i); Console.WriteLine("(#{0}) Block: ", i); //Console.WriteLine("Magic values: {0}{1}", (char)(block[0]), (char)(block[1])); Console.WriteLine("Icon display flag: {0}", block.IconFrames); Console.WriteLine("Blocks used: {0}", block.BlocksUsed); Console.WriteLine("Title: {0}", block.Title); Console.WriteLine(String.Empty); Console.ReadKey(); } } } }
using PSXMMCLibrary; using System; using System.IO; using System.Text; namespace PSXCardPOC { class Program { static void Main(string[] args) { MemoryCard mc = new MemoryCard("ctr.mcr"); Encoding shiftJisEncoding = Encoding.GetEncoding(932); byte[] mBlock = mc.GetRawBlock(0); Console.WriteLine("Header Block: "); // Values should be "M" "C" Console.WriteLine("Magic values: {0}{1}", (char)(mBlock[0]), (char)(mBlock[1])); // XOR or magic values (should be "OE") Console.WriteLine("Checksum magic values: {0}", mBlock[127].ToString("X2")); Console.ReadKey(); for (int i = 0; i <= 14; ++i) { var directoryFrame = mc.GetDirectoryFrame(i); Console.WriteLine("(#{0}) Directory Frame: ", i + 1); Console.WriteLine("Availability: {0}", directoryFrame.AvailableStatus); Console.WriteLine("Used Blocks Byte: {0}", directoryFrame.BlocksUsed); Console.WriteLine("Link order: {0}", directoryFrame.LinkOrder); Console.WriteLine("Country Code: {0}", directoryFrame.Country); Console.WriteLine("Product Code: {0}", directoryFrame.ProductCode); Console.WriteLine("Identifier: {0}", directoryFrame.Identifier); Console.WriteLine("Checksum: {0}", directoryFrame.CheckSum); Console.ReadKey(); } for (int i = 1; i <= 15; ++i) { var block = mc.GetBlock(i); Console.WriteLine("(#{0}) Title Frame: ", i); //Console.WriteLine("Magic values: {0}{1}", (char)(block[0]), (char)(block[1])); Console.WriteLine("Icon display flag: {0}", block.IconFrames); Console.WriteLine("Blocks used: {0}", block.BlocksUsed); Console.WriteLine("Title: {0}", block.Title); Console.WriteLine(String.Empty); Console.ReadKey(); } } } }
mit
C#
c373ca920e137ea196f437f717d17cbeb9a31f08
switch GetGrantedScopes to call Scope.TryParse for now
Brightspace/D2L.Security.OAuth2
src/D2L.Security.OAuth2.WebApi/Extensions/System.Security.Claims.ClaimsPrincipal.Extensions.cs
src/D2L.Security.OAuth2.WebApi/Extensions/System.Security.Claims.ClaimsPrincipal.Extensions.cs
using System.Collections.Generic; using System.Linq; using System.Security.Claims; using D2L.Security.OAuth2.Scopes; namespace D2L.Security.OAuth2 { internal static partial class WebApiExtensionMethods { internal static IEnumerable<Scope> GetGrantedScopes( this ClaimsPrincipal principal ) { IEnumerable<Scope> grantedScopes = principal.FindAll( Constants.Claims.SCOPE ) .SelectMany( c => c.Value.Split( ' ' ) ) .Select( scopeString => { Scope scope; if( Scope.TryParse( scopeString, out scope ) ) { return scope; } return null; } ) .Where( s => s != null ); return grantedScopes; } } }
using System.Collections.Generic; using System.Linq; using System.Security.Claims; using D2L.Security.OAuth2.Scopes; namespace D2L.Security.OAuth2 { internal static partial class WebApiExtensionMethods { internal static IEnumerable<Scope> GetGrantedScopes( this ClaimsPrincipal principal ) { IEnumerable<Scope> grantedScopes = principal.FindAll( Constants.Claims.SCOPE ) .SelectMany( c => c.Value.Split( ' ' ) ) .Select( Scope.Parse ) .Where( s => s != null ); return grantedScopes; } } }
apache-2.0
C#
0ba1eef298e70d4ff7b18c6c78e656f345d919ae
bump version
Dalet/140-speedrun-timer,Dalet/140-speedrun-timer,Dalet/140-speedrun-timer
SharedAssemblyInfo.cs
SharedAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyVersion("0.6.1.5")] [assembly: AssemblyFileVersion("0.6.1.5")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyVersion("0.6.1.4")] [assembly: AssemblyFileVersion("0.6.1.4")]
unlicense
C#
cb9300263ce4c3f39595b92a5abbcde418f239f7
Add array test
DotNetCross/Memory.Unsafe
src/DotNetCross.Memory.Unsafe.Tests/Unsafe.AsRefAtByteOffset.Test.cs
src/DotNetCross.Memory.Unsafe.Tests/Unsafe.AsRefAtByteOffset.Test.cs
using Xunit; namespace DotNetCross.Memory.Tests { public class Unsafe_AsRefAtByteOffset_Test { public class ObjectValue { public int Value = 42; } [Fact] public static unsafe void AsRefAtByteOffset_Object() { var obj = new ObjectValue(); ref var valueRef = ref obj.Value; var valueByteOffset = Unsafe.ByteOffset(obj, ref valueRef); ref var byteOffsetValueRef = ref Unsafe.AsRefAtByteOffset<int>(obj, valueByteOffset); byteOffsetValueRef = 17; Assert.True(Unsafe.AreSame(ref valueRef, ref byteOffsetValueRef)); Assert.Equal(17, obj.Value); } [Fact] public static unsafe void AsRefAtByteOffset_Array() { var array = new byte[] { 0, 1, 2}; ref var valueRef = ref array[1]; var valueByteOffset = Unsafe.ByteOffset(array, ref valueRef); ref var byteOffsetValueRef = ref Unsafe.AsRefAtByteOffset<byte>(array, valueByteOffset); byteOffsetValueRef = 17; ref var nextValueRef = ref Unsafe.Add(ref byteOffsetValueRef, 1); nextValueRef = 42; Assert.True(Unsafe.AreSame(ref valueRef, ref byteOffsetValueRef)); Assert.Equal(17, array[1]); Assert.Equal(42, array[2]); } } }
using Xunit; namespace DotNetCross.Memory.Tests { public class Unsafe_AsRefAtByteOffset_Test { public class ObjectValue { public int Value = 42; } [Fact] public static unsafe void AsRefAtByteOffset() { var obj = new ObjectValue(); ref var valueRef = ref obj.Value; var valueByteOffset = Unsafe.ByteOffset(obj, ref valueRef); ref var byteOffsetValueRef = ref Unsafe.AsRefAtByteOffset<int>(obj, valueByteOffset); byteOffsetValueRef = 17; Assert.True(Unsafe.AreSame(ref valueRef, ref byteOffsetValueRef)); Assert.Equal(17, obj.Value); } } }
mit
C#
6f1df96d23c9e2489972ffd48914f8a00f56bff1
Update CommonAssemblyInfo.cs
atata-framework/atata-sample-app-tests
src/CommonAssemblyInfo.cs
src/CommonAssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Yevgeniy Shunevych")] [assembly: AssemblyProduct("Atata Framework")] [assembly: AssemblyCopyright("© Yevgeniy Shunevych 2018")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyFileVersion("1.0.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Yevgeniy Shunevych")] [assembly: AssemblyProduct("Atata Framework")] [assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2017")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("0.16.0")] [assembly: AssemblyFileVersion("0.16.0")]
apache-2.0
C#
278475fdce4d709076f51c0ffd3891b96c490e7a
Update IncrementalTestsOnCultureSpecificResource.cs
gkhanna79/cli,weshaggard/cli,AbhitejJohn/cli,weshaggard/cli,marono/cli,schellap/cli,dasMulli/cli,schellap/cli,borgdylan/dotnet-cli,blackdwarf/cli,borgdylan/dotnet-cli,gkhanna79/cli,MichaelSimons/cli,jkotas/cli,Faizan2304/cli,Faizan2304/cli,ravimeda/cli,MichaelSimons/cli,johnbeisner/cli,anurse/Cli,schellap/cli,EdwardBlair/cli,krwq/cli,blackdwarf/cli,jonsequitur/cli,krwq/cli,mlorbetske/cli,AbhitejJohn/cli,danquirk/cli,MichaelSimons/cli,schellap/cli,johnbeisner/cli,mylibero/cli,stuartleeks/dotnet-cli,gkhanna79/cli,livarcocc/cli-1,mlorbetske/cli,dasMulli/cli,weshaggard/cli,schellap/cli,krwq/cli,EdwardBlair/cli,naamunds/cli,nguerrera/cli,JohnChen0/cli,harshjain2/cli,weshaggard/cli,schellap/cli,marono/cli,naamunds/cli,jkotas/cli,krwq/cli,jkotas/cli,danquirk/cli,livarcocc/cli-1,jkotas/cli,borgdylan/dotnet-cli,harshjain2/cli,FubarDevelopment/cli,jkotas/cli,JohnChen0/cli,stuartleeks/dotnet-cli,nguerrera/cli,johnbeisner/cli,JohnChen0/cli,borgdylan/dotnet-cli,svick/cli,FubarDevelopment/cli,marono/cli,danquirk/cli,blackdwarf/cli,harshjain2/cli,jonsequitur/cli,mylibero/cli,danquirk/cli,gkhanna79/cli,jonsequitur/cli,krwq/cli,borgdylan/dotnet-cli,JohnChen0/cli,jonsequitur/cli,Faizan2304/cli,weshaggard/cli,mlorbetske/cli,mylibero/cli,blackdwarf/cli,stuartleeks/dotnet-cli,MichaelSimons/cli,EdwardBlair/cli,ravimeda/cli,svick/cli,livarcocc/cli-1,dasMulli/cli,FubarDevelopment/cli,mlorbetske/cli,MichaelSimons/cli,nguerrera/cli,AbhitejJohn/cli,naamunds/cli,naamunds/cli,svick/cli,AbhitejJohn/cli,marono/cli,stuartleeks/dotnet-cli,marono/cli,mylibero/cli,danquirk/cli,mylibero/cli,naamunds/cli,FubarDevelopment/cli,gkhanna79/cli,stuartleeks/dotnet-cli,ravimeda/cli,nguerrera/cli
test/dotnet-build.Tests/IncrementalTestsOnCultureSpecificResource.cs
test/dotnet-build.Tests/IncrementalTestsOnCultureSpecificResource.cs
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.IO; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; namespace Microsoft.DotNet.Tools.Builder.Tests { public class IncrementalTestsOnCultureSpecificResource : IncrementalTestBase { public IncrementalTestsOnCultureSpecificResource() { MainProject = "TestProjectWithCultureSpecificResource"; ExpectedOutput = "Hello World!" + Environment.NewLine + "Bonjour!" + Environment.NewLine; } // Sridhar-MS - temporarily disable the test and investigate why it is failing in CI machine. // [Fact] public void TestRebuildSkipsCompilationOnNonCultureResource() { var testInstance = TestAssetsManager.CreateTestInstance("TestProjectWithCultureSpecificResource") .WithLockFiles(); TestProjectRoot = testInstance.TestRoot; var buildResult = BuildProject(); buildResult.Should().HaveCompiledProject(MainProject); buildResult = BuildProject(); buildResult.Should().HaveSkippedProjectCompilation(MainProject); } } }
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.IO; using Microsoft.DotNet.Tools.Test.Utilities; using Xunit; namespace Microsoft.DotNet.Tools.Builder.Tests { public class IncrementalTestsOnCultureSpecificResource : IncrementalTestBase { public IncrementalTestsOnCultureSpecificResource() { MainProject = "TestProjectWithCultureSpecificResource"; ExpectedOutput = "Hello World!" + Environment.NewLine + "Bonjour!" + Environment.NewLine; } [Fact] public void TestRebuildSkipsCompilationOnNonCultureResource() { var testInstance = TestAssetsManager.CreateTestInstance("TestProjectWithCultureSpecificResource") .WithLockFiles(); TestProjectRoot = testInstance.TestRoot; var buildResult = BuildProject(); buildResult.Should().HaveCompiledProject(MainProject); buildResult = BuildProject(); buildResult.Should().HaveSkippedProjectCompilation(MainProject); } } }
mit
C#
161edc8788596b9b64f9c08dc0e703b0877a34e5
add sentiment fields to aggregate dto
Redcley/iot-insider-lab,Redcley/iot-insider-lab
Argonne/Api/ArgonneWebApi/Models/Datastore/CampaignAdAggregateData.cs
Argonne/Api/ArgonneWebApi/Models/Datastore/CampaignAdAggregateData.cs
using System; namespace ArgonneWebApi.Models.Datastore { internal class CampaignAdAggregateData { public Guid CampaignId { get; set; } public string CampaignName { get; set; } public Guid DisplayedAdId { get; set; } public string AdName { get; set; } public int? TotalFaces { get; set; } public int? UniqueFaces { get; set; } public string OverallSentiment { get; set; } public decimal? TotalAnger { get; set; } public decimal? TotalContempt { get; set; } public decimal? TotalDisgust { get; set; } public decimal? TotalFear { get; set; } public decimal? TotalHappiness { get; set; } public decimal? TotalNeutral { get; set; } public decimal? TotalSadness { get; set; } public decimal? TotalSurprise { get; set; } public int? MinAge { get; set; } public int? MaxAge { get; set; } public int? UniqueMales { get; set; } public int? UniqueFemales { get; set; } public int? AgeBracket0 { get; set; } public int? AgeBracket0Males { get; set; } public int? AgeBracket0Females { get; set; } public int? AgeBracket1 { get; set; } public int? AgeBracket1Males { get; set; } public int? AgeBracket1Females { get; set; } public int? AgeBracket2 { get; set; } public int? AgeBracket2Males { get; set; } public int? AgeBracket2Females { get; set; } public int? AgeBracket3 { get; set; } public int? AgeBracket3Males { get; set; } public int? AgeBracket3Females { get; set; } public int? AgeBracket4 { get; set; } public int? AgeBracket4Males { get; set; } public int? AgeBracket4Females { get; set; } public int? AgeBracket5 { get; set; } public int? AgeBracket5Males { get; set; } public int? AgeBracket5Females { get; set; } public int? AgeBracket6 { get; set; } public int? AgeBracket6Males { get; set; } public int? AgeBracket6Females { get; set; } } } //WHEN Age BETWEEN 0 AND 14 THEN 0 //WHEN Age BETWEEN 15 AND 19 THEN 1 //WHEN Age BETWEEN 20 AND 29 THEN 2 //WHEN Age BETWEEN 30 AND 39 THEN 3 //WHEN Age BETWEEN 40 AND 49 THEN 4 //WHEN Age BETWEEN 50 AND 59 THEN 5 //ELSE 6
using System; namespace ArgonneWebApi.Models.Datastore { internal class CampaignAdAggregateData { public Guid CampaignId { get; set; } public string CampaignName { get; set; } public Guid DisplayedAdId { get; set; } public string AdName { get; set; } public int? TotalFaces { get; set; } public int? UniqueFaces { get; set; } public string OverallSentiment { get; set; } public int? MinAge { get; set; } public int? MaxAge { get; set; } public int? UniqueMales { get; set; } public int? UniqueFemales { get; set; } public int? AgeBracket0 { get; set; } public int? AgeBracket0Males { get; set; } public int? AgeBracket0Females { get; set; } public int? AgeBracket1 { get; set; } public int? AgeBracket1Males { get; set; } public int? AgeBracket1Females { get; set; } public int? AgeBracket2 { get; set; } public int? AgeBracket2Males { get; set; } public int? AgeBracket2Females { get; set; } public int? AgeBracket3 { get; set; } public int? AgeBracket3Males { get; set; } public int? AgeBracket3Females { get; set; } public int? AgeBracket4 { get; set; } public int? AgeBracket4Males { get; set; } public int? AgeBracket4Females { get; set; } public int? AgeBracket5 { get; set; } public int? AgeBracket5Males { get; set; } public int? AgeBracket5Females { get; set; } public int? AgeBracket6 { get; set; } public int? AgeBracket6Males { get; set; } public int? AgeBracket6Females { get; set; } } } //WHEN Age BETWEEN 0 AND 14 THEN 0 //WHEN Age BETWEEN 15 AND 19 THEN 1 //WHEN Age BETWEEN 20 AND 29 THEN 2 //WHEN Age BETWEEN 30 AND 39 THEN 3 //WHEN Age BETWEEN 40 AND 49 THEN 4 //WHEN Age BETWEEN 50 AND 59 THEN 5 //ELSE 6
mit
C#
6068d384a4af225b79833962e5cab9a96167bd5a
fix missing bundle tag helper
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
BTCPayServer/_ViewImports.cshtml
BTCPayServer/_ViewImports.cshtml
@using Microsoft.AspNetCore.Identity @using BTCPayServer @using BTCPayServer.Views @using BTCPayServer.Models @using BTCPayServer.Models.AccountViewModels @using BTCPayServer.Models.InvoicingModels @using BTCPayServer.Models.ManageViewModels @using BTCPayServer.Models.StoreViewModels @using BTCPayServer.Data @using Microsoft.AspNetCore.Routing; @inject BTCPayServer.Services.Safe Safe @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, BTCPayServer @addTagHelper *, BundlerMinifier.TagHelpers
@using Microsoft.AspNetCore.Identity @using BTCPayServer @using BTCPayServer.Views @using BTCPayServer.Models @using BTCPayServer.Models.AccountViewModels @using BTCPayServer.Models.InvoicingModels @using BTCPayServer.Models.ManageViewModels @using BTCPayServer.Models.StoreViewModels @using BTCPayServer.Data @using Microsoft.AspNetCore.Routing; @inject BTCPayServer.Services.Safe Safe @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, BTCPayServer
mit
C#
301b4a35af57dbd23b4f14300a056a439574a288
Fix the type of the tilt surface, the previous case was invalide because CreateSimilar didn't have the proper format and data keys set.
GNOME/f-spot,mono/f-spot,NguyenMatthieu/f-spot,nathansamson/F-Spot-Album-Exporter,nathansamson/F-Spot-Album-Exporter,dkoeb/f-spot,mono/f-spot,nathansamson/F-Spot-Album-Exporter,Sanva/f-spot,NguyenMatthieu/f-spot,mans0954/f-spot,Yetangitu/f-spot,mans0954/f-spot,Yetangitu/f-spot,mans0954/f-spot,mono/f-spot,Yetangitu/f-spot,dkoeb/f-spot,Yetangitu/f-spot,mans0954/f-spot,dkoeb/f-spot,nathansamson/F-Spot-Album-Exporter,mono/f-spot,dkoeb/f-spot,dkoeb/f-spot,GNOME/f-spot,Yetangitu/f-spot,Sanva/f-spot,GNOME/f-spot,Sanva/f-spot,GNOME/f-spot,Sanva/f-spot,mans0954/f-spot,dkoeb/f-spot,mono/f-spot,GNOME/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,mans0954/f-spot,mono/f-spot
src/Filters/TiltFilter.cs
src/Filters/TiltFilter.cs
/* * Filters/TiltFilter.cs * * Author(s) * * Larry Ewing <lewing@novell.com> * * This is free software. See COPYING for details * */ using System; using System.IO; using FSpot; using FSpot.Widgets; using Cairo; using Gdk; #if ENABLE_NUNIT using NUnit.Framework; #endif namespace FSpot.Filters { public class TiltFilter : IFilter { double angle; public TiltFilter (double angle) { this.angle = angle; } public bool Convert (FilterRequest req) { string source = req.Current.LocalPath; Uri dest = req.TempUri (Path.GetExtension (source)); ImageFile img = ImageFile.Create (source); using (Pixbuf pixbuf = img.Load ()) { using (ImageInfo info = new ImageInfo (pixbuf)) { MemorySurface surface = new MemorySurface (Format.Argb32, pixbuf.Width, pixbuf.Height); Context ctx = new Context (surface); ctx.Matrix = info.Fill (info.Bounds, angle); Pattern p = new SurfacePattern (info.Surface); ctx.Source = p; ctx.Paint (); ((IDisposable)ctx).Dispose (); p.Destroy (); using (Pixbuf result = CairoUtils.CreatePixbuf (surface)) { using (Stream output = File.OpenWrite (dest.LocalPath)) { img.Save (result, output); } } surface.Flush (); info.Dispose (); req.Current = dest; return true; } } } #if ENABLE_NUNIT [TestFixture] public class Tests : ImageTest { [Test] public void TestPng () { Basic ("file.png"); } [Test] public void TestJpeg () { Basic ("file.jpg"); } [Test] public void TestTiff () { Basic ("file.tiff"); } public void Basic (string name) { string path = CreateFile (name, 120); using (FilterRequest req = new FilterRequest (path)) { IFilter filter = new TiltFilter (Math.PI / 4); filter.Convert (req); Assert.IsTrue (System.IO.File.Exists (req.Current.LocalPath), "Error: Did not create " + req.Current.LocalPath); Assert.IsTrue (new FileInfo (req.Current.LocalPath).Length > 0, "Error: " + req.Current.LocalPath + "is Zero length"); } } } #endif } }
/* * Filters/TiltFilter.cs * * Author(s) * * Larry Ewing <lewing@novell.com> * * This is free software. See COPYING for details * */ using System; using System.IO; using FSpot; using FSpot.Widgets; using Cairo; using Gdk; #if ENABLE_NUNIT using NUnit.Framework; #endif namespace FSpot.Filters { public class TiltFilter : IFilter { double angle; public TiltFilter (double angle) { this.angle = angle; } public bool Convert (FilterRequest req) { string source = req.Current.LocalPath; Uri dest = req.TempUri (Path.GetExtension (source)); ImageFile img = ImageFile.Create (source); using (Pixbuf pixbuf = img.Load ()) { using (ImageInfo info = new ImageInfo (pixbuf)) { Surface surface = info.Surface.CreateSimilar (Content.Color, pixbuf.Width, pixbuf.Height); Context ctx = new Context (surface); ctx.Matrix = info.Fill (info.Bounds, angle); Pattern p = new SurfacePattern (info.Surface); ctx.Source = p; ctx.Paint (); ((IDisposable)ctx).Dispose (); p.Destroy (); using (Pixbuf result = CairoUtils.CreatePixbuf ((MemorySurface)surface)) { using (Stream output = File.OpenWrite (dest.LocalPath)) { img.Save (result, output); } } surface.Flush (); info.Dispose (); req.Current = dest; return true; } } } #if ENABLE_NUNIT [TestFixture] public class Tests : ImageTest { [Test] public void TestPng () { Basic ("file.png"); } [Test] public void TestJpeg () { Basic ("file.jpg"); } [Test] public void TestTiff () { Basic ("file.tiff"); } public void Basic (string name) { string path = CreateFile (name, 120); using (FilterRequest req = new FilterRequest (path)) { IFilter filter = new TiltFilter (Math.PI / 4); filter.Convert (req); Assert.IsTrue (System.IO.File.Exists (req.Current.LocalPath), "Error: Did not create " + req.Current.LocalPath); Assert.IsTrue (new FileInfo (req.Current.LocalPath).Length > 0, "Error: " + req.Current.LocalPath + "is Zero length"); } } } #endif } }
mit
C#
27055b7244055bd3cbc7e08deb0454f67a6ccac1
change to property
marihachi/MSharp2
src/MSharp.Core/Config.cs
src/MSharp.Core/Config.cs
using System; namespace MSharp.Core { public class Config { public string SessionKeyName { get; set; } = "hmsk"; public Uri Url { get; set; } = new Uri("https://misskey.xyz"); public Uri LoginUrl { get; set; } = new Uri("https://login.misskey.xyz"); public Uri ApiUrl { get; set; } = new Uri("https://himasaku.misskey.xyz"); public Uri StreamingApiUrl { get; set; } = new Uri("https://himasaku.misskey.xyz:3000"); } }
using System; namespace MSharp.Core { public class Config { public string SessionKeyName = "hmsk"; public Uri Url { get; set; } = new Uri("https://misskey.xyz"); public Uri LoginUrl { get; set; } = new Uri("https://login.misskey.xyz"); public Uri ApiUrl { get; set; } = new Uri("https://himasaku.misskey.xyz"); public Uri StreamingApiUrl { get; set; } = new Uri("https://himasaku.misskey.xyz:3000"); } }
mit
C#
9fd747bda46d461b15066e41f37f4a370bd9e838
Fix DelegatingHandler.Combine
yufeih/Common
src/HttpHelper.cs
src/HttpHelper.cs
namespace System.Net.Http { using System.Collections.Generic; using System.Diagnostics; using System.Linq; static class HttpHelper { public static string ValidatePath(string path) { if (path == null) throw new ArgumentNullException(nameof(path)); if (path == "" || path == "/") return ""; if (path[0] != '/' || path[path.Length - 1] == '/') throw new ArgumentException(nameof(path)); return path; } public static DelegatingHandler Combine(this IEnumerable<DelegatingHandler> handlers) { var result = handlers.FirstOrDefault(); var last = result; foreach (var handler in handlers.Skip(1)) { last.InnerHandler = handler; last = handler; } return result; } [Conditional("DEBUG")] public static void DumpErrors(HttpResponseMessage message) { if (!message.IsSuccessStatusCode && message.StatusCode != HttpStatusCode.Unauthorized) { var dump = (Action)(async () => { var error = await message.Content.ReadAsStringAsync(); Debug.WriteLine(error); }); dump(); } } public static int TryGetContentLength(HttpResponseMessage response) { int result; IEnumerable<string> value; if (response.Headers.TryGetValues("Content-Length", out value) && value.Any() && int.TryParse(value.First(), out result)) { return result; } return 0; } } }
namespace System.Net.Http { using System.Collections.Generic; using System.Diagnostics; using System.Linq; static class HttpHelper { public static string ValidatePath(string path) { if (path == null) throw new ArgumentNullException(nameof(path)); if (path == "" || path == "/") return ""; if (path[0] != '/' || path[path.Length - 1] == '/') throw new ArgumentException(nameof(path)); return path; } public static DelegatingHandler Combine(this IEnumerable<DelegatingHandler> handlers) { var result = handlers.FirstOrDefault(); var last = result; foreach (var handler in handlers) { last.InnerHandler = handler; last = handler; } return result; } [Conditional("DEBUG")] public static void DumpErrors(HttpResponseMessage message) { if (!message.IsSuccessStatusCode && message.StatusCode != HttpStatusCode.Unauthorized) { var dump = (Action)(async () => { var error = await message.Content.ReadAsStringAsync(); Debug.WriteLine(error); }); dump(); } } public static int TryGetContentLength(HttpResponseMessage response) { int result; IEnumerable<string> value; if (response.Headers.TryGetValues("Content-Length", out value) && value.Any() && int.TryParse(value.First(), out result)) { return result; } return 0; } } }
mit
C#
cd6ea4f89ca7148c3e144ce36b3491af3f74431f
Add Bigsby Gates was here
Bigsby/NetCore,Bigsby/NetCore,Bigsby/NetCore
consoleApp/Program.cs
consoleApp/Program.cs
using System; namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("Hello World, I was created by my father, Bigsby, in an unidentified evironment!"); Console.WriteLine("Bigsby Gates was here!"); } } }
using System; namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("Hello World, I was created by my father, Bigsby, in an unidentified evironment!"); } } }
apache-2.0
C#
687135d55f7e64e39e2c4516bbd45a9907b73846
Make backward compatible.
Eusth/IPA
IllusionInjector/Bootstrapper.cs
IllusionInjector/Bootstrapper.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace IllusionInjector { class Bootstrapper : MonoBehaviour { public event Action Destroyed = delegate {}; void Start() { Destroy(gameObject); } void OnDestroy() { Destroyed(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace IllusionInjector { class Bootstrapper : MonoBehaviour { public event Action Destroyed = delegate {}; void OnDestroy() { Destroyed(); } } }
mit
C#
b6322a1b8f841fe17621de979995eb2113d64655
change type of Id in WateringValue model
MCeddy/IoT-core
IoT-Core/Models/WateringValue.cs
IoT-Core/Models/WateringValue.cs
using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace IoT_Core.Models { public class WateringValue { public ObjectId Id { get; set; } [BsonDateTimeOptions(Kind = DateTimeKind.Local)] public DateTime Date { get; set; } public ObjectId SensorsId { get; set; } public int Milliseconds { get; set; } public WateringValue() { Date = DateTime.Now; } public WateringValue(SensorValues sensors, int milliseconds) : this() { SensorsId = sensors.Id; Milliseconds = milliseconds; } } }
using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace IoT_Core.Models { public class WateringValue { public int Id { get; set; } [BsonDateTimeOptions(Kind = DateTimeKind.Local)] public DateTime Date { get; set; } public ObjectId SensorsId { get; set; } public int Milliseconds { get; set; } public WateringValue() { Date = DateTime.Now; } public WateringValue(SensorValues sensors, int milliseconds) : this() { SensorsId = sensors.Id; Milliseconds = milliseconds; } } }
mit
C#
d5e29755ecaa72a339e0b09ca1b644758b5ac926
Update AssemblyInfo.cs
yaakoviyun/azure-sdk-for-net,jamestao/azure-sdk-for-net,jamestao/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,stankovski/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,markcowl/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,hyonholee/azure-sdk-for-net,stankovski/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,pilor/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,jamestao/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,pilor/azure-sdk-for-net,jamestao/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,hyonholee/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,pilor/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,hyonholee/azure-sdk-for-net,hyonholee/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,hyonholee/azure-sdk-for-net
src/SDKs/CognitiveServices/dataPlane/Language/SpellCheck/BingSpellCheck/Properties/AssemblyInfo.cs
src/SDKs/CognitiveServices/dataPlane/Language/SpellCheck/BingSpellCheck/Properties/AssemblyInfo.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System.Reflection; using System.Resources; [assembly: AssemblyTitle("Microsoft Azure Cognitive Services SpellCheck Client Library")] [assembly: AssemblyDescription("Provides API functions for consuming the Microsoft Azure Cognitive Services SpellCheck API.")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System.Reflection; using System.Resources; [assembly: AssemblyTitle("Microsoft Azure Cognitive Services SpellCheck Client Library")] [assembly: AssemblyDescription("Provides API functions for consuming the Microsoft Azure Cognitive Services SpellCheck API.")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
mit
C#
97bcc683aabb8c376c29bcd70b5e813fdcbedb7d
fix typo
frispgames/frisp-ads-unity-asset,frispgames/frisp-ads-unity-asset,frispgames/frisp-ads-unity-asset
Assets/Extensions/FrispAds/FrispAd.cs
Assets/Extensions/FrispAds/FrispAd.cs
using UnityEngine; using System.Collections; namespace FrispAds { using AdUnit = AdUnits.AdUnit; using Admob = AdUnits.Admob; using AppleAd = AdUnits.AppleAd; using FakeAdUnit = AdUnits.FakeAdUnit; public class FrispAd : MonoBehaviour { private static AdUnit iAdBanner = null; private static AdUnit adMobBanner = null; public FrispAd() { if (iAdBanner == null) iAdBanner = iAdUnit(); if (adMobBanner == null) adMobBanner = admobAdUnit(); } // Prioritize iAd over adMob as iAd pays more public void ShowBanner () { if (iAdBanner.Loaded ()) { adMobBanner.Hide (); iAdBanner.Show (); } else { adMobBanner.Show (); iAdBanner.Hide (); } } public void HideBanner () { adMobBanner.Hide (); iAdBanner.Hide (); } private AdUnit iAdUnit() { if (isAppleDevice ()) { return new AppleAd (); } else { return new FakeAdUnit (); } } private AdUnit admobAdUnit() { if (isAppleDevice () || isAndroidDevice()) { return new Admob (); } else { return new FakeAdUnit (); } } private bool isAndroidDevice() { #if UNITY_ANDROID && !UNITY_EDITOR return true; #else return false; #endif } private bool isAppleDevice() { #if UNITY_IPHONE && !UNITY_EDITOR return true; #else return false; #endif } } }
using UnityEngine; using System.Collections; namespace FrispAds { using AdUnit = FrispAds.AdUnits.AdUnit; using Admob = FrispAds.AdUnits.Admob; using AppleAd = FrispAds.AdUnits.AppleAd; using FakeAdUnit = FrispAds.AdUnits.FakeAdUnit; public class FrispAd : MonoBehaviour { private static AdUnit iAdBanner = null; private static AdUnit adMobBanner = null; public FrispAd() { if (iAdBanner == null) iAdBanner = iAdUnit(); if (adMobBanner == null) adMobBanner = admobAdUnit(); } // Prioritize iAd over adMob as iAd pays more public void ShowBanner () { if (iAdBanner.Loaded ()) { adMobBanner.Hide (); iAdBanner.Show (); } else { adMobBanner.Show (); iAdBanner.Hide (); } } public void HideBanner () { adMobBanner.Hide (); iAdBanner.Hide (); } private AdUnit iAdUnit() { if (isAppleDevice ()) { return new AppleAd (); } else { return new FakeAdUnit (); } } private AdUnit admobAdUnit() { if (isAppleDevice () || isAndroidDevice()) { return new Admob (); } else { return new FakeAdUnit (); } } private bool isAndroidDevice() { #if UNITY_ANDROID && !UNITY_EDITOR return true; #else return false; #endif } private bool isAppleDevice() { #if UNITY_IPHONE && !UNITY_EDITOR return true; #else return false; #endif } } }
mit
C#
6a0ae855d0cba1fd9249b0c9fe04d2dcec9d0758
Update Facede method
vivet/GoogleApi
GoogleApi/GoogleSearch.cs
GoogleApi/GoogleSearch.cs
using GoogleApi.Entities.Search; using GoogleApi.Entities.Search.Image.Request; using GoogleApi.Entities.Search.Video.Request; using GoogleApi.Entities.Search.Video.Response; using GoogleApi.Entities.Search.Web.Request; namespace GoogleApi { /// <summary> /// The JSON/Atom Custom Search API lets you develop websites and applications to retrieve and display search results from Google Custom Search programmatically. /// With this API, you can use RESTful requests to get either web search or image search results in JSON or Atom format. /// https://developers.google.com/custom-search/docs/overview /// By calling the API user issues requests against an existing instance of a Custom Search Engine. /// Therefore, before using the API, you need to create one in the Control Panel (https://cse.google.com/cse/all). /// Follow the tutorial to learn more about different configuration options. You can find the engine's ID in the Setup > Basics > Details section of the Control Panel. /// REST Api: https://developers.google.com/custom-search/json-api/v1/overview /// There are also two external documents that are helpful resources for using this API: /// - Google WebSearch Protocol(XML): The JSON/Atom Custom Search API provides a subset of the functionality provided by the XML API, but it instead returns data in JSON or Atom format. (https://developers.google.com/custom-search/docs/xml_results) /// - OpenSearch 1.1 Specification: This API uses the OpenSearch specification to describe the search engine and provide data regarding the results.Because of this, you can write your code so that it can support any OpenSearch engine, not just Google's custom search engine. There is currently no other JSON implementation of OpenSearch, so all the examples in the OpenSearch spec are in XML. (http://www.opensearch.org/Specifications/OpenSearch/1.1) /// </summary> public class GoogleSearch { /// <summary> /// Web Search. /// You can retrieve results for a particular search by sending an HTTP GET request to its URI. /// You pass in the details of the search request as query parameters. /// </summary> public static HttpEngine<WebSearchRequest, BaseSearchResponse> WebSearch => HttpEngine<WebSearchRequest, BaseSearchResponse>.instance; /// <summary> /// Image Search. /// You can retrieve results for a particular search by sending an HTTP GET request to its URI. /// You pass in the details of the search request as query parameters. /// </summary> public static HttpEngine<ImageSearchRequest, BaseSearchResponse> ImageSearch => HttpEngine<ImageSearchRequest, BaseSearchResponse>.instance; /// <summary> /// Video Search. /// You can retrieve results for a particular search by sending an HTTP GET request to its URI. /// You pass in the details of the search request as query parameters. /// Docs: https://developers.google.com/youtube/v3/getting-started /// </summary> public static HttpEngine<VideoSearchRequest, VideoSearchResponse> VideoSearch => HttpEngine<VideoSearchRequest, VideoSearchResponse>.instance; } }
using GoogleApi.Entities.Search; using GoogleApi.Entities.Search.Image.Request; using GoogleApi.Entities.Search.Web.Request; namespace GoogleApi { /// <summary> /// The JSON/Atom Custom Search API lets you develop websites and applications to retrieve and display search results from Google Custom Search programmatically. /// With this API, you can use RESTful requests to get either web search or image search results in JSON or Atom format. /// https://developers.google.com/custom-search/docs/overview /// By calling the API user issues requests against an existing instance of a Custom Search Engine. /// Therefore, before using the API, you need to create one in the Control Panel (https://cse.google.com/cse/all). /// Follow the tutorial to learn more about different configuration options. You can find the engine's ID in the Setup > Basics > Details section of the Control Panel. /// REST Api: https://developers.google.com/custom-search/json-api/v1/overview /// There are also two external documents that are helpful resources for using this API: /// - Google WebSearch Protocol(XML): The JSON/Atom Custom Search API provides a subset of the functionality provided by the XML API, but it instead returns data in JSON or Atom format. (https://developers.google.com/custom-search/docs/xml_results) /// - OpenSearch 1.1 Specification: This API uses the OpenSearch specification to describe the search engine and provide data regarding the results.Because of this, you can write your code so that it can support any OpenSearch engine, not just Google's custom search engine. There is currently no other JSON implementation of OpenSearch, so all the examples in the OpenSearch spec are in XML. (http://www.opensearch.org/Specifications/OpenSearch/1.1) /// </summary> public class GoogleSearch { /// <summary> /// Web Search (free). /// You can retrieve results for a particular search by sending an HTTP GET request to its URI. /// You pass in the details of the search request as query parameters. /// </summary> public static HttpEngine<WebSearchRequest, BaseSearchResponse> WebSearch => HttpEngine<WebSearchRequest, BaseSearchResponse>.instance; /// <summary> /// Image Search (free). /// You can retrieve results for a particular search by sending an HTTP GET request to its URI. /// You pass in the details of the search request as query parameters. /// </summary> public static HttpEngine<ImageSearchRequest, BaseSearchResponse> ImageSearch => HttpEngine<ImageSearchRequest, BaseSearchResponse>.instance; } }
mit
C#
8c9e06664a6f38de6c34bb62bdb8c9a09ca7de26
Return 400 instead of 500 if no login/password
joinrpg/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net
Joinrpg/App_Start/ApiSignInProvider.cs
Joinrpg/App_Start/ApiSignInProvider.cs
using System.Threading.Tasks; using JoinRpg.Web.Helpers; using Microsoft.Owin.Security.OAuth; namespace JoinRpg.Web { internal class ApiSignInProvider : OAuthAuthorizationServerProvider { private ApplicationUserManager Manager { get; } public ApiSignInProvider(ApplicationUserManager manager) { Manager = manager; } /// <inheritdoc /> public override Task ValidateClientAuthentication( OAuthValidateClientAuthenticationContext context) { context.Validated(); return Task.FromResult(0); } public override async Task GrantResourceOwnerCredentials( OAuthGrantResourceOwnerCredentialsContext context) { context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] {"*"}); if (string.IsNullOrWhiteSpace(context.UserName) || string.IsNullOrWhiteSpace(context.Password)) { context.SetError("invalid_grant", "Please supply susername and password."); return; } var user = await Manager.FindByEmailAsync(context.UserName); if (!await Manager.CheckPasswordAsync(user, context.Password)) { context.SetError("invalid_grant", "The user name or password is incorrect."); return; } var x = await user.GenerateUserIdentityAsync(Manager, context.Options.AuthenticationType); context.Validated(x); } } }
using System.Data.Entity; using System.Threading.Tasks; using JoinRpg.Web.Helpers; using Microsoft.Owin.Security.OAuth; namespace JoinRpg.Web { internal class ApiSignInProvider : OAuthAuthorizationServerProvider { private ApplicationUserManager Manager { get; } public ApiSignInProvider(ApplicationUserManager manager) { Manager = manager; } /// <inheritdoc /> public override Task ValidateClientAuthentication( OAuthValidateClientAuthenticationContext context) { context.Validated(); return Task.FromResult(0); } public override async Task GrantResourceOwnerCredentials( OAuthGrantResourceOwnerCredentialsContext context) { context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] {"*"}); var user = await Manager.FindByEmailAsync(context.UserName); if (!await Manager.CheckPasswordAsync(user, context.Password)) { context.SetError("invalid_grant", "The user name or password is incorrect."); return; } var x = await user.GenerateUserIdentityAsync(Manager, context.Options.AuthenticationType); context.Validated(x); } } }
mit
C#