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 |
|---|---|---|---|---|---|---|---|---|
7e98de7d0c3f2e125384ee24e5730ecf5f2cdea2 | Bump version for release | programcsharp/griddly,jehhynes/griddly,programcsharp/griddly,programcsharp/griddly,jehhynes/griddly | Build/CommonAssemblyInfo.cs | Build/CommonAssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Griddly")]
[assembly: AssemblyCopyright("Copyright © 2013-2017 Chris Hynes and Data Research Group")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.8.4")]
[assembly: AssemblyFileVersion("1.8.4")]
//[assembly: AssemblyInformationalVersion("1.4.5-editlyalpha2")]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Griddly")]
[assembly: AssemblyCopyright("Copyright © 2013-2017 Chris Hynes and Data Research Group")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.8.3")]
[assembly: AssemblyFileVersion("1.8.3")]
//[assembly: AssemblyInformationalVersion("1.4.5-editlyalpha2")]
| mit | C# |
d5ce618d9bf32e4098d6a0a2c947981be7d59982 | Update with framework changes | DrabWeb/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,Nabile-Rahmani/osu,EVAST9919/osu,johnneijzen/osu,ppy/osu,peppy/osu,ZLima12/osu,naoey/osu,2yangk23/osu,johnneijzen/osu,EVAST9919/osu,UselessToucan/osu,ZLima12/osu,smoogipoo/osu,naoey/osu,NeoAdonis/osu,naoey/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,DrabWeb/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu-new,peppy/osu,peppy/osu,DrabWeb/osu,2yangk23/osu,ppy/osu | osu.Game/Tests/Visual/OsuTestCase.cs | osu.Game/Tests/Visual/OsuTestCase.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.IO;
using System.Reflection;
using osu.Framework.Testing;
namespace osu.Game.Tests.Visual
{
public abstract class OsuTestCase : TestCase
{
protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner();
public class OsuTestCaseTestRunner : OsuGameBase, ITestCaseTestRunner
{
protected override string MainResourceFile => File.Exists(base.MainResourceFile) ? base.MainResourceFile : Assembly.GetExecutingAssembly().Location;
private readonly TestCaseTestRunner.TestRunner runner;
public OsuTestCaseTestRunner()
{
runner = new TestCaseTestRunner.TestRunner();
}
protected override void LoadComplete()
{
base.LoadComplete();
Add(runner);
}
public void RunTestBlocking(TestCase test) => runner.RunTestBlocking(test);
}
}
}
| // 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;
using System.IO;
using System.Reflection;
using osu.Framework.Testing;
namespace osu.Game.Tests.Visual
{
public abstract class OsuTestCase : TestCase
{
public override void RunTest()
{
using (var host = new CleanRunHeadlessGameHost($"test-{Guid.NewGuid()}", realtime: false))
host.Run(new OsuTestCaseTestRunner(this));
}
public class OsuTestCaseTestRunner : OsuGameBase
{
private readonly OsuTestCase testCase;
protected override string MainResourceFile => File.Exists(base.MainResourceFile) ? base.MainResourceFile : Assembly.GetExecutingAssembly().Location;
public OsuTestCaseTestRunner(OsuTestCase testCase)
{
this.testCase = testCase;
}
protected override void LoadComplete()
{
base.LoadComplete();
Add(new TestCaseTestRunner.TestRunner(testCase));
}
}
}
}
| mit | C# |
aacb15e86be86365f52dc477a53ddf15c907912a | Rewrite WebGLUnityTaskDelayFactory to consume all tasks per frame | HelloKitty/317refactor | src/Client/Rs317.Client.Unity/WebGL/WebGLUnityTaskDelayFactory.cs | src/Client/Rs317.Client.Unity/WebGL/WebGLUnityTaskDelayFactory.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Rs317.Sharp
{
//Task.Delay does not work in WebGL because it uses
//System.Timers which requires multithreading under the hood.
//To mitigate this we manually create and managed timers on the main thread.
public sealed class WebGLUnityTaskDelayFactory : MonoBehaviour, ITaskDelayFactory
{
private class RegisteredDelayTaskSource
{
private float CreationTime { get; }
private float DurationSeconds { get; }
public TaskCompletionSource<bool> DelayTaskCompletionSource { get; }
public RegisteredDelayTaskSource(float creationTime, int durationInMilliseconds)
{
CreationTime = creationTime;
DurationSeconds = (float)durationInMilliseconds / 1000.0f;
DelayTaskCompletionSource = new TaskCompletionSource<bool>();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool isCompleted(float currentTime)
{
float secondsPassed = currentTime - CreationTime;
return secondsPassed >= DurationSeconds;
}
}
private readonly object SyncObj = new object();
private List<RegisteredDelayTaskSource> DelayTaskList = new List<RegisteredDelayTaskSource>();
[SerializeField]
private int RegisteredTaskDelayListCount = 0;
private void Update()
{
RegisteredTaskDelayListCount = DelayTaskList.Count;
lock (SyncObj)
{
if (DelayTaskList.Count == 0)
return;
//Poll until they're all complete.
while (PollRegisterTaskSourceList()) ;
}
}
private bool PollRegisterTaskSourceList()
{
//You may wonder why I'm doing things so oddly here
//There seemed to be some issues with completing the task within the loop.
//might actually be incorrect IL being generated??
RegisteredDelayTaskSource finished = null;
bool isTaskFired = false;
foreach (RegisteredDelayTaskSource source in DelayTaskList)
{
if (source.isCompleted(Time.time))
{
finished = source;
isTaskFired = true;
break;
}
}
if (isTaskFired)
finished.DelayTaskCompletionSource.SetResult(true);
if (isTaskFired)
if (DelayTaskList.Count == 0)
DelayTaskList.Clear();
else
DelayTaskList.Remove(finished);
return isTaskFired;
}
public Task Create(int context)
{
lock (SyncObj)
{
RegisteredDelayTaskSource task = new RegisteredDelayTaskSource(Time.time, context);
DelayTaskList.Add(task);
return task.DelayTaskCompletionSource.Task;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Rs317.Sharp
{
//Task.Delay does not work in WebGL because it uses
//System.Timers which requires multithreading under the hood.
//To mitigate this we manually create and managed timers on the main thread.
public sealed class WebGLUnityTaskDelayFactory : MonoBehaviour, ITaskDelayFactory
{
private class RegisteredDelayTaskSource
{
private float CreationTime { get; }
private float DurationSeconds { get; }
public TaskCompletionSource<bool> DelayTaskCompletionSource { get; }
public RegisteredDelayTaskSource(float creationTime, int durationInMilliseconds)
{
CreationTime = creationTime;
DurationSeconds = (float)durationInMilliseconds / 1000.0f;
DelayTaskCompletionSource = new TaskCompletionSource<bool>();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool isCompleted(float currentTime)
{
float secondsPassed = currentTime - CreationTime;
return secondsPassed >= DurationSeconds;
}
}
private readonly object SyncObj = new object();
private List<RegisteredDelayTaskSource> DelayTaskList = new List<RegisteredDelayTaskSource>();
private void Update()
{
lock (SyncObj)
{
if (DelayTaskList.Count == 0)
return;
//You may wonder why I'm doing things so oddly here
//There seemed to be some issues with completing the task within the loop.
//might actually be incorrect IL being generated??
RegisteredDelayTaskSource finished = null;
foreach (RegisteredDelayTaskSource source in DelayTaskList)
{
if (source.isCompleted(Time.time))
{
finished = source;
break;
}
}
finished?.DelayTaskCompletionSource.SetResult(true);
//DelayTaskList = DelayTaskList.Where(t => !t.DelayTaskCompletionSource.Task.IsCompleted).ToList();
DelayTaskList.RemoveAll(t => t.DelayTaskCompletionSource.Task.IsCompleted);
}
}
public Task Create(int context)
{
lock (SyncObj)
{
RegisteredDelayTaskSource task = new RegisteredDelayTaskSource(Time.time, context);
DelayTaskList.Add(task);
return task.DelayTaskCompletionSource.Task;
}
}
}
}
| mit | C# |
af236d4c91d13c3418c1508565a4f1b41deda1ca | Make an option2 | panopticoncentral/roslyn,stephentoub/roslyn,wvdd007/roslyn,sharwell/roslyn,weltkante/roslyn,KevinRansom/roslyn,jmarolf/roslyn,KevinRansom/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,sharwell/roslyn,wvdd007/roslyn,jmarolf/roslyn,mavasani/roslyn,eriawan/roslyn,reaction1989/roslyn,AmadeusW/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,aelij/roslyn,diryboy/roslyn,physhi/roslyn,jasonmalinowski/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,reaction1989/roslyn,ErikSchierboom/roslyn,AmadeusW/roslyn,shyamnamboodiripad/roslyn,aelij/roslyn,davkean/roslyn,KevinRansom/roslyn,gafter/roslyn,heejaechang/roslyn,wvdd007/roslyn,brettfo/roslyn,brettfo/roslyn,mavasani/roslyn,tmat/roslyn,genlu/roslyn,davkean/roslyn,tmat/roslyn,dotnet/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,ErikSchierboom/roslyn,eriawan/roslyn,gafter/roslyn,KirillOsenkov/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,genlu/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,AmadeusW/roslyn,tannergooding/roslyn,mavasani/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,eriawan/roslyn,AlekseyTs/roslyn,davkean/roslyn,brettfo/roslyn,AlekseyTs/roslyn,CyrusNajmabadi/roslyn,mgoertz-msft/roslyn,stephentoub/roslyn,tannergooding/roslyn,weltkante/roslyn,AlekseyTs/roslyn,tmat/roslyn,tannergooding/roslyn,bartdesmet/roslyn,diryboy/roslyn,genlu/roslyn,diryboy/roslyn,ErikSchierboom/roslyn,reaction1989/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,gafter/roslyn,jmarolf/roslyn,physhi/roslyn,aelij/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn | src/EditorFeatures/TestUtilities/InProcRemoteHostClientFactory.cs | src/EditorFeatures/TestUtilities/InProcRemoteHostClientFactory.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.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
using Microsoft.CodeAnalysis.Remote;
using Roslyn.Test.Utilities.Remote;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Test.Utilities.RemoteHost
{
internal static class RemoteHostOptions
{
public static readonly Option2<bool> RemoteHostTest = new Option2<bool>(
nameof(RemoteHostOptions), nameof(RemoteHostTest), defaultValue: false);
}
[ExportOptionProvider, Shared]
internal class RemoteHostOptionsProvider : IOptionProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public RemoteHostOptionsProvider()
{
}
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
RemoteHostOptions.RemoteHostTest);
}
[ExportWorkspaceService(typeof(IRemoteHostClientFactory)), Shared]
internal class InProcRemoteHostClientFactory : IRemoteHostClientFactory
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public InProcRemoteHostClientFactory()
{
}
public Task<RemoteHostClient> CreateAsync(Workspace workspace, CancellationToken cancellationToken)
{
if (workspace.Options.GetOption(RemoteHostOptions.RemoteHostTest))
{
return InProcRemoteHostClient.CreateAsync(workspace, runCacheCleanup: false);
}
return SpecializedTasks.Null<RemoteHostClient>();
}
}
}
| // 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.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
using Microsoft.CodeAnalysis.Remote;
using Roslyn.Test.Utilities.Remote;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Test.Utilities.RemoteHost
{
internal static class RemoteHostOptions
{
public static readonly Option<bool> RemoteHostTest = new Option<bool>(
nameof(RemoteHostOptions), nameof(RemoteHostTest), defaultValue: false);
}
[ExportOptionProvider, Shared]
internal class RemoteHostOptionsProvider : IOptionProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public RemoteHostOptionsProvider()
{
}
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
RemoteHostOptions.RemoteHostTest);
}
[ExportWorkspaceService(typeof(IRemoteHostClientFactory)), Shared]
internal class InProcRemoteHostClientFactory : IRemoteHostClientFactory
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public InProcRemoteHostClientFactory()
{
}
public Task<RemoteHostClient> CreateAsync(Workspace workspace, CancellationToken cancellationToken)
{
if (workspace.Options.GetOption(RemoteHostOptions.RemoteHostTest))
{
return InProcRemoteHostClient.CreateAsync(workspace, runCacheCleanup: false);
}
return SpecializedTasks.Null<RemoteHostClient>();
}
}
}
| mit | C# |
e9ce894f1b7b284b37dd0938d4e1315c06c2b532 | Add missing license header | dipeshc/BTDeploy | src/MonoTorrent/MonoTorrent.Client/PiecePicking/IgnoringPicker.cs | src/MonoTorrent/MonoTorrent.Client/PiecePicking/IgnoringPicker.cs | //
// IgnoringPicker.cs
//
// Authors:
// Alan McGovern alan.mcgovern@gmail.com
//
// Copyright (C) 2008 Alan McGovern
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Text;
using MonoTorrent.Common;
using MonoTorrent.Client.Messages;
namespace MonoTorrent.Client
{
public class IgnoringPicker : PiecePicker
{
BitField bitfield;
BitField temp;
public IgnoringPicker(BitField bitfield, PiecePicker picker)
: base(picker)
{
this.bitfield = bitfield;
this.temp = new BitField(bitfield.Length);
}
public override MessageBundle PickPiece(PeerId id, BitField peerBitfield, List<PeerId> otherPeers, int count, int startIndex, int endIndex)
{
// Invert 'bitfield' and AND it with the peers bitfield
// Any pieces which are 'true' in the bitfield will not be downloaded
temp.From(peerBitfield).NAnd(bitfield);
if (temp.AllFalse)
return null;
return base.PickPiece(id, temp, otherPeers, count, startIndex, endIndex);
}
public override bool IsInteresting(BitField bitfield)
{
temp.From(bitfield).NAnd(this.bitfield);
if (temp.AllFalse)
return false;
return base.IsInteresting(temp);
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using MonoTorrent.Common;
using MonoTorrent.Client.Messages;
namespace MonoTorrent.Client
{
public class IgnoringPicker : PiecePicker
{
BitField bitfield;
BitField temp;
public IgnoringPicker(BitField bitfield, PiecePicker picker)
: base(picker)
{
this.bitfield = bitfield;
this.temp = new BitField(bitfield.Length);
}
public override MessageBundle PickPiece(PeerId id, BitField peerBitfield, List<PeerId> otherPeers, int count, int startIndex, int endIndex)
{
// Invert 'bitfield' and AND it with the peers bitfield
// Any pieces which are 'true' in the bitfield will not be downloaded
temp.From(peerBitfield).NAnd(bitfield);
if (temp.AllFalse)
return null;
return base.PickPiece(id, temp, otherPeers, count, startIndex, endIndex);
}
public override bool IsInteresting(BitField bitfield)
{
temp.From(bitfield).NAnd(this.bitfield);
if (temp.AllFalse)
return false;
return base.IsInteresting(temp);
}
}
}
| mit | C# |
98b0d6c2a4b0e716f4b3be2ba2669790fb81932b | add manual RegisterValidator ext methods | nataren/NServiceKit,ZocDoc/ServiceStack,timba/NServiceKit,nataren/NServiceKit,ZocDoc/ServiceStack,NServiceKit/NServiceKit,MindTouch/NServiceKit,MindTouch/NServiceKit,meebey/ServiceStack,ZocDoc/ServiceStack,timba/NServiceKit,MindTouch/NServiceKit,ZocDoc/ServiceStack,MindTouch/NServiceKit,timba/NServiceKit,NServiceKit/NServiceKit,nataren/NServiceKit,NServiceKit/NServiceKit,timba/NServiceKit,nataren/NServiceKit,NServiceKit/NServiceKit,meebey/ServiceStack | src/ServiceStack.ServiceInterface/Validation/ValidationFeature.cs | src/ServiceStack.ServiceInterface/Validation/ValidationFeature.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Funq;
using ServiceStack.FluentValidation;
using ServiceStack.ServiceHost;
using ServiceStack.WebHost.Endpoints;
using ServiceStack.Text;
namespace ServiceStack.ServiceInterface.Validation
{
public static class ValidationFeature
{
/// <summary>
/// Activate the validation mechanism, so every request DTO with an existing validator
/// will be validated.
/// </summary>
/// <param name="appHost">The app host</param>
public static void Init(IAppHost appHost)
{
var filter = new ValidationFilters();
appHost.RequestFilters.Add(filter.RequestFilter);
}
/// <summary>
/// Auto-scans the provided assemblies for a <see cref="IValidator"/>
/// and registers it in the provided IoC container.
/// </summary>
/// <param name="container">The IoC container</param>
/// <param name="assemblies">The assemblies to scan for a validator</param>
public static void RegisterValidators(this Container container, params Assembly[] assemblies)
{
var autoWire = new ExpressionTypeFunqContainer(container);
foreach (var assembly in assemblies)
{
foreach (var validator in assembly.GetTypes()
.Where(t => t.IsOrHasGenericInterfaceTypeOf(typeof(IValidator<>))))
{
RegisterValidator(autoWire, validator);
}
}
}
public static void RegisterValidator(this Container container, Type validator)
{
RegisterValidator(new ExpressionTypeFunqContainer(container), validator);
}
private static void RegisterValidator(ExpressionTypeFunqContainer autoWire, Type validator)
{
var baseType = validator.BaseType;
while (!baseType.IsGenericType)
{
baseType = baseType.BaseType;
}
var dtoType = baseType.GetGenericArguments()[0];
var validatorType = typeof (IValidator<>).MakeGenericType(dtoType);
autoWire.RegisterType(validator, validatorType);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Funq;
using ServiceStack.FluentValidation;
using ServiceStack.ServiceHost;
using ServiceStack.WebHost.Endpoints;
using ServiceStack.Text;
namespace ServiceStack.ServiceInterface.Validation
{
public static class ValidationFeature
{
/// <summary>
/// Activate the validation mechanism, so every request DTO with an existing validator
/// will be validated.
/// </summary>
/// <param name="appHost">The app host</param>
public static void Init(IAppHost appHost)
{
var filter = new ValidationFilters();
appHost.RequestFilters.Add(filter.RequestFilter);
}
/// <summary>
/// Auto-scans the provided assemblies for a <see cref="IValidator"/>
/// and registers it in the provided IoC container.
/// </summary>
/// <param name="container">The IoC container</param>
/// <param name="assemblies">The assemblies to scan for a validator</param>
public static void RegisterValidators(this Container container, params Assembly[] assemblies)
{
var autoWire = new ExpressionTypeFunqContainer(container);
foreach (var assembly in assemblies)
{
foreach (var validator in assembly.GetTypes()
.Where(t => t.IsOrHasGenericInterfaceTypeOf(typeof(IValidator<>))))
{
var baseType = validator.BaseType;
while (!baseType.IsGenericType)
{
baseType = baseType.BaseType;
}
var dtoType = baseType.GetGenericArguments()[0];
var validatorType = typeof(IValidator<>).MakeGenericType(dtoType);
autoWire.RegisterType(validator, validatorType);
}
}
}
}
}
| bsd-3-clause | C# |
6c74f8316b688ff703aa59b2cb2845d1f0cef8e2 | Fix for one more IDE0078 | dotnet/roslyn-analyzers,dotnet/roslyn-analyzers,mavasani/roslyn-analyzers,mavasani/roslyn-analyzers | src/Tools/RulesetToEditorconfigConverter/Source/Program.cs | src/Tools/RulesetToEditorconfigConverter/Source/Program.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
namespace Microsoft.CodeAnalysis.RulesetToEditorconfig
{
internal static class Program
{
public static int Main(string[] args)
{
if (args.Length is < 1 or > 2)
{
ShowUsage();
return 1;
}
var rulesetFilePath = args[0];
var editorconfigFilePath = args.Length == 2 ?
args[1] :
Path.Combine(Environment.CurrentDirectory, ".editorconfig");
try
{
Converter.GenerateEditorconfig(rulesetFilePath, editorconfigFilePath);
}
catch (IOException ex)
{
Console.WriteLine(ex.Message);
return 2;
}
Console.WriteLine($"Successfully converted to '{editorconfigFilePath}'");
return 0;
static void ShowUsage()
{
Console.WriteLine("Usage: RulesetToEditorconfigConverter.exe <%ruleset_file%> [<%path_to_editorconfig%>]");
return;
}
}
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
namespace Microsoft.CodeAnalysis.RulesetToEditorconfig
{
internal static class Program
{
public static int Main(string[] args)
{
if (args.Length < 1 || args.Length > 2)
{
ShowUsage();
return 1;
}
var rulesetFilePath = args[0];
var editorconfigFilePath = args.Length == 2 ?
args[1] :
Path.Combine(Environment.CurrentDirectory, ".editorconfig");
try
{
Converter.GenerateEditorconfig(rulesetFilePath, editorconfigFilePath);
}
catch (IOException ex)
{
Console.WriteLine(ex.Message);
return 2;
}
Console.WriteLine($"Successfully converted to '{editorconfigFilePath}'");
return 0;
static void ShowUsage()
{
Console.WriteLine("Usage: RulesetToEditorconfigConverter.exe <%ruleset_file%> [<%path_to_editorconfig%>]");
return;
}
}
}
}
| mit | C# |
4f8ea07dc846836e2d97cc3632525d239a37fff8 | Add a lock for StatisticCounter | heejaechang/roslyn,stephentoub/roslyn,AmadeusW/roslyn,diryboy/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,mavasani/roslyn,genlu/roslyn,weltkante/roslyn,mavasani/roslyn,dotnet/roslyn,eriawan/roslyn,weltkante/roslyn,gafter/roslyn,gafter/roslyn,AlekseyTs/roslyn,brettfo/roslyn,tmat/roslyn,jmarolf/roslyn,tannergooding/roslyn,panopticoncentral/roslyn,abock/roslyn,diryboy/roslyn,AlekseyTs/roslyn,physhi/roslyn,genlu/roslyn,heejaechang/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,agocke/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,ErikSchierboom/roslyn,nguerrera/roslyn,sharwell/roslyn,KevinRansom/roslyn,brettfo/roslyn,aelij/roslyn,KevinRansom/roslyn,tannergooding/roslyn,sharwell/roslyn,davkean/roslyn,eriawan/roslyn,jasonmalinowski/roslyn,agocke/roslyn,mgoertz-msft/roslyn,sharwell/roslyn,physhi/roslyn,dotnet/roslyn,davkean/roslyn,AmadeusW/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,panopticoncentral/roslyn,davkean/roslyn,reaction1989/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,tmat/roslyn,wvdd007/roslyn,weltkante/roslyn,jmarolf/roslyn,reaction1989/roslyn,mgoertz-msft/roslyn,tmat/roslyn,gafter/roslyn,heejaechang/roslyn,nguerrera/roslyn,ErikSchierboom/roslyn,reaction1989/roslyn,wvdd007/roslyn,nguerrera/roslyn,KirillOsenkov/roslyn,dotnet/roslyn,abock/roslyn,stephentoub/roslyn,aelij/roslyn,KirillOsenkov/roslyn,physhi/roslyn,ErikSchierboom/roslyn,agocke/roslyn,AlekseyTs/roslyn,panopticoncentral/roslyn,abock/roslyn,bartdesmet/roslyn,brettfo/roslyn,tannergooding/roslyn,jmarolf/roslyn,mgoertz-msft/roslyn,aelij/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,KirillOsenkov/roslyn | src/Workspaces/Core/Portable/Log/StatisticLogAggregator.cs | src/Workspaces/Core/Portable/Log/StatisticLogAggregator.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.
namespace Microsoft.CodeAnalysis.Internal.Log
{
internal sealed class StatisticLogAggregator : AbstractLogAggregator<StatisticLogAggregator.StatisticCounter>
{
protected override StatisticCounter CreateCounter()
{
return new StatisticCounter();
}
public void AddDataPoint(object key, int value)
{
var counter = GetCounter(key);
counter.AddDataPoint(value);
}
public StatisticResult GetStaticticResult(object key)
{
if (TryGetCounter(key, out var counter))
{
return counter.GetStatisticResult();
}
return default;
}
internal sealed class StatisticCounter
{
private readonly object _lock = new object();
private int _count;
private int _maximum;
private int _mininum;
private int _total;
public void AddDataPoint(int value)
{
lock (_lock)
{
if (_count == 0 || value > _maximum)
{
_maximum = value;
}
if (_count == 0 || value < _mininum)
{
_mininum = value;
}
_count++;
_total += value;
}
}
public StatisticResult GetStatisticResult()
{
if (_count == 0)
{
return default;
}
else
{
return new StatisticResult(_maximum, _mininum, median: null, mean: _total / _count, range: _maximum - _mininum, mode: null, count: _count);
}
}
}
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.Internal.Log
{
internal sealed class StatisticLogAggregator : AbstractLogAggregator<StatisticLogAggregator.StatisticCounter>
{
protected override StatisticCounter CreateCounter()
{
return new StatisticCounter();
}
public void AddDataPoint(object key, int value)
{
var counter = GetCounter(key);
counter.AddDataPoint(value);
}
public StatisticResult GetStaticticResult(object key)
{
if (TryGetCounter(key, out var counter))
{
return counter.GetStatisticResult();
}
return default;
}
internal sealed class StatisticCounter
{
private int _count;
private int _maximum;
private int _mininum;
private int _total;
public void AddDataPoint(int value)
{
if (_count == 0 || value > _maximum)
{
_maximum = value;
}
if (_count == 0 || value < _mininum)
{
_mininum = value;
}
_count++;
_total += value;
}
public StatisticResult GetStatisticResult()
{
if (_count == 0)
{
return default;
}
else
{
return new StatisticResult(_maximum, _mininum, median: null, mean: _total / _count, range: _maximum - _mininum, mode: null, count: _count);
}
}
}
}
}
| mit | C# |
31b150a02c81e4bc42ace71cba615092c7b2a1c6 | Fix typo (win) | codeman38/toggldesktop,codeman38/toggldesktop,codeman38/toggldesktop,codeman38/toggldesktop,codeman38/toggldesktop,codeman38/toggldesktop | src/ui/windows/TogglDesktop/TogglDesktop/AboutWindowController.cs | src/ui/windows/TogglDesktop/TogglDesktop/AboutWindowController.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace TogglDesktop
{
public partial class AboutWindowController : TogglForm
{
public AboutWindowController()
{
InitializeComponent();
labelVersion.Text = TogglDesktop.Program.Version();
bool updateCheckDisabled = Toggl.IsUpdateCheckDisabled();
comboBoxChannel.Visible = !updateCheckDisabled;
labelReleaseChannel.Visible = !updateCheckDisabled;
}
private void AboutWindowController_FormClosing(object sender, FormClosingEventArgs e)
{
Hide();
e.Cancel = true;
}
private void comboBoxChannel_SelectedIndexChanged(object sender, EventArgs e)
{
Toggl.SetUpdateChannel(comboBoxChannel.Text);
}
private void linkLabelGithub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start(linkLabelGithub.Text);
}
public void ShowUpdates()
{
Show();
if (comboBoxChannel.Visible)
{
string channel = Toggl.UpdateChannel();
comboBoxChannel.SelectedIndex = comboBoxChannel.Items.IndexOf(channel);
}
}
internal void initAndCheck()
{
string channel = Toggl.UpdateChannel();
comboBoxChannel.SelectedIndex = comboBoxChannel.Items.IndexOf(channel);
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace TogglDesktop
{
public partial class AboutWindowController : TogglForm
{
s public AboutWindowController()
{
InitializeComponent();
labelVersion.Text = TogglDesktop.Program.Version();
bool updateCheckDisabled = Toggl.IsUpdateCheckDisabled();
comboBoxChannel.Visible = !updateCheckDisabled;
labelReleaseChannel.Visible = !updateCheckDisabled;
}
private void AboutWindowController_FormClosing(object sender, FormClosingEventArgs e)
{
Hide();
e.Cancel = true;
}
private void comboBoxChannel_SelectedIndexChanged(object sender, EventArgs e)
{
Toggl.SetUpdateChannel(comboBoxChannel.Text);
}
private void linkLabelGithub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start(linkLabelGithub.Text);
}
public void ShowUpdates()
{
Show();
if (comboBoxChannel.Visible)
{
string channel = Toggl.UpdateChannel();
comboBoxChannel.SelectedIndex = comboBoxChannel.Items.IndexOf(channel);
}
}
internal void initAndCheck()
{
string channel = Toggl.UpdateChannel();
comboBoxChannel.SelectedIndex = comboBoxChannel.Items.IndexOf(channel);
}
}
}
| bsd-3-clause | C# |
3e4acb9140deec1c13d557ccf398af318114fde2 | Add comments | farity/farity | Farity/F.cs | Farity/F.cs | namespace Farity
{
/// <summary>
/// The root static class of Farity, through which all of its functional bliss is exposed.
/// </summary>
public static partial class F
{
/// <summary>
/// A placeholder used to provide dummy arguments to a function in order to place arguments properly.
/// </summary>
public static readonly Placeholder _ = new Placeholder();
}
} | namespace Farity
{
public static partial class F
{
public static readonly Placeholder _ = new Placeholder();
}
} | mit | C# |
b84e0567ff6a70b1b61e2010af3b7939db7b1f0e | migrate test setup for new sap client from v3 | MaceWindu/linq2db,LinqToDB4iSeries/linq2db,MaceWindu/linq2db,LinqToDB4iSeries/linq2db,linq2db/linq2db,linq2db/linq2db | Tests/Linq/TestsInitialization.cs | Tests/Linq/TestsInitialization.cs | using System;
using System.Data.Common;
using System.IO;
using System.Reflection;
using NUnit.Framework;
using Tests;
/// <summary>
/// 1. Don't add namespace to this class! It's intentional
/// 2. This class implements test assembly setup/teardown methods.
/// </summary>
[SetUpFixture]
public class TestsInitialization
{
[OneTimeSetUp]
public void TestAssemblySetup()
{
#if !NETSTANDARD1_6 && !NETSTANDARD2_0 && !APPVEYOR && !TRAVIS
// recent SAP HANA provider uses Assembly.GetEntryAssembly() calls during native dlls discovery, which
// leads to NRE as it returns null under NETFX, so we need to fake this method result to unblock HANA testing
// https://github.com/microsoft/vstest/issues/1834
// https://dejanstojanovic.net/aspnet/2015/january/set-entry-assembly-in-unit-testing-methods/
var assembly = Assembly.GetCallingAssembly();
var manager = new AppDomainManager();
var entryAssemblyfield = manager.GetType().GetField("m_entryAssembly", BindingFlags.Instance | BindingFlags.NonPublic);
entryAssemblyfield.SetValue(manager, assembly);
var domain = AppDomain.CurrentDomain;
var domainManagerField = domain.GetType().GetField("_domainManager", BindingFlags.Instance | BindingFlags.NonPublic);
domainManagerField.SetValue(domain, manager);
#endif
#if !NETSTANDARD1_6 && !NETSTANDARD2_0 && !APPVEYOR && !TRAVIS
// configure assembly redirect for referenced assemblies to use version from GAC
// this solves exception from provider-specific tests, when it tries to load version from redist folder
// but loaded from GAC assembly has other version
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
var requestedAssembly = new AssemblyName(args.Name);
if (requestedAssembly.Name == "IBM.Data.DB2")
return DbProviderFactories.GetFactory("IBM.Data.DB2").GetType().Assembly;
if (requestedAssembly.Name == "IBM.Data.Informix")
// chose your red or blue pill carefully
//return DbProviderFactories.GetFactory("IBM.Data.Informix").GetType().Assembly;
return typeof(IBM.Data.Informix.IfxTimeSpan).Assembly;
return null;
};
#endif
// register test providers
TestNoopProvider.Init();
// disabled for core, as default loader doesn't allow multiple assemblies with same name
// https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/assemblyloadcontext.md
#if !NETSTANDARD1_6 && !NETSTANDARD2_0
Npgsql4PostgreSQLDataProvider.Init();
#endif
}
[OneTimeTearDown]
public void TestAssemblyTeardown()
{
}
}
| using System;
using System.Data.Common;
using System.Reflection;
using NUnit.Framework;
using Tests;
/// <summary>
/// 1. Don't add namespace to this class! It's intentional
/// 2. This class implements test assembly setup/teardown methods.
/// </summary>
[SetUpFixture]
public class TestsInitialization
{
[OneTimeSetUp]
public void TestAssemblySetup()
{
#if !NETSTANDARD1_6 && !NETSTANDARD2_0 && !APPVEYOR && !TRAVIS
// configure assembly redirect for referenced assemblies to use version from GAC
// this solves exception from provider-specific tests, when it tries to load version from redist folder
// but loaded from GAC assembly has other version
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
var requestedAssembly = new AssemblyName(args.Name);
if (requestedAssembly.Name == "IBM.Data.DB2")
return DbProviderFactories.GetFactory("IBM.Data.DB2").GetType().Assembly;
if (requestedAssembly.Name == "IBM.Data.Informix")
// chose your red or blue pill carefully
//return DbProviderFactories.GetFactory("IBM.Data.Informix").GetType().Assembly;
return typeof(IBM.Data.Informix.IfxTimeSpan).Assembly;
return null;
};
#endif
// register test providers
TestNoopProvider.Init();
// disabled for core, as default loader doesn't allow multiple assemblies with same name
// https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/assemblyloadcontext.md
#if !NETSTANDARD1_6 && !NETSTANDARD2_0
Npgsql4PostgreSQLDataProvider.Init();
#endif
}
[OneTimeTearDown]
public void TestAssemblyTeardown()
{
}
}
| mit | C# |
f84a365a7310717819f47123b4cd467abbd098ae | Update AtomicService.cs | redcanaryco/atomic-red-team,redcanaryco/atomic-red-team,redcanaryco/atomic-red-team,redcanaryco/atomic-red-team,redcanaryco/atomic-red-team,redcanaryco/atomic-red-team,redcanaryco/atomic-red-team,redcanaryco/atomic-red-team,redcanaryco/atomic-red-team,redcanaryco/atomic-red-team,redcanaryco/atomic-red-team,redcanaryco/atomic-red-team | Windows/Payloads/AtomicService.cs | Windows/Payloads/AtomicService.cs | using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
// c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe AtomicService.cs
// sc create AtomicService binPath= "C:\Test\AtomicService.exe"
// sc start AtomicService
// sc stop AtomicSerivce
// sc delete AtomicSerivce
// May requjire Administrator privileges
namespace AtomicService
{
public class Service1 : System.ServiceProcess.ServiceBase
{
private System.ComponentModel.Container components = null;
public Service1()
{
InitializeComponent();
}
// The main entry point for the process
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new AtomicService.Service1()};
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
private void InitializeComponent()
{
//
// Service1
//
this.ServiceName = "AtomicService";
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
}
protected override void OnContinue()
{
}
}
}
| using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
// c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe AtomicService.cs
// sc start AtomicService
// sc stop AtomicSerivce
// sc delete AtomicSerivce
// May requjire Administrator privileges
namespace AtomicService
{
public class Service1 : System.ServiceProcess.ServiceBase
{
private System.ComponentModel.Container components = null;
public Service1()
{
InitializeComponent();
}
// The main entry point for the process
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new AtomicService.Service1()};
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
private void InitializeComponent()
{
//
// Service1
//
this.ServiceName = "AtomicService";
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
}
protected override void OnContinue()
{
}
}
}
| mit | C# |
804c3bddfbd49e0d4935be6bc5936bd3a43ee152 | Configure route. | yasotidev/BP00,yasotidev/BP00 | 00/Src/Client/Web/BP00.Scaffolding/App_Start/RouteConfig.cs | 00/Src/Client/Web/BP00.Scaffolding/App_Start/RouteConfig.cs | using System.Web.Mvc;
using System.Web.Routing;
namespace BP00.Scaffolding
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Person", action = "Index", id = UrlParameter.Optional }
);
}
}
}
| using System.Web.Mvc;
using System.Web.Routing;
namespace BP00.Scaffolding
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
| agpl-3.0 | C# |
a7aaa440c72a9a5faceb7e71488e500bc46bf1f2 | Fix thumbnail retrieval options to actually work | yovio/onedrive-explorer-win,marcosnz/onedrive-explorer-win,KumaranKamalanathan/onedrive-explorer-win,reddralf/onedrive-explorer-win,rgregg/onedrive-explorer-win | OneDriveSDK/CommandOptions/ThumbnailRetrievalOptions.cs | OneDriveSDK/CommandOptions/ThumbnailRetrievalOptions.cs | using System;
using System.Collections.Generic;
namespace OneDrive
{
public class ThumbnailRetrievalOptions : RetrievalOptions
{
/// <summary>
/// List of thumbnail size names to return
/// </summary>
public string[] SelectThumbnailNames { get; set; }
/// <summary>
/// Retrieve the default thumbnails for an item
/// </summary>
public static ThumbnailRetrievalOptions Default { get { return new ThumbnailRetrievalOptions(); } }
/// <summary>
/// Returns a string like "select=small,medium" that can be used in an expand parameter value
/// </summary>
/// <returns></returns>
public override IEnumerable<ODataOption> ToOptions()
{
List<ODataOption> options = new List<ODataOption>();
SelectOData thumbnailSelect = null;
if (SelectThumbnailNames != null && SelectThumbnailNames.Length > 0)
{
thumbnailSelect = new SelectOData { FieldNames = SelectThumbnailNames };
options.Add(thumbnailSelect);
}
return options;
}
}
public static class ThumbnailSize
{
public const string Small = "small";
public const string Medium = "medium";
public const string Large = "large";
public const string SmallSquare = "smallSquare";
public const string MediumSquare = "mediumSquare";
public const string LargeSquare = "largeSquare";
public static string CustomSize(int width, int height, bool cropped)
{
return string.Format("c{0}x{1}{2}", width, height, cropped ? "_Crop" : "");
}
}
}
| using System;
using System.Collections.Generic;
namespace OneDrive
{
public class ThumbnailRetrievalOptions : RetrievalOptions
{
/// <summary>
/// List of thumbnail size names to return
/// </summary>
public string[] SelectThumbnailNames { get; set; }
/// <summary>
/// Retrieve the default thumbnails for an item
/// </summary>
public static ThumbnailRetrievalOptions Default { get { return new ThumbnailRetrievalOptions(); } }
/// <summary>
/// Returns a string like "select=small,medium" that can be used in an expand parameter value
/// </summary>
/// <returns></returns>
public override IEnumerable<ODataOption> ToOptions()
{
List<ODataOption> options = new List<ODataOption>();
SelectOData thumbnailSelect = null;
if (SelectThumbnailNames != null && SelectThumbnailNames.Length > 0)
thumbnailSelect = new SelectOData { FieldNames = SelectThumbnailNames };
options.Add(new ExpandOData
{
PropertyToExpand = ApiConstants.ThumbnailsRelationshipName,
Select = thumbnailSelect
});
return EmptyCollection;
}
}
}
| mit | C# |
47b84f0479b7959ccc8fe4ada3d00f687f67b19b | Add BsonSerializer for Date and Time | InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform | InfinniPlatform.DocumentStorage/MongoDB/MongoTimeBsonSerializer.cs | InfinniPlatform.DocumentStorage/MongoDB/MongoTimeBsonSerializer.cs | using System;
using InfinniPlatform.Sdk.Types;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace InfinniPlatform.DocumentStorage.MongoDB
{
/// <summary>
/// Реализует логику сериализации и десериализации <see cref="Time"/> для MongoDB.
/// </summary>
internal sealed class MongoTimeBsonSerializer : SerializerBase<Time>
{
public static readonly MongoTimeBsonSerializer Default = new MongoTimeBsonSerializer();
public override Time Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
{
var reader = context.Reader;
var currentBsonType = reader.GetCurrentBsonType();
double totalSeconds;
switch (currentBsonType)
{
case BsonType.Double:
totalSeconds = reader.ReadDouble();
break;
case BsonType.Int64:
totalSeconds = reader.ReadInt64();
break;
case BsonType.Int32:
totalSeconds = reader.ReadInt32();
break;
default:
throw new FormatException($"Cannot deserialize a '{BsonUtils.GetFriendlyTypeName(typeof(Time))}' from BsonType '{currentBsonType}'.");
}
return new Time(totalSeconds);
}
public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, Time value)
{
var writer = context.Writer;
writer.WriteDouble(value.TotalSeconds);
}
}
} | using System;
using InfinniPlatform.Sdk.Types;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace InfinniPlatform.DocumentStorage.MongoDB
{
/// <summary>
/// Реализует логику сериализации и десериализации <see cref="Time"/> для MongoDB.
/// </summary>
internal sealed class MongoTimeBsonSerializer : SerializerBase<Time>
{
public static readonly MongoTimeBsonSerializer Default = new MongoTimeBsonSerializer();
public override Time Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
{
var reader = context.Reader;
var currentBsonType = reader.GetCurrentBsonType();
long totalSeconds;
switch (currentBsonType)
{
case BsonType.Double:
totalSeconds = (long)reader.ReadDouble();
break;
case BsonType.Int64:
totalSeconds = reader.ReadInt64();
break;
case BsonType.Int32:
totalSeconds = reader.ReadInt32();
break;
default:
throw new FormatException($"Cannot deserialize a '{BsonUtils.GetFriendlyTypeName(typeof(Time))}' from BsonType '{currentBsonType}'.");
}
return new Time(totalSeconds);
}
public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, Time value)
{
var writer = context.Writer;
writer.WriteDouble(value.TotalSeconds);
}
}
} | agpl-3.0 | C# |
911d16da63a8a1cfd63cd4a4747a090f91c0e086 | Tweak beef001a to suppress Message when no additional shell items are present | EricZimmerman/ExtensionBlocks | ExtensionBlocks/Beef001a.cs | ExtensionBlocks/Beef001a.cs | using System;
using System.Text;
namespace ExtensionBlocks
{
public class Beef001a : BeefBase
{
public Beef001a(byte[] rawBytes)
: base(rawBytes)
{
if (Signature != 0xbeef001a)
{
throw new Exception($"Signature mismatch! Should be Beef001a but is {Signature}");
}
var len = 0;
var index = 10;
while ((rawBytes[index + len] != 0x0 || rawBytes[index + len + 1] != 0x0))
{
len += 1;
}
var uname = Encoding.Unicode.GetString(rawBytes, index, len + 1);
FileDocumentTypeString = uname;
index += len + 3; // move past string and end of string marker
//is index 24?
//TODO get shell item list
if (index != 38)
{
Message =
"Unsupported Extension block. Please report to Report to saericzimmerman@gmail.com to get it added!";
}
VersionOffset = BitConverter.ToInt16(rawBytes, index);
}
public string FileDocumentTypeString { get; }
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine(base.ToString());
sb.AppendLine();
sb.AppendLine($"File Document Type String: {FileDocumentTypeString}");
return sb.ToString();
}
}
} | using System;
using System.Text;
namespace ExtensionBlocks
{
public class Beef001a : BeefBase
{
public Beef001a(byte[] rawBytes)
: base(rawBytes)
{
if (Signature != 0xbeef001a)
{
throw new Exception($"Signature mismatch! Should be Beef001a but is {Signature}");
}
var len = 0;
var index = 10;
while ((rawBytes[index + len] != 0x0 || rawBytes[index + len + 1] != 0x0))
{
len += 1;
}
var uname = Encoding.Unicode.GetString(rawBytes, index, len + 1);
FileDocumentTypeString = uname;
index += len + 3; // move past string and end of string marker
//is index 24?
//TODO get shell item list
Message =
"Unsupported Extension block. Please report to Report to saericzimmerman@gmail.com to get it added!";
VersionOffset = BitConverter.ToInt16(rawBytes, index);
}
public string FileDocumentTypeString { get; }
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine(base.ToString());
sb.AppendLine();
sb.AppendLine($"File Document Type String: {FileDocumentTypeString}");
return sb.ToString();
}
}
} | mit | C# |
92643ad6c005d0765a2b93c07aba278b2485d791 | Replace InvalidOperationException with false-assert | ppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework | osu.Framework.Tests/Visual/Testing/TestSceneIgnore.cs | osu.Framework.Tests/Visual/Testing/TestSceneIgnore.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
namespace osu.Framework.Tests.Visual.Testing
{
public class TestSceneIgnore : FrameworkTestScene
{
[Test]
[Ignore("test")]
public void IgnoredTest()
{
AddAssert("Test ignored", () => false);
}
[TestCase(1)]
[TestCase(2)]
[Ignore("test")]
public void IgnoredParameterizedTest(int test)
{
AddAssert("Test ignored", () => false);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using NUnit.Framework;
namespace osu.Framework.Tests.Visual.Testing
{
public class TestSceneIgnore : FrameworkTestScene
{
[Test]
[Ignore("test")]
public void IgnoredTest()
{
AddStep($"Throw {typeof(InvalidOperationException)}", () => throw new InvalidOperationException());
}
[TestCase(1)]
[TestCase(2)]
[Ignore("test")]
public void IgnoredParameterizedTest(int test)
{
AddStep($"Throw {typeof(InvalidOperationException)}", () => throw new InvalidOperationException());
}
}
}
| mit | C# |
3e9dc86c19c1fa194d22af62b156cb6528ecc069 | Test removed usings | RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast | RightpointLabs.Pourcast.Web/Controllers/HomeController.cs | RightpointLabs.Pourcast.Web/Controllers/HomeController.cs | using System.Web.Mvc;
namespace RightpointLabs.Pourcast.Web.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace RightpointLabs.Pourcast.Web.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}
}
} | mit | C# |
50f0723fe08acf3aa774f91a3acc2e96cc94415c | Add missing new file license | QuantConnect/Lean,StefanoRaggi/Lean,AlexCatarino/Lean,AlexCatarino/Lean,jameschch/Lean,AlexCatarino/Lean,JKarathiya/Lean,StefanoRaggi/Lean,jameschch/Lean,StefanoRaggi/Lean,JKarathiya/Lean,JKarathiya/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,JKarathiya/Lean,jameschch/Lean,jameschch/Lean,QuantConnect/Lean,QuantConnect/Lean,jameschch/Lean,AlexCatarino/Lean,QuantConnect/Lean | Tests/Algorithm/Framework/Alphas/GeneratedInsightsCollectionTests.cs | Tests/Algorithm/Framework/Alphas/GeneratedInsightsCollectionTests.cs | /*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using NUnit.Framework;
using QuantConnect.Algorithm.Framework.Alphas;
namespace QuantConnect.Tests.Algorithm.Framework.Alphas
{
[TestFixture]
public class GeneratedInsightsCollectionTests
{
[Test]
public void CheckCloneRespectsDerivedTypes()
{
var insights = new List<DerivedInsight>
{
new DerivedInsight(Symbol.Empty, TimeSpan.Zero, InsightType.Price, InsightDirection.Flat),
new DerivedInsight(Symbol.Empty, TimeSpan.Zero, InsightType.Price, InsightDirection.Flat),
new DerivedInsight(Symbol.Empty, TimeSpan.Zero, InsightType.Price, InsightDirection.Flat),
new DerivedInsight(Symbol.Empty, TimeSpan.Zero, InsightType.Price, InsightDirection.Flat),
};
var generatedInsightsCollection = new GeneratedInsightsCollection(DateTime.UtcNow, insights, clone: true);
Assert.True(generatedInsightsCollection.Insights.TrueForAll(x => x.GetType() == typeof(DerivedInsight)));
}
private class DerivedInsight : Insight
{
public DerivedInsight(Symbol symbol, TimeSpan period, InsightType type, InsightDirection direction)
: base(symbol, period, type, direction)
{
}
public override Insight Clone()
{
return new DerivedInsight(Symbol, Period, Type, Direction);
}
}
}
} | using System;
using System.Collections.Generic;
using NUnit.Framework;
using QuantConnect.Algorithm.Framework.Alphas;
namespace QuantConnect.Tests.Algorithm.Framework.Alphas
{
[TestFixture]
public class GeneratedInsightsCollectionTests
{
[Test]
public void CheckCloneRespectsDerivedTypes()
{
var insights = new List<DerivedInsight>
{
new DerivedInsight(Symbol.Empty, TimeSpan.Zero, InsightType.Price, InsightDirection.Flat),
new DerivedInsight(Symbol.Empty, TimeSpan.Zero, InsightType.Price, InsightDirection.Flat),
new DerivedInsight(Symbol.Empty, TimeSpan.Zero, InsightType.Price, InsightDirection.Flat),
new DerivedInsight(Symbol.Empty, TimeSpan.Zero, InsightType.Price, InsightDirection.Flat),
};
var generatedInsightsCollection = new GeneratedInsightsCollection(DateTime.UtcNow, insights, clone: true);
Assert.True(generatedInsightsCollection.Insights.TrueForAll(x => x.GetType() == typeof(DerivedInsight)));
}
public class DerivedInsight : Insight
{
public DerivedInsight(Symbol symbol, TimeSpan period, InsightType type, InsightDirection direction)
: base(symbol, period, type, direction)
{
}
public override Insight Clone()
{
return new DerivedInsight(Symbol, Period, Type, Direction);
}
}
}
} | apache-2.0 | C# |
17784a5f367116c52f3c994e2650836285220ce8 | Update CardService.cs | sebastian88/Solitaire | Lib/Solitaire.Lib/Solitaire.Lib/Services/CardService.cs | Lib/Solitaire.Lib/Solitaire.Lib/Services/CardService.cs | using Solitaire.Lib.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Solitaire.Lib.Services
{
public class CardService
{
public CardService()
{
// test
}
public bool IsValidTableauMove(Card topCard, Card bottomCard)
{
return IsTopCardOneValueLowerThanBottomCard(topCard, bottomCard)
&& IsOppositeSuit(topCard, bottomCard);
}
private bool IsTopCardOneValueLowerThanBottomCard(Card topCard, Card bottomCard)
{
return IsTopCardOfLowerValueThanBottomCard(topCard, bottomCard)
&& IsInSequence(topCard, bottomCard);
}
private bool IsTopCardOfLowerValueThanBottomCard(Card topCard, Card bottomCard)
{
return topCard.ValueInt - bottomCard.ValueInt < 0;
}
private bool IsInSequence(Card cardOne, Card cardTwo)
{
return Math.Abs(cardOne.ValueInt - cardTwo.ValueInt) == 1;
}
private bool IsOppositeSuit(Card cardOne, Card cardTwo)
{
return IsOdd(cardOne.SuitInt + cardTwo.SuitInt);
}
private bool IsOdd(int value)
{
return value % 2 != 0;
}
public bool IsValidFoundationMove(Card topCard, Card bottomCard)
{
return true;
}
}
}
| using Solitaire.Lib.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Solitaire.Lib.Services
{
public class CardService
{
public CardService()
{
}
public bool IsValidTableauMove(Card topCard, Card bottomCard)
{
return IsTopCardOneValueLowerThanBottomCard(topCard, bottomCard)
&& IsOppositeSuit(topCard, bottomCard);
}
private bool IsTopCardOneValueLowerThanBottomCard(Card topCard, Card bottomCard)
{
return IsTopCardOfLowerValueThanBottomCard(topCard, bottomCard)
&& IsInSequence(topCard, bottomCard);
}
private bool IsTopCardOfLowerValueThanBottomCard(Card topCard, Card bottomCard)
{
return topCard.ValueInt - bottomCard.ValueInt < 0;
}
private bool IsInSequence(Card cardOne, Card cardTwo)
{
return Math.Abs(cardOne.ValueInt - cardTwo.ValueInt) == 1;
}
private bool IsOppositeSuit(Card cardOne, Card cardTwo)
{
return IsOdd(cardOne.SuitInt + cardTwo.SuitInt);
}
private bool IsOdd(int value)
{
return value % 2 != 0;
}
public bool IsValidFoundationMove(Card topCard, Card bottomCard)
{
return true;
}
}
}
| cc0-1.0 | C# |
de186a1b8d2b0a1c55e8e7844e9bb81e0868f03c | fix broken snippet | WojcikMike/docs.particular.net | Snippets/Snippets_5/Sagas/FindSagas/NHibernateSagaFinder.cs | Snippets/Snippets_5/Sagas/FindSagas/NHibernateSagaFinder.cs | namespace Snippets5.Sagas.FindSagas
{
using NServiceBus.Persistence.NHibernate;
using NServiceBus.Saga;
public class NHibernateSagaFinder
{
#region nhibernate-saga-finder
public class MyNHibernateSagaFinder :
IFindSagas<MySagaData>.Using<MyMessage>
{
public NHibernateStorageContext StorageContext { get; set; }
public MySagaData FindBy(MyMessage message)
{
//your custom finding logic here, e.g.
return StorageContext.Session.QueryOver<MySagaData>()
.Where(x =>
x.SomeID == message.SomeID &&
x.SomeData == message.SomeData)
.SingleOrDefault();
}
}
#endregion
}
} | namespace Snippets5.Sagas.FindSagas
{
using NServiceBus.Persistence.NHibernate;
using NServiceBus.Saga;
public class NHibernateSagaFinder
{
#region nhiebarenate-saga-finder
public class MyNHibernateSagaFinder :
IFindSagas<MySagaData>.Using<MyMessage>
{
public NHibernateStorageContext StorageContext { get; set; }
public MySagaData FindBy(MyMessage message)
{
//your custom finding logic here, e.g.
return StorageContext.Session.QueryOver<MySagaData>()
.Where(x =>
x.SomeID == message.SomeID &&
x.SomeData == message.SomeData)
.SingleOrDefault();
}
}
#endregion
}
} | apache-2.0 | C# |
cd6b6dfd07660984f7fe7d4a3acd00ce9647b680 | update version | prodot/ReCommended-Extension | Sources/ReCommendedExtension/Properties/AssemblyInfo.cs | Sources/ReCommendedExtension/Properties/AssemblyInfo.cs | using System.Reflection;
using ReCommendedExtension;
// 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(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2022 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.6.5.0")]
[assembly: AssemblyFileVersion("5.6.5")] | using System.Reflection;
using ReCommendedExtension;
// 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(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2022 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.6.4.0")]
[assembly: AssemblyFileVersion("5.6.4")] | apache-2.0 | C# |
36b03e69d054fbda3e1a2417bffce3a14190623a | Add certificate | softwarejc/angular2-aspmvc-core1-getting-started,softwarejc/angular2-aspmvc-core1-getting-started,softwarejc/angular2-aspmvc-core1-getting-started,softwarejc/angular2-aspmvc-core1-getting-started | 4-IdentityServer/Program.cs | 4-IdentityServer/Program.cs | using System;
using Microsoft.Owin.Hosting;
namespace _4_IdentityServer
{
class Program
{
static void Main(string[] args)
{
using (WebApp.Start<Startup>("https://localhost:44300"))
{
Console.ReadLine();
}
}
}
}
| using System;
using Microsoft.Owin.Hosting;
namespace _4_IdentityServer
{
class Program
{
static void Main(string[] args)
{
using (WebApp.Start<Startup>("https://localhost:44300"))
{
Console.ReadLine();
}
}
}
}
| mit | C# |
3224d42bea873255e69bd8f747e38e040355bf75 | Add untyped AssertX.Throws method. | eylvisaker/AgateLib | AgateLib/Quality/AssertX.cs | AgateLib/Quality/AssertX.cs | // The contents of this file are subject to the Mozilla Public License
// Version 1.1 (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.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AgateLib.Quality
{
/// <summary>
/// Extra methods that aren't in the MSTest Assert class.
/// </summary>
public static class AssertX
{
/// <summary>
/// Verifies that the method throws any exception.
/// </summary>
/// <param name="expression"></param>
public static void Throws(Action expression)
{
try
{
expression();
}
catch (Exception)
{
return;
}
throw new AssertFailedException("Expression did not throw any exception.");
}
/// <summary>
/// Verifies that the method throws an exception of the specified type,
/// or an exception type deriving from it.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="expression"></param>
public static void Throws<T>(Action expression) where T:Exception
{
try
{
expression();
}
catch (T)
{
return;
}
throw new AssertFailedException("Expression did not throw " + typeof(T).Name);
}
}
}
| // The contents of this file are subject to the Mozilla Public License
// Version 1.1 (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.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AgateLib.Quality
{
public static class AssertX
{
public static void Throws<T>(Action expression) where T:Exception
{
try
{
expression();
}
catch (T)
{
return;
}
throw new AssertFailedException("Expression did not throw " + typeof(T).Name);
}
}
}
| mit | C# |
1f4a943f74dfeb8340296e0187c4ca865866ecd1 | Fix test case runs not being correctly isolated on mono | naoey/osu,DrabWeb/osu,naoey/osu,UselessToucan/osu,2yangk23/osu,peppy/osu,EVAST9919/osu,peppy/osu,DrabWeb/osu,Drezi126/osu,peppy/osu,UselessToucan/osu,Nabile-Rahmani/osu,DrabWeb/osu,johnneijzen/osu,johnneijzen/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,2yangk23/osu,smoogipoo/osu,smoogipoo/osu,EVAST9919/osu,Frontear/osuKyzer,ZLima12/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,naoey/osu,NeoAdonis/osu,ZLima12/osu,peppy/osu-new,ppy/osu | osu.Game/Tests/Visual/OsuTestCase.cs | osu.Game/Tests/Visual/OsuTestCase.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Platform;
using osu.Framework.Testing;
namespace osu.Game.Tests.Visual
{
public abstract class OsuTestCase : TestCase
{
public override void RunTest()
{
Storage storage;
using (var host = new HeadlessGameHost($"test-{Guid.NewGuid()}", realtime: false))
{
storage = host.Storage;
host.Run(new OsuTestCaseTestRunner(this));
}
// clean up after each run
storage.DeleteDirectory(string.Empty);
}
public class OsuTestCaseTestRunner : OsuGameBase
{
private readonly OsuTestCase testCase;
public OsuTestCaseTestRunner(OsuTestCase testCase)
{
this.testCase = testCase;
}
protected override void LoadComplete()
{
base.LoadComplete();
Add(new TestCaseTestRunner.TestRunner(testCase));
}
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Platform;
using osu.Framework.Testing;
namespace osu.Game.Tests.Visual
{
public abstract class OsuTestCase : TestCase
{
public override void RunTest()
{
using (var host = new HeadlessGameHost(AppDomain.CurrentDomain.FriendlyName.Replace(' ', '-'), realtime: false))
host.Run(new OsuTestCaseTestRunner(this));
}
public class OsuTestCaseTestRunner : OsuGameBase
{
private readonly OsuTestCase testCase;
public OsuTestCaseTestRunner(OsuTestCase testCase)
{
this.testCase = testCase;
}
protected override void LoadComplete()
{
base.LoadComplete();
Add(new TestCaseTestRunner.TestRunner(testCase));
}
}
}
}
| mit | C# |
fdcc4be654d6e9b24bb13efb885a29c1492ebd60 | Handle console input in fbdev mode | AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,MrDaedra/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,akrisiun/Perspex,jkoritzinsky/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jazzay/Perspex,grokys/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,grokys/Perspex,MrDaedra/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex | samples/ControlCatalog.NetCore/Program.cs | samples/ControlCatalog.NetCore/Program.cs | using System;
using System.Linq;
using Avalonia;
namespace ControlCatalog.NetCore
{
class Program
{
static void Main(string[] args)
{
if (args.Contains("--fbdev")) AppBuilder.Configure<App>().InitializeWithLinuxFramebuffer(tl =>
{
tl.Content = new MainView();
System.Threading.ThreadPool.QueueUserWorkItem(_ => ConsoleSilencer());
});
else
AppBuilder.Configure<App>()
.UsePlatformDetect()
.Start<MainWindow>();
}
static void ConsoleSilencer()
{
Console.CursorVisible = false;
while (true)
Console.ReadKey();
}
}
} | using System;
using System.Linq;
using Avalonia;
namespace ControlCatalog.NetCore
{
class Program
{
static void Main(string[] args)
{
if (args.Contains("--fbdev"))
AppBuilder.Configure<App>()
.InitializeWithLinuxFramebuffer(tl => tl.Content = new MainView());
else
AppBuilder.Configure<App>()
.UsePlatformDetect()
.Start<MainWindow>();
}
}
} | mit | C# |
2bf30fd612a399643521c08e388dfe823b023f4b | Fix ArgumentOutOfRangeException | GStreamer/gstreamer-sharp,freedesktop-unofficial-mirror/gstreamer__gstreamer-sharp,GStreamer/gstreamer-sharp,GStreamer/gstreamer-sharp,gstreamer-sharp/gstreamer-sharp,gstreamer-sharp/gstreamer-sharp,freedesktop-unofficial-mirror/gstreamer__gstreamer-sharp,gstreamer-sharp/gstreamer-sharp,freedesktop-unofficial-mirror/gstreamer__gstreamer-sharp | sources/custom/MapInfo.cs | sources/custom/MapInfo.cs | //
// MapInfo.cs
//
// Authors:
// Stephan Sundermann <stephansundermann@gmail.com>
//
// Copyright (C) 2014 Stephan Sundermann
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 USA
namespace Gst {
using System;
using System.Runtime.InteropServices;
partial struct MapInfo
{
public byte[] Data {
get {
byte[] data = new byte[Size];
Marshal.Copy (_data, data, 0, (int)Size);
return data;
}
set {
Marshal.Copy (value, 0, _data, value.Length);
}
}
public IntPtr DataPtr {
get {
return _data;
}
}
}
}
| //
// MapInfo.cs
//
// Authors:
// Stephan Sundermann <stephansundermann@gmail.com>
//
// Copyright (C) 2014 Stephan Sundermann
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 USA
namespace Gst {
using System;
using System.Runtime.InteropServices;
partial struct MapInfo
{
public byte[] Data {
get {
byte[] data = new byte[Size];
Marshal.Copy (_data, data, 0, (int)Size);
return data;
}
set {
Marshal.Copy (value, 0, _data, Data.Length);
}
}
public IntPtr DataPtr {
get {
return _data;
}
}
}
}
| lgpl-2.1 | C# |
5cb6222cdb15d519a29c57aff7a910922edfde33 | Bump up version | Ar3sDevelopment/Caelan.Frameworks.Common | Caelan.Frameworks.Common/Properties/AssemblyInfo.cs | Caelan.Frameworks.Common/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
// set di attributi. Per modificare le informazioni associate a un assembly
// occorre quindi modificare i valori di questi attributi.
[assembly: AssemblyTitle("Caelan.Frameworks.Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Caelan.Frameworks.Common")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]
// Se il progetto viene esposto a COM, il GUID che segue verrà utilizzato per creare l'ID della libreria dei tipi
[assembly: Guid("bb560e7a-c19e-41ff-8e2b-1fc647bbb847")]
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Numero di versione principale
// Numero di versione secondario
// Numero build
// Revisione
//
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// utilizzando l'asterisco (*) come descritto di seguito:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5.*")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
// set di attributi. Per modificare le informazioni associate a un assembly
// occorre quindi modificare i valori di questi attributi.
[assembly: AssemblyTitle("Caelan.Frameworks.Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Caelan.Frameworks.Common")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]
// Se il progetto viene esposto a COM, il GUID che segue verrà utilizzato per creare l'ID della libreria dei tipi
[assembly: Guid("bb560e7a-c19e-41ff-8e2b-1fc647bbb847")]
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Numero di versione principale
// Numero di versione secondario
// Numero build
// Revisione
//
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// utilizzando l'asterisco (*) come descritto di seguito:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.4.*")]
| mit | C# |
0b6ed9880341f186a58344d94a8d9cfeb3508f4d | Fix broken build because of failing test | gabrielweyer/Glimpse,flcdrg/Glimpse,paynecrl97/Glimpse,Glimpse/Glimpse,gabrielweyer/Glimpse,dudzon/Glimpse,paynecrl97/Glimpse,sorenhl/Glimpse,elkingtonmcb/Glimpse,SusanaL/Glimpse,paynecrl97/Glimpse,flcdrg/Glimpse,rho24/Glimpse,dudzon/Glimpse,flcdrg/Glimpse,codevlabs/Glimpse,rho24/Glimpse,Glimpse/Glimpse,Glimpse/Glimpse,gabrielweyer/Glimpse,codevlabs/Glimpse,dudzon/Glimpse,SusanaL/Glimpse,elkingtonmcb/Glimpse,rho24/Glimpse,codevlabs/Glimpse,rho24/Glimpse,sorenhl/Glimpse,sorenhl/Glimpse,SusanaL/Glimpse,paynecrl97/Glimpse,elkingtonmcb/Glimpse | source/Glimpse.Test.Core/Resource/ConfigurationShould.cs | source/Glimpse.Test.Core/Resource/ConfigurationShould.cs | using System;
using Glimpse.Core.Extensibility;
using Glimpse.Core.Framework;
using Glimpse.Core.Resource;
using Glimpse.Core.ResourceResult;
using Moq;
using Xunit;
namespace Glimpse.Test.Core.Resource
{
public class ConfigurationShould
{
[Fact]
public void ReturnProperName()
{
var name = "glimpse_config";
var resource = new ConfigurationResource();
Assert.Equal(name, ConfigurationResource.InternalName);
Assert.Equal(name, resource.Name);
}
[Fact]
public void ReturnNoParameterKeys()
{
var resource = new ConfigurationResource();
Assert.Empty(resource.Parameters);
}
[Fact]
public void NotSupportNonPrivilegedExecution()
{
var resource = new PopupResource();
var contextMock = new Mock<IResourceContext>();
Assert.Throws<NotSupportedException>(() => resource.Execute(contextMock.Object));
}
[Fact(Skip = "Need to build out correct test here")]
public void Execute()
{
var contextMock = new Mock<IResourceContext>();
var configMock = new Mock<IGlimpseConfiguration>();
var resource = new ConfigurationResource();
var result = resource.Execute(contextMock.Object, configMock.Object);
var htmlResourceResult = result as HtmlResourceResult;
Assert.NotNull(result);
}
}
} | using System;
using Glimpse.Core.Extensibility;
using Glimpse.Core.Resource;
using Moq;
using Xunit;
namespace Glimpse.Test.Core.Resource
{
public class ConfigurationShould
{
[Fact]
public void ReturnProperName()
{
var name = "glimpse_config";
var resource = new ConfigurationResource();
Assert.Equal(name, ConfigurationResource.InternalName);
Assert.Equal(name, resource.Name);
}
[Fact]
public void ReturnNoParameterKeys()
{
var resource = new ConfigurationResource();
Assert.Empty(resource.Parameters);
}
[Fact]
public void Execute()
{
var contextMock = new Mock<IResourceContext>();
var resource = new ConfigurationResource();
Assert.NotNull(resource.Execute(contextMock.Object));
}
}
} | apache-2.0 | C# |
ddf3cb3a9c54ab83fbcb92ca820108315e0676bf | Optimize use of LanguageServices | magicmonty/pickles,blorgbeard/pickles,blorgbeard/pickles,dirkrombauts/pickles,ludwigjossieaux/pickles,ludwigjossieaux/pickles,magicmonty/pickles,magicmonty/pickles,dirkrombauts/pickles,magicmonty/pickles,picklesdoc/pickles,blorgbeard/pickles,picklesdoc/pickles,dirkrombauts/pickles,blorgbeard/pickles,dirkrombauts/pickles,picklesdoc/pickles,ludwigjossieaux/pickles,picklesdoc/pickles | src/Pickles/Pickles/ObjectModel/KeywordResolver.cs | src/Pickles/Pickles/ObjectModel/KeywordResolver.cs | using System;
using System.Linq;
using AutoMapper;
namespace PicklesDoc.Pickles.ObjectModel
{
public class KeywordResolver : ITypeConverter<string, Keyword>
{
private readonly LanguageServices languageServices;
public KeywordResolver(string language)
{
this.languageServices = new LanguageServices(language);
}
public Keyword Convert(ResolutionContext context)
{
string source = (string) context.SourceValue;
return this.MapToKeyword(source);
}
private Keyword MapToKeyword(string keyword)
{
keyword = keyword.Trim();
if (this.languageServices.WhenStepKeywords.Contains(keyword))
{
return Keyword.When;
}
if (this.languageServices.GivenStepKeywords.Contains(keyword))
{
return Keyword.Given;
}
if (this.languageServices.ThenStepKeywords.Contains(keyword))
{
return Keyword.Then;
}
if (this.languageServices.AndStepKeywords.Contains(keyword))
{
return Keyword.And;
}
if (this.languageServices.ButStepKeywords.Contains(keyword))
{
return Keyword.But;
}
throw new ArgumentOutOfRangeException("keyword");
}
}
} | using System;
using System.Linq;
using AutoMapper;
namespace PicklesDoc.Pickles.ObjectModel
{
public class KeywordResolver : ITypeConverter<string, Keyword>
{
private readonly string language;
public KeywordResolver(string language)
{
this.language = language;
}
public Keyword Convert(ResolutionContext context)
{
string source = (string) context.SourceValue;
return this.MapToKeyword(source);
}
private Keyword MapToKeyword(string keyword)
{
keyword = keyword.Trim();
var gherkinDialect = new LanguageServices(this.language);
if (gherkinDialect.WhenStepKeywords.Contains(keyword))
{
return Keyword.When;
}
if (gherkinDialect.GivenStepKeywords.Contains(keyword))
{
return Keyword.Given;
}
if (gherkinDialect.ThenStepKeywords.Contains(keyword))
{
return Keyword.Then;
}
if (gherkinDialect.AndStepKeywords.Contains(keyword))
{
return Keyword.And;
}
if (gherkinDialect.ButStepKeywords.Contains(keyword))
{
return Keyword.But;
}
throw new ArgumentOutOfRangeException("keyword");
}
}
} | apache-2.0 | C# |
d21614d1b9b6892800c37dc4fe6bbc4a97e204c5 | print correct status code in error msg | simontaylor81/Syrup,simontaylor81/Syrup | SRPTests/Util/AppveyorCI.cs | SRPTests/Util/AppveyorCI.cs | using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace SRPTests.Util
{
// AppVeyor CI provider
internal class AppveyorCI : ICIProvider
{
// Create an instance if we're running in AppVeyor
public static ICIProvider ConditionalCreate()
{
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("APPVEYOR")))
{
return new AppveyorCI();
}
return null;
}
public bool IsCI => true;
public bool IsAppVeyor => true;
public bool IsDummy => false;
public string BuildNumber => Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER");
public string Version => Environment.GetEnvironmentVariable("APPVEYOR_BUILD_VERSION");
public string Commit => Environment.GetEnvironmentVariable("APPVEYOR_REPO_COMMIT");
public async Task PublishArtefactAsync(string path)
{
Console.WriteLine("Publishing artefact {0}", path);
try
{
var appveyorApiUrl = Environment.GetEnvironmentVariable("APPVEYOR_API_URL");
var jsonRequest = JsonConvert.SerializeObject(new
{
path = Path.GetFullPath(path),
fileName = Path.GetFileName(path),
name = (string)null,
});
Console.WriteLine("APPVEYOR_API_URL = {0}", appveyorApiUrl);
Console.WriteLine("jsonRequest = {0}", jsonRequest);
// PUT data to api URL to get where to upload the file to.
var httpClient = new HttpClient();
var response = await httpClient.PostAsync(
appveyorApiUrl + "api/artifacts",
new StringContent(jsonRequest, Encoding.UTF8, "application/json")
).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
var responseString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var uploadUrl = JsonConvert.DeserializeObject<string>(responseString);
Console.WriteLine("responseString = {0}", responseString);
Console.WriteLine("uploadUrl = {0}", uploadUrl);
// Upload the file to the returned URL.
using (var wc = new WebClient())
{
await wc.UploadFileTaskAsync(new Uri(uploadUrl), path).ConfigureAwait(false);
}
}
catch (WebException ex) when (ex.Response is HttpWebResponse)
{
var response = (HttpWebResponse)ex.Response;
Console.WriteLine("Error uploading artefact.");
Console.WriteLine($"Status code: {response.StatusCode}");
using (var reader = new StreamReader(response.GetResponseStream()))
{
Console.WriteLine("Reponse:");
Console.WriteLine(reader.ReadToEnd());
}
}
catch (Exception ex)
{
Console.WriteLine("Error uploading artefact.");
Console.WriteLine(ex.Message);
}
}
}
}
| using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace SRPTests.Util
{
// AppVeyor CI provider
internal class AppveyorCI : ICIProvider
{
// Create an instance if we're running in AppVeyor
public static ICIProvider ConditionalCreate()
{
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("APPVEYOR")))
{
return new AppveyorCI();
}
return null;
}
public bool IsCI => true;
public bool IsAppVeyor => true;
public bool IsDummy => false;
public string BuildNumber => Environment.GetEnvironmentVariable("APPVEYOR_BUILD_NUMBER");
public string Version => Environment.GetEnvironmentVariable("APPVEYOR_BUILD_VERSION");
public string Commit => Environment.GetEnvironmentVariable("APPVEYOR_REPO_COMMIT");
public async Task PublishArtefactAsync(string path)
{
Console.WriteLine("Publishing artefact {0}", path);
try
{
var appveyorApiUrl = Environment.GetEnvironmentVariable("APPVEYOR_API_URL");
var jsonRequest = JsonConvert.SerializeObject(new
{
path = Path.GetFullPath(path),
fileName = Path.GetFileName(path),
name = (string)null,
});
Console.WriteLine("APPVEYOR_API_URL = {0}", appveyorApiUrl);
Console.WriteLine("jsonRequest = {0}", jsonRequest);
// PUT data to api URL to get where to upload the file to.
var httpClient = new HttpClient();
var response = await httpClient.PostAsync(
appveyorApiUrl + "api/artifacts",
new StringContent(jsonRequest, Encoding.UTF8, "application/json")
).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
var responseString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var uploadUrl = JsonConvert.DeserializeObject<string>(responseString);
Console.WriteLine("responseString = {0}", responseString);
Console.WriteLine("uploadUrl = {0}", uploadUrl);
// Upload the file to the returned URL.
using (var wc = new WebClient())
{
await wc.UploadFileTaskAsync(new Uri(uploadUrl), path).ConfigureAwait(false);
}
}
catch (WebException ex) when (ex.Response != null)
{
Console.WriteLine("Error uploading artefact.");
Console.WriteLine($"Status code: {ex.Status.ToString()}");
using (var reader = new StreamReader(ex.Response.GetResponseStream()))
{
Console.WriteLine("Reponse:");
Console.WriteLine(reader.ReadToEnd());
}
}
catch (Exception ex)
{
Console.WriteLine("Error uploading artefact.");
Console.WriteLine(ex.Message);
}
}
}
}
| mit | C# |
9d5185b5587a8f94ab6b06dcb14e8c1ea4eb48d2 | Revert "multiple lines" | ClusterReplyBUS/MonoTouch.Dialog | MonoTouch.Dialog/Elements/Custom/ReadonlyElement.cs | MonoTouch.Dialog/Elements/Custom/ReadonlyElement.cs | using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using System.Drawing;
using System.IO;
namespace MonoTouch.Dialog
{
public class ReadonlyElement : StringElement, IElementSizing
{
public ReadonlyElement (string caption, string value):base(caption,value)
{
}
public override MonoTouch.UIKit.UITableViewCell GetCell (MonoTouch.UIKit.UITableView tv)
{
var cell = base.GetCell (tv);
if (cell.DetailTextLabel != null) {
cell.DetailTextLabel.LineBreakMode = MonoTouch.UIKit.UILineBreakMode.WordWrap;
if (cell != null && cell.DetailTextLabel != null && !string.IsNullOrWhiteSpace (cell.DetailTextLabel.Text)) {
int lineCount = 0;
using (StringReader r = new StringReader(cell.DetailTextLabel.Text)) {
while (r.ReadLine()!=null)
lineCount++;
}
cell.DetailTextLabel.Lines = 0;
cell.TextLabel.Lines = lineCount;
}
}
return cell;
}
public virtual float GetHeight (UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell = GetCell (tableView);
int lineCount = 0;
if (cell != null && cell.DetailTextLabel != null) {
// lineCount = cell.DetailTextLabel.Lines;
// using (StringReader r = new StringReader(cell.DetailTextLabel.Text)) {
// string line;
// while ((line = r.ReadLine())!=null) {
// lineCount += (int)(line.Length / 50);
// }
// }
using (StringReader r = new StringReader(cell.DetailTextLabel.Text)) {
while (r.ReadLine()!=null)
lineCount++;
}
}
float lineHeight;
SizeF size = new SizeF (280, float.MaxValue);
using (var font = UIFont.FromName ("Helvetica", 17f))
lineHeight = tableView.StringSize (Caption, font, size, UILineBreakMode.WordWrap).Height + 3;
return Math.Max (lineHeight * lineCount + 20, cell.Frame.Height);
}
}
}
| using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using System.Drawing;
using System.IO;
namespace MonoTouch.Dialog
{
public class ReadonlyElement : StringElement, IElementSizing
{
public ReadonlyElement (string caption, string value):base(caption,value)
{
}
public override MonoTouch.UIKit.UITableViewCell GetCell (MonoTouch.UIKit.UITableView tv)
{
var cell = base.GetCell (tv);
if (cell.DetailTextLabel != null) {
cell.DetailTextLabel.Lines = 0;
cell.DetailTextLabel.LineBreakMode = UILineBreakMode.WordWrap;
}
if (cell.TextLabel != null) {
cell.TextLabel.Lines = 0;
cell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap;
}
// cell.DetailTextLabel.LineBreakMode = MonoTouch.UIKit.UILineBreakMode.WordWrap;
// if (cell != null && cell.DetailTextLabel != null && !string.IsNullOrWhiteSpace (cell.DetailTextLabel.Text)) {
// int lineCount = 0;
// using (StringReader r = new StringReader(cell.DetailTextLabel.Text)) {
// while (r.ReadLine()!=null)
// lineCount++;
// }
// cell.DetailTextLabel.Lines = 0;
// cell.TextLabel.Lines = lineCount;
// }
// }
return cell;
}
public virtual float GetHeight (UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell = GetCell (tableView);
// int lineCount = 0;
// if (cell != null && cell.DetailTextLabel != null) {
//// lineCount = cell.DetailTextLabel.Lines;
//// using (StringReader r = new StringReader(cell.DetailTextLabel.Text)) {
//// string line;
//// while ((line = r.ReadLine())!=null) {
//// lineCount += (int)(line.Length / 50);
//// }
//// }
// using (StringReader r = new StringReader(cell.DetailTextLabel.Text)) {
// while (r.ReadLine()!=null)
// lineCount++;
// }
// }
// float lineHeight;
// SizeF size = new SizeF (280, float.MaxValue);
// using (var font = UIFont.FromName ("Helvetica", 17f))
// lineHeight = tableView.StringSize (Value, font, size, UILineBreakMode.WordWrap).Height + 3;
//
// return Math.Max (lineHeight * lineCount + 20, cell.Frame.Height);
float textHeight = 0, titleHeight = 0;
using (var font = UIFont.FromName ("Helvetica", 17f)) {
SizeF size = new SizeF (280, float.MaxValue);
textHeight = tableView.StringSize (string.IsNullOrWhiteSpace(Value) ? "x" : Value, font, size, UILineBreakMode.WordWrap).Height + 3;
titleHeight = tableView.StringSize (string.IsNullOrWhiteSpace(Caption) ? "x" : Caption, font, size, UILineBreakMode.WordWrap).Height + 3;
}
return Math.Max (textHeight + 10, Math.Max(titleHeight + 10, cell.Frame.Height + 10));
}
}
}
| mit | C# |
7044e545ccf6f86f7b5cf6118ade3bbf6783a366 | Update IFightingArtCriteria.cs | SwiftAusterity/NetMud,SwiftAusterity/NetMud,SwiftAusterity/NetMud,SwiftAusterity/NetMud,SwiftAusterity/NetMud | NetMud.DataStructure/Combat/IFightingArtCriteria.cs | NetMud.DataStructure/Combat/IFightingArtCriteria.cs | using NetMud.DataStructure.Architectural;
using NetMud.DataStructure.Architectural.ActorBase;
namespace NetMud.DataStructure.Combat
{
public interface IFightingArtCriteria
{
/// <summary>
/// Does the target need to have at least X health or at most X stamina to use?
/// </summary>
ValueRange<int> StaminaRange { get; set; }
/// <summary>
/// Does the target need to have at least X health or at most X health to use?
/// </summary>
ValueRange<int> HealthRange { get; set; }
/// <summary>
/// What position does the target need to be in
/// </summary>
MobilityState ValidPosition { get; set; }
/// <summary>
/// The quality we're checking for
/// </summary>
string Quality { get; set; }
/// <summary>
/// The value range of the quality we're checking for
/// </summary>
ValueRange<int> QualityRange { get; set; }
/// <summary>
/// Validate the criteria against the actor and victim
/// </summary>
/// <param name="actor">who's doing the hitting</param>
/// <param name="victim">who's being hit</param>
/// <returns></returns>
bool Validate(IMobile target, ulong distance);
}
}
| using NetMud.DataStructure.Architectural;
using NetMud.DataStructure.Architectural.ActorBase;
using NetMud.DataStructure.Player;
namespace NetMud.DataStructure.Combat
{
public interface IFightingArtCriteria
{
/// <summary>
/// Does the target need to have at least X health or at most X stamina to use?
/// </summary>
ValueRange<int> StaminaRange { get; set; }
/// <summary>
/// Does the target need to have at least X health or at most X health to use?
/// </summary>
ValueRange<int> HealthRange { get; set; }
/// <summary>
/// What position does the target need to be in
/// </summary>
MobilityState ValidPosition { get; set; }
/// <summary>
/// The quality we're checking for
/// </summary>
string Quality { get; set; }
/// <summary>
/// The value range of the quality we're checking for
/// </summary>
ValueRange<int> QualityRange { get; set; }
/// <summary>
/// Validate the criteria against the actor and victim
/// </summary>
/// <param name="actor">who's doing the hitting</param>
/// <param name="victim">who's being hit</param>
/// <returns></returns>
bool Validate(IMobile target, ulong distance);
}
}
| mit | C# |
6583c9aff390bb9f5527e427de6c9e92f63278b8 | Fix loops when configuration items are abnormal or unreachable. #444 | dotnetcore/CAP,dotnetcore/CAP,ouraspnet/cap,dotnetcore/CAP | src/DotNetCore.CAP/Processor/IProcessor.InfiniteRetry.cs | src/DotNetCore.CAP/Processor/IProcessor.InfiniteRetry.cs | // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace DotNetCore.CAP.Processor
{
public class InfiniteRetryProcessor : IProcessor
{
private readonly IProcessor _inner;
private readonly ILogger _logger;
public InfiniteRetryProcessor(
IProcessor inner,
ILoggerFactory loggerFactory)
{
_inner = inner;
_logger = loggerFactory.CreateLogger<InfiniteRetryProcessor>();
}
public async Task ProcessAsync(ProcessingContext context)
{
while (!context.IsStopping)
{
try
{
await _inner.ProcessAsync(context);
}
catch (OperationCanceledException)
{
//ignore
}
catch (Exception ex)
{
_logger.LogWarning(ex, "Processor '{ProcessorName}' failed. Retrying...", _inner.ToString());
await context.WaitAsync(TimeSpan.FromSeconds(2));
}
}
}
public override string ToString()
{
return _inner.ToString();
}
}
} | // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace DotNetCore.CAP.Processor
{
public class InfiniteRetryProcessor : IProcessor
{
private readonly IProcessor _inner;
private readonly ILogger _logger;
public InfiniteRetryProcessor(
IProcessor inner,
ILoggerFactory loggerFactory)
{
_inner = inner;
_logger = loggerFactory.CreateLogger<InfiniteRetryProcessor>();
}
public async Task ProcessAsync(ProcessingContext context)
{
while (!context.IsStopping)
{
try
{
await _inner.ProcessAsync(context);
}
catch (OperationCanceledException)
{
//ignore
}
catch (Exception ex)
{
_logger.LogWarning(1, ex, "Processor '{ProcessorName}' failed. Retrying...", _inner.ToString());
}
}
}
public override string ToString()
{
return _inner.ToString();
}
}
} | mit | C# |
72ba3a2b698a7f569ae82f9564a10b0bab157eef | Switch over string comparison to Ordinal | mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype | src/Glimpse.Agent.Web/Framework/MasterRequestProfiler.cs | src/Glimpse.Agent.Web/Framework/MasterRequestProfiler.cs | using Glimpse.Web;
using System;
using System.Threading.Tasks;
namespace Glimpse.Agent.Web
{
public class MasterRequestProfiler : IRequestRuntime
{
private readonly IDiscoverableCollection<IRequestProfiler> _requestProfiliers;
public MasterRequestProfiler(IDiscoverableCollection<IRequestProfiler> requestProfiliers)
{
_requestProfiliers = requestProfiliers;
_requestProfiliers.Discover();
}
public async Task Begin(IHttpContext context)
{
if (ShouldProfile(context))
{
foreach (var requestRuntime in _requestProfiliers)
{
await requestRuntime.Begin(context);
}
}
}
public async Task End(IHttpContext context)
{
if (ShouldProfile(context))
{
foreach (var requestRuntime in _requestProfiliers)
{
await requestRuntime.End(context);
}
}
}
public bool ShouldProfile(IHttpContext context)
{
// TODO: confirm that we want on by default. I'm
// thinking yes since they can easily exclude
// Glimpse middleware if they want.
// TODO: Propbably should be hardcoded to ignore
// own requests here.
// TODO: Hack for favicon atm. Can't be here
if (context.Request.Path.IndexOf("/Glimpse", StringComparison.OrdinalIgnoreCase) > -1
|| context.Request.Path.IndexOf("favicon.ico", StringComparison.OrdinalIgnoreCase) > -1)
{
return false;
}
else if (context.Settings.ShouldProfile != null)
{
return context.Settings.ShouldProfile(context);
}
return true;
}
}
} | using Glimpse.Web;
using System;
using System.Threading.Tasks;
namespace Glimpse.Agent.Web
{
public class MasterRequestProfiler : IRequestRuntime
{
private readonly IDiscoverableCollection<IRequestProfiler> _requestProfiliers;
public MasterRequestProfiler(IDiscoverableCollection<IRequestProfiler> requestProfiliers)
{
_requestProfiliers = requestProfiliers;
_requestProfiliers.Discover();
}
public async Task Begin(IHttpContext context)
{
if (ShouldProfile(context))
{
foreach (var requestRuntime in _requestProfiliers)
{
await requestRuntime.Begin(context);
}
}
}
public async Task End(IHttpContext context)
{
if (ShouldProfile(context))
{
foreach (var requestRuntime in _requestProfiliers)
{
await requestRuntime.End(context);
}
}
}
public bool ShouldProfile(IHttpContext context)
{
// TODO: confirm that we want on by default. I'm
// thinking yes since they can easily exclude
// Glimpse middleware if they want.
// TODO: Propbably should be hardcoded to ignore
// own requests here.
// TODO: Hack for favicon atm. Can't be here
if (context.Request.Path.IndexOf("/Glimpse", StringComparison.InvariantCultureIgnoreCase) > -1
|| context.Request.Path.IndexOf("favicon.ico", StringComparison.InvariantCultureIgnoreCase) > -1)
{
return false;
}
else if (context.Settings.ShouldProfile != null)
{
return context.Settings.ShouldProfile(context);
}
return true;
}
}
} | mit | C# |
cdb21f18de21f495823162e2dcd3c4f2bde42530 | Extend assertions to check for missing conversions. | nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke | source/Nuke.Core.Tests/BuildServerTest.cs | source/Nuke.Core.Tests/BuildServerTest.cs | // Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using FluentAssertions;
using Nuke.Core.BuildServers;
using Xunit;
namespace Nuke.Core.Tests
{
public class BuildServerTest
{
[BuildServerTheory(typeof(Bitrise))]
[MemberData(nameof(Properties), typeof(Bitrise))]
public void TestBitrise(PropertyInfo property)
{
AssertProperty(Bitrise.Instance.NotNull(), property);
}
[BuildServerTheory(typeof(TeamCity))]
[MemberData(nameof(Properties), typeof(TeamCity))]
public void TestTeamCity(PropertyInfo property)
{
AssertProperty(TeamCity.Instance.NotNull(), property);
}
[BuildServerTheory(typeof(TeamFoundationServer))]
[MemberData(nameof(Properties), typeof(TeamFoundationServer))]
public void TestTeamFoundationServer(PropertyInfo property)
{
AssertProperty(TeamFoundationServer.Instance.NotNull(), property);
}
public static IEnumerable<object[]> Properties(Type type)
{
return type.GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Select(x => new object[] { x }).ToArray();
}
private static void AssertProperty (object instance, PropertyInfo property)
{
Action act = () => property.GetValue(instance);
act.ShouldNotThrow<Exception>();
var value = property.GetValue(instance);
if (!(value is string strValue))
return;
bool.TryParse(strValue, out var _).Should().BeFalse();
int.TryParse(strValue, out var _).Should().BeFalse();
float.TryParse(strValue, out var _).Should().BeFalse();
}
internal class BuildServerTheoryAttribute : TheoryAttribute
{
private readonly Type _type;
public BuildServerTheoryAttribute (Type type)
{
_type = type;
}
public override string Skip => HasNoInstance() ? $"Only applies to {_type.Name}." : null;
private bool HasNoInstance()
{
var property = _type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static).NotNull();
return property.GetValue(obj: null) == null;
}
}
}
}
| // Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using FluentAssertions;
using Nuke.Core.BuildServers;
using Xunit;
namespace Nuke.Core.Tests
{
public class BuildServerTest
{
[BuildServerTheory(typeof(Bitrise))]
[MemberData(nameof(Properties), typeof(Bitrise))]
public void TestBitrise(PropertyInfo property)
{
AssertDoesNotThrows(Bitrise.Instance.NotNull(), property);
}
[BuildServerTheory(typeof(TeamCity))]
[MemberData(nameof(Properties), typeof(TeamCity))]
public void TestTeamCity(PropertyInfo property)
{
AssertDoesNotThrows(TeamCity.Instance.NotNull(), property);
}
[BuildServerTheory(typeof(TeamFoundationServer))]
[MemberData(nameof(Properties), typeof(TeamFoundationServer))]
public void TestTeamFoundationServer(PropertyInfo property)
{
AssertDoesNotThrows(TeamFoundationServer.Instance.NotNull(), property);
}
public static IEnumerable<object[]> Properties(Type type)
{
return type.GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Select(x => new object[] { x }).ToArray();
}
private static void AssertDoesNotThrows (object instance, PropertyInfo property)
{
Action act = () => property.GetValue(instance);
act.ShouldNotThrow<Exception>();
}
internal class BuildServerTheoryAttribute : TheoryAttribute
{
private readonly Type _type;
public BuildServerTheoryAttribute (Type type)
{
_type = type;
}
public override string Skip => HasNoInstance() ? $"Only applies to {_type.Name}." : null;
private bool HasNoInstance()
{
var property = _type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static).NotNull();
return property.GetValue(obj: null) == null;
}
}
}
}
| mit | C# |
9be98525f0e774769708312ad0dc955bebd24f42 | Set project neutral language | emoacht/ManagedNativeWifi | Source/ManagedNativeWifi/Properties/AssemblyInfo.cs | Source/ManagedNativeWifi/Properties/AssemblyInfo.cs | using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ManagedNativeWifi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ManagedNativeWifi")]
[assembly: AssemblyCopyright("Copyright © 2015-2018 emoacht")]
[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("ebff4686-23e6-42bf-97ca-cf82641bcfa7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: NeutralResourcesLanguage("en-US")]
// For unit test
[assembly: InternalsVisibleTo("ManagedNativeWifi.Test")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ManagedNativeWifi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ManagedNativeWifi")]
[assembly: AssemblyCopyright("Copyright © 2015-2018 emoacht")]
[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("ebff4686-23e6-42bf-97ca-cf82641bcfa7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
// For unit test
[assembly: InternalsVisibleTo("ManagedNativeWifi.Test")] | mit | C# |
7fdd1e747f176609cff19f4460bdbd99cc23a1b9 | fix crash in constructor. Chain to the this. constructor, and fix the actual parameter to be the length of the array | jorik041/maccore,cwensley/maccore,mono/maccore | src/CoreImage/CIVector.cs | src/CoreImage/CIVector.cs | //
// CIVector.cs: Extra methods for CIVector
//
// Copyright 2010, Novell, Inc.
//
// Author:
// Miguel de Icaza
//
// 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;
namespace MonoMac.CoreImage {
public partial class CIVector {
float this [int index] {
get {
return ValueAtIndex (index);
}
}
static IntPtr GetPtr (float [] values)
{
if (values == null)
throw new ArgumentNullException ("values");
unsafe {
fixed (float *ptr = &values [0])
return (IntPtr) ptr;
}
}
public CIVector (float [] values) : this (GetPtr (values), values.Length)
{
}
public static CIVector FromValues (float [] values)
{
if (values == null)
throw new ArgumentNullException ("values");
unsafe {
fixed (float *ptr = &values [0])
return _FromValues ((IntPtr) ptr, values.Length);
}
}
public override string ToString ()
{
return StringRepresentation ();
}
}
} | //
// CIVector.cs: Extra methods for CIVector
//
// Copyright 2010, Novell, Inc.
//
// Author:
// Miguel de Icaza
//
// 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;
namespace MonoMac.CoreImage {
public partial class CIVector {
float this [int index] {
get {
return ValueAtIndex (index);
}
}
static IntPtr GetPtr (float [] values)
{
if (values == null)
throw new ArgumentNullException ("values");
unsafe {
fixed (float *ptr = &values [0])
return (IntPtr) ptr;
}
}
public CIVector (float [] values) : base (GetPtr (values))
{
}
public static CIVector FromValues (float [] values)
{
if (values == null)
throw new ArgumentNullException ("values");
unsafe {
fixed (float *ptr = &values [0])
return _FromValues ((IntPtr) ptr, values.Length);
}
}
public override string ToString ()
{
return StringRepresentation ();
}
}
} | apache-2.0 | C# |
f8d90ea815818b098b33b47549e29811666c18f7 | add comment to broken new theater adding to db | olebg/Movie-Theater-Project | MovieTheater/MovieTheater.Framework/Core/Commands/CreateTheaterCommand.cs | MovieTheater/MovieTheater.Framework/Core/Commands/CreateTheaterCommand.cs | using System.Collections.Generic;
using MovieTheater.Data;
using MovieTheater.Framework.Core.Commands.Contracts;
using MovieTheater.Framework.Models;
using System;
using System.Linq;
namespace MovieTheater.Framework.Core.Commands
{
public class CreateTheaterCommand : ICommand
{
private MovieTheaterDbContext dbContext;
private ModelsFactory factory;
public CreateTheaterCommand(MovieTheaterDbContext dbContext, ModelsFactory factory)
{
this.dbContext = dbContext;
this.factory = factory;
}
public string Execute(List<string> parameters)
{
if (parameters.Any(x => x == string.Empty))
{
throw new Exception("Some of the passed parameters are empty!");
}
var theater = this.factory.CreateTheater(parameters[0]);
// this.dbContext.Theaters.Add(theater); //FIX ME
return "Successfully created a new Theater!";
}
}
}
| using System.Collections.Generic;
using MovieTheater.Data;
using MovieTheater.Framework.Core.Commands.Contracts;
using MovieTheater.Framework.Models;
using System;
using System.Linq;
namespace MovieTheater.Framework.Core.Commands
{
public class CreateTheaterCommand : ICommand
{
private MovieTheaterDbContext dbContext;
private ModelsFactory factory;
public CreateTheaterCommand(MovieTheaterDbContext dbContext, ModelsFactory factory)
{
this.dbContext = dbContext;
this.factory = factory;
}
public string Execute(List<string> parameters)
{
if (parameters.Any(x => x == string.Empty))
{
throw new Exception("Some of the passed parameters are empty!");
}
var theater = this.factory.CreateTheater(parameters[0]);
this.dbContext.Theaters.Add(theater);
return "Successfully created a new Theater!";
}
}
}
| mit | C# |
308e6ef0c985b24a36ba2b6528d7cddb7c7675ea | Add Enabled = true, Exported = false | CrossGeeks/FirebasePushNotificationPlugin | Plugin.FirebasePushNotification/PushNotificationActionReceiver.android.cs | Plugin.FirebasePushNotification/PushNotificationActionReceiver.android.cs | using System.Collections.Generic;
using Android.App;
using Android.Content;
namespace Plugin.FirebasePushNotification
{
[BroadcastReceiver(Enabled = true, Exported = false)]
public class PushNotificationActionReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
IDictionary<string, object> parameters = new Dictionary<string, object>();
var extras = intent.Extras;
if (extras != null && !extras.IsEmpty)
{
foreach (var key in extras.KeySet())
{
parameters.Add(key, $"{extras.Get(key)}");
System.Diagnostics.Debug.WriteLine(key, $"{extras.Get(key)}");
}
}
FirebasePushNotificationManager.RegisterAction(parameters);
var manager = context.GetSystemService(Context.NotificationService) as NotificationManager;
var notificationId = extras.GetInt(DefaultPushNotificationHandler.ActionNotificationIdKey, -1);
if (notificationId != -1)
{
var notificationTag = extras.GetString(DefaultPushNotificationHandler.ActionNotificationTagKey, string.Empty);
if (notificationTag == null)
{
manager.Cancel(notificationId);
}
else
{
manager.Cancel(notificationTag, notificationId);
}
}
}
}
}
| using System.Collections.Generic;
using Android.App;
using Android.Content;
namespace Plugin.FirebasePushNotification
{
[BroadcastReceiver]
public class PushNotificationActionReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
IDictionary<string, object> parameters = new Dictionary<string, object>();
var extras = intent.Extras;
if (extras != null && !extras.IsEmpty)
{
foreach (var key in extras.KeySet())
{
parameters.Add(key, $"{extras.Get(key)}");
System.Diagnostics.Debug.WriteLine(key, $"{extras.Get(key)}");
}
}
FirebasePushNotificationManager.RegisterAction(parameters);
var manager = context.GetSystemService(Context.NotificationService) as NotificationManager;
var notificationId = extras.GetInt(DefaultPushNotificationHandler.ActionNotificationIdKey, -1);
if (notificationId != -1)
{
var notificationTag = extras.GetString(DefaultPushNotificationHandler.ActionNotificationTagKey, string.Empty);
if (notificationTag == null)
{
manager.Cancel(notificationId);
}
else
{
manager.Cancel(notificationTag, notificationId);
}
}
}
}
}
| mit | C# |
dda815a5fddebb0c03aa94ca8a1d11f4b48bc787 | Update UnsignedBigIntegerBinaryDeserializer.cs | tiksn/TIKSN-Framework | TIKSN.Core/Serialization/Numerics/UnsignedBigIntegerBinaryDeserializer.cs | TIKSN.Core/Serialization/Numerics/UnsignedBigIntegerBinaryDeserializer.cs | using System.Linq;
using System.Numerics;
namespace TIKSN.Serialization.Numerics
{
/// <summary>
/// Custom (specialized or typed) deserializer for unsigned <see cref="BigInteger" />
/// </summary>
public class UnsignedBigIntegerBinaryDeserializer : ICustomDeserializer<byte[], BigInteger>
{
/// <summary>
/// Deserializes byte array to unsigned <see cref="BigInteger" />
/// </summary>
/// <param name="serial"></param>
/// <returns></returns>
public BigInteger Deserialize(byte[] serial)
{
var last = serial[serial.Length - 1];
if (last < 0b_1000_0000)
{
return new BigInteger(serial);
}
return new BigInteger(serial.Concat(new byte[] {0b_0000_0000}).ToArray());
}
}
}
| using System.Linq;
using System.Numerics;
namespace TIKSN.Serialization.Numerics
{
/// <summary>
/// Custom (specialized or typed) deserializer for unsigned <see cref="BigInteger"/>
/// </summary>
public class UnsignedBigIntegerBinaryDeserializer : ICustomDeserializer<byte[], BigInteger>
{
/// <summary>
/// Deserializes byte array to unsigned <see cref="BigInteger"/>
/// </summary>
/// <param name="serial"></param>
/// <returns></returns>
public BigInteger Deserialize(byte[] serial)
{
var last = serial[serial.Length - 1];
if (last < 0b_1000_0000)
return new BigInteger(serial);
return new BigInteger(serial.Concat(new byte[] { 0b_0000_0000 }).ToArray());
}
}
} | mit | C# |
8378c83ceced8f863d447bf545b3cfd30a193be7 | Quit the Mac app after the window is closed | mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp | samples/Skia.OSX.Demo/AppDelegate.cs | samples/Skia.OSX.Demo/AppDelegate.cs | using AppKit;
using Foundation;
namespace Skia.OSX.Demo
{
[Register ("AppDelegate")]
public partial class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}
public override void DidFinishLaunching (NSNotification notification)
{
// Insert code here to initialize your application
}
public override void WillTerminate (NSNotification notification)
{
// Insert code here to tear down your application
}
public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
{
return true;
}
}
}
| using AppKit;
using Foundation;
namespace Skia.OSX.Demo
{
[Register ("AppDelegate")]
public partial class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}
public override void DidFinishLaunching (NSNotification notification)
{
// Insert code here to initialize your application
}
public override void WillTerminate (NSNotification notification)
{
// Insert code here to tear down your application
}
}
}
| mit | C# |
6e62f6f833e0d3eda837cefade5458e33808f391 | Update SharedAssemblyInfo | apemost/Newq,apemost/Newq | src/SharedAssemblyInfo.cs | src/SharedAssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Newq")]
[assembly: AssemblyDescription("New query builder for CSharp")]
[assembly: AssemblyProduct("Newq")]
[assembly: AssemblyCopyright("Copyright (C) Andrew Lyu & Uriel Van")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: InternalsVisibleTo("Newq.Tests")]
| using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Newq")]
[assembly: AssemblyDescription("A new query builder for CSharp")]
[assembly: AssemblyProduct("Newq")]
[assembly: AssemblyCopyright("Copyright (C) Andrew Lyu & Uriel Van")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: InternalsVisibleTo("Newq.Tests")]
| mit | C# |
8494a5b2fffefc487d1288a974d77be3639a35f1 | Refactor method parameter name | msoler8785/ExoMail | ExoMail.Smtp.Example/IO/FileMessageStore.cs | ExoMail.Smtp.Example/IO/FileMessageStore.cs | using ExoMail.Smtp.Interfaces;
using ExoMail.Smtp.Models;
using System;
using System.IO;
namespace ExoMail.Smtp.Server.IO
{
/// <summary>
/// An example implementation of storing messages on the file system.
/// </summary>
public class FileMessageStore : IMessageStore
{
private string FolderPath { get; set; }
private string FileName { get; set; }
/// <summary>
/// Create a new FileMessageStore instance.
/// </summary>
public static FileMessageStore Create { get { return new FileMessageStore(); } }
private FileMessageStore()
{
}
/// <summary>
/// The path to the folder to store this message.
/// </summary>
/// <param name="path">An absolute folder path.</param>
/// <returns>this</returns>
public FileMessageStore WithFolderPath(string path)
{
this.FolderPath = path;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
return this;
}
/// <summary>
/// The file name to use for this message.
/// </summary>
/// <param name="fileName">A name for the file including the extension.</param>
/// <returns>this</returns>
public FileMessageStore WithFileName(string fileName)
{
this.FileName = fileName;
return this;
}
/// <summary>
/// Saves the message to the specified folder.
/// </summary>
public void Save(Stream stream, ReceivedHeader receivedHeader)
{
this.FolderPath = this.FolderPath ?? AppDomain.CurrentDomain.BaseDirectory;
this.FileName = Guid.NewGuid().ToString().ToUpper() + ".eml";
string path = Path.Combine(this.FolderPath, this.FileName);
using (FileStream fileStream = new FileStream(path, FileMode.Append))
{
receivedHeader.GetReceivedHeaders().CopyTo(fileStream);
stream.CopyTo(fileStream);
}
}
}
} | using ExoMail.Smtp.Interfaces;
using ExoMail.Smtp.Models;
using System;
using System.IO;
namespace ExoMail.Smtp.Server.IO
{
/// <summary>
/// An example implementation of storing messages on the file system.
/// </summary>
public class FileMessageStore : IMessageStore
{
private string FolderPath { get; set; }
private string FileName { get; set; }
/// <summary>
/// Create a new FileMessageStore instance.
/// </summary>
public static FileMessageStore Create { get { return new FileMessageStore(); } }
private FileMessageStore()
{
}
/// <summary>
/// The path to the folder to store this message.
/// </summary>
/// <param name="path">An absolute folder path.</param>
/// <returns>this</returns>
public FileMessageStore WithFolderPath(string path)
{
this.FolderPath = path;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
return this;
}
/// <summary>
/// The file name to use for this message.
/// </summary>
/// <param name="fileName">A name for the file including the extension.</param>
/// <returns>this</returns>
public FileMessageStore WithFileName(string fileName)
{
this.FileName = fileName;
return this;
}
/// <summary>
/// Saves the message to the specified folder.
/// </summary>
public void Save(Stream stream, ReceivedHeader sessionMessage)
{
this.FolderPath = this.FolderPath ?? AppDomain.CurrentDomain.BaseDirectory;
this.FileName = Guid.NewGuid().ToString().ToUpper() + ".eml";
string path = Path.Combine(this.FolderPath, this.FileName);
using (FileStream fileStream = new FileStream(path, FileMode.Append))
{
sessionMessage.GetReceivedHeaders().CopyTo(fileStream);
stream.CopyTo(fileStream);
}
}
}
} | mit | C# |
a4b20d211726e0980d55969e2193121cb9b60b75 | Make EZ mod able to fail in Taiko | UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,smoogipoo/osu,UselessToucan/osu | osu.Game.Rulesets.Taiko/Mods/TaikoModEasy.cs | osu.Game.Rulesets.Taiko/Mods/TaikoModEasy.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using Humanizer;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Taiko.Mods
{
public class TaikoModEasy : Mod, IApplicableToDifficulty, IApplicableFailOverride
{
public override string Name => "Easy";
public override string Acronym => "EZ";
public override string Description => @"Beats move slower, less accuracy required";
public override IconUsage? Icon => OsuIcon.ModEasy;
public override ModType Type => ModType.DifficultyReduction;
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock), typeof(ModDifficultyAdjust) };
public void ReadFromDifficulty(BeatmapDifficulty difficulty)
{
}
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
const float ratio = 0.5f;
difficulty.CircleSize *= ratio;
difficulty.ApproachRate *= ratio;
difficulty.DrainRate *= ratio;
difficulty.OverallDifficulty *= ratio;
}
public bool PerformFail() => true;
public bool RestartOnFail => false;
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Taiko.Mods
{
public class TaikoModEasy : ModEasy
{
public override string Description => @"Beats move slower, less accuracy required, and three lives!";
}
}
| mit | C# |
3840cd4c7476a4d8beca2c0933f485747b068879 | Add Values observable | wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors | samples/BehaviorsTestApplication/ViewModels/MainWindowViewModel.cs | samples/BehaviorsTestApplication/ViewModels/MainWindowViewModel.cs | using System;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Windows.Input;
using BehaviorsTestApplication.ViewModels.Core;
namespace BehaviorsTestApplication.ViewModels
{
public class MainWindowViewModel : ViewModelBase
{
private int _value;
private int _count;
private double _position;
public int Count
{
get => _count;
set => Update(ref _count, value);
}
public double Position
{
get => _position;
set => Update(ref _position, value);
}
public IObservable<int> Values { get; }
public ICommand MoveLeftCommand { get; set; }
public ICommand MoveRightCommand { get; set; }
public ICommand ResetMoveCommand { get; set; }
public MainWindowViewModel()
{
Count = 0;
Position = 100.0;
MoveLeftCommand = new Command((param) => Position -= 5.0);
MoveRightCommand = new Command((param) => Position += 5.0);
ResetMoveCommand = new Command((param) => Position = 100.0);
Values = Observable.Interval(TimeSpan.FromSeconds(1)).Select(_ => _value++);
}
public void IncrementCount() => Count++;
public void DecrementCount(object? sender, object parameter) => Count--;
}
}
| using System.Windows.Input;
using BehaviorsTestApplication.ViewModels.Core;
namespace BehaviorsTestApplication.ViewModels
{
public class MainWindowViewModel : ViewModelBase
{
private int _count;
private double _position;
public int Count
{
get => _count;
set => Update(ref _count, value);
}
public double Position
{
get => _position;
set => Update(ref _position, value);
}
public ICommand MoveLeftCommand { get; set; }
public ICommand MoveRightCommand { get; set; }
public ICommand ResetMoveCommand { get; set; }
public MainWindowViewModel()
{
Count = 0;
Position = 100.0;
MoveLeftCommand = new Command((param) => Position -= 5.0);
MoveRightCommand = new Command((param) => Position += 5.0);
ResetMoveCommand = new Command((param) => Position = 100.0);
}
public void IncrementCount() => Count++;
public void DecrementCount(object? sender, object parameter) => Count--;
}
}
| mit | C# |
24a7b5f0d69438034f406e0ff27bf5d7578d3ad0 | Fix missing comma | UselessToucan/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,EVAST9919/osu,peppy/osu,EVAST9919/osu,UselessToucan/osu,NeoAdonis/osu | osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs | osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.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.
namespace osu.Game.Skinning
{
public class LegacyManiaSkinConfigurationLookup
{
public readonly int Keys;
public readonly LegacyManiaSkinConfigurationLookups Lookup;
public readonly int? TargetColumn;
public LegacyManiaSkinConfigurationLookup(int keys, LegacyManiaSkinConfigurationLookups lookup, int? targetColumn = null)
{
Keys = keys;
Lookup = lookup;
TargetColumn = targetColumn;
}
}
public enum LegacyManiaSkinConfigurationLookups
{
ColumnWidth,
ColumnSpacing,
LightImage,
LeftLineWidth,
RightLineWidth,
HitPosition,
LightPosition,
HitTargetImage,
ShowJudgementLine,
KeyImage,
KeyImageDown,
NoteImage,
HoldNoteHeadImage,
HoldNoteTailImage,
HoldNoteBodyImage,
ExplosionImage,
ExplosionScale,
ColumnLineColour
}
}
| // 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.
namespace osu.Game.Skinning
{
public class LegacyManiaSkinConfigurationLookup
{
public readonly int Keys;
public readonly LegacyManiaSkinConfigurationLookups Lookup;
public readonly int? TargetColumn;
public LegacyManiaSkinConfigurationLookup(int keys, LegacyManiaSkinConfigurationLookups lookup, int? targetColumn = null)
{
Keys = keys;
Lookup = lookup;
TargetColumn = targetColumn;
}
}
public enum LegacyManiaSkinConfigurationLookups
{
ColumnWidth,
ColumnSpacing,
LightImage,
LeftLineWidth,
RightLineWidth,
HitPosition,
LightPosition,
HitTargetImage,
ShowJudgementLine,
KeyImage,
KeyImageDown,
NoteImage,
HoldNoteHeadImage,
HoldNoteTailImage,
HoldNoteBodyImage,
ExplosionImage,
ExplosionScale
ColumnLineColour
}
}
| mit | C# |
5fedb9db6b818ad72d8461c2e74904af40f02622 | Support for parsing equality operator with constant operand. | TestStack/TestStack.FluentMVCTesting | TestStack.FluentMVCTesting.Tests/Internal/ExpressionInspectorTests.cs | TestStack.FluentMVCTesting.Tests/Internal/ExpressionInspectorTests.cs | using NUnit.Framework;
using System;
using System.Linq.Expressions;
using TestStack.FluentMVCTesting.Internal;
namespace TestStack.FluentMVCTesting.Tests.Internal
{
[TestFixture]
public class ExpressionInspectorShould
{
[Test]
public void Correctly_parse_equality_comparison_with_string_operands()
{
Expression<Func<string, bool>> func = text => text == "any";
ExpressionInspector sut = new ExpressionInspector();
var actual = sut.Inspect(func);
Assert.AreEqual("text => text == \"any\"", actual);
}
[Test]
public void Correctly_parse_equality_comparison_with_int_operands()
{
Expression<Func<int, bool>> func = number => number == 5;
ExpressionInspector sut = new ExpressionInspector();
var actual = sut.Inspect(func);
Assert.AreEqual("number => number == 5", actual);
}
[Test]
public void Correctly_parse_inequality_comparison_with_int_operands()
{
Expression<Func<int, bool>> func = number => number != 5;
ExpressionInspector sut = new ExpressionInspector();
var actual = sut.Inspect(func);
Assert.AreEqual("number => number != 5", actual);
}
[Test]
public void Correctly_parse_equality_comparison_with_captured_constant_operand()
{
const int Number = 5;
Expression<Func<int, bool>> func = number => number == Number;
ExpressionInspector sut = new ExpressionInspector();
var actual = sut.Inspect(func);
Assert.AreEqual("number => number == " + Number, actual);
}
}
} | using NUnit.Framework;
using System;
using System.Linq.Expressions;
using TestStack.FluentMVCTesting.Internal;
namespace TestStack.FluentMVCTesting.Tests.Internal
{
[TestFixture]
public class ExpressionInspectorShould
{
[Test]
public void Correctly_parse_equality_comparison_with_string_operands()
{
Expression<Func<string, bool>> func = text => text == "any";
ExpressionInspector sut = new ExpressionInspector();
var actual = sut.Inspect(func);
Assert.AreEqual("text => text == \"any\"", actual);
}
[Test]
public void Correctly_parse_equality_comparison_with_int_operands()
{
Expression<Func<int, bool>> func = number => number == 5;
ExpressionInspector sut = new ExpressionInspector();
var actual = sut.Inspect(func);
Assert.AreEqual("number => number == 5", actual);
}
[Test]
public void Correctly_parse_inequality_comparison_with_int_operands()
{
Expression<Func<int, bool>> func = number => number != 5;
ExpressionInspector sut = new ExpressionInspector();
var actual = sut.Inspect(func);
Assert.AreEqual("number => number != 5", actual);
}
}
} | mit | C# |
7240de7bc5c22be6add90e03a8134e53cca81069 | Change convention builder namespace to Microsoft.AspNetCore.Buil… (#399) | grpc/grpc-dotnet,grpc/grpc-dotnet,grpc/grpc-dotnet,grpc/grpc-dotnet | src/Grpc.AspNetCore.Server/GrpcServiceEndpointConventionBuilder.cs | src/Grpc.AspNetCore.Server/GrpcServiceEndpointConventionBuilder.cs | #region Copyright notice and license
// Copyright 2019 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.AspNetCore.Builder
{
/// <summary>
/// Builds conventions that will be used for customization of gRPC service <see cref="EndpointBuilder"/> instances.
/// </summary>
public sealed class GrpcServiceEndpointConventionBuilder : IEndpointConventionBuilder
{
private readonly List<IEndpointConventionBuilder> _endpointConventionBuilders;
internal GrpcServiceEndpointConventionBuilder(IEnumerable<IEndpointConventionBuilder> endpointConventionBuilders)
{
_endpointConventionBuilders = endpointConventionBuilders.ToList();
}
/// <summary>
/// Adds the specified convention to the builder. Conventions are used to customize <see cref="EndpointBuilder"/> instances.
/// </summary>
/// <param name="convention">The convention to add to the builder.</param>
public void Add(Action<EndpointBuilder> convention)
{
foreach (var endpointConventionBuilder in _endpointConventionBuilders)
{
endpointConventionBuilder.Add(convention);
}
}
}
}
| #region Copyright notice and license
// Copyright 2019 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Builder;
namespace Grpc.AspNetCore.Server
{
/// <summary>
/// Builds conventions that will be used for customization of gRPC service <see cref="EndpointBuilder"/> instances.
/// </summary>
public sealed class GrpcServiceEndpointConventionBuilder : IEndpointConventionBuilder
{
private readonly List<IEndpointConventionBuilder> _endpointConventionBuilders;
internal GrpcServiceEndpointConventionBuilder(IEnumerable<IEndpointConventionBuilder> endpointConventionBuilders)
{
_endpointConventionBuilders = endpointConventionBuilders.ToList();
}
/// <summary>
/// Adds the specified convention to the builder. Conventions are used to customize <see cref="EndpointBuilder"/> instances.
/// </summary>
/// <param name="convention">The convention to add to the builder.</param>
public void Add(Action<EndpointBuilder> convention)
{
foreach (var endpointConventionBuilder in _endpointConventionBuilders)
{
endpointConventionBuilder.Add(convention);
}
}
}
}
| apache-2.0 | C# |
252313a064af988d9d2f2b404132010f08a4d03a | Reset AssemblyVersion before initial publishing. | tischlda/StaticMapHelpers | StaticMapHelpers/Properties/AssemblyInfo.cs | StaticMapHelpers/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("Molimentum.StaticMapHelpers")]
[assembly: AssemblyDescription("ASP.NET MVC helpers for embedding static maps with the Google Static Maps API V2.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("David Tischler")]
[assembly: AssemblyProduct("Molimentum.StaticMapHelpers")]
[assembly: AssemblyCopyright("Copyright © David Tischler 2012")]
[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("43232d90-438c-4628-9e07-a3f945052685")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.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("Molimentum.StaticMapHelpers")]
[assembly: AssemblyDescription("ASP.NET MVC helpers for embedding static maps with the Google Static Maps API V2.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("David Tischler")]
[assembly: AssemblyProduct("Molimentum.StaticMapHelpers")]
[assembly: AssemblyCopyright("Copyright © David Tischler 2012")]
[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("43232d90-438c-4628-9e07-a3f945052685")]
// 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.2")]
[assembly: AssemblyFileVersion("1.0.0.2")]
| mit | C# |
b206e7ee399a7d956aeefdc5a29f4678f0edc868 | fix comments | jhgbrt/yadal | Net.Code.ADONet/DbConfig.cs | Net.Code.ADONet/DbConfig.cs | using System;
using System.Data;
namespace Net.Code.ADONet
{
public class DbConfig
{
public DbConfig(Action<IDbCommand> prepareCommand, MappingConvention convention, string providerName)
{
PrepareCommand = prepareCommand;
MappingConvention = convention;
ProviderName = providerName;
}
public Action<IDbCommand> PrepareCommand { get; }
public MappingConvention MappingConvention { get; }
public string ProviderName { get; }
public static readonly DbConfig Default = Create("System.Data.SqlClient");
public static DbConfig FromProviderName(string providerName)
{
return !string.IsNullOrEmpty(providerName) && providerName.StartsWith("Oracle") ? Oracle(providerName) : Create(providerName);
}
private static DbConfig Oracle(string providerName)
{
// By default, the Oracle driver does not support binding parameters by name;
// one has to set the BindByName property on the OracleDbCommand.
// Mapping:
// Oracle convention is to work with UPPERCASE_AND_UNDERSCORE instead of BookTitleCase
return new DbConfig(SetBindByName, MappingConvention.Loose, providerName);
}
private static DbConfig Create(string providerName)
{
return new DbConfig(c => {}, MappingConvention.Strict, providerName);
}
private static void SetBindByName(IDbCommand c)
{
dynamic d = c;
d.BindByName = true;
}
}
} | using System;
using System.Data;
namespace Net.Code.ADONet
{
public class DbConfig
{
public DbConfig(Action<IDbCommand> prepareCommand, MappingConvention convention, string providerName)
{
PrepareCommand = prepareCommand;
MappingConvention = convention;
ProviderName = providerName;
}
public Action<IDbCommand> PrepareCommand { get; }
public MappingConvention MappingConvention { get; }
public string ProviderName { get; }
public static readonly DbConfig Default = Create("System.Data.SqlClient");
public static DbConfig FromProviderName(string providerName)
{
return !string.IsNullOrEmpty(providerName) && providerName.StartsWith("Oracle") ? Oracle(providerName) : Create(providerName);
}
private static DbConfig Oracle(string providerName)
{
// // By default, the Oracle driver does not support binding parameters by name;
// // one has to set the BindByName property on the OracleDbCommand.
// // Mapping:
// // Oracle convention is to work with UPPERCASE_AND_UNDERSCORE instead of BookTitleCase
return new DbConfig(SetBindByName, MappingConvention.Loose, providerName);
}
private static DbConfig Create(string providerName)
{
return new DbConfig(c => {}, MappingConvention.Strict, providerName);
}
private static void SetBindByName(IDbCommand c)
{
dynamic d = c;
d.BindByName = true;
}
}
} | mit | C# |
74d833c214830bae97a3536f9d23ccb77b6dd619 | Enable nullable: System.Management.Automation.Interpreter.IInstructionProvider (#14173) | TravisEz13/PowerShell,JamesWTruher/PowerShell-1,JamesWTruher/PowerShell-1,daxian-dbw/PowerShell,TravisEz13/PowerShell,JamesWTruher/PowerShell-1,TravisEz13/PowerShell,JamesWTruher/PowerShell-1,PaulHigin/PowerShell,PaulHigin/PowerShell,PaulHigin/PowerShell,TravisEz13/PowerShell,PaulHigin/PowerShell,daxian-dbw/PowerShell,daxian-dbw/PowerShell,daxian-dbw/PowerShell | src/System.Management.Automation/engine/interpreter/Instruction.cs | src/System.Management.Automation/engine/interpreter/Instruction.cs | /* ****************************************************************************
*
* Copyright (c) Microsoft Corporation.
*
* This source code is subject to terms and conditions of the Apache License, Version 2.0. A
* copy of the license can be found in the License.html file at the root of this distribution. If
* you cannot locate the Apache License, Version 2.0, please send an email to
* dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
* by the terms of the Apache License, Version 2.0.
*
* You must not remove this notice, or any other, from this software.
*
*
* ***************************************************************************/
using System.Collections.Generic;
namespace System.Management.Automation.Interpreter
{
#nullable enable
internal interface IInstructionProvider
{
void AddInstructions(LightCompiler compiler);
}
#nullable restore
internal abstract class Instruction
{
public const int UnknownInstrIndex = int.MaxValue;
public virtual int ConsumedStack { get { return 0; } }
public virtual int ProducedStack { get { return 0; } }
public virtual int ConsumedContinuations { get { return 0; } }
public virtual int ProducedContinuations { get { return 0; } }
public int StackBalance
{
get { return ProducedStack - ConsumedStack; }
}
public int ContinuationsBalance
{
get { return ProducedContinuations - ConsumedContinuations; }
}
public abstract int Run(InterpretedFrame frame);
public virtual string InstructionName
{
get { return GetType().Name.Replace("Instruction", string.Empty); }
}
public override string ToString()
{
return InstructionName + "()";
}
public virtual string ToDebugString(int instructionIndex, object cookie, Func<int, int> labelIndexer, IList<object> objects)
{
return ToString();
}
public virtual object GetDebugCookie(LightCompiler compiler)
{
return null;
}
}
internal sealed class NotInstruction : Instruction
{
public static readonly Instruction Instance = new NotInstruction();
private NotInstruction() { }
public override int ConsumedStack { get { return 1; } }
public override int ProducedStack { get { return 1; } }
public override int Run(InterpretedFrame frame)
{
frame.Push((bool)frame.Pop() ? ScriptingRuntimeHelpers.False : ScriptingRuntimeHelpers.True);
return +1;
}
}
}
| /* ****************************************************************************
*
* Copyright (c) Microsoft Corporation.
*
* This source code is subject to terms and conditions of the Apache License, Version 2.0. A
* copy of the license can be found in the License.html file at the root of this distribution. If
* you cannot locate the Apache License, Version 2.0, please send an email to
* dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
* by the terms of the Apache License, Version 2.0.
*
* You must not remove this notice, or any other, from this software.
*
*
* ***************************************************************************/
using System.Collections.Generic;
namespace System.Management.Automation.Interpreter
{
internal interface IInstructionProvider
{
void AddInstructions(LightCompiler compiler);
}
internal abstract class Instruction
{
public const int UnknownInstrIndex = int.MaxValue;
public virtual int ConsumedStack { get { return 0; } }
public virtual int ProducedStack { get { return 0; } }
public virtual int ConsumedContinuations { get { return 0; } }
public virtual int ProducedContinuations { get { return 0; } }
public int StackBalance
{
get { return ProducedStack - ConsumedStack; }
}
public int ContinuationsBalance
{
get { return ProducedContinuations - ConsumedContinuations; }
}
public abstract int Run(InterpretedFrame frame);
public virtual string InstructionName
{
get { return GetType().Name.Replace("Instruction", string.Empty); }
}
public override string ToString()
{
return InstructionName + "()";
}
public virtual string ToDebugString(int instructionIndex, object cookie, Func<int, int> labelIndexer, IList<object> objects)
{
return ToString();
}
public virtual object GetDebugCookie(LightCompiler compiler)
{
return null;
}
}
internal sealed class NotInstruction : Instruction
{
public static readonly Instruction Instance = new NotInstruction();
private NotInstruction() { }
public override int ConsumedStack { get { return 1; } }
public override int ProducedStack { get { return 1; } }
public override int Run(InterpretedFrame frame)
{
frame.Push((bool)frame.Pop() ? ScriptingRuntimeHelpers.False : ScriptingRuntimeHelpers.True);
return +1;
}
}
}
| mit | C# |
1d9843cf33e1890ad7227ebef4fff06448582b5c | Make clone root build config test more strict | ComputerWorkware/TeamCityApi | src/TeamCityApi.Tests/UseCases/CloneRootBuildConfigUseCaseTests.cs | src/TeamCityApi.Tests/UseCases/CloneRootBuildConfigUseCaseTests.cs | using System.Threading.Tasks;
using NSubstitute;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.Xunit;
using TeamCityApi.Domain;
using TeamCityApi.Locators;
using TeamCityApi.Tests.Helpers;
using TeamCityApi.Tests.Scenarios;
using TeamCityApi.UseCases;
using Xunit;
using Xunit.Extensions;
namespace TeamCityApi.Tests.UseCases
{
public class CloneRootBuildConfigUseCaseTests
{
[Theory]
[AutoNSubstituteData]
public void Should_clone_root_build_config(
int buildId,
string newNameSyntax,
ITeamCityClient client,
IFixture fixture)
{
var sourceBuildId = buildId.ToString();
var scenario = new SingleBuildScenario(fixture, client, sourceBuildId);
var sut = new CloneRootBuildConfigUseCase(client);
sut.Execute(sourceBuildId, newNameSyntax).Wait();
var newBuildConfigName = scenario.BuildConfig.Name + Consts.SuffixSeparator + newNameSyntax;
client.BuildConfigs.Received(1)
.CopyBuildConfiguration(scenario.Project.Id, newBuildConfigName, scenario.BuildConfig.Id, Arg.Any<bool>(), Arg.Any<bool>());
}
}
} | using System.Threading.Tasks;
using NSubstitute;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.Xunit;
using TeamCityApi.Domain;
using TeamCityApi.Locators;
using TeamCityApi.Tests.Helpers;
using TeamCityApi.Tests.Scenarios;
using TeamCityApi.UseCases;
using Xunit;
using Xunit.Extensions;
namespace TeamCityApi.Tests.UseCases
{
public class CloneRootBuildConfigUseCaseTests
{
[Theory]
[AutoNSubstituteData]
public void Should_clone_root_build_config(
int buildId,
string newNameSyntax,
ITeamCityClient client,
IFixture fixture)
{
var sourceBuildId = buildId.ToString();
var scenario = new SingleBuildScenario(fixture, client, sourceBuildId);
var sut = new CloneRootBuildConfigUseCase(client);
sut.Execute(sourceBuildId, newNameSyntax).Wait();
var newBuildConfigName = scenario.BuildConfig.Name + Consts.SuffixSeparator + newNameSyntax;
client.BuildConfigs.Received()
.CopyBuildConfiguration(scenario.Project.Id, newBuildConfigName, scenario.BuildConfig.Id, Arg.Any<bool>(), Arg.Any<bool>());
}
}
} | mit | C# |
e78d1609f41d2bdfe99588c0f87280c687f558a7 | correct english description | fredatgithub/TranslatorHelper | TranslatorHelper/Properties/AssemblyInfo.cs | TranslatorHelper/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("Translator Helper")]
[assembly: AssemblyDescription("This application helps any translator to record what have already been translated for future use.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Freddy Juhel")]
[assembly: AssemblyProduct("Translator Helper")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("77d2b0f7-357b-4e76-9d48-f6a1ec57a833")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("Translator Helper")]
[assembly: AssemblyDescription("This application helps any translator to record what have already translated for future use.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Freddy Juhel")]
[assembly: AssemblyProduct("Translator Helper")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("77d2b0f7-357b-4e76-9d48-f6a1ec57a833")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
| mit | C# |
e83e571bb12761ffed295cf9b8031e22b3c7d804 | Remove attach process in skype | Ridermansb/wox.skype | Wox.Skype/Main.cs | Wox.Skype/Main.cs | using SKYPE4COMLib;
using System.Collections.Generic;
using Wox.Plugin;
using System.Linq;
namespace Wox.Skype
{
public class Main : IPlugin
{
private SkypeClass _skype;
public void Init(PluginInitContext context)
{
_skype = new SkypeClass();
}
public List<Result> Query(Query query)
{
List<Result> results = new List<Result>();
if (query.ActionParameters.Count == 0)
{
results.Add(new Result()
{
IcoPath = "Images\\app.png",
Title = "Open skype",
Action = e =>
{
_skype.Client.Start();
return true;
}
});
return results;
}
var queryName = query.ActionParameters[0].ToLower();
_skype.Friends.OfType<SKYPE4COMLib.User>()
.Where(u => ((u.Aliases != null && !string.IsNullOrEmpty(u.Aliases) ? u.Aliases.ToLower().Contains(queryName) : false)
|| (u.DisplayName != null && !string.IsNullOrEmpty(u.DisplayName) ? u.DisplayName.ToLower().Contains(queryName) : false)
|| (u.FullName != null && !string.IsNullOrEmpty(u.FullName) ? u.FullName.ToLower().Contains(queryName) : false)
|| (u.PhoneHome != null && !string.IsNullOrEmpty(u.PhoneHome) ? u.PhoneHome.ToLower().Contains(queryName) : false)
|| (u.PhoneMobile != null && !string.IsNullOrEmpty(u.PhoneMobile) ? u.PhoneMobile.ToLower().Contains(queryName) : false)
|| (u.PhoneOffice != null && !string.IsNullOrEmpty(u.PhoneOffice) ? u.PhoneOffice.ToLower().Contains(queryName) : false))
)
.OrderBy(u => u.FullName)
.ToList()
.ForEach(u =>
{
results.Add(new Result()
{
Title = u.FullName,
SubTitle = u.MoodText,
IcoPath = "Images\\plugin.png",
Action = e =>
{
_skype.Client.OpenMessageDialog(u.Handle);
return true;
}
});
});
return results;
}
}
}
| using SKYPE4COMLib;
using System.Collections.Generic;
using Wox.Plugin;
using System.Linq;
namespace Wox.Skype
{
public class Main : IPlugin
{
private SkypeClass _skype;
public void Init(PluginInitContext context)
{
_skype = new SkypeClass();
_skype.Attach(6, true);
}
public List<Result> Query(Query query)
{
List<Result> results = new List<Result>();
if (query.ActionParameters.Count == 0)
{
results.Add(new Result()
{
IcoPath = "Images\\app.png",
Title = "Open skype",
Action = e =>
{
_skype.Client.Start();
return true;
}
});
return results;
}
var queryName = query.ActionParameters[0].ToLower();
_skype.Friends.OfType<SKYPE4COMLib.User>()
.Where(u => ((u.Aliases != null && !string.IsNullOrEmpty(u.Aliases) ? u.Aliases.ToLower().Contains(queryName) : false)
|| (u.DisplayName != null && !string.IsNullOrEmpty(u.DisplayName) ? u.DisplayName.ToLower().Contains(queryName) : false)
|| (u.FullName != null && !string.IsNullOrEmpty(u.FullName) ? u.FullName.ToLower().Contains(queryName) : false)
|| (u.PhoneHome != null && !string.IsNullOrEmpty(u.PhoneHome) ? u.PhoneHome.ToLower().Contains(queryName) : false)
|| (u.PhoneMobile != null && !string.IsNullOrEmpty(u.PhoneMobile) ? u.PhoneMobile.ToLower().Contains(queryName) : false)
|| (u.PhoneOffice != null && !string.IsNullOrEmpty(u.PhoneOffice) ? u.PhoneOffice.ToLower().Contains(queryName) : false))
)
.OrderBy(u => u.FullName)
.ToList()
.ForEach(u =>
{
results.Add(new Result()
{
Title = u.FullName,
SubTitle = u.MoodText,
IcoPath = "Images\\plugin.png",
Action = e =>
{
_skype.Client.OpenMessageDialog(u.Handle);
return true;
}
});
});
return results;
}
}
}
| mit | C# |
19cb8cb03a100c9baa80c23b7b307ff300130df2 | Update tests | peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu | osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.cs | osu.Game.Tests/Visual/Settings/TestSceneMigrationScreens.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.IO;
using System.Threading;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings.Sections.Maintenance;
namespace osu.Game.Tests.Visual.Settings
{
public class TestSceneMigrationScreens : ScreenTestScene
{
[Cached]
private readonly NotificationOverlay notifications;
public TestSceneMigrationScreens()
{
Children = new Drawable[]
{
notifications = new NotificationOverlay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}
};
}
[Test]
public void TestDeleteSuccess()
{
AddStep("Push screen", () => Stack.Push(new TestMigrationSelectScreen(true)));
}
[Test]
public void TestDeleteFails()
{
AddStep("Push screen", () => Stack.Push(new TestMigrationSelectScreen(false)));
}
private class TestMigrationSelectScreen : MigrationSelectScreen
{
private readonly bool deleteSuccess;
public TestMigrationSelectScreen(bool deleteSuccess)
{
this.deleteSuccess = deleteSuccess;
}
protected override void BeginMigration(DirectoryInfo target) => this.Push(new TestMigrationRunScreen(deleteSuccess));
private class TestMigrationRunScreen : MigrationRunScreen
{
private readonly bool success;
public TestMigrationRunScreen(bool success)
: base(null)
{
this.success = success;
}
protected override bool PerformMigration()
{
Thread.Sleep(3000);
return success;
}
}
}
}
}
| // 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.IO;
using System.Threading;
using osu.Framework.Screens;
using osu.Game.Overlays.Settings.Sections.Maintenance;
namespace osu.Game.Tests.Visual.Settings
{
public class TestSceneMigrationScreens : ScreenTestScene
{
public TestSceneMigrationScreens()
{
AddStep("Push screen", () => Stack.Push(new TestMigrationSelectScreen()));
}
private class TestMigrationSelectScreen : MigrationSelectScreen
{
protected override void BeginMigration(DirectoryInfo target) => this.Push(new TestMigrationRunScreen());
private class TestMigrationRunScreen : MigrationRunScreen
{
protected override void PerformMigration()
{
Thread.Sleep(3000);
}
public TestMigrationRunScreen()
: base(null)
{
}
}
}
}
}
| mit | C# |
58e5ae7bed3a4909ef970d723e8addd01e8cb7be | trim email input value before validation | VishalMadhvani/allReady,c0g1t8/allReady,gitChuckD/allReady,enderdickerson/allReady,stevejgordon/allReady,jonatwabash/allReady,MisterJames/allReady,JowenMei/allReady,HamidMosalla/allReady,pranap/allReady,shanecharles/allReady,binaryjanitor/allReady,dpaquette/allReady,chinwobble/allReady,forestcheng/allReady,VishalMadhvani/allReady,arst/allReady,dpaquette/allReady,arst/allReady,timstarbuck/allReady,MisterJames/allReady,GProulx/allReady,mgmccarthy/allReady,c0g1t8/allReady,anobleperson/allReady,VishalMadhvani/allReady,enderdickerson/allReady,JowenMei/allReady,BillWagner/allReady,mheggeseth/allReady,mgmccarthy/allReady,HTBox/allReady,timstarbuck/allReady,HTBox/allReady,JowenMei/allReady,colhountech/allReady,anobleperson/allReady,forestcheng/allReady,mipre100/allReady,bcbeatty/allReady,GProulx/allReady,BillWagner/allReady,shanecharles/allReady,BillWagner/allReady,MisterJames/allReady,mgmccarthy/allReady,colhountech/allReady,stevejgordon/allReady,binaryjanitor/allReady,dpaquette/allReady,enderdickerson/allReady,jonatwabash/allReady,arst/allReady,mheggeseth/allReady,stevejgordon/allReady,GProulx/allReady,colhountech/allReady,bcbeatty/allReady,HamidMosalla/allReady,shanecharles/allReady,anobleperson/allReady,chinwobble/allReady,stevejgordon/allReady,dpaquette/allReady,HTBox/allReady,HamidMosalla/allReady,timstarbuck/allReady,anobleperson/allReady,forestcheng/allReady,pranap/allReady,MisterJames/allReady,binaryjanitor/allReady,binaryjanitor/allReady,VishalMadhvani/allReady,mheggeseth/allReady,HamidMosalla/allReady,mipre100/allReady,c0g1t8/allReady,gitChuckD/allReady,c0g1t8/allReady,jonatwabash/allReady,pranap/allReady,gitChuckD/allReady,colhountech/allReady,mipre100/allReady,bcbeatty/allReady,JowenMei/allReady,bcbeatty/allReady,mheggeseth/allReady,mipre100/allReady,arst/allReady,pranap/allReady,shanecharles/allReady,GProulx/allReady,HTBox/allReady,enderdickerson/allReady,mgmccarthy/allReady,chinwobble/allReady,forestcheng/allReady,chinwobble/allReady,BillWagner/allReady,gitChuckD/allReady,timstarbuck/allReady,jonatwabash/allReady | AllReadyApp/Web-App/AllReady/Views/Shared/_ValidationScriptsPartial.cshtml | AllReadyApp/Web-App/AllReady/Views/Shared/_ValidationScriptsPartial.cshtml | <environment names="Development">
<script src="~/lib/jquery-validation/jquery.validate.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
</environment>
<environment names="Staging,Production">
<script src="//ajax.aspnetcdn.com/ajax/jquery.validation/1.11.1/jquery.validate.min.js"
asp-fallback-src="~/lib/jquery-validation/jquery.validate.js"
asp-fallback-test="window.jquery && window.jquery.validator">
</script>
<script src="//ajax.aspnetcdn.com/ajax/mvc/5.2.3/jquery.validate.unobtrusive.min.js"
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
asp-fallback-test="window.jquery && window.jquery.validator && window.jquery.validator.unobtrusive">
</script>
</environment>
<script>
// decorate the email validation rule to trim spaces in the view value before validation
var originalRule = $.validator.methods.email;
$.validator.methods.email = function (value, element) {
value = value.trim();
element.value = value;
return originalRule(value, element);
};
</script>
| <environment names="Development">
<script src="~/lib/jquery-validation/jquery.validate.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
</environment>
<environment names="Staging,Production">
<script src="//ajax.aspnetcdn.com/ajax/jquery.validation/1.11.1/jquery.validate.min.js"
asp-fallback-src="~/lib/jquery-validation/jquery.validate.js"
asp-fallback-test="window.jquery && window.jquery.validator">
</script>
<script src="//ajax.aspnetcdn.com/ajax/mvc/5.2.3/jquery.validate.unobtrusive.min.js"
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
asp-fallback-test="window.jquery && window.jquery.validator && window.jquery.validator.unobtrusive">
</script>
</environment>
| mit | C# |
f87dcd0a50be897e9943cf28d07e3fea07c863a4 | Update token-generation-server.4.x.cs | TwilioDevEd/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets | video/users/token-generation-server/token-generation-server.4.x.cs | video/users/token-generation-server/token-generation-server.4.x.cs | using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Twilio;
using Twilio.Auth;
using JWT;
using Faker;
namespace VideoQuickstart.Controllers
{
public class TokenController : Controller
{
// GET: /token
public ActionResult Index(string Device)
{
// Load Twilio configuration from Web.config
var accountSid = ConfigurationManager.AppSettings["TwilioAccountSid"];
var apiKey = ConfigurationManager.AppSettings["TwilioApiKey"];
var apiSecret = ConfigurationManager.AppSettings["TwilioApiSecret"];
var videoConfigSid = ConfigurationManager.AppSettings["TwilioConfigurationSid"];
// Create a random identity for the client
var identity = Internet.UserName();
// Create an Access Token generator
var token = new AccessToken(accountSid, apiKey, apiSecret);
token.Identity = identity;
// Grant access to Video
var grant = new VideoGrant();
grant.ConfigurationProfileSid = videoConfigSid;
token.AddGrant(grant);
return Json(new
{
identity = identity,
token = token.ToJWT()
}, JsonRequestBehavior.AllowGet);
}
}
}
| using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Twilio;
using Twilio.Auth;
using JWT;
using Faker;
namespace VideoQuickstart.Controllers
{
public class TokenController : Controller
{
// GET: /token
public ActionResult Index(string Device)
{
// Load Twilio configuration from Web.config
var accountSid = ConfigurationManager.AppSettings["TwilioAccountSid"];
var apiKey = ConfigurationManager.AppSettings["TwilioApiKey"];
var apiSecret = ConfigurationManager.AppSettings["TwilioApiSecret"];
var videoConfigSid = ConfigurationManager.AppSettings["TwilioConfigurationSid"];
// Create a random identity for the client
var identity = Internet.UserName();
// Create an Access Token generator
var token = new AccessToken(accountSid, apiKey, apiSecret);
token.Identity = identity;
// Create a video (Conversations SDK) grant for this token
var grant = new VideoGrant();
token.AddGrant(grant);
return Json(new
{
identity = identity,
token = token.ToJWT()
}, JsonRequestBehavior.AllowGet);
}
}
}
| mit | C# |
250f6eac6afb0824e82a2efb433784eca70e51b5 | Make AssemblyLine.OutOfRange a property that returns new instances (since the class is mutable). | mono/debugger-libs,Unity-Technologies/debugger-libs,Unity-Technologies/debugger-libs,mono/debugger-libs,joj/debugger-libs,joj/debugger-libs | Mono.Debugging/Mono.Debugging.Client/AssemblyLine.cs | Mono.Debugging/Mono.Debugging.Client/AssemblyLine.cs | // AssemblyLine.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//
using System;
namespace Mono.Debugging.Client
{
[Serializable]
public class AssemblyLine
{
long address;
string code;
int sourceLine;
string addressSpace;
public string Code {
get {
return code;
}
}
public long Address {
get {
return address;
}
}
public string AddressSpace {
get {
return addressSpace;
}
}
public int SourceLine {
get {
return sourceLine;
}
set {
sourceLine = value;
}
}
public bool IsOutOfRange {
get { return address == -1 && code == null; }
}
public static AssemblyLine OutOfRange {
get { return new AssemblyLine (-1, null, null); }
}
public AssemblyLine (long address, string code): this (address, "", code, -1)
{
}
public AssemblyLine (long address, string code, int sourceLine): this (address, "", code, sourceLine)
{
}
public AssemblyLine (long address, string addressSpace, string code): this (address, addressSpace, code, -1)
{
}
public AssemblyLine (long address, string addressSpace, string code, int sourceLine)
{
this.address = address;
this.code = code;
this.sourceLine = sourceLine;
this.addressSpace = addressSpace;
}
}
}
| // AssemblyLine.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//
using System;
namespace Mono.Debugging.Client
{
[Serializable]
public class AssemblyLine
{
long address;
string code;
int sourceLine;
string addressSpace;
public string Code {
get {
return code;
}
}
public long Address {
get {
return address;
}
}
public string AddressSpace {
get {
return addressSpace;
}
}
public int SourceLine {
get {
return sourceLine;
}
set {
sourceLine = value;
}
}
public bool IsOutOfRange {
get { return address == -1 && code == null; }
}
public static readonly AssemblyLine OutOfRange = new AssemblyLine (-1, null, null);
public AssemblyLine (long address, string code): this (address, "", code, -1)
{
}
public AssemblyLine (long address, string code, int sourceLine): this (address, "", code, sourceLine)
{
}
public AssemblyLine (long address, string addressSpace, string code): this (address, addressSpace, code, -1)
{
}
public AssemblyLine (long address, string addressSpace, string code, int sourceLine)
{
this.address = address;
this.code = code;
this.sourceLine = sourceLine;
this.addressSpace = addressSpace;
}
}
}
| mit | C# |
a288b7cb588220d7b7d02b611a1c22e444e49894 | Add SetCheckedItemReally method to BetterCheckedListBox. | chrisvire/libpalaso,andrew-polk/libpalaso,marksvc/libpalaso,darcywong00/libpalaso,glasseyes/libpalaso,andrew-polk/libpalaso,ermshiperete/libpalaso,ermshiperete/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,marksvc/libpalaso,gmartin7/libpalaso,hatton/libpalaso,mccarthyrb/libpalaso,chrisvire/libpalaso,ddaspit/libpalaso,darcywong00/libpalaso,tombogle/libpalaso,chrisvire/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso,gtryus/libpalaso,sillsdev/libpalaso,JohnThomson/libpalaso,sillsdev/libpalaso,marksvc/libpalaso,ddaspit/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,JohnThomson/libpalaso,ddaspit/libpalaso,JohnThomson/libpalaso,andrew-polk/libpalaso,ddaspit/libpalaso,ermshiperete/libpalaso,gmartin7/libpalaso,gmartin7/libpalaso,mccarthyrb/libpalaso,hatton/libpalaso,mccarthyrb/libpalaso,chrisvire/libpalaso,JohnThomson/libpalaso,sillsdev/libpalaso,hatton/libpalaso,tombogle/libpalaso,andrew-polk/libpalaso,hatton/libpalaso,gmartin7/libpalaso,darcywong00/libpalaso,gtryus/libpalaso,tombogle/libpalaso,gtryus/libpalaso,glasseyes/libpalaso | PalasoUIWindowsForms/Widgets/BetterCheckedListBox.cs | PalasoUIWindowsForms/Widgets/BetterCheckedListBox.cs | using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Palaso.UI.WindowsForms.Widgets
{
/// <summary>
/// This version does two things:
/// 1) you don't have to first get focus before it will pay attention to you trying to check a box (e.g. it doesn't swallow the first attempt)
/// 2) only clicks on the actual box will check/uncheck the box.
///
/// Got help from: http://stackoverflow.com/questions/2093961/checkedlistbox-control-only-checking-the-checkbox-when-the-actual-checkbox-is
/// </summary>
public partial class BetterCheckedListBox : CheckedListBox
{
bool AuthorizeCheck { get; set; }
public BetterCheckedListBox()
{
InitializeComponent();
CheckOnClick = false;
AuthorizeCheck = true; // allow setup code to do any pre-checking
}
public BetterCheckedListBox(IContainer container)
{
container.Add(this);
InitializeComponent();
}
/// <summary>
/// we can't override SetItemCheck, alas. But it sure won't work because of our AuthorizeCheck thing.
/// </summary>
/// <param name="item"></param>
/// <param name="check"></param>
public void SetItemCheckedReally(int index, bool value)
{
AuthorizeCheck = true;
SetItemChecked(index, value);
AuthorizeCheck = false;
}
private void OnItemCheck(object sender, ItemCheckEventArgs e)
{
if (!AuthorizeCheck)
e.NewValue = e.CurrentValue; //check state change was not through authorized actions
}
private void OnMouseDown(object sender, MouseEventArgs e)
{
Point loc = PointToClient(Cursor.Position);
for (int i = 0; i < Items.Count; i++)
{
Rectangle rec = GetItemRectangle(i);
rec.Width = 16; //checkbox itself has a default width of about 16 pixels
if (rec.Contains(loc))
{
AuthorizeCheck = true;
bool newValue = !GetItemChecked(i);
SetItemChecked(i, newValue);//check
AuthorizeCheck = false;
return;
}
}
}
private void BetterCheckedListBox_Enter(object sender, System.EventArgs e)
{
//ok, now that we're all set up, turn off unwanted checking. Until this point, we might have head checking by set-up code
AuthorizeCheck = false;
}
}
}
| using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Palaso.UI.WindowsForms.Widgets
{
/// <summary>
/// This version does two things:
/// 1) you don't have to first get focus before it will pay attention to you trying to check a box (e.g. it doesn't swallow the first attempt)
/// 2) only clicks on the actual box will check/uncheck the box.
///
/// Got help from: http://stackoverflow.com/questions/2093961/checkedlistbox-control-only-checking-the-checkbox-when-the-actual-checkbox-is
/// </summary>
public partial class BetterCheckedListBox : CheckedListBox
{
bool AuthorizeCheck { get; set; }
public BetterCheckedListBox()
{
InitializeComponent();
CheckOnClick = false;
AuthorizeCheck = true; // allow setup code to do any pre-checking
}
public BetterCheckedListBox(IContainer container)
{
container.Add(this);
InitializeComponent();
}
private void OnItemCheck(object sender, ItemCheckEventArgs e)
{
if (!AuthorizeCheck)
e.NewValue = e.CurrentValue; //check state change was not through authorized actions
}
private void OnMouseDown(object sender, MouseEventArgs e)
{
Point loc = PointToClient(Cursor.Position);
for (int i = 0; i < Items.Count; i++)
{
Rectangle rec = GetItemRectangle(i);
rec.Width = 16; //checkbox itself has a default width of about 16 pixels
if (rec.Contains(loc))
{
AuthorizeCheck = true;
bool newValue = !GetItemChecked(i);
SetItemChecked(i, newValue);//check
AuthorizeCheck = false;
return;
}
}
}
private void BetterCheckedListBox_Enter(object sender, System.EventArgs e)
{
//ok, now that we're all set up, turn off unwanted checking. Until this point, we might have head checking by set-up code
AuthorizeCheck = false;
}
}
}
| mit | C# |
f9c64d7be38558d5b737ade5053622cbff276906 | Implement creation of mods | NeoAdonis/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,peppy/osu,smoogipooo/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,peppy/osu,peppy/osu,UselessToucan/osu | osu.Game/Online/API/RoomScore.cs | osu.Game/Online/API/RoomScore.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using osu.Game.Online.Multiplayer;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
namespace osu.Game.Online.API
{
public class RoomScore
{
[JsonProperty("id")]
public int ID { get; set; }
[JsonProperty("user_id")]
public int UserID { get; set; }
[JsonProperty("rank")]
[JsonConverter(typeof(StringEnumConverter))]
public ScoreRank Rank { get; set; }
[JsonProperty("total_score")]
public long TotalScore { get; set; }
[JsonProperty("accuracy")]
public double Accuracy { get; set; }
[JsonProperty("max_combo")]
public int MaxCombo { get; set; }
[JsonProperty("mods")]
public APIMod[] Mods { get; set; }
[JsonProperty("statistics")]
public Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>();
[JsonProperty("passed")]
public bool Passed { get; set; }
[JsonProperty("ended_at")]
public DateTimeOffset EndedAt { get; set; }
public ScoreInfo CreateScoreInfo(PlaylistItem playlistItem)
{
var scoreInfo = new ScoreInfo
{
OnlineScoreID = ID,
TotalScore = TotalScore,
MaxCombo = MaxCombo,
Beatmap = playlistItem.Beatmap.Value,
BeatmapInfoID = playlistItem.BeatmapID,
Ruleset = playlistItem.Ruleset.Value,
RulesetID = playlistItem.RulesetID,
User = null, // todo: do we have a user object?
Accuracy = Accuracy,
Date = EndedAt,
Hash = string.Empty, // todo: temporary?
Rank = Rank,
Mods = Mods.Select(m => m.ToMod(playlistItem.Ruleset.Value.CreateInstance())).ToArray()
};
return scoreInfo;
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using osu.Game.Online.Multiplayer;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
namespace osu.Game.Online.API
{
public class RoomScore
{
[JsonProperty("id")]
public int ID { get; set; }
[JsonProperty("user_id")]
public int UserID { get; set; }
[JsonProperty("rank")]
[JsonConverter(typeof(StringEnumConverter))]
public ScoreRank Rank { get; set; }
[JsonProperty("total_score")]
public long TotalScore { get; set; }
[JsonProperty("accuracy")]
public double Accuracy { get; set; }
[JsonProperty("max_combo")]
public int MaxCombo { get; set; }
[JsonProperty("mods")]
public APIMod[] Mods { get; set; }
[JsonProperty("statistics")]
public Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>();
[JsonProperty("passed")]
public bool Passed { get; set; }
[JsonProperty("ended_at")]
public DateTimeOffset EndedAt { get; set; }
public ScoreInfo CreateScoreInfo(PlaylistItem playlistItem)
{
var scoreInfo = new ScoreInfo
{
OnlineScoreID = ID,
TotalScore = TotalScore,
MaxCombo = MaxCombo,
Beatmap = playlistItem.Beatmap.Value,
BeatmapInfoID = playlistItem.BeatmapID,
Ruleset = playlistItem.Ruleset.Value,
RulesetID = playlistItem.RulesetID,
User = null, // todo: do we have a user object?
Accuracy = Accuracy,
Date = EndedAt,
Hash = string.Empty, // todo: temporary?
Rank = Rank,
Mods = Array.Empty<Mod>(), // todo: how?
};
return scoreInfo;
}
}
}
| mit | C# |
fac6c835d07abfce1ae629f90a9ed5471f991a5c | Update SMSTodayAMController.cs | dkitchen/bpcc,dkitchen/bpcc | src/BPCCScheduler.Web/Controllers/SMSTodayAMController.cs | src/BPCCScheduler.Web/Controllers/SMSTodayAMController.cs | using BPCCScheduler.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Twilio;
namespace BPCCScheduler.Controllers
{
public class SMSTodayAMController : SMSApiController
{
//public IEnumerable<SMSMessage> Get()
public string Get()
{
//any appointment today after last-night midnight, but before today noon
var lastNightMidnight = DateTime.Now.Date;
var ret = "";
ret += lastNightMidnight.ToLongDateString();
var todayNoon = lastNightMidnight.AddHours(12);
return ret;
var appts = base.AppointmentContext.Appointments.ToList() //materialize for date conversion
.Where(i => i.Date.ToLocalTime() > lastNightMidnight && i.Date.ToLocalTime() < todayNoon);
var messages = new List<SMSMessage>();
foreach (var appt in appts)
{
var body = string.Format("BPCC Reminder: Appointment this morning at {0}",
appt.Date.ToLocalTime().ToShortTimeString());
var cell = string.Format("+1{0}", appt.Cell);
messages.Add(base.SendSmsMessage(cell, body));
}
//return messages;
}
}
}
| using BPCCScheduler.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Twilio;
namespace BPCCScheduler.Controllers
{
public class SMSTodayAMController : SMSApiController
{
//public IEnumerable<SMSMessage> Get()
public string Get()
{
//any appointment today after last-night midnight, but before today noon
var lastNightMidnight = DateTime.Now.Date;
var ret = "";
ret += lastNightMidnight.ToLongDateString();
var todayNoon = lastNightMidnight.AddHours(12);
return ret;
var appts = base.AppointmentContext.Appointments.ToList() //materialize for date conversion
.Where(i => i.Date.ToLocalTime() > lastNightMidnight && i.Date.ToLocalTime() < todayNoon);
var messages = new List<SMSMessage>();
foreach (var appt in appts)
{
var body = string.Format("BPCC Reminder: Appointment this morning at {0}",
appt.Date.ToLocalTime().ToShortTimeString());
var cell = string.Format("+1{0}", appt.Cell);
messages.Add(base.SendSmsMessage(cell, body));
}
return messages;
}
}
}
| mit | C# |
992a92a784ba11917d19369ed35ecb7771c499db | Update route | denismaster/DiplomContentSystem,denismaster/DiplomContentSystem,denismaster/DiplomContentSystem,denismaster/DiplomContentSystem | src/DiplomContentSystem/Controllers/SpecialityController.cs | src/DiplomContentSystem/Controllers/SpecialityController.cs | using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using DiplomContentSystem.Authentication;
using DiplomContentSystem.Core;
using DiplomContentSystem.Dto;
namespace DiplomContentSystem.Controllers
{
[Route("api/specialities")]
[Authorize(Policy=AuthConsts.PolicyUser)]
public class SpecialityController : Controller
{
private readonly IRepository<Speciality> _repository;
public SpecialityController(IRepository<Speciality> repository)
{
if(repository==null) throw new ArgumentNullException(nameof(repository));
_repository = repository;
}
[HttpGet("select-list")]
public IActionResult Get()
{
var result = _repository.Get().Select(item=>new SelectListItem(){
Value = item.Id.ToString(),
Text = item.Name
});
if(result!=null) return Ok(result);
return BadRequest();
}
}
}
| using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using DiplomContentSystem.Authentication;
using DiplomContentSystem.Core;
using DiplomContentSystem.Dto;
namespace DiplomContentSystem.Controllers
{
[Route("api/specialities")]
[Authorize(Policy=AuthConsts.PolicyUser)]
public class SpecialityController : Controller
{
private readonly IRepository<Speciality> _repository;
public SpecialityController(IRepository<Speciality> repository)
{
if(repository==null) throw new ArgumentNullException(nameof(repository));
_repository = repository;
}
[HttpGet("")]
public IActionResult Get()
{
var result = _repository.Get().Select(item=>new SelectListItem(){
Value = item.Id.ToString(),
Text = item.Name
});
if(result!=null) return Ok(result);
return BadRequest();
}
}
}
| apache-2.0 | C# |
ac6290748fef4dce1c8957287085132a3ebaa831 | Mark CompileJobs as Required in the ReattachInformation model | tgstation/tgstation-server-tools,tgstation/tgstation-server,Cyberboss/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server | src/Tgstation.Server.Host/Models/ReattachInformation.cs | src/Tgstation.Server.Host/Models/ReattachInformation.cs | using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Host.Models
{
/// <summary>
/// Database representation of <see cref="Components.Watchdog.ReattachInformation"/>
/// </summary>
public sealed class ReattachInformation : ReattachInformationBase
{
/// <summary>
/// The row Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// The <see cref="Models.CompileJob"/> for the <see cref="Components.Watchdog.ReattachInformation.Dmb"/>
/// </summary>
[Required]
public CompileJob CompileJob { get; set; }
}
}
| namespace Tgstation.Server.Host.Models
{
/// <summary>
/// Database representation of <see cref="Components.Watchdog.ReattachInformation"/>
/// </summary>
public sealed class ReattachInformation : ReattachInformationBase
{
/// <summary>
/// The row Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// The <see cref="Models.CompileJob"/> for the <see cref="Components.Watchdog.ReattachInformation.Dmb"/>
/// </summary>
public CompileJob CompileJob { get; set; }
}
}
| agpl-3.0 | C# |
501eb77df879d324acf43819c6e5787f4dfcb632 | Make TriggerFiredResult serializable to support remote IJobStore implementations | quartznet/quartznet,neuronesb/quartznet,RafalSladek/quartznet,sean-gilliam/quartznet,sean-gilliam/quartznet,quartznet/quartznet,quartznet/quartznet,sean-gilliam/quartznet,andyshao/quartznet,AndreGleichner/quartznet,quartznet/quartznet,xlgwr/quartznet,huoxudong125/quartznet,AlonAmsalem/quartznet,sean-gilliam/quartznet,sean-gilliam/quartznet,quartznet/quartznet,zhangjunhao/quartznet | src/Quartz/SPI/TriggerFiredResult.cs | src/Quartz/SPI/TriggerFiredResult.cs | using System;
namespace Quartz.Spi
{
/// <summary>
/// Result holder for trigger firing event.
/// </summary>
[Serializable]
public class TriggerFiredResult
{
private readonly TriggerFiredBundle triggerFiredBundle;
private readonly Exception exception;
///<summary>
/// Constructor.
///</summary>
///<param name="triggerFiredBundle"></param>
public TriggerFiredResult(TriggerFiredBundle triggerFiredBundle)
{
this.triggerFiredBundle = triggerFiredBundle;
}
///<summary>
/// Constructor.
///</summary>
public TriggerFiredResult(Exception exception)
{
this.exception = exception;
}
///<summary>
/// Bundle.
///</summary>
public TriggerFiredBundle TriggerFiredBundle
{
get { return triggerFiredBundle; }
}
/// <summary>
/// Possible exception.
/// </summary>
public Exception Exception
{
get { return exception; }
}
}
} | using System;
namespace Quartz.Spi
{
/// <summary>
/// Result holder for trigger firing event.
/// </summary>
public class TriggerFiredResult
{
private readonly TriggerFiredBundle triggerFiredBundle;
private readonly Exception exception;
///<summary>
/// Constructor.
///</summary>
///<param name="triggerFiredBundle"></param>
public TriggerFiredResult(TriggerFiredBundle triggerFiredBundle)
{
this.triggerFiredBundle = triggerFiredBundle;
}
///<summary>
/// Constructor.
///</summary>
public TriggerFiredResult(Exception exception)
{
this.exception = exception;
}
///<summary>
/// Bundle.
///</summary>
public TriggerFiredBundle TriggerFiredBundle
{
get { return triggerFiredBundle; }
}
/// <summary>
/// Possible exception.
/// </summary>
public Exception Exception
{
get { return exception; }
}
}
} | apache-2.0 | C# |
521b5708b01008b0a84a2b759ed7e6d0fc32f7c8 | Add Links property to Document class | huysentruitw/simple-json-api | src/SimpleJsonApi/Models/Document.cs | src/SimpleJsonApi/Models/Document.cs | using System.Collections.Generic;
using Newtonsoft.Json;
namespace SimpleJsonApi.Models
{
internal sealed class Document
{
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public IDictionary<string, string> Links { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DocumentData Data { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public IEnumerable<Error> Errors { get; set; }
}
}
| using System.Collections.Generic;
using Newtonsoft.Json;
namespace SimpleJsonApi.Models
{
internal sealed class Document
{
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public DocumentData Data { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public IEnumerable<Error> Errors { get; set; }
}
}
| apache-2.0 | C# |
214d561e3d6bf570b752500ffb52e10aed82a1df | Update lock version to 9.0 | Amialc/auth0-aspnet-owin,auth0/auth0-aspnet-owin,Amialc/auth0-aspnet-owin,Amialc/auth0-aspnet-owin,auth0/auth0-aspnet-owin,auth0/auth0-aspnet-owin | examples/basic-mvc-sample/BasicMvcSample/Views/Account/Login.cshtml | examples/basic-mvc-sample/BasicMvcSample/Views/Account/Login.cshtml | @using System.Configuration;
@{
ViewBag.Title = "Login";
}
<div id="root" style="width: 320px; margin: 40px auto; padding: 10px; border-style: dashed; border-width: 1px;">
embeded area
</div>
@Html.AntiForgeryToken()
<script src="https://cdn.auth0.com/js/lock-9.0.js"></script>
<script>
var lock = new Auth0Lock('@ConfigurationManager.AppSettings["auth0:ClientId"]', '@ConfigurationManager.AppSettings["auth0:Domain"]');
var xsrf = document.getElementsByName("__RequestVerificationToken")[0].value;
lock.show({
container: 'root',
callbackURL: window.location.origin + '/signin-auth0',
responseType: 'code',
authParams: {
scope: 'openid profile',
state: 'xsrf=' + xsrf + '&ru=' + '@ViewBag.ReturnUrl'
}
});
</script>
| @using System.Configuration;
@{
ViewBag.Title = "Login";
}
<div id="root" style="width: 320px; margin: 40px auto; padding: 10px; border-style: dashed; border-width: 1px;">
embeded area
</div>
@Html.AntiForgeryToken()
<script src="https://cdn.auth0.com/js/lock-8.2.2.min.js"></script>
<script>
var lock = new Auth0Lock('@ConfigurationManager.AppSettings["auth0:ClientId"]', '@ConfigurationManager.AppSettings["auth0:Domain"]');
var xsrf = document.getElementsByName("__RequestVerificationToken")[0].value;
lock.show({
container: 'root',
callbackURL: window.location.origin + '/signin-auth0',
responseType: 'code',
authParams: {
scope: 'openid profile',
state: 'xsrf=' + xsrf + '&ru=' + '@ViewBag.ReturnUrl'
}
});
</script>
| mit | C# |
44df2e4aee9c0a70e3292280e5476fc05559638b | fix delete task | kidozen/kido-xamarin | samples/shared/Todo/Data/TodoItemDatabase.cs | samples/shared/Todo/Data/TodoItemDatabase.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Newtonsoft.Json.Linq;
using KidoZen;
#if __IOS__
using Kidozen.Client.iOS;
#else
using KidoZen.Client.Android;
using Android.Content;
#endif
namespace Todo
{
public class TodoItemDatabase
{
static object locker = new object ();
KZApplication kidozenApplication;
Storage database;
DataSource queryDataSource, saveDataSource;
public TodoItemDatabase()
{
this.kidozenApplication = new KZApplication (Settings.Marketplace, Settings.Application, Settings.Key);
}
public void Login(KZApplication.OnEventHandler onAuthFinish) {
#if __ANDROID__
this.kidozenApplication.Authenticate (App.AndroidContext, onAuthFinish);
#else
this.kidozenApplication.Authenticate (onAuthFinish);
#endif
database = kidozenApplication.Storage["todo"];
queryDataSource = kidozenApplication.DataSource["QueryTodo"];
saveDataSource = kidozenApplication.DataSource["AddTodo"];
}
public IEnumerable<TodoItem> GetItemsNotDone ()
{
lock (locker) {
return database.Query<TodoItem>(@"{""Done"":false}").Result.Data;
}
}
public void DeleteItem(string id)
{
lock (locker) {
var deleted = database.Delete (id).Result;
}
}
public IEnumerable<TodoItem> GetItems ()
{
lock (locker) {
return database.All<TodoItem>().Result.Data;
}
}
public void SaveItem (TodoItem item)
{
lock (locker) {
database.Save<TodoItem>(item); //upsert
}
}
// ******************************
// *** DataSource sample code ***
// ******************************
/*
public IEnumerable<TodoItem> GetItems ()
{
lock (locker) {
var results = queryDataSource.Query().Result.Data;
return createTodoItemList (results);
}
}
//Ensure that your DataSource can execute an UPSERT
public void SaveItem (TodoItem item)
{
lock (locker) {
var result = saveDataSource.Invoke(item).Result;
}
}
IEnumerable<TodoItem> createTodoItemList (JObject results)
{
var result = JArray.Parse (results.SelectToken("data").ToString());
return result.Select ( todo => new TodoItem {
Name = todo.Value<string>("Name"),
Notes = todo.Value<string>("Notes") ,
_id = todo.Value<string>("_id") ,
}
).ToList();
}
*/
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Newtonsoft.Json.Linq;
using KidoZen;
#if __IOS__
using Kidozen.Client.iOS;
#else
using KidoZen.Client.Android;
using Android.Content;
#endif
namespace Todo
{
public class TodoItemDatabase
{
static object locker = new object ();
KZApplication kidozenApplication;
Storage database;
DataSource queryDataSource, saveDataSource;
public TodoItemDatabase()
{
this.kidozenApplication = new KZApplication (Settings.Marketplace, Settings.Application, Settings.Key);
}
public void Login(KZApplication.OnEventHandler onAuthFinish) {
#if __ANDROID__
this.kidozenApplication.Authenticate (App.AndroidContext, onAuthFinish);
#else
this.kidozenApplication.Authenticate (onAuthFinish);
#endif
database = kidozenApplication.Storage["todo"];
queryDataSource = kidozenApplication.DataSource["QueryTodo"];
saveDataSource = kidozenApplication.DataSource["AddTodo"];
}
public IEnumerable<TodoItem> GetItemsNotDone ()
{
lock (locker) {
return database.Query<TodoItem>(@"{""Done"":false}").Result.Data;
}
}
public void DeleteItem(string id)
{
lock (locker) {
database.Delete(id).RunSynchronously();
}
}
public IEnumerable<TodoItem> GetItems ()
{
lock (locker) {
return database.All<TodoItem>().Result.Data;
}
}
public void SaveItem (TodoItem item)
{
lock (locker) {
database.Save<TodoItem>(item); //upsert
}
}
// ******************************
// *** DataSource sample code ***
// ******************************
/*
public IEnumerable<TodoItem> GetItems ()
{
lock (locker) {
var results = queryDataSource.Query().Result.Data;
return createTodoItemList (results);
}
}
//Ensure that your DataSource can execute an UPSERT
public void SaveItem (TodoItem item)
{
lock (locker) {
var result = saveDataSource.Invoke(item).Result;
}
}
IEnumerable<TodoItem> createTodoItemList (JObject results)
{
var result = JArray.Parse (results.SelectToken("data").ToString());
return result.Select ( todo => new TodoItem {
Name = todo.Value<string>("Name"),
Notes = todo.Value<string>("Notes") ,
_id = todo.Value<string>("_id") ,
}
).ToList();
}
*/
}
}
| mit | C# |
9b32c83182526b6532300fb6fbacea75a195c842 | Update PropertyTypeGroupDto IdentitySeed to no longer collide with new media types | robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,bjarnef/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,umbraco/Umbraco-CMS,bjarnef/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS,mattbrailsford/Umbraco-CMS,marcemarc/Umbraco-CMS,abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS | src/Umbraco.Core/Persistence/Dtos/PropertyTypeGroupDto.cs | src/Umbraco.Core/Persistence/Dtos/PropertyTypeGroupDto.cs | using System;
using System.Collections.Generic;
using NPoco;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
namespace Umbraco.Core.Persistence.Dtos
{
[TableName(Constants.DatabaseSchema.Tables.PropertyTypeGroup)]
[PrimaryKey("id", AutoIncrement = true)]
[ExplicitColumns]
internal class PropertyTypeGroupDto
{
[Column("id")]
[PrimaryKeyColumn(IdentitySeed = 56)]
public int Id { get; set; }
[Column("contenttypeNodeId")]
[ForeignKey(typeof(ContentTypeDto), Column = "nodeId")]
public int ContentTypeNodeId { get; set; }
[Column("text")]
public string Text { get; set; }
[Column("sortorder")]
public int SortOrder { get; set; }
[ResultColumn]
[Reference(ReferenceType.Many, ReferenceMemberName = "PropertyTypeGroupId")]
public List<PropertyTypeDto> PropertyTypeDtos { get; set; }
[Column("uniqueID")]
[NullSetting(NullSetting = NullSettings.NotNull)]
[Constraint(Default = SystemMethods.NewGuid)]
[Index(IndexTypes.UniqueNonClustered, Name = "IX_cmsPropertyTypeGroupUniqueID")]
public Guid UniqueId { get; set; }
}
}
| using System;
using System.Collections.Generic;
using NPoco;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
namespace Umbraco.Core.Persistence.Dtos
{
[TableName(Constants.DatabaseSchema.Tables.PropertyTypeGroup)]
[PrimaryKey("id", AutoIncrement = true)]
[ExplicitColumns]
internal class PropertyTypeGroupDto
{
[Column("id")]
[PrimaryKeyColumn(IdentitySeed = 12)]
public int Id { get; set; }
[Column("contenttypeNodeId")]
[ForeignKey(typeof(ContentTypeDto), Column = "nodeId")]
public int ContentTypeNodeId { get; set; }
[Column("text")]
public string Text { get; set; }
[Column("sortorder")]
public int SortOrder { get; set; }
[ResultColumn]
[Reference(ReferenceType.Many, ReferenceMemberName = "PropertyTypeGroupId")]
public List<PropertyTypeDto> PropertyTypeDtos { get; set; }
[Column("uniqueID")]
[NullSetting(NullSetting = NullSettings.NotNull)]
[Constraint(Default = SystemMethods.NewGuid)]
[Index(IndexTypes.UniqueNonClustered, Name = "IX_cmsPropertyTypeGroupUniqueID")]
public Guid UniqueId { get; set; }
}
}
| mit | C# |
d40f0204bf2125a530d366ced2dac21dd43a1e08 | fix cuota comentarios lenght | PFC-acl-amg/GamaPFC,PFC-acl-amg/GamaPFC,PFC-acl-amg/GamaPFC | GamaPFC/Gama.Socios.DataAccess/Mappings/CuotaMap.cs | GamaPFC/Gama.Socios.DataAccess/Mappings/CuotaMap.cs | using FluentNHibernate.Mapping;
using Gama.Socios.Business;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Gama.Socios.DataAccess.Mappings
{
public class CuotaMap : ClassMap<Cuota>
{
public CuotaMap()
{
Table("Cuotas");
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.CantidadTotal).Default("0");
Map(x => x.CantidadPagada).Default("0");
Map(x => x.Fecha).Not.Nullable();
Map(x => x.EstaPagado);
Map(x => x.NoContabilizar);
Map(x => x.Comentarios).Not.Nullable().Default("").CustomSqlType("TEXT");
References(x => x.PeriodoDeAlta)
.Cascade.None()
.Not.LazyLoad();
}
}
}
| using FluentNHibernate.Mapping;
using Gama.Socios.Business;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Gama.Socios.DataAccess.Mappings
{
public class CuotaMap : ClassMap<Cuota>
{
public CuotaMap()
{
Table("Cuotas");
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.CantidadTotal).Default("0");
Map(x => x.CantidadPagada).Default("0");
Map(x => x.Fecha).Not.Nullable();
Map(x => x.EstaPagado);
Map(x => x.NoContabilizar);
Map(x => x.Comentarios).Not.Nullable().Default("");
References(x => x.PeriodoDeAlta)
.Cascade.None()
.Not.LazyLoad();
}
}
}
| mit | C# |
12a672b312f42f56b97517083b7609afd95af91e | Add NodeCurrentlyUnderCursor property | syl20bnr/omnisharp-server,mispencer/OmniSharpServer,x335/omnisharp-server,svermeulen/omnisharp-server,corngood/omnisharp-server,OmniSharp/omnisharp-server,x335/omnisharp-server,syl20bnr/omnisharp-server,corngood/omnisharp-server | OmniSharp/AutoComplete/AutoCompleteBufferContext.cs | OmniSharp/AutoComplete/AutoCompleteBufferContext.cs | using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.CSharp.Completion;
using ICSharpCode.NRefactory.CSharp.TypeSystem;
using ICSharpCode.NRefactory.Completion;
using ICSharpCode.NRefactory.Editor;
using OmniSharp.Parser;
namespace OmniSharp.AutoComplete {
/// <summary>
/// Represents a buffer state in an editor and that state's
/// context in relation to the current solution. Can be used to
/// provide different context dependent completions to the user.
/// </summary>
public class AutoCompleteBufferContext {
public AutoCompleteBufferContext
( AutoCompleteRequest request
, BufferParser parser) {
this.AutoCompleteRequest = request;
this.BufferParser = parser;
this.Document = new ReadOnlyDocument(request.Buffer ?? "");
this.TextLocation = new TextLocation
( request.Line
, request.Column - request.WordToComplete.Length);
int cursorPosition = this.Document.GetOffset(this.TextLocation);
//Ensure cursorPosition only equals 0 when editorText is empty, so line 1,column 1
//completion will work correctly.
cursorPosition = Math.Max(cursorPosition, 1);
cursorPosition = Math.Min(cursorPosition, request.Buffer.Length);
this.CursorPosition = cursorPosition;
this.ParsedContent = this.BufferParser.ParsedContent(request.Buffer, request.FileName);
this.ResolveContext = this.ParsedContent.UnresolvedFile.GetTypeResolveContext(this.ParsedContent.Compilation, this.TextLocation);
}
public AutoCompleteRequest AutoCompleteRequest {get; set;}
public ReadOnlyDocument Document {get; set;}
public int CursorPosition {get; set;}
public TextLocation TextLocation {get; set;}
public BufferParser BufferParser {get; set;}
public ParsedResult ParsedContent {get; set;}
public CSharpTypeResolveContext ResolveContext {get; set;}
public AstNode NodeCurrentlyUnderCursor {
get {
return this.ParsedContent.SyntaxTree.GetNodeAt(this.TextLocation);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp.Completion;
using ICSharpCode.NRefactory.CSharp.TypeSystem;
using ICSharpCode.NRefactory.Completion;
using ICSharpCode.NRefactory.Editor;
using OmniSharp.Parser;
namespace OmniSharp.AutoComplete {
/// <summary>
/// Represents a buffer state in an editor and that state's
/// context in relation to the current solution. Can be used to
/// provide different context dependent completions to the user.
/// </summary>
public class AutoCompleteBufferContext {
public AutoCompleteBufferContext
( AutoCompleteRequest request
, BufferParser parser) {
this.AutoCompleteRequest = request;
this.BufferParser = parser;
this.Document = new ReadOnlyDocument(request.Buffer ?? "");
this.TextLocation = new TextLocation
( request.Line
, request.Column - request.WordToComplete.Length);
int cursorPosition = this.Document.GetOffset(this.TextLocation);
//Ensure cursorPosition only equals 0 when editorText is empty, so line 1,column 1
//completion will work correctly.
cursorPosition = Math.Max(cursorPosition, 1);
cursorPosition = Math.Min(cursorPosition, request.Buffer.Length);
this.CursorPosition = cursorPosition;
this.ParsedContent = this.BufferParser.ParsedContent(request.Buffer, request.FileName);
this.ResolveContext = this.ParsedContent.UnresolvedFile.GetTypeResolveContext(this.ParsedContent.Compilation, this.TextLocation);
}
public AutoCompleteRequest AutoCompleteRequest {get; set;}
public ReadOnlyDocument Document {get; set;}
public int CursorPosition {get; set;}
public TextLocation TextLocation {get; set;}
public BufferParser BufferParser {get; set;}
public ParsedResult ParsedContent {get; set;}
public CSharpTypeResolveContext ResolveContext {get; set;}
}
}
| mit | C# |
a3333393a69af53a8d0f167ec3a07cff8ebd8bbf | fix url | indice-co/Incontrl.Net | src/Incontrl.Sdk/Services/PaymentOptionTransactionsApi.cs | src/Incontrl.Sdk/Services/PaymentOptionTransactionsApi.cs | using System;
using System.Threading;
using System.Threading.Tasks;
using Incontrl.Sdk.Abstractions;
using Incontrl.Sdk.Models;
using Incontrl.Sdk.Types;
namespace Incontrl.Sdk.Services
{
internal class PaymentOptionTransactionsApi : IPaymentOptionTransactionsApi
{
private readonly ClientBase _clientBase;
private readonly Lazy<IPaymentOptionTransactionPaymentsApi> _paymentOptionTransactionPaymentsApi;
public PaymentOptionTransactionsApi(ClientBase clientBase) {
_clientBase = clientBase;
_paymentOptionTransactionPaymentsApi = new Lazy<IPaymentOptionTransactionPaymentsApi>(() => new PaymentOptionTransactionPaymentsApi(_clientBase));
}
public string SubscriptionId { get; set; }
public string PaymentOptionId { get; set; }
public Task BulkCreateAsync(BulkLoadTransactionsRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
_clientBase.PostAsync<BulkLoadTransactionsRequest, BulkLoadTransactionsRequest>($"{_clientBase.ApiAddress}/subscriptions/{SubscriptionId}/payment-options/{PaymentOptionId}/transactions/bulk", request, cancellationToken);
public Task<Transaction> CreateAsync(Transaction request, CancellationToken cancellationToken = default(CancellationToken)) =>
_clientBase.PostAsync<Transaction, Transaction>($"{_clientBase.ApiAddress}/subscriptions/{SubscriptionId}/payment-options/{PaymentOptionId}/transactions", request, cancellationToken);
public Task<ResultSet<Transaction>> ListAsync(ListOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
_clientBase.GetAsync<ResultSet<Transaction>>($"{_clientBase.ApiAddress}/subscriptions/{SubscriptionId}/payment-options/{PaymentOptionId}/transactions", cancellationToken);
public IPaymentOptionTransactionPaymentsApi Payments() {
var paymentOptionTransactionPaymentsApi = _paymentOptionTransactionPaymentsApi.Value;
paymentOptionTransactionPaymentsApi.SubscriptionId = SubscriptionId;
paymentOptionTransactionPaymentsApi.PaymentOptionId = PaymentOptionId;
return paymentOptionTransactionPaymentsApi;
}
}
}
| using System;
using System.Threading;
using System.Threading.Tasks;
using Incontrl.Sdk.Abstractions;
using Incontrl.Sdk.Models;
using Incontrl.Sdk.Types;
namespace Incontrl.Sdk.Services
{
internal class PaymentOptionTransactionsApi : IPaymentOptionTransactionsApi
{
private readonly ClientBase _clientBase;
private readonly Lazy<IPaymentOptionTransactionPaymentsApi> _paymentOptionTransactionPaymentsApi;
public PaymentOptionTransactionsApi(ClientBase clientBase) {
_clientBase = clientBase;
_paymentOptionTransactionPaymentsApi = new Lazy<IPaymentOptionTransactionPaymentsApi>(() => new PaymentOptionTransactionPaymentsApi(_clientBase));
}
public string SubscriptionId { get; set; }
public string PaymentOptionId { get; set; }
public Task BulkCreateAsync(BulkLoadTransactionsRequest request, CancellationToken cancellationToken = default(CancellationToken)) =>
_clientBase.PostAsync<BulkLoadTransactionsRequest, BulkLoadTransactionsRequest>($"/subscriptions/{SubscriptionId}/payment-options/{PaymentOptionId}/transactions/bulk", request, cancellationToken);
public Task<Transaction> CreateAsync(Transaction request, CancellationToken cancellationToken = default(CancellationToken)) =>
_clientBase.PostAsync<Transaction, Transaction>($"{_clientBase.ApiAddress}/subscriptions/{SubscriptionId}/payment-options/{PaymentOptionId}/transactions", request, cancellationToken);
public Task<ResultSet<Transaction>> ListAsync(ListOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
_clientBase.GetAsync<ResultSet<Transaction>>($"{_clientBase.ApiAddress}/subscriptions/{SubscriptionId}/payment-options/{PaymentOptionId}/transactions", cancellationToken);
public IPaymentOptionTransactionPaymentsApi Payments() {
var paymentOptionTransactionPaymentsApi = _paymentOptionTransactionPaymentsApi.Value;
paymentOptionTransactionPaymentsApi.SubscriptionId = SubscriptionId;
paymentOptionTransactionPaymentsApi.PaymentOptionId = PaymentOptionId;
return paymentOptionTransactionPaymentsApi;
}
}
}
| mit | C# |
bb2cf02dff0bdaac5eccb21a7a904cb813b8f619 | Add missing copyright header | weshaggard/buildtools,tarekgh/buildtools,ChadNedzlek/buildtools,mmitche/buildtools,ianhays/buildtools,stephentoub/buildtools,joperezr/buildtools,maririos/buildtools,schaabs/buildtools,alexperovich/buildtools,AlexGhiondea/buildtools,weshaggard/buildtools,tarekgh/buildtools,MattGal/buildtools,nguerrera/buildtools,ChadNedzlek/buildtools,karajas/buildtools,ianhays/buildtools,stephentoub/buildtools,maririos/buildtools,schaabs/buildtools,dotnet/buildtools,AlexGhiondea/buildtools,weshaggard/buildtools,AlexGhiondea/buildtools,alexperovich/buildtools,joperezr/buildtools,weshaggard/buildtools,joperezr/buildtools,mmitche/buildtools,JeremyKuhne/buildtools,maririos/buildtools,alexperovich/buildtools,jthelin/dotnet-buildtools,roncain/buildtools,roncain/buildtools,dotnet/buildtools,stephentoub/buildtools,ianhays/buildtools,ericstj/buildtools,tarekgh/buildtools,chcosta/buildtools,jthelin/dotnet-buildtools,roncain/buildtools,ChadNedzlek/buildtools,JeremyKuhne/buildtools,karajas/buildtools,MattGal/buildtools,chcosta/buildtools,jhendrixMSFT/buildtools,schaabs/buildtools,tarekgh/buildtools,MattGal/buildtools,jthelin/dotnet-buildtools,jhendrixMSFT/buildtools,ericstj/buildtools,chcosta/buildtools,mmitche/buildtools,alexperovich/buildtools,jhendrixMSFT/buildtools,JeremyKuhne/buildtools,crummel/dotnet_buildtools,crummel/dotnet_buildtools,schaabs/buildtools,mmitche/buildtools,roncain/buildtools,karajas/buildtools,nguerrera/buildtools,ChadNedzlek/buildtools,chcosta/buildtools,alexperovich/buildtools,crummel/dotnet_buildtools,MattGal/buildtools,naamunds/buildtools,naamunds/buildtools,JeremyKuhne/buildtools,nguerrera/buildtools,joperezr/buildtools,naamunds/buildtools,MattGal/buildtools,dotnet/buildtools,ianhays/buildtools,stephentoub/buildtools,tarekgh/buildtools,joperezr/buildtools,AlexGhiondea/buildtools,ericstj/buildtools,nguerrera/buildtools,maririos/buildtools,jhendrixMSFT/buildtools,ericstj/buildtools,crummel/dotnet_buildtools,dotnet/buildtools,mmitche/buildtools,jthelin/dotnet-buildtools,naamunds/buildtools,karajas/buildtools | src/Microsoft.DotNet.Build.Tasks/ExceptionFromResource.cs | src/Microsoft.DotNet.Build.Tasks/ExceptionFromResource.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;
namespace Microsoft.DotNet.Build.Tasks
{
internal sealed class ExceptionFromResource : Exception
{
public string ResourceName { get; private set; }
public object[] MessageArgs { get; private set; }
public ExceptionFromResource(string resourceName, params object[] messageArgs)
{
ResourceName = resourceName;
MessageArgs = messageArgs;
}
}
}
| using System;
namespace Microsoft.DotNet.Build.Tasks
{
internal sealed class ExceptionFromResource : Exception
{
public string ResourceName { get; private set; }
public object[] MessageArgs { get; private set; }
public ExceptionFromResource(string resourceName, params object[] messageArgs)
{
ResourceName = resourceName;
MessageArgs = messageArgs;
}
}
}
| mit | C# |
705769bda6943bec6c1585afdfe207f0c23de5f6 | Fix build | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/MusicStore/compiler/preprocess/RazorPreCompilation.cs | src/MusicStore/compiler/preprocess/RazorPreCompilation.cs | using System;
using Microsoft.AspNet.Mvc.Razor.Precompilation;
using Microsoft.Extensions.PlatformAbstractions;
namespace MusicStore
{
public class RazorPreCompilation : RazorPreCompileModule
{
}
} | using System;
using Microsoft.AspNet.Mvc.Razor.Precompilation;
using Microsoft.Extensions.PlatformAbstractions;
namespace MusicStore
{
public class RazorPreCompilation : RazorPreCompileModule
{
public RazorPreCompilation(IApplicationEnvironment applicationEnvironment)
{
GenerateSymbols = string.Equals(applicationEnvironment.Configuration,
"debug",
StringComparison.OrdinalIgnoreCase);
}
}
} | apache-2.0 | C# |
23b6170106b275560df9bf89d7dff8a849a9bf41 | Set value type for Textarea to "TEXT". | engern/Umbraco-CMS,qizhiyu/Umbraco-CMS,kasperhhk/Umbraco-CMS,sargin48/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,Pyuuma/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,aaronpowell/Umbraco-CMS,Pyuuma/Umbraco-CMS,KevinJump/Umbraco-CMS,romanlytvyn/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,NikRimington/Umbraco-CMS,Tronhus/Umbraco-CMS,madsoulswe/Umbraco-CMS,robertjf/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,corsjune/Umbraco-CMS,tcmorris/Umbraco-CMS,AzarinSergey/Umbraco-CMS,yannisgu/Umbraco-CMS,neilgaietto/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,mstodd/Umbraco-CMS,base33/Umbraco-CMS,m0wo/Umbraco-CMS,AzarinSergey/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,kgiszewski/Umbraco-CMS,mittonp/Umbraco-CMS,mattbrailsford/Umbraco-CMS,iahdevelop/Umbraco-CMS,neilgaietto/Umbraco-CMS,marcemarc/Umbraco-CMS,christopherbauer/Umbraco-CMS,nvisage-gf/Umbraco-CMS,rustyswayne/Umbraco-CMS,markoliver288/Umbraco-CMS,sargin48/Umbraco-CMS,yannisgu/Umbraco-CMS,Tronhus/Umbraco-CMS,yannisgu/Umbraco-CMS,arknu/Umbraco-CMS,kasperhhk/Umbraco-CMS,leekelleher/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Spijkerboer/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,lingxyd/Umbraco-CMS,Pyuuma/Umbraco-CMS,nvisage-gf/Umbraco-CMS,qizhiyu/Umbraco-CMS,Khamull/Umbraco-CMS,rasmuseeg/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,gkonings/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,marcemarc/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,arknu/Umbraco-CMS,lars-erik/Umbraco-CMS,sargin48/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,lingxyd/Umbraco-CMS,bjarnef/Umbraco-CMS,KevinJump/Umbraco-CMS,leekelleher/Umbraco-CMS,TimoPerplex/Umbraco-CMS,Khamull/Umbraco-CMS,aaronpowell/Umbraco-CMS,yannisgu/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,rasmuseeg/Umbraco-CMS,lingxyd/Umbraco-CMS,Phosworks/Umbraco-CMS,WebCentrum/Umbraco-CMS,kasperhhk/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,tompipe/Umbraco-CMS,corsjune/Umbraco-CMS,marcemarc/Umbraco-CMS,iahdevelop/Umbraco-CMS,nvisage-gf/Umbraco-CMS,aaronpowell/Umbraco-CMS,yannisgu/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,aadfPT/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,WebCentrum/Umbraco-CMS,ehornbostel/Umbraco-CMS,lars-erik/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Spijkerboer/Umbraco-CMS,christopherbauer/Umbraco-CMS,umbraco/Umbraco-CMS,ordepdev/Umbraco-CMS,VDBBjorn/Umbraco-CMS,lars-erik/Umbraco-CMS,corsjune/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Phosworks/Umbraco-CMS,Tronhus/Umbraco-CMS,christopherbauer/Umbraco-CMS,tompipe/Umbraco-CMS,abjerner/Umbraco-CMS,abjerner/Umbraco-CMS,ordepdev/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,engern/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,TimoPerplex/Umbraco-CMS,gregoriusxu/Umbraco-CMS,madsoulswe/Umbraco-CMS,bjarnef/Umbraco-CMS,KevinJump/Umbraco-CMS,tcmorris/Umbraco-CMS,rajendra1809/Umbraco-CMS,jchurchley/Umbraco-CMS,AzarinSergey/Umbraco-CMS,timothyleerussell/Umbraco-CMS,gkonings/Umbraco-CMS,romanlytvyn/Umbraco-CMS,romanlytvyn/Umbraco-CMS,qizhiyu/Umbraco-CMS,gavinfaux/Umbraco-CMS,robertjf/Umbraco-CMS,VDBBjorn/Umbraco-CMS,WebCentrum/Umbraco-CMS,m0wo/Umbraco-CMS,mstodd/Umbraco-CMS,lingxyd/Umbraco-CMS,marcemarc/Umbraco-CMS,Phosworks/Umbraco-CMS,DaveGreasley/Umbraco-CMS,abryukhov/Umbraco-CMS,aadfPT/Umbraco-CMS,engern/Umbraco-CMS,Phosworks/Umbraco-CMS,christopherbauer/Umbraco-CMS,rustyswayne/Umbraco-CMS,umbraco/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,m0wo/Umbraco-CMS,Tronhus/Umbraco-CMS,aadfPT/Umbraco-CMS,hfloyd/Umbraco-CMS,engern/Umbraco-CMS,neilgaietto/Umbraco-CMS,Pyuuma/Umbraco-CMS,christopherbauer/Umbraco-CMS,mstodd/Umbraco-CMS,timothyleerussell/Umbraco-CMS,nvisage-gf/Umbraco-CMS,gkonings/Umbraco-CMS,lingxyd/Umbraco-CMS,gkonings/Umbraco-CMS,romanlytvyn/Umbraco-CMS,markoliver288/Umbraco-CMS,mstodd/Umbraco-CMS,rustyswayne/Umbraco-CMS,iahdevelop/Umbraco-CMS,tcmorris/Umbraco-CMS,Tronhus/Umbraco-CMS,dawoe/Umbraco-CMS,romanlytvyn/Umbraco-CMS,gregoriusxu/Umbraco-CMS,kasperhhk/Umbraco-CMS,m0wo/Umbraco-CMS,qizhiyu/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,rasmuseeg/Umbraco-CMS,TimoPerplex/Umbraco-CMS,qizhiyu/Umbraco-CMS,DaveGreasley/Umbraco-CMS,mittonp/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,rasmusfjord/Umbraco-CMS,ordepdev/Umbraco-CMS,Khamull/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,VDBBjorn/Umbraco-CMS,markoliver288/Umbraco-CMS,timothyleerussell/Umbraco-CMS,mattbrailsford/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,sargin48/Umbraco-CMS,gavinfaux/Umbraco-CMS,ehornbostel/Umbraco-CMS,mittonp/Umbraco-CMS,gkonings/Umbraco-CMS,abjerner/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,bjarnef/Umbraco-CMS,neilgaietto/Umbraco-CMS,marcemarc/Umbraco-CMS,DaveGreasley/Umbraco-CMS,VDBBjorn/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,lars-erik/Umbraco-CMS,tcmorris/Umbraco-CMS,markoliver288/Umbraco-CMS,rajendra1809/Umbraco-CMS,nvisage-gf/Umbraco-CMS,hfloyd/Umbraco-CMS,kasperhhk/Umbraco-CMS,lars-erik/Umbraco-CMS,gregoriusxu/Umbraco-CMS,bjarnef/Umbraco-CMS,DaveGreasley/Umbraco-CMS,kgiszewski/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,Pyuuma/Umbraco-CMS,base33/Umbraco-CMS,rajendra1809/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,engern/Umbraco-CMS,kgiszewski/Umbraco-CMS,ehornbostel/Umbraco-CMS,rustyswayne/Umbraco-CMS,gavinfaux/Umbraco-CMS,mstodd/Umbraco-CMS,robertjf/Umbraco-CMS,mittonp/Umbraco-CMS,mittonp/Umbraco-CMS,leekelleher/Umbraco-CMS,NikRimington/Umbraco-CMS,gavinfaux/Umbraco-CMS,iahdevelop/Umbraco-CMS,dawoe/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,gavinfaux/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,corsjune/Umbraco-CMS,rasmusfjord/Umbraco-CMS,dawoe/Umbraco-CMS,NikRimington/Umbraco-CMS,sargin48/Umbraco-CMS,ordepdev/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,rajendra1809/Umbraco-CMS,markoliver288/Umbraco-CMS,leekelleher/Umbraco-CMS,base33/Umbraco-CMS,Khamull/Umbraco-CMS,TimoPerplex/Umbraco-CMS,jchurchley/Umbraco-CMS,arknu/Umbraco-CMS,AzarinSergey/Umbraco-CMS,VDBBjorn/Umbraco-CMS,neilgaietto/Umbraco-CMS,rajendra1809/Umbraco-CMS,Phosworks/Umbraco-CMS,madsoulswe/Umbraco-CMS,iahdevelop/Umbraco-CMS,corsjune/Umbraco-CMS,TimoPerplex/Umbraco-CMS,ordepdev/Umbraco-CMS,gregoriusxu/Umbraco-CMS,timothyleerussell/Umbraco-CMS,Spijkerboer/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,AzarinSergey/Umbraco-CMS,gregoriusxu/Umbraco-CMS,KevinJump/Umbraco-CMS,Khamull/Umbraco-CMS,hfloyd/Umbraco-CMS,m0wo/Umbraco-CMS,ehornbostel/Umbraco-CMS,rustyswayne/Umbraco-CMS,markoliver288/Umbraco-CMS,rasmusfjord/Umbraco-CMS,jchurchley/Umbraco-CMS,DaveGreasley/Umbraco-CMS,ehornbostel/Umbraco-CMS,timothyleerussell/Umbraco-CMS,YsqEvilmax/Umbraco-CMS | src/Umbraco.Web/PropertyEditors/TextAreaPropertyEditor.cs | src/Umbraco.Web/PropertyEditors/TextAreaPropertyEditor.cs | using Umbraco.Core;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors
{
[PropertyEditor(Constants.PropertyEditors.TextboxMultipleAlias, "Textarea", "textarea", IsParameterEditor = true, ValueType = "TEXT")]
public class TextAreaPropertyEditor : PropertyEditor
{
}
}
| using Umbraco.Core;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors
{
[PropertyEditor(Constants.PropertyEditors.TextboxMultipleAlias, "Textarea", "textarea", IsParameterEditor = true)]
public class TextAreaPropertyEditor : PropertyEditor
{
}
} | mit | C# |
7eb6cad81c0fc1a690ae1ca2dc78adea6a533f48 | Set the bit that will override binding redirects | jamesqo/roslyn,OmarTawfik/roslyn,akrisiun/roslyn,dpoeschl/roslyn,physhi/roslyn,leppie/roslyn,moozzyk/roslyn,bkoelman/roslyn,AnthonyDGreen/roslyn,tvand7093/roslyn,drognanar/roslyn,basoundr/roslyn,diryboy/roslyn,eriawan/roslyn,paulvanbrenk/roslyn,Pvlerick/roslyn,moozzyk/roslyn,natgla/roslyn,abock/roslyn,jkotas/roslyn,MattWindsor91/roslyn,KiloBravoLima/roslyn,khyperia/roslyn,jasonmalinowski/roslyn,sharadagrawal/Roslyn,lorcanmooney/roslyn,natgla/roslyn,CaptainHayashi/roslyn,KevinH-MS/roslyn,natidea/roslyn,genlu/roslyn,bbarry/roslyn,abock/roslyn,balajikris/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,aelij/roslyn,TyOverby/roslyn,zooba/roslyn,stephentoub/roslyn,HellBrick/roslyn,yeaicc/roslyn,tannergooding/roslyn,ericfe-ms/roslyn,shyamnamboodiripad/roslyn,OmarTawfik/roslyn,AmadeusW/roslyn,budcribar/roslyn,KevinRansom/roslyn,srivatsn/roslyn,davkean/roslyn,tannergooding/roslyn,ljw1004/roslyn,akrisiun/roslyn,brettfo/roslyn,jaredpar/roslyn,heejaechang/roslyn,MatthieuMEZIL/roslyn,pdelvo/roslyn,tvand7093/roslyn,bartdesmet/roslyn,Giftednewt/roslyn,KirillOsenkov/roslyn,davkean/roslyn,khellang/roslyn,natgla/roslyn,ErikSchierboom/roslyn,SeriaWei/roslyn,gafter/roslyn,DustinCampbell/roslyn,Inverness/roslyn,jeffanders/roslyn,robinsedlaczek/roslyn,vslsnap/roslyn,diryboy/roslyn,michalhosala/roslyn,DustinCampbell/roslyn,jhendrixMSFT/roslyn,bbarry/roslyn,dpoeschl/roslyn,khyperia/roslyn,bkoelman/roslyn,physhi/roslyn,jcouv/roslyn,SeriaWei/roslyn,srivatsn/roslyn,ValentinRueda/roslyn,basoundr/roslyn,TyOverby/roslyn,shyamnamboodiripad/roslyn,aelij/roslyn,agocke/roslyn,amcasey/roslyn,paulvanbrenk/roslyn,aelij/roslyn,jasonmalinowski/roslyn,AlekseyTs/roslyn,xoofx/roslyn,AlekseyTs/roslyn,weltkante/roslyn,thomaslevesque/roslyn,pdelvo/roslyn,mgoertz-msft/roslyn,paulvanbrenk/roslyn,ValentinRueda/roslyn,reaction1989/roslyn,gafter/roslyn,VPashkov/roslyn,HellBrick/roslyn,AArnott/roslyn,bkoelman/roslyn,jamesqo/roslyn,drognanar/roslyn,MatthieuMEZIL/roslyn,cston/roslyn,lorcanmooney/roslyn,panopticoncentral/roslyn,ValentinRueda/roslyn,tvand7093/roslyn,ljw1004/roslyn,VPashkov/roslyn,AmadeusW/roslyn,jmarolf/roslyn,mseamari/Stuff,bartdesmet/roslyn,sharwell/roslyn,SeriaWei/roslyn,robinsedlaczek/roslyn,VSadov/roslyn,jmarolf/roslyn,srivatsn/roslyn,budcribar/roslyn,xasx/roslyn,vslsnap/roslyn,jkotas/roslyn,managed-commons/roslyn,jhendrixMSFT/roslyn,VPashkov/roslyn,yeaicc/roslyn,a-ctor/roslyn,balajikris/roslyn,tannergooding/roslyn,Maxwe11/roslyn,davkean/roslyn,TyOverby/roslyn,KevinH-MS/roslyn,Giftednewt/roslyn,shyamnamboodiripad/roslyn,sharadagrawal/Roslyn,kelltrick/roslyn,mmitche/roslyn,thomaslevesque/roslyn,wvdd007/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,leppie/roslyn,jcouv/roslyn,Pvlerick/roslyn,bbarry/roslyn,eriawan/roslyn,ericfe-ms/roslyn,physhi/roslyn,genlu/roslyn,CyrusNajmabadi/roslyn,khellang/roslyn,natidea/roslyn,antonssonj/roslyn,reaction1989/roslyn,DustinCampbell/roslyn,CyrusNajmabadi/roslyn,jeffanders/roslyn,rgani/roslyn,KirillOsenkov/roslyn,cston/roslyn,ErikSchierboom/roslyn,amcasey/roslyn,xoofx/roslyn,diryboy/roslyn,mseamari/Stuff,AArnott/roslyn,xasx/roslyn,vcsjones/roslyn,Maxwe11/roslyn,tmeschter/roslyn,xoofx/roslyn,VSadov/roslyn,dpoeschl/roslyn,HellBrick/roslyn,mmitche/roslyn,zooba/roslyn,Hosch250/roslyn,Shiney/roslyn,akrisiun/roslyn,brettfo/roslyn,dotnet/roslyn,MichalStrehovsky/roslyn,gafter/roslyn,mattscheffer/roslyn,jmarolf/roslyn,wvdd007/roslyn,moozzyk/roslyn,amcasey/roslyn,MattWindsor91/roslyn,nguerrera/roslyn,kelltrick/roslyn,thomaslevesque/roslyn,lorcanmooney/roslyn,swaroop-sridhar/roslyn,Pvlerick/roslyn,sharwell/roslyn,a-ctor/roslyn,vslsnap/roslyn,Shiney/roslyn,tmeschter/roslyn,mgoertz-msft/roslyn,CaptainHayashi/roslyn,mavasani/roslyn,antonssonj/roslyn,eriawan/roslyn,mattscheffer/roslyn,tmat/roslyn,KevinRansom/roslyn,mavasani/roslyn,OmarTawfik/roslyn,dotnet/roslyn,jkotas/roslyn,jamesqo/roslyn,orthoxerox/roslyn,rgani/roslyn,AlekseyTs/roslyn,mseamari/Stuff,KevinH-MS/roslyn,Hosch250/roslyn,mmitche/roslyn,MatthieuMEZIL/roslyn,pdelvo/roslyn,vcsjones/roslyn,jaredpar/roslyn,brettfo/roslyn,AmadeusW/roslyn,jcouv/roslyn,MattWindsor91/roslyn,sharadagrawal/Roslyn,AnthonyDGreen/roslyn,Hosch250/roslyn,mattwar/roslyn,leppie/roslyn,reaction1989/roslyn,antonssonj/roslyn,ljw1004/roslyn,balajikris/roslyn,jasonmalinowski/roslyn,jhendrixMSFT/roslyn,sharwell/roslyn,Shiney/roslyn,Inverness/roslyn,heejaechang/roslyn,CyrusNajmabadi/roslyn,jaredpar/roslyn,bartdesmet/roslyn,nguerrera/roslyn,ErikSchierboom/roslyn,mattscheffer/roslyn,MichalStrehovsky/roslyn,robinsedlaczek/roslyn,kelltrick/roslyn,drognanar/roslyn,swaroop-sridhar/roslyn,heejaechang/roslyn,xasx/roslyn,VSadov/roslyn,managed-commons/roslyn,weltkante/roslyn,mattwar/roslyn,rgani/roslyn,MattWindsor91/roslyn,swaroop-sridhar/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,managed-commons/roslyn,natidea/roslyn,basoundr/roslyn,michalhosala/roslyn,Giftednewt/roslyn,tmeschter/roslyn,mattwar/roslyn,Maxwe11/roslyn,budcribar/roslyn,CaptainHayashi/roslyn,agocke/roslyn,AArnott/roslyn,Inverness/roslyn,stephentoub/roslyn,tmat/roslyn,stephentoub/roslyn,nguerrera/roslyn,MichalStrehovsky/roslyn,khellang/roslyn,agocke/roslyn,KiloBravoLima/roslyn,wvdd007/roslyn,AnthonyDGreen/roslyn,genlu/roslyn,mavasani/roslyn,vcsjones/roslyn,a-ctor/roslyn,khyperia/roslyn,abock/roslyn,tmat/roslyn,zooba/roslyn,ericfe-ms/roslyn,panopticoncentral/roslyn,orthoxerox/roslyn,KevinRansom/roslyn,KiloBravoLima/roslyn,yeaicc/roslyn,michalhosala/roslyn,panopticoncentral/roslyn,orthoxerox/roslyn,jeffanders/roslyn,dotnet/roslyn,KirillOsenkov/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,cston/roslyn | src/VisualStudio/Setup/ProvideRoslynBindingRedirection.cs | src/VisualStudio/Setup/ProvideRoslynBindingRedirection.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.VisualStudio.Shell;
namespace Roslyn.VisualStudio.Setup
{
/// <summary>
/// A <see cref="RegistrationAttribute"/> that provides binding redirects with all of the Roslyn settings we need.
/// It's just a wrapper for <see cref="ProvideBindingRedirectionAttribute"/> that sets all the defaults rather than duplicating them.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class ProvideRoslynBindingRedirectionAttribute : RegistrationAttribute
{
private readonly ProvideBindingRedirectionAttribute _redirectionAttribute;
#if OFFICIAL_BUILD
// We should not include CodeBase attributes because we want them to get loaded from PrivateAssemblies
public const bool GenerateCodeBase = false;
#else
// We should include CodeBase attributes so they always are loaded from this extension
public const bool GenerateCodeBase = true;
#endif
public ProvideRoslynBindingRedirectionAttribute(string assemblyName)
{
// ProvideBindingRedirectionAttribute is sealed, so we can't inherit from it to provide defaults.
// Instead, we'll do more of an aggregation pattern here.
_redirectionAttribute = new ProvideBindingRedirectionAttribute
{
AssemblyName = assemblyName,
PublicKeyToken = "31BF3856AD364E35",
OldVersionLowerBound = "0.7.0.0",
OldVersionUpperBound = "1.1.0.0",
#if OFFICIAL_BUILD
// If this is an official build we want to generate binding
// redirects from our old versions to the release version
NewVersion = "1.1.0.0",
#else
// Non-official builds get redirects to local 42.42.42.42,
// which will only be built locally
NewVersion = "42.42.42.42",
#endif
GenerateCodeBase = GenerateCodeBase,
};
}
public override void Register(RegistrationContext context)
{
_redirectionAttribute.Register(context);
// Opt into overriding the devenv.exe.config binding redirect
using (var key = context.CreateKey(@"RuntimeConfiguration\dependentAssembly\bindingRedirection\" + _redirectionAttribute.Guid.ToString("B").ToUpperInvariant()))
{
key.SetValue("isPkgDefOverrideEnabled", true);
}
}
public override void Unregister(RegistrationContext context)
{
_redirectionAttribute.Unregister(context);
}
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.VisualStudio.Shell;
namespace Roslyn.VisualStudio.Setup
{
/// <summary>
/// A <see cref="RegistrationAttribute"/> that provides binding redirects with all of the Roslyn settings we need.
/// It's just a wrapper for <see cref="ProvideBindingRedirectionAttribute"/> that sets all the defaults rather than duplicating them.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class ProvideRoslynBindingRedirectionAttribute : RegistrationAttribute
{
private readonly ProvideBindingRedirectionAttribute _redirectionAttribute;
#if OFFICIAL_BUILD
// We should not include CodeBase attributes because we want them to get loaded from PrivateAssemblies
public const bool GenerateCodeBase = false;
#else
// We should include CodeBase attributes so they always are loaded from this extension
public const bool GenerateCodeBase = true;
#endif
public ProvideRoslynBindingRedirectionAttribute(string assemblyName)
{
// ProvideBindingRedirectionAttribute is sealed, so we can't inherit from it to provide defaults.
// Instead, we'll do more of an aggregation pattern here.
_redirectionAttribute = new ProvideBindingRedirectionAttribute
{
AssemblyName = assemblyName,
PublicKeyToken = "31BF3856AD364E35",
OldVersionLowerBound = "0.7.0.0",
OldVersionUpperBound = "1.1.0.0",
#if OFFICIAL_BUILD
// If this is an official build we want to generate binding
// redirects from our old versions to the release version
NewVersion = "1.1.0.0",
#else
// Non-official builds get redirects to local 42.42.42.42,
// which will only be built locally
NewVersion = "42.42.42.42",
#endif
GenerateCodeBase = GenerateCodeBase,
};
}
public override void Register(RegistrationContext context)
{
_redirectionAttribute.Register(context);
}
public override void Unregister(RegistrationContext context)
{
_redirectionAttribute.Unregister(context);
}
}
}
| apache-2.0 | C# |
039eb00ca92e29f8bdc1dfd53e15fe1cff14a1ac | Add tip about quotes | Lone-Coder/letsencrypt-win-simple | src/main/Plugins/ValidationPlugins/Dns/Manual/Manual.cs | src/main/Plugins/ValidationPlugins/Dns/Manual/Manual.cs | using PKISharp.WACS.Services;
namespace PKISharp.WACS.Plugins.ValidationPlugins.Dns
{
class Manual : DnsValidation<ManualOptions, Manual>
{
private IInputService _input;
public Manual(ILogService log, IInputService input, ManualOptions options, string identifier) : base(log, options, identifier)
{
// Usually it's a big no-no to rely on user input in validation plugin
// because this should be able to run unattended. This plugin is for testing
// only and therefor we will allow it. Future versions might be more advanced,
// e.g. shoot an email to an admin and complete the order later.
_input = input;
}
public override void CreateRecord(string recordName, string token)
{
_input.Show("Domain", _identifier, true);
_input.Show("Record", recordName);
_input.Show("Type", "TXT");
_input.Show("Content", $"\"{token}\"");
_input.Show("Note", "Some DNS control panels add quotes automatically. Only one set is required.");
_input.Wait("Please press enter after you've created and verified the record");
}
public override void DeleteRecord(string recordName, string token)
{
_input.Show("Domain", _identifier, true);
_input.Show("Record", recordName);
_input.Show("Type", "TXT");
_input.Show("Content", $"\"{token}\"");
_input.Wait("Please press enter after you've deleted the record");
}
}
}
| using PKISharp.WACS.Services;
namespace PKISharp.WACS.Plugins.ValidationPlugins.Dns
{
class Manual : DnsValidation<ManualOptions, Manual>
{
private IInputService _input;
public Manual(ILogService log, IInputService input, ManualOptions options, string identifier) : base(log, options, identifier)
{
// Usually it's a big no-no to rely on user input in validation plugin
// because this should be able to run unattended. This plugin is for testing
// only and therefor we will allow it. Future versions might be more advanced,
// e.g. shoot an email to an admin and complete the order later.
_input = input;
}
public override void CreateRecord(string recordName, string token)
{
_input.Show("Domain", _identifier, true);
_input.Show("Record", recordName);
_input.Show("Type", "TXT");
_input.Show("Content", token);
_input.Wait("Please press enter after you've created and verified the record");
}
public override void DeleteRecord(string recordName, string token)
{
_input.Show("Domain", _identifier, true);
_input.Show("Record", recordName);
_input.Show("Type", "TXT");
_input.Show("Content", token);
_input.Wait("Please press enter after you've deleted the record");
}
}
}
| apache-2.0 | C# |
3693a44bad6fc0d9ccc8256510fa43d8127e0911 | Comment fix. | dlemstra/line-bot-sdk-dotnet,dlemstra/line-bot-sdk-dotnet | src/LineBot/Messages/Template/IButtonsTemplate.cs | src/LineBot/Messages/Template/IButtonsTemplate.cs | // Copyright 2017 Dirk Lemstra (https://github.com/dlemstra/line-bot-sdk-dotnet)
//
// Dirk Lemstra licenses this file to you under the Apache License,
// version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at:
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
using System;
using System.Collections.Generic;
namespace Line
{
/// <summary>
/// Encapsulates a buttons template.
/// </summary>
public interface IButtonsTemplate : ITemplate
{
/// <summary>
/// Gets the image url for the thumbnail.
/// </summary>
/// <remarks>
/// Protocol: HTTPS<para/>
/// Format: JPEG or PNG<para/>
/// Max url length: 1000 characters<para/>
/// Aspect ratio: 1:1.51<para/>
/// Max width: 1024px<para/>
/// Max size: 1 MB
/// </remarks>
Uri ThumbnailUrl { get; }
/// <summary>
/// Gets the title.
/// </summary>
/// <remarks>Max: 400 characters</remarks>
string Title { get; }
/// <summary>
/// Gets the message text.
/// </summary>
/// <remarks>
/// Max: 160 characters (no image or title)
/// Max: 60 characters(message with an image or title)
/// </remarks>
string Text { get; }
/// <summary>
/// Gets the actions when tapped.
/// </summary>
/// <remarks>
/// Max: 4
/// </remarks>
IEnumerable<ITemplateAction> Actions { get; }
}
}
| // Copyright 2017 Dirk Lemstra (https://github.com/dlemstra/line-bot-sdk-dotnet)
//
// Dirk Lemstra licenses this file to you under the Apache License,
// version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at:
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
using System;
using System.Collections.Generic;
namespace Line
{
/// <summary>
/// Encapsulates a buttons template.
/// </summary>
public interface IButtonsTemplate : ITemplate
{
/// <summary>
/// Gets the image url for the thumbnail.
/// </summary>
/// <remarks>
/// Protocol: HTTPS<para/>
/// Format: JPEG or PNG<para/>
/// Max url length: 1000 characters<para/>
/// Aspect ratio: 1:1.51<para/>
/// Max width: 1024px<para/>
/// Max size: 1 MB
/// </remarks>
Uri ThumbnailUrl { get; }
/// <summary>
/// Gets the title.
/// </summary>
/// <remarks>Max: 400 characters</remarks>
string Title { get; }
/// <summary>
/// Gets the message text.
/// </summary>
/// <remarks>
/// Max: 160 characters (no image or title)
/// Max: 60 characters(message with an image or title)
/// </remarks>
string Text { get; }
/// <summary>
/// Gets or sets the actions when tapped.
/// </summary>
/// <remarks>
/// Max: 4
/// </remarks>
IEnumerable<ITemplateAction> Actions { get; }
}
}
| apache-2.0 | C# |
e9228cc5ccb925a3fc34dab8bf366c6857cc3c16 | Remove a BOM :poop: | Geroshabu/MatchGenerator | Application/MatchGenerator/Core/UI/MemberListViewItem.cs | Application/MatchGenerator/Core/UI/MemberListViewItem.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MatchGenerator.Core.UI
{
class MemberListViewItem
{
public int Id { get; }
public bool IsChecked { get; set; }
public Person Person { get; set; }
private static int NumberOfPerson = 0;
public MemberListViewItem(Person person)
{
IsChecked = false;
Person = person;
NumberOfPerson++;
Id = NumberOfPerson;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MatchGenerator.Core.UI
{
class MemberListViewItem
{
public int Id { get; }
public bool IsChecked { get; set; }
public Person Person { get; set; }
private static int NumberOfPerson = 0;
public MemberListViewItem(Person person)
{
IsChecked = false;
Person = person;
NumberOfPerson++;
Id = NumberOfPerson;
}
}
}
| mit | C# |
0f4d251cc083fcf997c04a7084446883c0efb890 | Rework clear scene method by collecting all roots | out-of-pixel/HoloToolkit-Unity,willcong/HoloToolkit-Unity,ForrestTrepte/HoloToolkit-Unity,paseb/MixedRealityToolkit-Unity,dbastienMS/HoloToolkit-Unity,HattMarris1/HoloToolkit-Unity,NeerajW/HoloToolkit-Unity,paseb/HoloToolkit-Unity | Assets/HoloToolkit-Tests/Utilities/Editor/EditorUtils.cs | Assets/HoloToolkit-Tests/Utilities/Editor/EditorUtils.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Linq;
using UnityEngine;
namespace HoloToolkit.Unity
{
public static class EditorUtils
{
/// <summary>
/// Deletes all objects in the scene
/// </summary>
public static void ClearScene()
{
foreach (var transform in Object.FindObjectsOfType<Transform>().Select(t => t.root).Distinct().ToList())
{
Object.DestroyImmediate(transform.gameObject);
}
}
}
}
| // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEngine;
namespace HoloToolkit.Unity
{
public static class EditorUtils
{
/// <summary>
/// Deletes all objects in the scene
/// </summary>
public static void ClearScene()
{
foreach (var gameObject in Object.FindObjectsOfType<GameObject>())
{
//only destroy root objects
if (gameObject.transform.parent == null)
{
Object.DestroyImmediate(gameObject);
}
}
}
}
}
| mit | C# |
e7f2a8d9922f6af702e37783ca226f28a70ee14d | Fix argument for formatted string. | jherby2k/AudioWorks | AudioWorks/tests/AudioWorks.TestUtilities/XunitLogger.cs | AudioWorks/tests/AudioWorks.TestUtilities/XunitLogger.cs | /* Copyright © 2018 Jeremy Herbison
This file is part of AudioWorks.
AudioWorks is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
version.
AudioWorks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.
You should have received a copy of the GNU Affero General Public License along with AudioWorks. If not, see
<https://www.gnu.org/licenses/>. */
using System;
using JetBrains.Annotations;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions.Internal;
namespace AudioWorks.TestUtilities
{
public sealed class XunitLogger : ILogger
{
[NotNull] readonly XunitLoggerProvider _provider;
[CanBeNull] readonly string _categoryName;
public XunitLogger([NotNull] XunitLoggerProvider provider, [CanBeNull] string categoryName)
{
_provider = provider;
_categoryName = categoryName;
}
public void Log<TState>(LogLevel logLevel, EventId eventId, [CanBeNull] TState state,
[CanBeNull] Exception exception, [NotNull] Func<TState, Exception, string> formatter)
{
if (!IsEnabled(logLevel)) return;
try
{
if (_categoryName != null)
_provider.OutputHelper?.WriteLine("{0}: {1}: {2}",
Enum.GetName(typeof(LogLevel), logLevel),
_categoryName,
formatter(state, exception));
else
_provider.OutputHelper?.WriteLine("{0}: {1}",
Enum.GetName(typeof(LogLevel), logLevel),
formatter(state, exception));
}
catch (InvalidOperationException)
{
// Test already completed on another thread
}
}
public bool IsEnabled(LogLevel logLevel) => logLevel >= _provider.MinLogLevel;
[NotNull]
public IDisposable BeginScope<TState>([CanBeNull] TState state) => NullScope.Instance;
}
} | /* Copyright © 2018 Jeremy Herbison
This file is part of AudioWorks.
AudioWorks is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
version.
AudioWorks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.
You should have received a copy of the GNU Affero General Public License along with AudioWorks. If not, see
<https://www.gnu.org/licenses/>. */
using System;
using JetBrains.Annotations;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions.Internal;
namespace AudioWorks.TestUtilities
{
public sealed class XunitLogger : ILogger
{
[NotNull] readonly XunitLoggerProvider _provider;
[CanBeNull] readonly string _categoryName;
public XunitLogger([NotNull] XunitLoggerProvider provider, [CanBeNull] string categoryName)
{
_provider = provider;
_categoryName = categoryName;
}
public void Log<TState>(LogLevel logLevel, EventId eventId, [CanBeNull] TState state,
[CanBeNull] Exception exception, [NotNull] Func<TState, Exception, string> formatter)
{
if (!IsEnabled(logLevel)) return;
try
{
if (_categoryName != null)
_provider.OutputHelper?.WriteLine("{0}: {1}: {2}",
Enum.GetName(typeof(LogLevel), logLevel),
_categoryName,
formatter(state, exception));
else
_provider.OutputHelper?.WriteLine("{0}: {2}",
Enum.GetName(typeof(LogLevel), logLevel),
formatter(state, exception));
}
catch (InvalidOperationException)
{
// Test already completed on another thread
}
}
public bool IsEnabled(LogLevel logLevel) => logLevel >= _provider.MinLogLevel;
[NotNull]
public IDisposable BeginScope<TState>([CanBeNull] TState state) => NullScope.Instance;
}
} | agpl-3.0 | C# |
43460f8da2491c8fdff24bef28dccfd33365b29d | Fix percent conversion to color. | dotless/dotless,dotless/dotless,rytmis/dotless,rytmis/dotless,rytmis/dotless,rytmis/dotless,rytmis/dotless,rytmis/dotless,rytmis/dotless | src/dotless.Core/Parser/Functions/RgbaFunction.cs | src/dotless.Core/Parser/Functions/RgbaFunction.cs | namespace dotless.Core.Parser.Functions
{
using System.Linq;
using Infrastructure;
using Infrastructure.Nodes;
using Tree;
using Utils;
public class RgbaFunction : Function
{
protected override Node Evaluate(Env env)
{
if (Arguments.Count == 2)
{
var color = Guard.ExpectNode<Color>(Arguments[0], this, Location);
var number = Guard.ExpectNode<Number>(Arguments[1], this, Location);
return new Color(color.RGB, number.Value);
}
Guard.ExpectNumArguments(4, Arguments.Count, this, Location);
var args = Guard.ExpectAllNodes<Number>(Arguments, this, Location);
var rgb = args.Take(3).Select(n => n.ToNumber(255.0)).ToArray();
var alpha = args[3].ToNumber(1.0);
return new Color(rgb, alpha);
}
}
} | namespace dotless.Core.Parser.Functions
{
using System.Linq;
using Infrastructure;
using Infrastructure.Nodes;
using Tree;
using Utils;
public class RgbaFunction : Function
{
protected override Node Evaluate(Env env)
{
if (Arguments.Count == 2)
{
var color = Guard.ExpectNode<Color>(Arguments[0], this, Location);
var number = Guard.ExpectNode<Number>(Arguments[1], this, Location);
return new Color(color.RGB, number.Value);
}
Guard.ExpectNumArguments(4, Arguments.Count, this, Location);
var args = Guard.ExpectAllNodes<Number>(Arguments, this, Location);
var values = args.Select(n => n.Value).ToList();
var rgb = values.Take(3).ToArray();
var alpha = values[3];
return new Color(rgb, alpha);
}
}
} | apache-2.0 | C# |
9c56a5a036f7788edcf05603ce7219d647110b41 | Fix Accio to need at least 2 lessons in discard pile | StefanoFiumara/Harry-Potter-Unity | Assets/Scripts/HarryPotterUnity/Cards/Charms/Spells/Accio.cs | Assets/Scripts/HarryPotterUnity/Cards/Charms/Spells/Accio.cs | using System.Collections.Generic;
using System.Linq;
using HarryPotterUnity.Enums;
using JetBrains.Annotations;
namespace HarryPotterUnity.Cards.Charms.Spells
{
[UsedImplicitly]
public class Accio : BaseSpell {
protected override void SpellAction(List<BaseCard> targets)
{
var lessons = Player.Discard.Cards.Where(card => card.Type == Type.Lesson).Take(2).ToList();
Player.Hand.AddAll(lessons);
}
protected override bool MeetsAdditionalPlayRequirements()
{
return Player.Discard.Cards.Count(c => c.Type == Type.Lesson) >= 2;
}
}
}
| using System.Collections.Generic;
using System.Linq;
using HarryPotterUnity.Enums;
using JetBrains.Annotations;
namespace HarryPotterUnity.Cards.Charms.Spells
{
[UsedImplicitly]
public class Accio : BaseSpell {
protected override void SpellAction(List<BaseCard> targets)
{
var lessons = Player.Discard.Cards.Where(card => card.Type == Type.Lesson).Take(2).ToList();
Player.Hand.AddAll(lessons);
}
}
}
| mit | C# |
23254e364f77b6bb4586235a2ef750a6b58e630a | remove of db string as no longer needed since using providers now | Appleseed/base,Appleseed/base | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Program.cs | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SendGrid;
using SendGrid.Helpers.Mail;
using System.Net;
using System.IO;
using Newtonsoft.Json;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using Dapper;
using Appleseed.Base.Alerts.Model;
using Appleseed.Base.Alerts.Controller;
using Appleseed.Base.Alerts.Providers;
namespace Appleseed.Base.Alerts
{
/// <summary>
/// Main Program for Alert Notifications
/// </summary>
class Program
{
#region App Config Values
#endregion
static void Main(string[] args)
{
Console.WriteLine("INFO : Starting Alert Engine.");
CheckAlertsProvider();
Console.WriteLine("INFO : Ending Alert Engine.");
}
static void CheckAlertsProvider()
{
IAlert aAlertProvider = new EmailAlertProvider();
aAlertProvider.Run();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SendGrid;
using SendGrid.Helpers.Mail;
using System.Net;
using System.IO;
using Newtonsoft.Json;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using Dapper;
using Appleseed.Base.Alerts.Model;
using Appleseed.Base.Alerts.Controller;
using Appleseed.Base.Alerts.Providers;
namespace Appleseed.Base.Alerts
{
/// <summary>
/// Main Program for Alert Notifications
/// </summary>
class Program
{
#region App Config Values
static IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
#endregion
static void Main(string[] args)
{
Console.WriteLine("INFO : Starting Alert Engine.");
CheckAlertsProvider();
Console.WriteLine("INFO : Ending Alert Engine.");
}
static void CheckAlertsProvider()
{
IAlert aAlertProvider = new EmailAlertProvider();
aAlertProvider.Run();
}
}
}
| apache-2.0 | C# |
2eb4c592b4282119aa8ed593261d793a6c0b8e60 | Update IHitTest.cs | Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Core2D/Editor/Bounds/IHitTest.cs | src/Core2D/Editor/Bounds/IHitTest.cs | using System;
using System.Collections.Generic;
using Core2D.Shapes;
using Spatial;
namespace Core2D.Editor.Bounds
{
public interface IHitTest
{
IDictionary<Type, IBounds> Registered { get; set; }
void Register(IBounds hitTest);
void Register(IEnumerable<IBounds> hitTests);
IPointShape TryToGetPoint(IBaseShape shape, Point2 target, double radius);
IPointShape TryToGetPoint(IEnumerable<IBaseShape> shapes, Point2 target, double radius);
bool Contains(IBaseShape shape, Point2 target, double radius);
bool Overlaps(IBaseShape shape, Rect2 target, double radius);
IBaseShape TryToGetShape(IEnumerable<IBaseShape> shapes, Point2 target, double radius);
ISet<IBaseShape> TryToGetShapes(IEnumerable<IBaseShape> shapes, Rect2 target, double radius);
}
}
| using System;
using System.Collections.Generic;
using Core2D.Shapes;
using Spatial;
namespace Core2D.Editor.Bounds
{
public interface IHitTest
{
IDictionary<Type, IBounds> Registered { get; set; }
void Register(IBounds hitTest);
void Register(IEnumerable<IBounds> hitTests);
IPointShape TryToGetPoint(IBaseShape shape, Point2 target, double radius);
IPointShape TryToGetPoint(IEnumerable<IBaseShape> shapes, Point2 target, double radius);
bool Contains(IBaseShape shape, Point2 target, double radius);
bool Overlaps(IBaseShape shape, Rect2 target, double radius);
IBaseShape TryToGetShape(IEnumerable<IBaseShape> shapes, Point2 target, double radius);
HashSet<IBaseShape> TryToGetShapes(IEnumerable<IBaseShape> shapes, Rect2 target, double radius);
}
}
| mit | C# |
c5f5acea0f1eb5a013df661416a49e3068bbe9de | Update version. | grantcolley/wpfcontrols | DevelopmentInProgress.WPFControls/Properties/AssemblyInfo.cs | DevelopmentInProgress.WPFControls/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("DipWpfControls")]
[assembly: AssemblyDescription("Custom WPF controls (beta)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Development In Progress Ltd")]
[assembly: AssemblyProduct("DipWpfControls")]
[assembly: AssemblyCopyright("Copyright © Development In Progress Ltd 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//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.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DipWpfControls")]
[assembly: AssemblyDescription("Custom WPF controls (beta)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Development In Progress Ltd")]
[assembly: AssemblyProduct("DipWpfControls")]
[assembly: AssemblyCopyright("Copyright © Development In Progress Ltd 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//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.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| apache-2.0 | C# |
b5f144ec259312b5d8a561e34fd6b5726ce617b9 | Revert "Add SecurityZone stub" (dotnet/coreclr#11053) | mmitche/corefx,ptoonen/corefx,wtgodbe/corefx,Jiayili1/corefx,ericstj/corefx,ericstj/corefx,zhenlan/corefx,Ermiar/corefx,zhenlan/corefx,zhenlan/corefx,Jiayili1/corefx,Jiayili1/corefx,Jiayili1/corefx,wtgodbe/corefx,zhenlan/corefx,ptoonen/corefx,Ermiar/corefx,ericstj/corefx,wtgodbe/corefx,ViktorHofer/corefx,ptoonen/corefx,shimingsg/corefx,BrennanConroy/corefx,shimingsg/corefx,wtgodbe/corefx,mmitche/corefx,Ermiar/corefx,ericstj/corefx,ravimeda/corefx,Ermiar/corefx,BrennanConroy/corefx,ravimeda/corefx,ravimeda/corefx,shimingsg/corefx,ViktorHofer/corefx,mmitche/corefx,Ermiar/corefx,wtgodbe/corefx,Jiayili1/corefx,zhenlan/corefx,ViktorHofer/corefx,wtgodbe/corefx,ericstj/corefx,zhenlan/corefx,ViktorHofer/corefx,mmitche/corefx,ravimeda/corefx,ericstj/corefx,ViktorHofer/corefx,wtgodbe/corefx,zhenlan/corefx,shimingsg/corefx,ravimeda/corefx,Ermiar/corefx,BrennanConroy/corefx,Jiayili1/corefx,mmitche/corefx,ericstj/corefx,ptoonen/corefx,Ermiar/corefx,shimingsg/corefx,mmitche/corefx,ViktorHofer/corefx,Jiayili1/corefx,ravimeda/corefx,ravimeda/corefx,ptoonen/corefx,shimingsg/corefx,shimingsg/corefx,mmitche/corefx,ViktorHofer/corefx,ptoonen/corefx,ptoonen/corefx | src/Common/src/CoreLib/System/Security/SecurityException.cs | src/Common/src/CoreLib/System/Security/SecurityException.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.Reflection;
using System.Runtime.Serialization;
namespace System.Security
{
[Serializable]
public class SecurityException : SystemException
{
public SecurityException()
: base(SR.Arg_SecurityException)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message, Exception inner)
: base(message, inner)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message, Type type)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
PermissionType = type;
}
public SecurityException(string message, Type type, string state)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
PermissionType = type;
PermissionState = state;
}
protected SecurityException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
public override string ToString() => base.ToString();
public override void GetObjectData(SerializationInfo info, StreamingContext context) => base.GetObjectData(info, context);
public object Demanded { get; set; }
public object DenySetInstance { get; set; }
public AssemblyName FailedAssemblyInfo { get; set; }
public string GrantedSet { get; set; }
public MethodInfo Method { get; set; }
public string PermissionState { get; set; }
public Type PermissionType { get; set; }
public object PermitOnlySetInstance { get; set; }
public string RefusedSet { get; set; }
public string Url { get; set; }
}
}
| // 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.Reflection;
using System.Runtime.Serialization;
namespace System.Security
{
[Serializable]
public class SecurityException : SystemException
{
public SecurityException()
: base(SR.Arg_SecurityException)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message, Exception inner)
: base(message, inner)
{
HResult = __HResults.COR_E_SECURITY;
}
public SecurityException(string message, Type type)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
PermissionType = type;
}
public SecurityException(string message, Type type, string state)
: base(message)
{
HResult = __HResults.COR_E_SECURITY;
PermissionType = type;
PermissionState = state;
}
protected SecurityException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
public override string ToString() => base.ToString();
public override void GetObjectData(SerializationInfo info, StreamingContext context) => base.GetObjectData(info, context);
public object Demanded { get; set; }
public object DenySetInstance { get; set; }
public AssemblyName FailedAssemblyInfo { get; set; }
public string GrantedSet { get; set; }
public MethodInfo Method { get; set; }
public string PermissionState { get; set; }
public Type PermissionType { get; set; }
public object PermitOnlySetInstance { get; set; }
public string RefusedSet { get; set; }
public string Url { get; set; }
public SecurityZone Zone { get; set; }
}
public enum SecurityZone
{
MyComputer = 0,
Intranet = 1,
Trusted = 2,
Internet = 3,
Untrusted = 4,
NoZone = -1
}
}
| mit | C# |
f9a6fb3a7dec9a144f10b0db13af52ec29ed81b8 | Update DMLib version to 0.8.1.0 | Azure/azure-storage-net-data-movement | tools/AssemblyInfo/SharedAssemblyInfo.cs | tools/AssemblyInfo/SharedAssemblyInfo.cs | //------------------------------------------------------------------------------
// <copyright file="SharedAssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation
// </copyright>
// <summary>
// Assembly global configuration.
// </summary>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("0.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure Storage")]
[assembly: AssemblyCopyright("Copyright © 2018 Microsoft Corp.")]
[assembly: AssemblyTrademark("Microsoft ® is a registered trademark of Microsoft Corporation.")]
[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)]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: CLSCompliant(false)]
| //------------------------------------------------------------------------------
// <copyright file="SharedAssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation
// </copyright>
// <summary>
// Assembly global configuration.
// </summary>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure Storage")]
[assembly: AssemblyCopyright("Copyright © 2018 Microsoft Corp.")]
[assembly: AssemblyTrademark("Microsoft ® is a registered trademark of Microsoft Corporation.")]
[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)]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: CLSCompliant(false)]
| mit | C# |
f8bdfaaf89be4a3c1a3ab8938f06ff5d2bab0020 | Fix skia page XAML. | GalaxiaGuy/MobileLibraries | XamarinForms.Sample/XamarinForms.Sample/SkiaPage.xaml.cs | XamarinForms.Sample/XamarinForms.Sample/SkiaPage.xaml.cs | using System;
using Xamarin.Forms;
namespace GamesWithGravitas.XamarinForms.Sample
{
public partial class SkiaPage : ContentPage
{
public SkiaPage()
{
InitializeComponent();
animatedView.AnimateAsync();
}
private void ButtonClicked(object sender, EventArgs e)
{
animatedView.AnimateAsync();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace GamesWithGravitas.XamarinForms.Sample
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SkiaPage : ContentPage
{
public SkiaPage()
{
InitializeComponent();
animatedView.AnimateAsync();
}
private void ButtonClicked(object sender, EventHandler e)
{
animatedView.AnimateAsync();
}
}
} | mit | C# |
a7a9dcc45b211dacee5fbd8e82fe176a4f6ba0e7 | Update css classes to new styles | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/V2/Index.cshtml | src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/V2/Index.cshtml | @model SFA.DAS.EmployerAccounts.Web.OrchestratorResponse<SFA.DAS.EmployerAccounts.Web.ViewModels.AccountDashboardViewModel>
@{
ViewBag.Title = "Home";
ViewBag.PageID = "page-company-homepage";
}
<div class="das-dashboard-header das-section--header">
<div class="govuk-width-container das-dashboard-header__border">
<h1 class="govuk-heading-m das-account__title">Your employer account</h1>
<h2 class="govuk-heading-l das-account__account-name">@Model.Data.Account.Name</h2>
</div>
</div>
<main class="govuk-main-wrapper das-section--dashboard" id="main-content" role="main">
<div class="govuk-width-container">
<div class="das-panels">
<div class="das-panels__col das-panels__col--primary">
@Html.Action("Row1Panel1", new { model = Model.Data })
@Html.Action("Row2Panel1", new { model = Model.Data })
</div>
<div class="das-panels__col das-panels__col--secondary">
@Html.Action("Row1Panel2", new { model = Model.Data })
@Html.Action("Row2Panel2", new { model = Model.Data })
</div>
</div>
</div>
</main>
| @model SFA.DAS.EmployerAccounts.Web.OrchestratorResponse<SFA.DAS.EmployerAccounts.Web.ViewModels.AccountDashboardViewModel>
@{
ViewBag.Title = "Home";
ViewBag.PageID = "page-company-homepage";
}
<div class="das-dashboard-header">
<div class="govuk-width-container das-dashboard-header__border">
<h1 class="das-dashboard-header__title">Your employer account</h1>
<h2 class="das-dashboard-header__account-name">@Model.Data.Account.Name</h2>
</div>
</div>
<main class="govuk-main-wrapper dashboard" id="main-content" role="main">
<div class="govuk-width-container">
<div class="das-panels">
<div class="das-panels__row">
@Html.Action("Row1Panel1", new { model = Model.Data })
@Html.Action("Row1Panel2", new { model = Model.Data })
</div>
<div class="das-panels__row das-panels__row--secondary">
@Html.Action("Row2Panel1", new { model = Model.Data })
@Html.Action("Row2Panel2", new { model = Model.Data })
</div>
</div>
</div>
</main>
| mit | C# |
13f8624a5526d9e71c6b8383c68be0afded8d596 | Work around an MCG bug (dotnet/corert#6658) | poizan42/coreclr,wtgodbe/coreclr,krk/coreclr,cshung/coreclr,krk/coreclr,krk/coreclr,cshung/coreclr,cshung/coreclr,poizan42/coreclr,wtgodbe/coreclr,poizan42/coreclr,poizan42/coreclr,krk/coreclr,cshung/coreclr,mmitche/coreclr,wtgodbe/coreclr,krk/coreclr,mmitche/coreclr,cshung/coreclr,wtgodbe/coreclr,mmitche/coreclr,poizan42/coreclr,cshung/coreclr,wtgodbe/coreclr,wtgodbe/coreclr,poizan42/coreclr,mmitche/coreclr,mmitche/coreclr,krk/coreclr,mmitche/coreclr | src/System.Private.CoreLib/shared/System/Collections/IEnumerable.cs | src/System.Private.CoreLib/shared/System/Collections/IEnumerable.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.Runtime.InteropServices;
namespace System.Collections
{
#if !PROJECTN // Hitting a bug in MCG, see VSO:743654
[Guid("496B0ABE-CDEE-11d3-88E8-00902754C43A")]
[ComVisible(true)]
#endif
public interface IEnumerable
{
// Returns an IEnumerator for this enumerable Object. The enumerator provides
// a simple way to access all the contents of a collection.
IEnumerator GetEnumerator();
}
}
| // 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.Runtime.InteropServices;
namespace System.Collections
{
[Guid("496B0ABE-CDEE-11d3-88E8-00902754C43A")]
[ComVisible(true)]
public interface IEnumerable
{
// Returns an IEnumerator for this enumerable Object. The enumerator provides
// a simple way to access all the contents of a collection.
IEnumerator GetEnumerator();
}
}
| mit | C# |
00948fbb74682e96ab8d78a8313ff026a538c049 | Remove unused usings | ASP-NET-Core-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates,ASP-NET-Core-Boilerplate/Templates,RehanSaeed/ASP.NET-MVC-Boilerplate,RehanSaeed/ASP.NET-MVC-Boilerplate,ASP-NET-Core-Boilerplate/Templates,RehanSaeed/ASP.NET-MVC-Boilerplate | Source/MVC6/Boilerplate.AspNetCore.Sample/Startup.Options.cs | Source/MVC6/Boilerplate.AspNetCore.Sample/Startup.Options.cs | namespace MvcBoilerplate
{
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using MvcBoilerplate.Settings;
public partial class Startup
{
/// <summary>
/// Configures the settings by binding the contents of the config.json file to the specified Plain Old CLR
/// Objects (POCO) and adding <see cref="IOptions{}"/> objects to the services collection.
/// </summary>
/// <param name="services">The services collection or IoC container.</param>
/// <param name="configuration">Gets or sets the application configuration, where key value pair settings are
/// stored.</param>
private static void ConfigureOptionsServices(IServiceCollection services, IConfiguration configuration)
{
// Adds IOptions<AppSettings> to the services container.
services.Configure<AppSettings>(configuration.GetSection(nameof(AppSettings)));
// Adds IOptions<CacheProfileSettings> to the services container.
services.Configure<CacheProfileSettings>(configuration.GetSection(nameof(CacheProfileSettings)));
// $Start-Sitemap$
// Adds IOptions<SitemapSettings> to the services container.
services.Configure<SitemapSettings>(configuration.GetSection(nameof(SitemapSettings)));
// $End-Sitemap$
}
}
} | namespace MvcBoilerplate
{
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using MvcBoilerplate.Settings;
public partial class Startup
{
/// <summary>
/// Configures the settings by binding the contents of the config.json file to the specified Plain Old CLR
/// Objects (POCO) and adding <see cref="IOptions{}"/> objects to the services collection.
/// </summary>
/// <param name="services">The services collection or IoC container.</param>
/// <param name="configuration">Gets or sets the application configuration, where key value pair settings are
/// stored.</param>
private static void ConfigureOptionsServices(IServiceCollection services, IConfiguration configuration)
{
// Adds IOptions<AppSettings> to the services container.
services.Configure<AppSettings>(configuration.GetSection(nameof(AppSettings)));
// Adds IOptions<CacheProfileSettings> to the services container.
services.Configure<CacheProfileSettings>(configuration.GetSection(nameof(CacheProfileSettings)));
// $Start-Sitemap$
// Adds IOptions<SitemapSettings> to the services container.
services.Configure<SitemapSettings>(configuration.GetSection(nameof(SitemapSettings)));
// $End-Sitemap$
}
}
} | mit | C# |
850b6d30c5a6cbf717eb32252efa1a84b5e66c4f | add product code to version JSON | robertwahler/jammer,robertwahler/jammer | Assets/Scripts/Application/Version.cs | Assets/Scripts/Application/Version.cs | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using SDD;
namespace Jammer {
/// <summary>
/// Manages version information
///
/// Format semver-label+code.build
/// Example: 1.0.0-dev+1.81a86ec
/// </summary>
public class Version {
/// <summary>
/// Base version string. This is written to the "Bundle Version" in the
/// mobile player project settings.
///
/// This can be automated by
///
/// git tag | tail -n 1
///
/// </summary>
public string version = "0.0.0";
/// <summary>
/// The product code id
/// </summary>
public string product = ApplicationConstants.ProductCode;
/// <summary>
/// Used by Google play store to determine if one version is newer than
/// another version. This written to "Bundle Version Code" for Android in
/// project settings.
///
/// This can be automated by counting the git tags
///
/// git tag | grep -c [0-9]
///
/// </summary>
public int code = 1;
/// <summary>
/// Base version string. This is is displayed on the end of the version to
/// distinguish builds.
///
/// This can be automated by
///
/// git log --pretty=format:%h --abbrev-commit -1
///
/// </summary>
public string build = "0000000";
/// <summary>
/// Prerelease label metadata. Optional and manually added.
/// </summary>
public string label;
/// <summary>
/// Application.unityVersion, written at build time by Editor/Builders/Build.cs
/// </summary>
public string unity = "5.2";
/// <summary>
/// Single string of characters representing build flags. Determined at runtime.
/// </summary>
public string BuildFlags { get { return GetBuildFlags(); }}
private string GetBuildFlags() {
// S L C
// DebugFlags.Stats | DebugFlags.Logger | DebugFlags.Console
// Duplicates will be removed
List<string> flags = new List<string>();
#if SDD_DEBUG
flags.Add("D");
#if SDD_LOG_DEBUG
flags.Add("L0");
#endif
#if SDD_LOG_VERBOSE
flags.Add("L1");
#endif
#endif
#if SDD_CONSOLE
flags.Add("C");
#endif
return string.Join("", flags.Distinct().ToArray());
}
/// <summary>
/// Return a string
/// </summary>
public override string ToString() {
string _label = string.IsNullOrEmpty(label) ? "" : "-" + label;
return string.Format("{0}{1}+{2}.{3}.{4}", version, _label, code.ToString(), build, unity);
}
}
}
| using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using SDD;
namespace Jammer {
/// <summary>
/// Manages version information
///
/// Format semver-label+code.build
/// Example: 1.0.0-dev+1.81a86ec
/// </summary>
public class Version {
/// <summary>
/// Base version string. This is written to the "Bundle Version" in the
/// mobile player project settings.
///
/// This can be automated by
///
/// git tag | tail -n 1
///
/// </summary>
public string version = "0.0.0";
/// <summary>
/// Used by Google play store to determine if one version is newer than
/// another version. This written to "Bundle Version Code" for Android in
/// project settings.
///
/// This can be automated by counting the git tags
///
/// git tag | grep -c [0-9]
///
/// </summary>
public int code = 1;
/// <summary>
/// Base version string. This is is displayed on the end of the version to
/// distinguish builds.
///
/// This can be automated by
///
/// git log --pretty=format:%h --abbrev-commit -1
///
/// </summary>
public string build = "0000000";
/// <summary>
/// Prerelease label metadata. Optional and manually added.
/// </summary>
public string label;
/// <summary>
/// Application.unityVersion, written at build time by Editor/Builders/Build.cs
/// </summary>
public string unity = "5.2";
/// <summary>
/// Single string of characters representing build flags. Determined at runtime.
/// </summary>
public string BuildFlags { get { return GetBuildFlags(); }}
private string GetBuildFlags() {
// S L C
// DebugFlags.Stats | DebugFlags.Logger | DebugFlags.Console
// Duplicates will be removed
List<string> flags = new List<string>();
#if SDD_DEBUG
flags.Add("D");
#if SDD_LOG_DEBUG
flags.Add("L0");
#endif
#if SDD_LOG_VERBOSE
flags.Add("L1");
#endif
#endif
#if SDD_CONSOLE
flags.Add("C");
#endif
return string.Join("", flags.Distinct().ToArray());
}
/// <summary>
/// Return a string
/// </summary>
public override string ToString() {
string _label = string.IsNullOrEmpty(label) ? "" : "-" + label;
return string.Format("{0}{1}+{2}.{3}.{4}", version, _label, code.ToString(), build, unity);
}
}
}
| mit | C# |
d99ff68219808476fcb8e939786ad7a0f4ab3d37 | Set DebuggingSubProcess = Debugger.IsAttached rather than a hard coded value | yoder/CefSharp,gregmartinhtc/CefSharp,gregmartinhtc/CefSharp,AJDev77/CefSharp,yoder/CefSharp,dga711/CefSharp,haozhouxu/CefSharp,VioletLife/CefSharp,rlmcneary2/CefSharp,joshvera/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp,zhangjingpu/CefSharp,Livit/CefSharp,rlmcneary2/CefSharp,battewr/CefSharp,wangzheng888520/CefSharp,jamespearce2006/CefSharp,VioletLife/CefSharp,windygu/CefSharp,illfang/CefSharp,jamespearce2006/CefSharp,wangzheng888520/CefSharp,rover886/CefSharp,battewr/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,haozhouxu/CefSharp,ruisebastiao/CefSharp,rover886/CefSharp,dga711/CefSharp,joshvera/CefSharp,illfang/CefSharp,yoder/CefSharp,joshvera/CefSharp,NumbersInternational/CefSharp,gregmartinhtc/CefSharp,wangzheng888520/CefSharp,ruisebastiao/CefSharp,ITGlobal/CefSharp,VioletLife/CefSharp,battewr/CefSharp,yoder/CefSharp,VioletLife/CefSharp,ITGlobal/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp,AJDev77/CefSharp,NumbersInternational/CefSharp,zhangjingpu/CefSharp,dga711/CefSharp,Octopus-ITSM/CefSharp,rover886/CefSharp,AJDev77/CefSharp,Haraguroicha/CefSharp,haozhouxu/CefSharp,AJDev77/CefSharp,rlmcneary2/CefSharp,ruisebastiao/CefSharp,twxstar/CefSharp,Haraguroicha/CefSharp,zhangjingpu/CefSharp,battewr/CefSharp,Haraguroicha/CefSharp,twxstar/CefSharp,Octopus-ITSM/CefSharp,Haraguroicha/CefSharp,twxstar/CefSharp,Octopus-ITSM/CefSharp,Haraguroicha/CefSharp,zhangjingpu/CefSharp,illfang/CefSharp,windygu/CefSharp,NumbersInternational/CefSharp,ITGlobal/CefSharp,rover886/CefSharp,rover886/CefSharp,windygu/CefSharp,haozhouxu/CefSharp,dga711/CefSharp,twxstar/CefSharp,windygu/CefSharp,rlmcneary2/CefSharp,joshvera/CefSharp,gregmartinhtc/CefSharp,ITGlobal/CefSharp,ruisebastiao/CefSharp,illfang/CefSharp,Octopus-ITSM/CefSharp,wangzheng888520/CefSharp,NumbersInternational/CefSharp | CefSharp.Example/CefExample.cs | CefSharp.Example/CefExample.cs | using System;
using System.Diagnostics;
using System.Linq;
namespace CefSharp.Example
{
public static class CefExample
{
public const string DefaultUrl = "custom://cefsharp/BindingTest.html";
// Use when debugging the actual SubProcess, to make breakpoints etc. inside that project work.
private static readonly bool DebuggingSubProcess = Debugger.IsAttached;
public static void Init()
{
var settings = new CefSettings();
settings.RemoteDebuggingPort = 8088;
//settings.CefCommandLineArgs.Add("renderer-process-limit", "1");
//settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog");
settings.LogSeverity = LogSeverity.Verbose;
if (DebuggingSubProcess)
{
var architecture = Environment.Is64BitProcess ? "x64" : "x86";
settings.BrowserSubprocessPath = "..\\..\\..\\..\\CefSharp.BrowserSubprocess\\bin\\" + architecture + "\\Debug\\CefSharp.BrowserSubprocess.exe";
}
settings.RegisterScheme(new CefCustomScheme
{
SchemeName = CefSharpSchemeHandlerFactory.SchemeName,
SchemeHandlerFactory = new CefSharpSchemeHandlerFactory()
});
if (!Cef.Initialize(settings))
{
if (Environment.GetCommandLineArgs().Contains("--type=renderer"))
{
Environment.Exit(0);
}
else
{
return;
}
}
}
}
}
| using System;
using System.Linq;
namespace CefSharp.Example
{
public static class CefExample
{
public const string DefaultUrl = "custom://cefsharp/BindingTest.html";
// Use when debugging the actual SubProcess, to make breakpoints etc. inside that project work.
private const bool debuggingSubProcess = true;
public static void Init()
{
var settings = new CefSettings();
settings.RemoteDebuggingPort = 8088;
//settings.CefCommandLineArgs.Add("renderer-process-limit", "1");
//settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog");
settings.LogSeverity = LogSeverity.Verbose;
if (debuggingSubProcess)
{
var architecture = Environment.Is64BitProcess ? "x64" : "x86";
settings.BrowserSubprocessPath = "..\\..\\..\\..\\CefSharp.BrowserSubprocess\\bin\\" + architecture + "\\Debug\\CefSharp.BrowserSubprocess.exe";
}
settings.RegisterScheme(new CefCustomScheme
{
SchemeName = CefSharpSchemeHandlerFactory.SchemeName,
SchemeHandlerFactory = new CefSharpSchemeHandlerFactory()
});
if (!Cef.Initialize(settings))
{
if (Environment.GetCommandLineArgs().Contains("--type=renderer"))
{
Environment.Exit(0);
}
else
{
return;
}
}
}
}
}
| bsd-3-clause | C# |
8bc36c30d08a2f5d2786ff8744decfc8af3d1efb | Clean unused code (#843) | AntShares/AntShares,shargon/neo | neo/Network/P2P/TaskSession.cs | neo/Network/P2P/TaskSession.cs | using Akka.Actor;
using Neo.Network.P2P.Capabilities;
using Neo.Network.P2P.Payloads;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Neo.Network.P2P
{
internal class TaskSession
{
public readonly IActorRef RemoteNode;
public readonly VersionPayload Version;
public readonly Dictionary<UInt256, DateTime> Tasks = new Dictionary<UInt256, DateTime>();
public readonly HashSet<UInt256> AvailableTasks = new HashSet<UInt256>();
public bool HasTask => Tasks.Count > 0;
public uint StartHeight { get; }
public TaskSession(IActorRef node, VersionPayload version)
{
this.RemoteNode = node;
this.Version = version;
this.StartHeight = version.Capabilities
.OfType<FullNodeCapability>()
.FirstOrDefault()?.StartHeight ?? 0;
}
}
}
| using Akka.Actor;
using Neo.Network.P2P.Capabilities;
using Neo.Network.P2P.Payloads;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Neo.Network.P2P
{
internal class TaskSession
{
public readonly IActorRef RemoteNode;
public readonly VersionPayload Version;
public readonly Dictionary<UInt256, DateTime> Tasks = new Dictionary<UInt256, DateTime>();
public readonly HashSet<UInt256> AvailableTasks = new HashSet<UInt256>();
public bool HasTask => Tasks.Count > 0;
public bool HeaderTask => Tasks.ContainsKey(UInt256.Zero);
public uint StartHeight { get; }
public TaskSession(IActorRef node, VersionPayload version)
{
this.RemoteNode = node;
this.Version = version;
this.StartHeight = version.Capabilities
.OfType<FullNodeCapability>()
.FirstOrDefault()?.StartHeight ?? 0;
}
}
}
| mit | C# |
51ed20677be65d45af1168531ca127eaea7d5ee1 | Add in comments for ThumborSigner. | mi9/DotNetThumbor | DotNetThumbor/ThumborSigner.cs | DotNetThumbor/ThumborSigner.cs | namespace DotNetThumbor
{
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
public class ThumborSigner : IThumborSigner
{
/// <summary>
/// Method to sign Thumbor urls correct as of 2015/03/12
/// </summary>
/// <param name="input">The image URL that thumbor expects</param>
/// <param name="key">The thumbor secret key</param>
/// <returns>The signed result which can be passed to thumbor</returns>
public string Encode(string input, string key)
{
var hmacsha1 = new HMACSHA1(Encoding.UTF8.GetBytes(key));
var byteArray = Encoding.UTF8.GetBytes(input);
var stream = new MemoryStream(byteArray);
var tmp = hmacsha1.ComputeHash(stream);
// Thumbor implementation replaces + and / and so is replicated here
return Convert.ToBase64String(tmp).Replace("+", "-").Replace("/", "_");
}
}
}
| namespace DotNetThumbor
{
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
public class ThumborSigner : IThumborSigner
{
public string Encode(string input, string key)
{
var hmacsha1 = new HMACSHA1(Encoding.UTF8.GetBytes(key));
var byteArray = Encoding.UTF8.GetBytes(input);
var stream = new MemoryStream(byteArray);
var tmp = hmacsha1.ComputeHash(stream);
return Convert.ToBase64String(tmp).Replace("+", "-").Replace("/", "_");
}
}
}
| bsd-3-clause | C# |
8d79eb75902a29c7a76b88b9ca146242661749c1 | Add a formated Json serialization option | eleven41/Eleven41.Helpers | Eleven41.Helpers/JsonHelper.cs | Eleven41.Helpers/JsonHelper.cs | using System;
using System.IO;
using System.Text;
using ServiceStack.Text;
namespace Eleven41.Helpers
{
public static class JsonHelper
{
public static string Serialize<T>(T obj)
{
return JsonSerializer.SerializeToString(obj, typeof(T));
}
public static string SerializeAndFormat<T>(T obj)
{
return obj.SerializeAndFormat();
}
public static void SerializeToStream<T>(T obj, Stream stream)
{
JsonSerializer.SerializeToStream(obj, stream);
}
public static T Deserialize<T>(string json)
{
return JsonSerializer.DeserializeFromString<T>(json);
}
public static T DeserializeFromStream<T>(Stream stream)
{
return JsonSerializer.DeserializeFromStream<T>(stream);
}
}
} | using System;
using System.IO;
using System.Text;
namespace Eleven41.Helpers
{
public static class JsonHelper
{
public static string Serialize<T>(T obj)
{
return ServiceStack.Text.JsonSerializer.SerializeToString(obj, typeof(T));
}
public static void SerializeToStream<T>(T obj, Stream stream)
{
ServiceStack.Text.JsonSerializer.SerializeToStream(obj, stream);
}
public static T Deserialize<T>(string json)
{
return ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(json);
}
public static T DeserializeFromStream<T>(Stream stream)
{
return ServiceStack.Text.JsonSerializer.DeserializeFromStream<T>(stream);
}
}
} | mit | C# |
c534dde07ce40087235f0e621fac379ba4e2ba9e | Trim the output of constants. | EliotVU/Unreal-Library | Core/Decompilers/UnConstDecompiler.cs | Core/Decompilers/UnConstDecompiler.cs | #if DECOMPILE
namespace UELib.Core
{
public partial class UConst : UField
{
/// <summary>
/// Decompiles this object into a text format of:
///
/// const NAME = VALUE;
/// </summary>
/// <returns></returns>
public override string Decompile()
{
return "const " + Name + " = " + Value.Trim() + ";";
}
}
}
#endif | #if DECOMPILE
namespace UELib.Core
{
public partial class UConst : UField
{
/// <summary>
/// Decompiles this object into a text format of:
///
/// const NAME = VALUE;
/// </summary>
/// <returns></returns>
public override string Decompile()
{
return "const " + Name + " = " + Value + ";";
}
}
}
#endif | mit | C# |
416c3bf7ddb4bbc4b0e09861dcc3354497502abd | Fix challenge div displaying in Chrome. | Mikuz/Battlezeppelins,Mikuz/Battlezeppelins | Battlezeppelins/Views/Shared/ChallengeInbox.cshtml | Battlezeppelins/Views/Shared/ChallengeInbox.cshtml | <div id="challengeInbox" style="display: none;">
<p id="challengeText"></p>
<input type="button" onclick="acceptChallenge()" value="Accept" />
<input type="button" onclick="rejectChallenge()" value="Reject" />
</div>
<script>
function pollChallengeInbox() {
$.getJSON('@Url.Content("~/Poll/ChallengeInbox")', function (data) {
var div = document.getElementById("challengeInbox");
var text = document.getElementById("challengeText");
if (data.challenged) {
text.textContent = "Challenge from " + data.challenger;
div.style.display = "inline-block";
} else {
div.style.display = "none";
}
});
}
var challengePoller = window.setInterval(pollChallengeInbox, 5000);
pollChallengeInbox();
function acceptChallenge() {
answer(true);
};
function rejectChallenge() {
answer(false);
};
function answer(accepted) {
$.ajax({
type: "POST",
url: "Challenge/BattleAnswer",
data: { PlayerAccepts: accepted },
success: function (data) {
pollChallengeInbox();
}
});
}
</script>
| <div id="challengeInbox" style="display: none;">
<p id="challengeText"></p>
<input type="button" onclick="acceptChallenge()" value="Accept" />
<input type="button" onclick="rejectChallenge()" value="Reject" />
</div>
<script>
function pollChallengeInbox() {
$.getJSON('@Url.Content("~/Poll/ChallengeInbox")', function (data) {
var div = document.getElementById("challengeInbox");
var text = document.getElementById("challengeText");
if (data.challenged) {
text.textContent = "Challenge from " + data.challenger;
div.style = "display: inline-block;";
} else {
div.style = "display: none;";
}
});
}
var challengePoller = window.setInterval(pollChallengeInbox, 5000);
pollChallengeInbox();
function acceptChallenge() {
answer(true);
};
function rejectChallenge() {
answer(false);
};
function answer(accepted) {
$.ajax({
type: "POST",
url: "Challenge/BattleAnswer",
data: { PlayerAccepts: accepted },
success: function (data) {
pollChallengeInbox();
}
});
}
</script>
| apache-2.0 | C# |
52806ddb6606d73a13f338db1a657eac9a9ef8d5 | Upgrade to allocation as it is used a bit | DragonSpark/Framework,DragonSpark/Framework,DragonSpark/Framework,DragonSpark/Framework | DragonSpark.Application/Security/Identity/Login.cs | DragonSpark.Application/Security/Identity/Login.cs | using Microsoft.AspNetCore.Identity;
namespace DragonSpark.Application.Security.Identity;
public sealed record Login<T>(ExternalLoginInfo Information, T User); | using Microsoft.AspNetCore.Identity;
namespace DragonSpark.Application.Security.Identity;
public readonly record struct Login<T>(ExternalLoginInfo Information, T User); | mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.