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 |
|---|---|---|---|---|---|---|---|---|
707358b1c3d09d6e9dca94218df4c11866734806 | Add new document extensions file | CyrusNajmabadi/roslyn,wvdd007/roslyn,KevinRansom/roslyn,eriawan/roslyn,ErikSchierboom/roslyn,stephentoub/roslyn,weltkante/roslyn,mgoertz-msft/roslyn,wvdd007/roslyn,diryboy/roslyn,heejaechang/roslyn,bartdesmet/roslyn,panopticoncentral/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,AlekseyTs/roslyn,tannergooding/roslyn,sharwell/roslyn,AmadeusW/roslyn,physhi/roslyn,KirillOsenkov/roslyn,stephentoub/roslyn,dotnet/roslyn,AmadeusW/roslyn,tannergooding/roslyn,ErikSchierboom/roslyn,mavasani/roslyn,tmat/roslyn,wvdd007/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,heejaechang/roslyn,diryboy/roslyn,sharwell/roslyn,diryboy/roslyn,tmat/roslyn,KirillOsenkov/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,panopticoncentral/roslyn,panopticoncentral/roslyn,heejaechang/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,eriawan/roslyn,tannergooding/roslyn,AmadeusW/roslyn,weltkante/roslyn,dotnet/roslyn,KevinRansom/roslyn,tmat/roslyn,bartdesmet/roslyn,mavasani/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,eriawan/roslyn,sharwell/roslyn,physhi/roslyn,ErikSchierboom/roslyn,mgoertz-msft/roslyn,physhi/roslyn,bartdesmet/roslyn | src/EditorFeatures/Core/Shared/Extensions/DocumentExtensions.cs | src/EditorFeatures/Core/Shared/Extensions/DocumentExtensions.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 Microsoft.CodeAnalysis.Editor.Shared.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions
{
internal static class DocumentExtensions
{
public static bool IsInCloudEnvironmentClientContext(this Document document)
{
var workspaceContextService = document.Project.Solution.Workspace.Services.GetRequiredService<IWorkspaceContextService>();
return workspaceContextService.IsCloudEnvironmentClient();
}
}
}
| mit | C# | |
cb8ddce4cad0a5902b621ef09a63db534826b058 | add shadow object | Tangerino/wrapper-c-sharp | WimdioApiProxy/DataTransferObjects/ShadowDevice/ShadowObject.cs | WimdioApiProxy/DataTransferObjects/ShadowDevice/ShadowObject.cs | using Newtonsoft.Json;
using WimdioApiProxy.v2.Helpers;
namespace WimdioApiProxy.v2.DataTransferObjects.ShadowDevice
{
public class ShadowObject
{
[JsonProperty("id")]
public int Id { get; set; }
[JsonProperty("objectcontent")]
[JsonConverter(typeof(StringObjectConverter<ShadowObjectContent>))]
public ShadowObjectContent ObjectContent { get; set; }
}
}
| mit | C# | |
4744bd2f78a332a349680a2ae21ad7262ceb81c8 | Add Handler | skatpgusskat/CircleFight,skatpgusskat/CircleFight,skatpgusskat/CircleFight,skatpgusskat/CircleFight | src/CircleFightUnityClient/Assets/Script/Network/Handle/LoginResultHandler.cs | src/CircleFightUnityClient/Assets/Script/Network/Handle/LoginResultHandler.cs | //------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.18449
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using packet_type;
using UnityEngine;
namespace Handler
{
public class LoginResultHandler
{
public LoginResultHandler ()
{
}
public static void Handle(LoginResult login_result)
{
Debug.Log ( "player_id : " + login_result.player_id);
}
}
}
| apache-2.0 | C# | |
1fb5518a3c16b058fa982a7811f2a1eb13f9af4a | Add tests | tmat/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,jmarolf/roslyn,brettfo/roslyn,wvdd007/roslyn,AmadeusW/roslyn,tannergooding/roslyn,sharwell/roslyn,genlu/roslyn,mgoertz-msft/roslyn,stephentoub/roslyn,brettfo/roslyn,AmadeusW/roslyn,dotnet/roslyn,AlekseyTs/roslyn,weltkante/roslyn,mgoertz-msft/roslyn,aelij/roslyn,eriawan/roslyn,aelij/roslyn,heejaechang/roslyn,reaction1989/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,diryboy/roslyn,KevinRansom/roslyn,tannergooding/roslyn,jmarolf/roslyn,sharwell/roslyn,diryboy/roslyn,genlu/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,tmat/roslyn,panopticoncentral/roslyn,KevinRansom/roslyn,panopticoncentral/roslyn,reaction1989/roslyn,davkean/roslyn,reaction1989/roslyn,brettfo/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,davkean/roslyn,tannergooding/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,mgoertz-msft/roslyn,wvdd007/roslyn,eriawan/roslyn,aelij/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,shyamnamboodiripad/roslyn,jmarolf/roslyn,AlekseyTs/roslyn,gafter/roslyn,genlu/roslyn,mavasani/roslyn,KirillOsenkov/roslyn,KirillOsenkov/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,davkean/roslyn,diryboy/roslyn,weltkante/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,AmadeusW/roslyn,ErikSchierboom/roslyn,physhi/roslyn,physhi/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,panopticoncentral/roslyn,eriawan/roslyn,heejaechang/roslyn,gafter/roslyn,jasonmalinowski/roslyn,gafter/roslyn,bartdesmet/roslyn,tmat/roslyn,sharwell/roslyn | src/EditorFeatures/CSharpTest/SimplifyConditional/SimplifyConditionalTests.cs | src/EditorFeatures/CSharpTest/SimplifyConditional/SimplifyConditionalTests.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.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.SimplifyConditional;
using Microsoft.CodeAnalysis.CSharp.UseLocalFunction;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.SimplifyConditional
{
public partial class SimplifyConditionalTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
=> (new CSharpSimplifyConditionalDiagnosticAnalyzer(), new CSharpSimplifyConditionalCodeFixProvider());
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseLocalFunction)]
public async Task TestSimpleCase()
{
await TestInRegularAndScript1Async(
@"using System;
using System;
class C
{
bool M()
{
return [|X() && Y() ? true : false|];
}
private bool X() => throw new NotImplementedException();
private bool Y() => throw new NotImplementedException();
}",
@"using System;
using System;
class C
{
bool M()
{
return X() && Y();
}
private bool X() => throw new NotImplementedException();
private bool Y() => throw new NotImplementedException();
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseLocalFunction)]
public async Task TestSimpleNegatedCase()
{
await TestInRegularAndScript1Async(
@"using System;
using System;
class C
{
bool M()
{
return [|X() && Y() ? false : true|];
}
private bool X() => throw new NotImplementedException();
private bool Y() => throw new NotImplementedException();
}",
@"using System;
using System;
class C
{
bool M()
{
return !X() || !Y();
}
private bool X() => throw new NotImplementedException();
private bool Y() => throw new NotImplementedException();
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseLocalFunction)]
public async Task TestMustBeBool1()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
using System;
class C
{
string M()
{
return [|X() && Y() ? """" : null|];
}
private bool X() => throw new NotImplementedException();
private bool Y() => throw new NotImplementedException();
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseLocalFunction)]
public async Task TestMustBeBool2()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
using System;
class C
{
string M()
{
return [|X() && Y() ? null : """"|];
}
private bool X() => throw new NotImplementedException();
private bool Y() => throw new NotImplementedException();
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseLocalFunction)]
public async Task TestNotWithTrueTrue()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
using System;
class C
{
bool M()
{
return [|X() && Y() ? true : true|];
}
private bool X() => throw new NotImplementedException();
private bool Y() => throw new NotImplementedException();
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseLocalFunction)]
public async Task TestNotWithFalseFalse()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
using System;
class C
{
bool M()
{
return [|X() && Y() ? false : false|];
}
private bool X() => throw new NotImplementedException();
private bool Y() => throw new NotImplementedException();
}");
}
}
}
| mit | C# | |
c1ab52d5c6dcda75dca7563494fd270e0e91a71f | Add metadata class for the compilation root. | jagrem/slang,jagrem/slang,jagrem/slang | slang/Compilation/CompilationMetadata.cs | slang/Compilation/CompilationMetadata.cs | namespace slang.Compilation
{
public class CompilationMetadata
{
public CompilationMetadata(string projectName)
{
ProjectName = projectName;
}
public string ProjectName { get; set; }
}
}
| mit | C# | |
647120aa2814086a6c6dcbaf1ec82b03cf302044 | Revert "moving error view to Shared from Home" | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Views/Home/Error.cshtml | src/Firehose.Web/Views/Home/Error.cshtml | @model System.Exception
@{
ViewBag.Title = "Error :)";
}
<section class="container">
<div class="row area">
<div class="col-xs-12">
<h1>@ViewBag.Title</h1>
<p>
Rats, something unfortunate happened. Below you can find some additional, technical information which can be helpful to track down what went wrong.
No additional information here? Check out the <a href="~/logs">logs</a> yourself, debug it and send us a <a href="https://github.com/planetpowershell/planetpowershell/pulls">pull request</a>! Or wait for us to do it.
</p>
@if (Model != null)
{
<div class="alert alert-warning">
@Model.Message @Model.StackTrace
</div>
}
else
{
<div class="alert alert-warning">
No additional information is available.
</div>
}
<p>To brighten your life, here is a picture of a Xamarin monkey eating a Death Star waffle!</p>
<div class="text-center">
<img src="~/Content/img/deathstar_monkey.jpg" class="img-rounded" title="Awww look at it, it is so cute" alt="Xamarin monkey eating a Death Star waffle to make it all better" />
</div>
</div>
</div>
</section>
| mit | C# | |
1d118c53416f1a157924f8acccd554bd1c880218 | Document EdgeEffect | ppy/osu-framework,paparony03/osu-framework,peppy/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,naoey/osu-framework,naoey/osu-framework,default0/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,paparony03/osu-framework,ZLima12/osu-framework,ppy/osu-framework,Nabile-Rahmani/osu-framework,default0/osu-framework,Nabile-Rahmani/osu-framework | osu.Framework/Graphics/Effects/EdgeEffect.cs | osu.Framework/Graphics/Effects/EdgeEffect.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Graphics.Effects
{
/// <summary>
/// An effect applied around the edge of the target drawable.
/// </summary>
public class EdgeEffect : IEffect<Container>
{
/// <summary>
/// The parameters of the edge effect.
/// </summary>
public EdgeEffectParameters Parameters { get; set; }
/// <summary>
/// Determines how large a radius is masked away around the corners.
/// </summary>
public float CornerRadius { get; set; }
public Container ApplyTo(Drawable drawable)
{
return new Container
{
Masking = true,
EdgeEffect = Parameters,
CornerRadius = CornerRadius,
Anchor = drawable.Anchor,
Origin = drawable.Origin,
RelativeSizeAxes = drawable.RelativeSizeAxes,
AutoSizeAxes = Axes.Both & ~drawable.RelativeSizeAxes,
Children = new[] { drawable }
};
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Graphics.Effects
{
/// <summary>
///
/// </summary>
public class EdgeEffect : IEffect<Container>
{
public EdgeEffectParameters Parameters { get; set; }
public float CornerRadius { get; set; }
public Container ApplyTo(Drawable drawable)
{
return new Container
{
Masking = true,
EdgeEffect = Parameters,
CornerRadius = CornerRadius,
Anchor = drawable.Anchor,
Origin = drawable.Origin,
RelativeSizeAxes = drawable.RelativeSizeAxes,
AutoSizeAxes = Axes.Both & ~drawable.RelativeSizeAxes,
Children = new[] { drawable }
};
}
}
}
| mit | C# |
1b033d2d53d219071aa755fd65bf6b3bb36033d2 | Add SequenceStartsWith | nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke | source/Nuke.Common/Utilities/Collections/Enumerable.Sequence.cs | source/Nuke.Common/Utilities/Collections/Enumerable.Sequence.cs | // Copyright 2021 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System.Collections.Generic;
using System.Linq;
namespace Nuke.Common.Utilities.Collections
{
public static partial class EnumerableExtensions
{
public static bool SequenceStartsWith<T>(this IEnumerable<T> enumerable, IEnumerable<T> other, IEqualityComparer<T> comparer = null)
{
var enumerableList = enumerable as List<T> ?? enumerable.ToList();
var otherList = other as List<T> ?? other.ToList();
return enumerableList.Take(otherList.Count).SequenceEqual(otherList, comparer);
}
}
}
| mit | C# | |
91e7e05bf929d0360ea9682912f50e34ceadde39 | Add missing Settings.cs file. | kcotugno/OpenARLog | OpenARLog/Settings.cs | OpenARLog/Settings.cs | namespace OpenARLog.Properties {
// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {
public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}
| mit | C# | |
5babfe2728f1426f7c4fe81cc1fabdb58ea5882b | Fix missing TranslationExtension file (wasn't being added to repo for some reason) | BrunoBrux/ArticulateDVS,Mpstark/articulate | SierraLib.Translation/TranslateExtension.cs | SierraLib.Translation/TranslateExtension.cs | using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Markup;
using System.Windows.Data;
namespace SierraLib.Translation
{
public class TranslateExtension : System.Windows.Markup.MarkupExtension
{
private string _key;
private string _default;
public TranslateExtension()
: this("unknown")
{ }
public TranslateExtension(string key)
: this(key, null)
{ }
public TranslateExtension(string key, string defaultValue)
{
_key = key;
_default = defaultValue;
}
[ConstructorArgument("key")]
public string Key
{
get { return _key; }
set { _key = value; }
}
[ConstructorArgument("defaultValue")]
public string Default
{
get { return _default; }
set { _default = value; }
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
var binding = new Binding("Value")
{
Source = new TranslationBinding(_key, _default),
Mode = BindingMode.OneWay
};
return binding.ProvideValue(serviceProvider);
}
}
}
| mit | C# | |
cad03a2c4358831d5984c48057aeb7d363e6f4cf | Add ExtensionsExceptionMEssageTest | unosquare/swan | test/Unosquare.Swan.Test/ExtensionsExceptionMEssageTest.cs | test/Unosquare.Swan.Test/ExtensionsExceptionMEssageTest.cs | using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Unosquare.Swan.Networking;
using Unosquare.Swan.Test.Mocks;
namespace Unosquare.Swan.Test
{
[TestFixture]
public class ExtensionsExceptionMessageTest
{
[Test]
public async Task ExceptionMessageTest()
{
try
{
var token = await JsonClient.GetString("https://accesscore.azurewebsites.net/api/token");
}
catch(Exception ex)
{
var exMsg = ex.ExceptionMessage();
Assert.IsNotNull(exMsg);
Assert.AreEqual(exMsg, ex.Message);
}
}
[Test]
public void InnerExceptionTest()
{
string[] splits = { "\r\n" };
List<Exception> exceptions = new List<Exception>();
exceptions.Add(new TimeoutException("It timed out", new ArgumentException("ID missing")));
exceptions.Add(new NotImplementedException("Somethings not implemented", new ArgumentNullException()));
AggregateException ex = new AggregateException(exceptions);
var exMsg = ex.ExceptionMessage();
string[] lines = exMsg.Split(splits, StringSplitOptions.None);
Assert.IsNotNull(exMsg);
Assert.AreEqual(lines.Count() - 1, ex.InnerExceptions.Count());
}
}
}
| mit | C# | |
6ab04018db449835848e25f1b7ea8811b15684e4 | Add default LSP initialize handler (for diagnostics). | heejaechang/roslyn,CyrusNajmabadi/roslyn,nguerrera/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,eriawan/roslyn,stephentoub/roslyn,AmadeusW/roslyn,diryboy/roslyn,jmarolf/roslyn,AlekseyTs/roslyn,aelij/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,stephentoub/roslyn,tannergooding/roslyn,heejaechang/roslyn,wvdd007/roslyn,reaction1989/roslyn,brettfo/roslyn,abock/roslyn,nguerrera/roslyn,panopticoncentral/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,tmat/roslyn,physhi/roslyn,dotnet/roslyn,aelij/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,AlekseyTs/roslyn,physhi/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,diryboy/roslyn,sharwell/roslyn,physhi/roslyn,dotnet/roslyn,sharwell/roslyn,tmat/roslyn,reaction1989/roslyn,wvdd007/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,nguerrera/roslyn,gafter/roslyn,mavasani/roslyn,panopticoncentral/roslyn,jasonmalinowski/roslyn,AmadeusW/roslyn,genlu/roslyn,gafter/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,tmat/roslyn,davkean/roslyn,eriawan/roslyn,agocke/roslyn,abock/roslyn,KevinRansom/roslyn,panopticoncentral/roslyn,brettfo/roslyn,tannergooding/roslyn,wvdd007/roslyn,weltkante/roslyn,AlekseyTs/roslyn,agocke/roslyn,AmadeusW/roslyn,jmarolf/roslyn,jmarolf/roslyn,tannergooding/roslyn,bartdesmet/roslyn,gafter/roslyn,mgoertz-msft/roslyn,jasonmalinowski/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,reaction1989/roslyn,stephentoub/roslyn,jasonmalinowski/roslyn,ErikSchierboom/roslyn,KevinRansom/roslyn,agocke/roslyn,dotnet/roslyn,mgoertz-msft/roslyn,brettfo/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,davkean/roslyn,davkean/roslyn,weltkante/roslyn,mavasani/roslyn,eriawan/roslyn,genlu/roslyn,abock/roslyn,shyamnamboodiripad/roslyn,genlu/roslyn,bartdesmet/roslyn | src/VisualStudio/LiveShare/Impl/LSPSDKInitializeHandler.cs | src/VisualStudio/LiveShare/Impl/LSPSDKInitializeHandler.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.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.VisualStudio.LiveShare.LanguageServices;
using Microsoft.VisualStudio.LiveShare.LanguageServices.Protocol;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare
{
/// <summary>
/// Handle the initialize request and report the capabilities of the server.
/// TODO Once the client side code is migrated to LSP client, this can be removed.
/// </summary>
[ExportLspRequestHandler(LiveShareConstants.RoslynLSPSDKContractName, LSP.Methods.InitializeName)]
internal class LSPSDKInitializeHandler : ILspRequestHandler<LSP.InitializeParams, LSP.InitializeResult, Solution>
{
public Task<LSP.InitializeResult> HandleAsync(LSP.InitializeParams request, RequestContext<Solution> requestContext, CancellationToken cancellationToken)
{
var result = new LSP.InitializeResult
{
Capabilities = new ServerCapabilities_v40()
};
return Task.FromResult(result);
}
}
}
| mit | C# | |
e91ec5c68cf4c46d6b97e1e46da172610e1fa124 | Create MultibaseCorrelationService.cs | tiksn/TIKSN-Framework | TIKSN.Core/Integration/Correlation/MultibaseCorrelationService.cs | TIKSN.Core/Integration/Correlation/MultibaseCorrelationService.cs | using Microsoft.Extensions.Options;
using Multiformats.Base;
using System;
namespace TIKSN.Integration.Correlation
{
public class MultibaseCorrelationService : ICorrelationService
{
private readonly IOptions<MultibaseCorrelationServiceOptions> _multibaseCorrelationServiceOptions;
private readonly Random _random;
public MultibaseCorrelationService(
Random random,
IOptions<MultibaseCorrelationServiceOptions> multibaseCorrelationServiceOptions)
{
_random = random ?? throw new ArgumentNullException(nameof(random));
_multibaseCorrelationServiceOptions = multibaseCorrelationServiceOptions ?? throw new ArgumentNullException(nameof(multibaseCorrelationServiceOptions));
}
public CorrelationID Create(string stringRepresentation)
{
byte[] byteArrayRepresentation = Multibase.Decode(stringRepresentation, out MultibaseEncoding encoding);
return new CorrelationID(stringRepresentation, byteArrayRepresentation);
}
public CorrelationID Create(byte[] byteArrayRepresentation)
{
string stringRepresentation = Multibase.Encode(_multibaseCorrelationServiceOptions.Value.Encoding, byteArrayRepresentation);
return new CorrelationID(stringRepresentation, byteArrayRepresentation);
}
public CorrelationID Generate()
{
var byteArrayRepresentation = new byte[_multibaseCorrelationServiceOptions.Value.ByteLength];
_random.NextBytes(byteArrayRepresentation);
return Create(byteArrayRepresentation);
}
}
} | mit | C# | |
c325086748a9f4ac493d7bf05939a6aeba3bea4b | add tests for collections ref | GetStream/stream-net,GetStream/stream-net,GetStream/stream-net | src/stream-net-tests/CollectionsTest.cs | src/stream-net-tests/CollectionsTest.cs | using NUnit.Framework;
using System;
using Stream;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace stream_net_tests
{
[Parallelizable(ParallelScope.None)]
[TestFixture]
public class CollectionsTest
{
[Test]
public void TestRefWithCollection()
{
var collectionObj = new Stream.CollectionObject("id-col");
var refString = Stream.Collections.Ref("col", collectionObj);
Assert.AreEqual("SO:col:id-col", refString);
}
[Test]
public void TestRefWithCollectionObjectID()
{
var refString = Stream.Collections.Ref("col", "id-col");
Assert.AreEqual("SO:col:id-col", refString);
}
}
}
| bsd-3-clause | C# | |
55c8352692438aa116a23cdc1e25ac878a78c284 | Create ReverseInteger.cs | shreeharshas/hackerrank,shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/hackerrank,shreeharshas/Algorithms,shreeharshas/hackerrank,shreeharshas/hackerrank | leetcode/ReverseInteger.cs | leetcode/ReverseInteger.cs | /*
Code to reverse an integer
Based on question at leetcode at: https://leetcode.com/problems/reverse-integer/
*/
public class ReverseInteger {
public int Reverse(int x) {
StringBuilder sb = new StringBuilder(); // to hold the reverse order
int d = 0; // to hold the last digit
bool negFlag = false; // to ensure negative numbers are reversed along with the sign
if(x<0){ // check for negative input
negFlag = true;
x *= -1; // make x positive for reversing
}
while(x>0){ // until all digits are rerversed one by one
d = x%10; // take last digit
sb.Append(d); // add it in reverse order
x=x/10; // remove last digit
}
int outResult; // to match datatype
if(Int32.TryParse(sb.ToString(),out outResult)){
return negFlag?outResult*-1:outResult; // check for negative and return integer value appropriately
}
else
return 0; // default to zereo in erraneous conditions
}
}
| mit | C# | |
b34c542f67ba851fab12fb12aa51858c9abebe03 | Add RantObjectExpression | TheBerkin/Rant | Rant/Engine/ObjectModel/Expressions/RantObjectExpression.cs | Rant/Engine/ObjectModel/Expressions/RantObjectExpression.cs | using Rant.Engine.Compiler;
using Rant.Stringes;
namespace Rant.Engine.ObjectModel.Expressions
{
internal class RantObjectExpression : RantExpression
{
private readonly Token<R> _token;
private readonly RantObject _object;
public RantObjectExpression(RantObject rantObj, Token<R> token)
{
_token = token;
_object = rantObj;
}
public override RantObject Evaluate(VM vm)
{
if (_object == null)
throw new RantException(vm.CurrentState.Reader.Source, _token, "What did you DO??!");
return _object;
}
}
} | mit | C# | |
208e37163a9a9beaed35af46fc3a77eb7cf8bb2b | Add class | mstrother/BmpListener | src/BmpListener/Bgp/CapabilitiesParameter.cs | src/BmpListener/Bgp/CapabilitiesParameter.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace BmpListener.Bgp
{
public class CapabilitiesParameter : OptionalParameter
{
public IList<Capability> Capabilities { get; } = new List<Capability>();
public override void Decode(ArraySegment<byte> data)
{
base.Decode(data);
data = new ArraySegment<byte>(data.Array, data.Offset + 2, Length);
for (var i = 0; i < Length;)
{
(Capability capability, int length) = Capability.DecodeCapability(data);
Capabilities.Add(capability);
data = new ArraySegment<byte>(data.Array, data.Offset + length, data.Count - length);
i += length;
}
}
}
} | mit | C# | |
6359bd7ae342a960197b4130412112aa5bf370ec | Create Definition.cs | Andy16823/OpenObjectLoader | source/OpenObjectLoader/Types/Definition.cs | source/OpenObjectLoader/Types/Definition.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenObjectLoader.Types
{
public class Definition
{
public int v { get; set; }
public int vt { get; set; }
public int vn { get; set; }
public Definition()
{
this.v = 0;
this.vt = 0;
this.vn = 0;
}
public Definition(int v, int vt, int vn)
{
this.v = v;
this.vt = vt;
this.vn = vn;
}
public Definition(String tokkeValue)
{
String[] tokkens = tokkeValue.Split('/');
this.v = int.Parse(tokkens[0]);
this.vt = int.Parse(tokkens[1]);
this.vn = int.Parse(tokkens[2]);
}
}
}
| mit | C# | |
aecc3d28bf2723877ce3f5a2b7db12eb20f799a3 | Fix U4-2286 - IFilteredControllerFactory classes are not resolved by Umbraco | Tronhus/Umbraco-CMS,DaveGreasley/Umbraco-CMS,gkonings/Umbraco-CMS,m0wo/Umbraco-CMS,dampee/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,leekelleher/Umbraco-CMS,dawoe/Umbraco-CMS,qizhiyu/Umbraco-CMS,marcemarc/Umbraco-CMS,tcmorris/Umbraco-CMS,Tronhus/Umbraco-CMS,VDBBjorn/Umbraco-CMS,countrywide/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,rajendra1809/Umbraco-CMS,madsoulswe/Umbraco-CMS,base33/Umbraco-CMS,gkonings/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,gkonings/Umbraco-CMS,nvisage-gf/Umbraco-CMS,mstodd/Umbraco-CMS,AzarinSergey/Umbraco-CMS,jchurchley/Umbraco-CMS,sargin48/Umbraco-CMS,markoliver288/Umbraco-CMS,engern/Umbraco-CMS,markoliver288/Umbraco-CMS,dawoe/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,qizhiyu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,markoliver288/Umbraco-CMS,ehornbostel/Umbraco-CMS,christopherbauer/Umbraco-CMS,gregoriusxu/Umbraco-CMS,TimoPerplex/Umbraco-CMS,markoliver288/Umbraco-CMS,tcmorris/Umbraco-CMS,abjerner/Umbraco-CMS,Khamull/Umbraco-CMS,lars-erik/Umbraco-CMS,Door3Dev/HRI-Umbraco,bjarnef/Umbraco-CMS,VDBBjorn/Umbraco-CMS,AndyButland/Umbraco-CMS,abjerner/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,rustyswayne/Umbraco-CMS,m0wo/Umbraco-CMS,aaronpowell/Umbraco-CMS,rasmusfjord/Umbraco-CMS,marcemarc/Umbraco-CMS,TimoPerplex/Umbraco-CMS,countrywide/Umbraco-CMS,kasperhhk/Umbraco-CMS,AzarinSergey/Umbraco-CMS,corsjune/Umbraco-CMS,base33/Umbraco-CMS,iahdevelop/Umbraco-CMS,abryukhov/Umbraco-CMS,DaveGreasley/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,mstodd/Umbraco-CMS,gregoriusxu/Umbraco-CMS,rustyswayne/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,mstodd/Umbraco-CMS,gkonings/Umbraco-CMS,Phosworks/Umbraco-CMS,madsoulswe/Umbraco-CMS,markoliver288/Umbraco-CMS,arvaris/HRI-Umbraco,mittonp/Umbraco-CMS,WebCentrum/Umbraco-CMS,qizhiyu/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,lingxyd/Umbraco-CMS,leekelleher/Umbraco-CMS,Spijkerboer/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mittonp/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dampee/Umbraco-CMS,Myster/Umbraco-CMS,kasperhhk/Umbraco-CMS,Myster/Umbraco-CMS,yannisgu/Umbraco-CMS,lingxyd/Umbraco-CMS,countrywide/Umbraco-CMS,corsjune/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,gavinfaux/Umbraco-CMS,rasmusfjord/Umbraco-CMS,TimoPerplex/Umbraco-CMS,mittonp/Umbraco-CMS,NikRimington/Umbraco-CMS,dampee/Umbraco-CMS,KevinJump/Umbraco-CMS,ordepdev/Umbraco-CMS,countrywide/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,ehornbostel/Umbraco-CMS,Phosworks/Umbraco-CMS,KevinJump/Umbraco-CMS,yannisgu/Umbraco-CMS,Tronhus/Umbraco-CMS,leekelleher/Umbraco-CMS,wtct/Umbraco-CMS,gavinfaux/Umbraco-CMS,arvaris/HRI-Umbraco,Nicholas-Westby/Umbraco-CMS,yannisgu/Umbraco-CMS,rustyswayne/Umbraco-CMS,arvaris/HRI-Umbraco,zidad/Umbraco-CMS,DaveGreasley/Umbraco-CMS,christopherbauer/Umbraco-CMS,wtct/Umbraco-CMS,kasperhhk/Umbraco-CMS,Myster/Umbraco-CMS,umbraco/Umbraco-CMS,Door3Dev/HRI-Umbraco,AzarinSergey/Umbraco-CMS,dawoe/Umbraco-CMS,rajendra1809/Umbraco-CMS,Phosworks/Umbraco-CMS,zidad/Umbraco-CMS,jchurchley/Umbraco-CMS,rasmuseeg/Umbraco-CMS,wtct/Umbraco-CMS,marcemarc/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,romanlytvyn/Umbraco-CMS,dawoe/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,rasmusfjord/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,lingxyd/Umbraco-CMS,VDBBjorn/Umbraco-CMS,AndyButland/Umbraco-CMS,aaronpowell/Umbraco-CMS,gkonings/Umbraco-CMS,kasperhhk/Umbraco-CMS,timothyleerussell/Umbraco-CMS,bjarnef/Umbraco-CMS,neilgaietto/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,rajendra1809/Umbraco-CMS,abryukhov/Umbraco-CMS,TimoPerplex/Umbraco-CMS,mittonp/Umbraco-CMS,engern/Umbraco-CMS,dampee/Umbraco-CMS,bjarnef/Umbraco-CMS,corsjune/Umbraco-CMS,neilgaietto/Umbraco-CMS,romanlytvyn/Umbraco-CMS,m0wo/Umbraco-CMS,hfloyd/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,mattbrailsford/Umbraco-CMS,ordepdev/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,Pyuuma/Umbraco-CMS,iahdevelop/Umbraco-CMS,tompipe/Umbraco-CMS,AndyButland/Umbraco-CMS,rajendra1809/Umbraco-CMS,hfloyd/Umbraco-CMS,wtct/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,umbraco/Umbraco-CMS,neilgaietto/Umbraco-CMS,robertjf/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,DaveGreasley/Umbraco-CMS,arknu/Umbraco-CMS,Spijkerboer/Umbraco-CMS,iahdevelop/Umbraco-CMS,Tronhus/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,Phosworks/Umbraco-CMS,timothyleerussell/Umbraco-CMS,Tronhus/Umbraco-CMS,ehornbostel/Umbraco-CMS,tompipe/Umbraco-CMS,zidad/Umbraco-CMS,arknu/Umbraco-CMS,engern/Umbraco-CMS,Pyuuma/Umbraco-CMS,AndyButland/Umbraco-CMS,NikRimington/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,AndyButland/Umbraco-CMS,yannisgu/Umbraco-CMS,sargin48/Umbraco-CMS,gavinfaux/Umbraco-CMS,abryukhov/Umbraco-CMS,kgiszewski/Umbraco-CMS,timothyleerussell/Umbraco-CMS,corsjune/Umbraco-CMS,mstodd/Umbraco-CMS,Khamull/Umbraco-CMS,NikRimington/Umbraco-CMS,rasmusfjord/Umbraco-CMS,tompipe/Umbraco-CMS,rustyswayne/Umbraco-CMS,AzarinSergey/Umbraco-CMS,ordepdev/Umbraco-CMS,iahdevelop/Umbraco-CMS,lars-erik/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,umbraco/Umbraco-CMS,kgiszewski/Umbraco-CMS,nvisage-gf/Umbraco-CMS,Khamull/Umbraco-CMS,abjerner/Umbraco-CMS,neilgaietto/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Pyuuma/Umbraco-CMS,Phosworks/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,Spijkerboer/Umbraco-CMS,lingxyd/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,hfloyd/Umbraco-CMS,ordepdev/Umbraco-CMS,ehornbostel/Umbraco-CMS,sargin48/Umbraco-CMS,ordepdev/Umbraco-CMS,Pyuuma/Umbraco-CMS,romanlytvyn/Umbraco-CMS,lingxyd/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,engern/Umbraco-CMS,romanlytvyn/Umbraco-CMS,gavinfaux/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,corsjune/Umbraco-CMS,romanlytvyn/Umbraco-CMS,nvisage-gf/Umbraco-CMS,leekelleher/Umbraco-CMS,arvaris/HRI-Umbraco,Myster/Umbraco-CMS,rasmuseeg/Umbraco-CMS,mittonp/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,WebCentrum/Umbraco-CMS,TimoPerplex/Umbraco-CMS,robertjf/Umbraco-CMS,christopherbauer/Umbraco-CMS,hfloyd/Umbraco-CMS,Khamull/Umbraco-CMS,hfloyd/Umbraco-CMS,Spijkerboer/Umbraco-CMS,rajendra1809/Umbraco-CMS,timothyleerussell/Umbraco-CMS,Door3Dev/HRI-Umbraco,mstodd/Umbraco-CMS,AzarinSergey/Umbraco-CMS,Door3Dev/HRI-Umbraco,timothyleerussell/Umbraco-CMS,madsoulswe/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,aadfPT/Umbraco-CMS,KevinJump/Umbraco-CMS,leekelleher/Umbraco-CMS,Door3Dev/HRI-Umbraco,engern/Umbraco-CMS,christopherbauer/Umbraco-CMS,gregoriusxu/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,jchurchley/Umbraco-CMS,yannisgu/Umbraco-CMS,gregoriusxu/Umbraco-CMS,rasmuseeg/Umbraco-CMS,ehornbostel/Umbraco-CMS,tcmorris/Umbraco-CMS,VDBBjorn/Umbraco-CMS,lars-erik/Umbraco-CMS,dampee/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,christopherbauer/Umbraco-CMS,wtct/Umbraco-CMS,m0wo/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,zidad/Umbraco-CMS,abjerner/Umbraco-CMS,Myster/Umbraco-CMS,Khamull/Umbraco-CMS,lars-erik/Umbraco-CMS,WebCentrum/Umbraco-CMS,KevinJump/Umbraco-CMS,nvisage-gf/Umbraco-CMS,iahdevelop/Umbraco-CMS,qizhiyu/Umbraco-CMS,qizhiyu/Umbraco-CMS,gavinfaux/Umbraco-CMS,neilgaietto/Umbraco-CMS,nvisage-gf/Umbraco-CMS,sargin48/Umbraco-CMS,aadfPT/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,kasperhhk/Umbraco-CMS,umbraco/Umbraco-CMS,countrywide/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,kgiszewski/Umbraco-CMS,lars-erik/Umbraco-CMS,zidad/Umbraco-CMS,gregoriusxu/Umbraco-CMS,aaronpowell/Umbraco-CMS,rustyswayne/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,markoliver288/Umbraco-CMS,tcmorris/Umbraco-CMS,aadfPT/Umbraco-CMS,m0wo/Umbraco-CMS,base33/Umbraco-CMS,VDBBjorn/Umbraco-CMS,Pyuuma/Umbraco-CMS,sargin48/Umbraco-CMS,DaveGreasley/Umbraco-CMS,Spijkerboer/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS | src/Umbraco.Web/Mvc/FilteredControllerFactoriesResolver.cs | src/Umbraco.Web/Mvc/FilteredControllerFactoriesResolver.cs | using System;
using System.Collections.Generic;
using Umbraco.Core.ObjectResolution;
namespace Umbraco.Web.Mvc
{
/// <summary>
/// A resolver for storing IFilteredControllerFactories
/// </summary>
public sealed class FilteredControllerFactoriesResolver : ManyObjectsResolverBase<FilteredControllerFactoriesResolver, IFilteredControllerFactory>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="factories"></param>
internal FilteredControllerFactoriesResolver(IEnumerable<Type> factories)
: base(factories)
{
}
public IEnumerable<IFilteredControllerFactory> Factories
{
get { return Values; }
}
}
} | using System;
using System.Collections.Generic;
using Umbraco.Core.ObjectResolution;
namespace Umbraco.Web.Mvc
{
/// <summary>
/// A resolver for storing IFilteredControllerFactories
/// </summary>
internal sealed class FilteredControllerFactoriesResolver : ManyObjectsResolverBase<FilteredControllerFactoriesResolver, IFilteredControllerFactory>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="factories"></param>
internal FilteredControllerFactoriesResolver(IEnumerable<Type> factories)
: base(factories)
{
}
public IEnumerable<IFilteredControllerFactory> Factories
{
get { return Values; }
}
}
} | mit | C# |
9db37d6beefb9ed7e69b6f9bbc68cf85b8633181 | Include test file | skonves/Konves.KScript | tests/Konves.KScript.UnitTests/RelationalExpressionTestFixture.cs | tests/Konves.KScript.UnitTests/RelationalExpressionTestFixture.cs | using Konves.KScript.Expressions;
using Konves.KScript.Parsing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
namespace Konves.KScript.UnitTests
{
[TestClass]
public class RelationalExpressionTestFixture
{
[TestCategory(nameof(RelationalExpression))]
[TestMethod]
public void TestEvaluate()
{
DoTestEvaluate(5m, 5m, KScriptLexer.EQ, true);
DoTestEvaluate(6m, 5m, KScriptLexer.EQ, false);
DoTestEvaluate(5m, 6m, KScriptLexer.EQ, false);
DoTestEvaluate(5m, 5m, KScriptLexer.NE, false);
DoTestEvaluate(6m, 5m, KScriptLexer.NE, true);
DoTestEvaluate(5m, 6m, KScriptLexer.NE, true);
DoTestEvaluate(5m, 5m, KScriptLexer.GT, false);
DoTestEvaluate(6m, 5m, KScriptLexer.GT, true);
DoTestEvaluate(5m, 6m, KScriptLexer.GT, false);
DoTestEvaluate(5m, 5m, KScriptLexer.LT, false);
DoTestEvaluate(6m, 5m, KScriptLexer.LT, false);
DoTestEvaluate(5m, 6m, KScriptLexer.LT, true);
DoTestEvaluate(5m, 5m, KScriptLexer.GT_ET, true);
DoTestEvaluate(6m, 5m, KScriptLexer.GT_ET, true);
DoTestEvaluate(5m, 6m, KScriptLexer.GT_ET, false);
DoTestEvaluate(5m, 5m, KScriptLexer.LT_ET, true);
DoTestEvaluate(6m, 5m, KScriptLexer.LT_ET, false);
DoTestEvaluate(5m, 6m, KScriptLexer.LT_ET, true);
}
[TestCategory(nameof(RelationalExpression))]
[ExpectedException(typeof(InvalidOperationException))]
[TestMethod]
public void TestEvaluate_OutOfRange()
{
// Arrange
Literal aa = new Literal(5m, LiteralType.Value);
Literal bb = new Literal(5m, LiteralType.Value);
IExpression expression = new RelationalExpression(aa, bb, int.MaxValue);
// Act
bool result = expression.Evaluate(null);
// Assert
Assert.Fail();
}
private void DoTestEvaluate(object a, object b, int operatorToken, bool expected)
{
// Arrange
Literal aa = new Literal(a, LiteralType.Value);
Literal bb = new Literal(b, LiteralType.Value);
IExpression expression = new RelationalExpression(aa, bb, operatorToken);
// Act
bool result = expression.Evaluate(null);
// Assert
Assert.AreEqual(expected, result);
}
private class TrueExpression : IExpression
{
public bool Evaluate(IDictionary<string, object> state)
{
return true;
}
}
private class FalseExpression : IExpression
{
public bool Evaluate(IDictionary<string, object> state)
{
return false;
}
}
}
}
| apache-2.0 | C# | |
872167969b5c41bf62714dbbf8cbe3b4d725712c | Add a unit test for the LedgerQueriesExtensions class | openchain/openchain | test/Openchain.Ledger.Tests/LedgerQueriesExtensionsTests.cs | test/Openchain.Ledger.Tests/LedgerQueriesExtensionsTests.cs | // Copyright 2015 Coinprism, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Openchain.Ledger.Tests
{
public class LedgerQueriesExtensionsTests
{
private ILedgerQueries store;
[Fact]
public async Task GetRecordVersion_Success()
{
this.store = new TestLedgerQueries(CreateTransaction("a", "b"));
Record record = await this.store.GetRecordVersion(new ByteString(Encoding.UTF8.GetBytes("b")), ByteString.Parse("1234"));
Assert.Equal(new ByteString(Encoding.UTF8.GetBytes("b")), record.Key);
Assert.Equal(ByteString.Parse("ab"), record.Value);
Assert.Equal(ByteString.Parse("cd"), record.Version);
}
private ByteString CreateTransaction(params string[] keys)
{
Mutation mutation = new Mutation(
ByteString.Empty,
keys.Select(key => new Record(
new ByteString(Encoding.UTF8.GetBytes(key)),
ByteString.Parse("ab"),
ByteString.Parse("cd"))),
ByteString.Empty);
byte[] serializedMutation = MessageSerializer.SerializeMutation(mutation);
Transaction transaction = new Transaction(
new ByteString(MessageSerializer.SerializeMutation(mutation)),
new DateTime(),
ByteString.Empty);
return new ByteString(MessageSerializer.SerializeTransaction(transaction));
}
private class TestLedgerQueries : ILedgerQueries
{
private readonly ByteString transaction;
public TestLedgerQueries(ByteString transaction)
{
this.transaction = transaction;
}
public Task<IReadOnlyList<Record>> GetKeyStartingFrom(ByteString prefix)
{
throw new NotImplementedException();
}
public Task<IReadOnlyList<ByteString>> GetRecordMutations(ByteString recordKey)
{
throw new NotImplementedException();
}
public Task<ByteString> GetTransaction(ByteString mutationHash)
{
return Task.FromResult(this.transaction);
}
}
}
}
| apache-2.0 | C# | |
1ec37812d137b6b776e313d9d9db5be71d9d8a69 | Create NumberFormattingTests.cs | keith-hall/Extensions,keith-hall/Extensions | tests/NumberFormattingTests.cs | tests/NumberFormattingTests.cs | using System;
using HallLibrary.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Tests
{
[TestClass]
public class NumberTests
{
[TestMethod]
public void TestNumberFormatting()
{
var numbers = new [] {
"1234", "1,234",
"123", "123",
"1234.56", "1,234.56",
"12345678.90", "12,345,678.90",
"12345678.9012345", "12,345,678.9012345",
"-1234.56", "-1,234.56"
};
for (var i = 0; i < numbers.Length; i += 2) {
Assert.AreEqual(NumberFormatting.AddThousandsSeparators(numbers[i]), numbers[i + 1]);
}
}
}
}
| apache-2.0 | C# | |
ce92bc94cb571e7021351f3d55959424bf5084aa | Create MessageBoxScrollable.cs | HartmanDev/WimP | Demo/MessageBoxScrollable.cs | Demo/MessageBoxScrollable.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;
namespace PathFinder
{
public partial class MessageBoxScrollable : Form
{
public MessageBoxScrollable()
{
InitializeComponent();
}
public MessageBoxScrollable(string strText)
{
InitializeComponent();
this.Name = "Fichier logs";
this.Text = "Fichier logs";
textBox1.Text = strText;
this.Focus();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
| mit | C# | |
c661ae86a67e770ff5fe572558e2f3878e414869 | Create Keywords.cs | SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming | Kattis-Solutions/Keywords.cs | Kattis-Solutions/Keywords.cs | using System;
using System.Collections.Generic;
namespace Keywords
{
class Program
{
static void Main(string[] args)
{
Dictionary<string,int> d = new Dictionary<string,int>();
int n = int.Parse(Console.ReadLine());
string stemp;
for (int i = 0; i < n; i++) {
stemp = Console.ReadLine().ToLower();
stemp = stemp.Replace('-', ' ');
if (!d.ContainsKey(stemp))
{
d.Add(stemp, 1);
}
}
Console.WriteLine(d.Count);
}
}
}
| mit | C# | |
de2bd3b470e6cb258bc91af9e90797b9043de70b | Add IdentityServerUser | IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,chrisowhite/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,chrisowhite/IdentityServer4,chrisowhite/IdentityServer4 | src/IdentityServer4/IdentityServerUser.cs | src/IdentityServer4/IdentityServerUser.cs | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityModel;
using IdentityServer4.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
namespace IdentityServer4
{
/// <summary>
/// Model properties of an IdentityServer user
/// </summary>
public class IdentityServerUser
{
/// <summary>
/// Subject ID (mandatory)
/// </summary>
public string SubjectId { get; }
/// <summary>
/// Display name (optional)
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// Identity provider (optional)
/// </summary>
public string IdentityProvider { get; set; }
/// <summary>
/// Authentication methods
/// </summary>
public ICollection<string> AuthenticationMethods { get; set; } = new HashSet<string>();
/// <summary>
/// Authentication time
/// </summary>
public DateTime? AuthenticationTime { get; set; }
/// <summary>
/// Additional claims
/// </summary>
public ICollection<Claim> AdditionalClaims { get; set; } = new HashSet<Claim>(new ClaimComparer());
/// <summary>
/// Initializes a user identity
/// </summary>
/// <param name="subjectId">The subject ID</param>
public IdentityServerUser(string subjectId)
{
if (subjectId.IsMissing()) throw new ArgumentException("SubjectId is mandatory", nameof(subjectId));
SubjectId = subjectId;
}
/// <summary>
/// Creates an IdentityServer claims principal
/// </summary>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public ClaimsPrincipal CreatePrincipal()
{
if (SubjectId.IsMissing()) throw new ArgumentException("SubjectId is mandatory", nameof(SubjectId));
var claims = new List<Claim> { new Claim(JwtClaimTypes.Subject, SubjectId) };
if (DisplayName.IsPresent())
{
claims.Add(new Claim(JwtClaimTypes.Name, DisplayName));
}
if (IdentityProvider.IsPresent())
{
claims.Add(new Claim(JwtClaimTypes.IdentityProvider, IdentityProvider));
}
if (AuthenticationMethods.Any())
{
foreach (var amr in AuthenticationMethods)
{
claims.Add(new Claim(JwtClaimTypes.AuthenticationMethod, amr));
}
}
if (AuthenticationTime.HasValue)
{
claims.Add(new Claim(JwtClaimTypes.AuthenticationTime, AuthenticationTime.Value.ToEpochTime().ToString()));
}
claims.AddRange(AdditionalClaims);
var id = new ClaimsIdentity(claims.Distinct(new ClaimComparer()), Constants.IdentityServerAuthenticationType, JwtClaimTypes.Name, JwtClaimTypes.Role);
return new ClaimsPrincipal(id);
}
}
} | apache-2.0 | C# | |
4e9795d65597152f2cf28c2f4cd65669b063cb90 | Fix crashing when OK button is pressed and no subtitle file is selected | handrake/SubtitleRenamer | SubtitleRenamer/ZipFilesForm.cs | SubtitleRenamer/ZipFilesForm.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;
namespace SubtitleRenamer
{
public partial class ZipFilesForm : Form
{
private List<string> zipFiles;
public string selectedSubtitleFileName;
public bool ok;
public ZipFilesForm(List<string> zipFiles)
{
InitializeComponent();
this.zipFiles = zipFiles;
}
private void ZipFilesForm_Load(object sender, EventArgs e)
{
ZipListBox.Items.AddRange(zipFiles.ToArray());
}
private void SubtitleSelected()
{
if (ZipListBox.SelectedItems.Count == 0)
{
MessageBox.Show("자막 파일을 선택하세요");
return;
}
selectedSubtitleFileName = ZipListBox.SelectedItem.ToString();
ok = true;
this.Close();
}
private void ZipListBox_MouseDoubleClick(object sender, MouseEventArgs e)
{
SubtitleSelected();
}
private void OkButton_Click(object sender, EventArgs e)
{
SubtitleSelected();
}
private void CancelButton_Click(object sender, EventArgs e)
{
ok = false;
this.Close();
}
}
}
| 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;
namespace SubtitleRenamer
{
public partial class ZipFilesForm : Form
{
private List<string> zipFiles;
public string selectedSubtitleFileName;
public bool ok;
public ZipFilesForm(List<string> zipFiles)
{
InitializeComponent();
this.zipFiles = zipFiles;
}
private void ZipFilesForm_Load(object sender, EventArgs e)
{
ZipListBox.Items.AddRange(zipFiles.ToArray());
}
private void SubtitleSelected()
{
if (ZipListBox.Items.Count == 0)
{
MessageBox.Show("자막 파일을 선택하세요");
return;
}
selectedSubtitleFileName = ZipListBox.SelectedItem.ToString();
ok = true;
this.Close();
}
private void ZipListBox_MouseDoubleClick(object sender, MouseEventArgs e)
{
SubtitleSelected();
}
private void OkButton_Click(object sender, EventArgs e)
{
SubtitleSelected();
}
private void CancelButton_Click(object sender, EventArgs e)
{
ok = false;
this.Close();
}
}
}
| mit | C# |
5ac8b4ef9f62366bcf9a06f802a9c82340c2b3f4 | Fix #4 | uheerme/core,uheerme/core,uheerme/core | Samesound.Core/Music.cs | Samesound.Core/Music.cs | using Samesound.Core.Interfaces;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Samesound.Core
{
public class Music : IDateTrackable
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public int SizeInBytes { get; set; }
public int LengthInMinutes { get; set; }
[ForeignKey("Channel")]
public int ChannelId { get; set; }
public virtual Channel Channel { get; set; }
public DateTime DateCreated { get; set; }
public DateTime? DateUpdated { get; set; }
}
}
| mit | C# | |
fea899f11434b779ec0aefe1a7781d490c70e3c4 | Remove OnTeardown from ConfigurableServiceLocatorTestBase | thomaslevesque/FakeItEasy,adamralph/FakeItEasy,FakeItEasy/FakeItEasy,adamralph/FakeItEasy,FakeItEasy/FakeItEasy,thomaslevesque/FakeItEasy,blairconrad/FakeItEasy,blairconrad/FakeItEasy | tests/FakeItEasy.Tests/ConfigurableServiceLocatorTestBase.cs | tests/FakeItEasy.Tests/ConfigurableServiceLocatorTestBase.cs | namespace FakeItEasy.Tests
{
using NUnit.Framework;
public abstract class ConfigurableServiceLocatorTestBase
{
private ServiceLocator replacedServiceLocator;
[SetUp]
public void Setup()
{
this.replacedServiceLocator = ServiceLocator.Current;
ServiceLocator.Current = A.Fake<ServiceLocator>(x => x.Wrapping(ServiceLocator.Current));
this.OnSetup();
}
[TearDown]
public void Teardown()
{
ServiceLocator.Current = this.replacedServiceLocator;
}
protected virtual void OnSetup()
{
}
protected void StubResolve<T>(T returnedInstance)
{
A.CallTo(() => ServiceLocator.Current.Resolve(typeof(T))).Returns(returnedInstance);
}
protected T StubResolveWithFake<T>()
{
var result = A.Fake<T>();
this.StubResolve<T>(result);
return result;
}
}
}
| namespace FakeItEasy.Tests
{
using NUnit.Framework;
public abstract class ConfigurableServiceLocatorTestBase
{
private ServiceLocator replacedServiceLocator;
[SetUp]
public void Setup()
{
this.replacedServiceLocator = ServiceLocator.Current;
ServiceLocator.Current = A.Fake<ServiceLocator>(x => x.Wrapping(ServiceLocator.Current));
this.OnSetup();
}
[TearDown]
public void Teardown()
{
ServiceLocator.Current = this.replacedServiceLocator;
this.OnTeardown();
}
protected virtual void OnSetup()
{
}
protected virtual void OnTeardown()
{
}
protected void StubResolve<T>(T returnedInstance)
{
A.CallTo(() => ServiceLocator.Current.Resolve(typeof(T))).Returns(returnedInstance);
}
protected T StubResolveWithFake<T>()
{
var result = A.Fake<T>();
this.StubResolve<T>(result);
return result;
}
}
}
| mit | C# |
8768bcfa8ee5e01d2ceefa2711330c9e6aab0de2 | Add exception for deserialization process | sitkoru/ModelSelector | Exceptions/PropertyNotFoundException.cs | Exceptions/PropertyNotFoundException.cs | using System;
namespace Sitko.ModelSelector.Exceptions
{
public class PropertyNotFoundException : Exception
{
public PropertyNotFoundException(string message) : base(message)
{
}
}
} | mit | C# | |
38f9a98418f41a3f9569b18749b88288867ec8c2 | Add files via upload | joshyy/Email | Message.cs | Message.cs | /*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit
* of the public at large and to the detriment of our heirs and
* successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this
* software under copyright law.
*
* 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 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.
*
* For more information, please refer to <http://unlicense.org>
*/
using System;
using System.Net;
using System.Net.Mail;
namespace joshyy.Email {
public class Message {
public MailHost mailHost;
public NetworkCredential cred;
public Message(MailHost mailHost, NetworkCredential cred) {
this.mailHost=mailHost;
this.cred=cred;
}
public void Send(string from, string to, string subject, string body) {
Send(from, new []{to}, null, null, subject, body, true, MailPriority.Normal, null);
}
public void Send(string from, string to, string cc, string subject, string body) {
Send(from, new []{to}, new []{cc}, null, subject, body, true, MailPriority.Normal, null);
}
public void Send(string from, string to, string cc, string bcc, string subject, string body) {
Send(from, new []{to}, new []{cc}, new []{bcc}, subject, body, true, MailPriority.Normal, null);
}
public void Send(string from, string[] to, string[] cc, string[] bcc, string subject, string body, bool isHtml, MailPriority mailPri, string[] attachments) {
System.Net.Mail.MailMessage msg = new MailMessage();
msg.From = new MailAddress(from);
foreach(var t in to){
msg.To.Add(t);
}
foreach(var c in cc){
msg.CC.Add(c);
}
foreach(var b in bcc){
msg.Bcc.Add(b);
}
msg.Subject = subject;
msg.Body = body;
msg.Priority = mailPri;
msg.IsBodyHtml = isHtml;
foreach(var att in attachments){
msg.Attachments.Add(new Attachment(att));
}
Send(msg);
}
public void Send(MailMessage msg) {
SmtpClient client = new SmtpClient(mailHost.Host);
client.Port = mailHost.Port;
client.EnableSsl = mailHost.EnableSsl;
client.Credentials = cred;
try {
client.Send(msg);
} catch (Exception ex) {
throw ex;
}
}
}
} | unlicense | C# | |
9ab41aef1fcde8f5faa2c3f8461f54e2cdcfc2c9 | Create Problem71.cs | fireheadmx/ProjectEuler,fireheadmx/ProjectEuler | Problems/Problem71.cs | Problems/Problem71.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ProjectEuler.Problems
{
class Problem71
{
int upper = 1000000;
public void Run()
{
Fraction f_closest = new Fraction(2, 5);
Fraction f_3_7 = new Fraction(3, 7);
for (int d = 2; d <= upper; d++)
{
for (long n = f_closest.Numerator; n < d; n++)
{
if (Fraction.GCD(n, d) == 1)
{
Fraction f = new Fraction(n, d);
if (f > f_3_7)
{
break;
}
else if (f > f_closest && f < f_3_7)
{
f_closest = f;
}
}
}
}
Console.WriteLine(f_closest.Numerator);
}
}
}
| mit | C# | |
9f1430ee7483a9a20a5a309ebe3dccbfbf3d917a | Add Script - InteractWithHotSpots | F0rTh3H0rd3/LevelingQuestsTNB,TheNoobCompany/LevelingQuestsTNB | Profiles/Quester/Scripts/InteractWithHotSpots.cs | Profiles/Quester/Scripts/InteractWithHotSpots.cs | /* Check if there is HotSpots in the objective */
if (questObjective.Hotspots.Count <= 0)
{
/* Objective CSharpScript with script InteractWithHotSpots requires valid "Hotspots" */
Logging.Write("InteractWithHotSpots requires valid 'HotSpots'.");
questObjective.IsObjectiveCompleted = true;
return false;
}
/* Move to Zone/Hotspot */
if (!MovementManager.InMovement)
{
MountTask.Mount();
if (questObjective.Hotspots[Math.NearestPointOfListPoints(questObjective.Hotspots, ObjectManager.Me.Position)].DistanceTo(ObjectManager.Me.Position) > 5)
{
MovementManager.Go(PathFinder.FindPath(questObjective.Hotspots[Math.NearestPointOfListPoints(questObjective.Hotspots, ObjectManager.Me.Position)]));
}
else
{
MovementManager.GoLoop(questObjective.Hotspots);
}
}
/* Search for Entry */
WoWGameObject node = ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectById(questObjective.Entry));
WoWUnit unit =ObjectManager.GetNearestWoWUnit(ObjectManager.GetWoWUnitByEntry(questObjective.Entry, questObjective.IsDead));
Point pos;
uint baseAddress;
/* If Entry found continue, otherwise continue checking around HotSpots */
if (node.IsValid || unit.IsValid)
{
/* Entry found, GoTo */
if(unit.IsValid)
{
baseAddress = MovementManager.FindTarget(unit); /* Move toward unit */
}
else if (node.IsValid)
{
baseAddress = MovementManager.FindTarget(unit); /* Move toward node */
}
Thread.Sleep(100 + Usefuls.Latency); /* ZZZzzzZZZzz */
if (MovementManager.InMovement)
return false; /* Waiting to reach Entry */
/* Entry reached, dismount */
MovementManager.StopMove();
MountTask.DismountMount();
if (questObjective.IgnoreFight)
Quest.GetSetIgnoreFight = true;
/* Interact With Entry */
Interact.InteractWith(baseAddress);
Thread.Sleep(Usefuls.Latency);
/* Wait for the interact cast to be finished, if any */
while (ObjectManager.Me.IsCast)
{
Thread.Sleep(Usefuls.Latency);
}
/* Do Gossip if necessary */
if (questObjective.GossipOptionsInteractWith != 0)
{
Thread.Sleep(250 + Usefuls.Latency);
Quest.SelectGossipOption(questObjective.GossipOptionsInteractWith);
}
if (Others.IsFrameVisible("StaticPopup1Button1"))
Lua.RunMacroText("/click StaticPopup1Button1");
if (ObjectManager.Me.InCombat && !questObjective.IgnoreFight)
return;
/* Wait if necessary */
if(questObjective.WaitMs > 0)
Thread.Sleep(questObjective.WaitMs);
/* Interact Completed - InternalIndex and count is used to determine if obj is completed - questObjective.IsObjectiveCompleted = true; */
Quest.GetSetIgnoreFight = false;
} | mit | C# | |
422975689d3ff9f509cb2e9987e5a0bac9a459dc | Add algorithm | ChristopherJdL/wheretomeet-server | WhereToMeet/Algorithm/PerfectPlaceAlgorithm.cs | WhereToMeet/Algorithm/PerfectPlaceAlgorithm.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Algorithm
{
class PerfectPlaceAlgorithm
{
PerfectPlaceAlgorithm()
{
}
Place FindPerfectPlace(IPlaceProvider placeProvider, String[] placeType,
IDistanceResolver distanceResolver,GeoCoordinates[] geoCoordinates)
{
double sumX=0.0, sumY=0.0;
foreach(GeoCoordinates item in geoCoordinates) {
sumX+=item.x;
sumY+=item.y;
num
}
GeoCoordinates averageCoordinates = new GeoCoordinates();
averageCoordinates.x = sumX/geoCoordinates.Length;
averageCoordinates.y = sumY/geoCoordinates.Length;
Place[] candidatePlace = placeProvider.FindNearbyPlaces(averageCoordinates,500,placeType);
int minimumMinute=0;
Place finalPlace=null;
foreach(Place item1 in candidatePlace) {
int minute=0;
foreach(GeoCoordinates item2 in geoCoordinates){
minute+=distanceResolver.ResloveDuration(item1.Location, item2);
}
if(finalPlace==null || minimumMinute<minute){
minimumMinute=minute;
finalPlace=item1;
}
}
return finalPlace;
}
}
}
| mit | C# | |
c20ff979035c1396fb6237982ffde1037afbb41c | add a helper class for notifications. | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Helpers/NotificationHelpers.cs | WalletWasabi.Gui/Helpers/NotificationHelpers.cs | using Avalonia.Controls.Notifications;
using Splat;
using System;
using System.Collections.Generic;
using System.Text;
namespace WalletWasabi.Gui.Helpers
{
public static class NotificationHelpers
{
public static INotificationManager GetNotificationManager()
{
return Locator.Current.GetService<INotificationManager>();
}
public static void Information (string title, string message)
{
GetNotificationManager().Show(new Notification(title, message, NotificationType.Information));
}
public static void Warning (string title, string message)
{
GetNotificationManager().Show(new Notification(title, message, NotificationType.Warning));
}
public static void Error(string title, string message)
{
GetNotificationManager().Show(new Notification(title, message, NotificationType.Error));
}
}
}
| mit | C# | |
43bedff79795c92b3b4786b1429192e3f66c12c6 | Add GameScreenshotCacheTests | RonnChyran/snowflake,SnowflakePowered/snowflake,faint32/snowflake-1,faint32/snowflake-1,SnowflakePowered/snowflake,RonnChyran/snowflake,RonnChyran/snowflake,faint32/snowflake-1,SnowflakePowered/snowflake | Snowflake.Tests/Game/GameScreenshotCacheTests.cs | Snowflake.Tests/Game/GameScreenshotCacheTests.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Snowflake.Game;
using System.Drawing;
using System.IO;
using Xunit;
using Snowflake.Tests;
namespace Snowflake.Game.Tests
{
public class GameScreenshotCacheTests
{
[Fact]
public void GameScreenshotCacheCreation_Test()
{
string testKey = Guid.NewGuid().ToString();
IGameScreenshotCache screenCache = new GameScreenshotCache(testKey);
Assert.True(Directory.Exists(Path.Combine(screenCache.RootPath, screenCache.CacheKey)));
}
[Fact]
public void AddScreenshotUri_Test()
{
string testKey = Guid.NewGuid().ToString();
IGameScreenshotCache screenCache = new GameScreenshotCache(testKey);
string tempFileName = Path.GetTempFileName();
using (Stream stream = TestUtilities.GetResource("GameCache.600x600.gif"))
{
Image image = Image.FromStream(stream);
image.Save(tempFileName);
image.Dispose();
screenCache.AddScreenshot(new Uri(tempFileName));
}
Assert.NotEmpty(screenCache.ScreenshotCollection);
}
[Fact]
public void AddScreenshotImage_Test()
{
string testKey = Guid.NewGuid().ToString();
IGameScreenshotCache screenCache = new GameScreenshotCache(testKey);
string tempFileName = Path.GetTempFileName();
using (Stream stream = TestUtilities.GetResource("GameCache.600x600.gif"))
{
Image image = Image.FromStream(stream);
screenCache.AddScreenshot(image);
}
Assert.NotEmpty(screenCache.ScreenshotCollection);
}
[Fact]
public void RemoveScreenshot_Test()
{
string testKey = Guid.NewGuid().ToString();
IGameScreenshotCache screenCache = new GameScreenshotCache(testKey);
string tempFileName = Path.GetTempFileName();
using (Stream stream = TestUtilities.GetResource("GameCache.600x600.gif"))
{
Image image = Image.FromStream(stream);
screenCache.AddScreenshot(image);
}
screenCache.RemoveScreenshot(0);
Assert.Empty(screenCache.ScreenshotCollection);
}
}
}
| mpl-2.0 | C# | |
75309e99322c85f971a12107bc7fbfd8eb26ccdc | add the 5-th subchapter from ch 2 | ordinary-developer/education,ordinary-developer/education,ordinary-developer/education,ordinary-developer/education,ordinary-developer/education,ordinary-developer/education,ordinary-developer/education | books/techno/.net/c#_6.0_in_a_nutshell_6_ed_j_albahari/ch_2-c#_language_basics/05-strings_and_characters/main.cs | books/techno/.net/c#_6.0_in_a_nutshell_6_ed_j_albahari/ch_2-c#_language_basics/05-strings_and_characters/main.cs | using System;
class Test
{
static void Example1_StringsAndCharacter()
{
char c = 'A';
Console.WriteLine(c);
char newLine = '\n';
char backSlash = '\\';
Console.WriteLine(newLine);
Console.WriteLine(backSlash);
char copyrightSymbol = '\u00A9';
char omegaSymbol = '\u03A9';
char newLineChar = '\u000A';
Console.WriteLine(copyrightSymbol);
Console.WriteLine(omegaSymbol);
Console.WriteLine(newLineChar);
}
static void Example2_StringType()
{
string a1 = "Heat";
Console.WriteLine(a1);
string a2 = "test";
string b2 = "test";
Console.WriteLine(a2 == b2);
string a3 = "Here's a tab:\t";
Console.WriteLine(a3);
string a4 = "\\\\server\\fileshare\\helloword.cs";
Console.WriteLine(a4);
string a5 = @"\\server\fileshare\helloword.cs";
Console.WriteLine(a5);
string escaped = "Frist Line\nSecond Line";
string verbatim = @"First Line
Second Line";
Console.WriteLine(escaped == verbatim);
string xml = @"<customer id=""123""></customer>";
Console.WriteLine(xml);
string s1 = "a" + "b";
string s2 = "a" + 5;
Console.WriteLine(s1);
Console.WriteLine(s2);
}
static void Main()
{
Example1_StringsAndCharacter();
Example2_StringType();
}
}
| mit | C# | |
030d7e4ca225e06d4bc4408b6848a6524901fefb | Add test for MySQL bug 96947. (#1298) | PomeloFoundation/Pomelo.EntityFrameworkCore.MySql,PomeloFoundation/Pomelo.EntityFrameworkCore.MySql | test/EFCore.MySql.Tests/Bugs/MySqlBug96947.cs | test/EFCore.MySql.Tests/Bugs/MySqlBug96947.cs | using System;
using Microsoft.EntityFrameworkCore;
using Xunit;
using Xunit.Abstractions;
namespace Pomelo.EntityFrameworkCore.MySql.Bugs
{
public class MySqlBug96947 : RawSqlTestWithFixture<MySqlBug96947.MySqlBug96947Fixture>
{
public MySqlBug96947(MySqlBug96947Fixture fixture, ITestOutputHelper testOutputHelper)
: base(fixture)
{
}
[Fact]
public void Bug_exists_in_MySql57_or_higher()
{
using var command = Connection.CreateCommand();
command.CommandText = @"
SELECT `od1`.`Constant`, `od1`.`OrderID`
FROM `Orders` AS `o`
LEFT JOIN (
SELECT 'MyConstantValue' AS `Constant`, `od`.`OrderID`
FROM `Order Details` AS `od`
) AS `od1` ON `o`.`OrderID` = `od1`.`OrderID`
ORDER BY `od1`.`OrderID`;";
using var reader = command.ExecuteReader();
while (reader.Read())
{
var constant = reader["Constant"];
var expected = ServerVersion.FromString(Connection.ServerVersion).Supports.MySqlBug96947Workaround
? (object)DBNull.Value
: "MyConstantValue";
Assert.Equal(expected, constant);
}
}
public class MySqlBug96947Fixture : MySqlTestFixtureBase<ContextBase>
{
protected override string SetupDatabaseScript => @"
CREATE TABLE `Orders` (
`OrderID` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`OrderID`)
) ENGINE=InnoDB;
CREATE TABLE `Order Details` (
`OrderID` int(11) NOT NULL,
PRIMARY KEY (`OrderID`)
) ENGINE=InnoDB;
INSERT INTO `Orders` (`OrderID`) VALUES (1);
INSERT INTO `Orders` (`OrderID`) VALUES (2);
INSERT INTO `Order Details` (`OrderID`) VALUES (1);
INSERT INTO `Order Details` (`OrderID`) VALUES (2);";
}
}
}
| mit | C# | |
d1defc92ab34ac8f6e713ee685a8991e89d87c71 | Add a very basic data adapter for building the grid cell views to show those SimpleItem objects. | wislon/xam-gridview-infinite-scroll | src/GridViewInfiniteScroll/GridViewInfiniteScroll/MyGridViewAdapter.cs | src/GridViewInfiniteScroll/GridViewInfiniteScroll/MyGridViewAdapter.cs | using Android.Content;
using Android.Views;
using Android.Widget;
namespace GridViewInfiniteScroll
{
public class MyGridViewAdapter : BaseAdapter<SimpleItem>
{
private readonly SimpleItemLoader _simpleItemLoader;
private readonly Context _context;
public MyGridViewAdapter(Context context, SimpleItemLoader simpleItemLoader)
{
_context = context;
_simpleItemLoader = simpleItemLoader;
}
public override View GetView(int position, View convertView, ViewGroup parent)
{
var item = _simpleItemLoader.SimpleItems[position];
View itemView = convertView ?? LayoutInflater.From(_context).Inflate(Resource.Layout.GridViewCell, parent, false);
var tvDisplayName = itemView.FindViewById<TextView>(Resource.Id.tvDisplayName);
var imgThumbail = itemView.FindViewById<ImageView>(Resource.Id.imgThumbnail);
imgThumbail.SetScaleType(ImageView.ScaleType.CenterCrop);
imgThumbail.SetPadding(8, 8, 8, 8);
tvDisplayName.Text = item.DisplayName;
imgThumbail.SetImageResource(Resource.Drawable.Icon);
return itemView;
}
public override long GetItemId(int position)
{
return position;
}
public override int Count
{
get { return _simpleItemLoader.SimpleItems.Count; }
}
public override SimpleItem this[int position]
{
get { return _simpleItemLoader.SimpleItems[position]; }
}
}
} | mit | C# | |
d402415b1ae62aab0361a53056da9f0c27895ffd | Add test on enumerator. | AxeDotNet/AxePractice.CSharpViaTest | src/CSharpViaTest.Collections/10_SkippedEnumeratorPractice.cs | src/CSharpViaTest.Collections/10_SkippedEnumeratorPractice.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace CSharpViaTest.Collections
{
public class SkippedEnumeratorPractice
{
class SkippedEnumerable<T> : IEnumerable<T>
{
readonly ICollection<T> collection;
public SkippedEnumerable(ICollection<T> collection)
{
this.collection = collection ?? throw new ArgumentNullException(nameof(collection));
}
public IEnumerator<T> GetEnumerator()
{
return new SkippedEnumerator<T>(collection);
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
class SkippedEnumerator<T> : IEnumerator<T>
{
readonly ICollection<T> collection;
public SkippedEnumerator(ICollection<T> collection)
{
this.collection = collection;
}
public bool MoveNext()
{
throw new NotImplementedException();
}
public void Reset()
{
throw new NotImplementedException();
}
public T Current => throw new NotImplementedException();
object IEnumerator.Current => Current;
public void Dispose()
{
throw new NotImplementedException();
}
}
[Fact]
public void should_visit_elements_in_reversed_order()
{
int[] sequence = {1, 2, 3, 4, 5, 6};
int[] resolved = new SkippedEnumerable<int>(sequence).ToArray();
Assert.Equal(new [] {2, 4, 6}, resolved);
}
}
} | mit | C# | |
a77ad12cf95b2eef597eba94cdf1c390048e7107 | Create ShopifySmartCollectionRules.cs | shajumohamed/ShopifySharp,addsb/ShopifySharp,Yitzchok/ShopifySharp,clement911/ShopifySharp,mooglegiant/ShopifySharp,nozzlegear/ShopifySharp | ShopifySharp/Entities/ShopifySmartCollectionRules.cs | ShopifySharp/Entities/ShopifySmartCollectionRules.cs | using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShopifySharp
{
/// <summary>
/// An entity representing a Shopify Smart Collection Rule.
/// </summary>
public class ShopifySmartCollectionRules
{
/// <summary>
/// The relationship between the column choice, and the condition.
/// </summary>
[JsonProperty("relation")]
public string Relation { get; set; }
/// <summary>
/// Select products for a collection using a condition. Conditions are either strings or numbers, depending on the relation.
/// </summary>
[JsonProperty("condition")]
public string Condition { get; set; }
/// <summary>
/// The properties of a product that can be used to to populate a collection.
/// </summary>
[JsonProperty("column")]
public string Column { get; set; }
}
}
| mit | C# | |
4f49e541fb6bcebb21707c15b1b49aae7e1e6b1a | Revert "Upgrade_20211109_RemoveSerializable" | signumsoftware/framework,signumsoftware/framework | Signum.Upgrade/Upgrades/Upgrade_20211109_RemoveSerializable.cs | Signum.Upgrade/Upgrades/Upgrade_20211109_RemoveSerializable.cs | namespace Signum.Upgrade.Upgrades;
class Upgrade_20211109_RemoveSerializable : CodeUpgradeBase
{
public override string Description => "Remove Unnecessary [Serializable] attribute from entities";
public override void Execute(UpgradeContext uctx)
{
uctx.ForeachCodeFile(@"*.cs", uctx.EntitiesDirectory, file =>
{
file.RemoveAllLines(a => a.Trim() == "[Serializable]");
file.Replace(new Regex(@"\[\s*Serializable\s*\]\s*"), "");
file.Replace(new Regex(@"Serializable\s*,\s*"), "");
});
}
}
| mit | C# | |
70f3c7888155ef2d354aaf21d379573fcf66211f | Remove tests which are not actual tests but rather stress tests/means to type files automatically | AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS | src/R/Editor/Application.Test/Typing/TypeFileTest.cs | src/R/Editor/Application.Test/Typing/TypeFileTest.cs | using System.Diagnostics.CodeAnalysis;
using FluentAssertions;
using Microsoft.R.Editor.Application.Test.TestShell;
using Microsoft.R.Editor.ContentType;
using Microsoft.R.Support.RD.ContentTypes;
using Microsoft.UnitTests.Core.XUnit;
using Xunit;
namespace Microsoft.R.Editor.Application.Test.Typing {
[ExcludeFromCodeCoverage]
[Collection(CollectionNames.NonParallel)]
public class TypeFileTest {
private readonly EditorAppTestFilesFixture _files;
public TypeFileTest(EditorAppTestFilesFixture files) {
_files = files;
}
//[Test(Skip = "Unstable")]
//[Category.Interactive]
public void TypeFile_R() {
string actual = TypeFileInEditor("lsfit-part.r", RContentTypeDefinition.ContentType);
string expected = "";
actual.Should().Be(expected);
}
//[Test(Skip="Unstable")]
//[Category.Interactive]
public void TypeFile_RD() {
TypeFileInEditor("01.rd", RdContentTypeDefinition.ContentType);
}
/// <summary>
/// Opens file in an editor window
/// </summary>
/// <param name="fileName">File name</param>
/// <param name="contentType">File content type</param>
private string TypeFileInEditor(string fileName, string contentType) {
using (var script = new TestScript(contentType)) {
string text = _files.LoadDestinationFile(fileName);
script.Type(text, idleTime: 10);
return script.EditorText;
}
}
}
}
| using System.Diagnostics.CodeAnalysis;
using System.IO;
using FluentAssertions;
using Microsoft.R.Editor.Application.Test.TestShell;
using Microsoft.R.Editor.ContentType;
using Microsoft.R.Support.RD.ContentTypes;
using Microsoft.UnitTests.Core.XUnit;
using Xunit;
namespace Microsoft.R.Editor.Application.Test.Typing {
[ExcludeFromCodeCoverage]
[Collection(CollectionNames.NonParallel)]
public class TypeFileTest {
private readonly EditorAppTestFilesFixture _files;
public TypeFileTest(EditorAppTestFilesFixture files) {
_files = files;
}
[Test(Skip = "Unstable")]
[Category.Interactive]
public void TypeFile_R() {
string actual = TypeFileInEditor("lsfit-part.r", RContentTypeDefinition.ContentType);
string expected = "";
actual.Should().Be(expected);
}
[Test(Skip="Unstable")]
[Category.Interactive]
public void TypeFile_RD() {
TypeFileInEditor("01.rd", RdContentTypeDefinition.ContentType);
}
/// <summary>
/// Opens file in an editor window
/// </summary>
/// <param name="fileName">File name</param>
/// <param name="contentType">File content type</param>
private string TypeFileInEditor(string fileName, string contentType) {
using (var script = new TestScript(contentType)) {
string text = _files.LoadDestinationFile(fileName);
script.Type(text, idleTime: 10);
return script.EditorText;
}
}
}
}
| mit | C# |
c2746ea2cef3f1580752a54709956be737b5baae | Solve Simple Product in c# | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground | solutions/uri/1004/1004.cs | solutions/uri/1004/1004.cs | using System;
using System.Collections.Generic;
class Solution {
static void Main() {
int a, b;
string val;
val = Console.ReadLine();
a = Convert.ToInt32(val);
val = Console.ReadLine();
b = Convert.ToInt32(val);
Console.Write("PROD = {0}{1}", a * b, Environment.NewLine);
}
}
| mit | C# | |
feac301ef266beac0b2dcb884ad2b6efdc51ca8d | Create QueryableExtensions.cs | keith-hall/Extensions,keith-hall/Extensions | src/QueryableExtensions.cs | src/QueryableExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace HallLibrary.Extensions
{
/// <summary>
/// Contains static methods for working with queryables.
/// </summary>
public static class QueryableExtensions
{
/// <summary>
/// Returns a single value from the specified <paramref name="queryable"/>, or throws an Exception if it contains multiple values.
/// </summary>
/// <typeparam name="T">The type of elements in the queryable.</typeparam>
/// <param name="queryable">The queryable sequence to get the single value of.</param>
/// <returns>Returns the single value from the specified <paramref name="queryable"/>, using the most efficient method possible to determine that it is a single value.</returns>
/// <remarks>More efficient than the built in LINQ to SQL "Single" method, because this one takes the minimum number of results necessary to determine if the queryable contains a single value or not.</remarks>
public static T EnsureSingle<T>(this IQueryable<T> queryable)
{
return queryable.Take(2).Single();
}
}
}
| apache-2.0 | C# | |
daf28e17ac45ee36164465ab605d7981bee51b1c | Add common constants | syedhassaanahmed/log-storage-service,syedhassaanahmed/log-storage-service,syedhassaanahmed/log-storage-service | ValidationPipeline.LogStorage/CommonConstants.cs | ValidationPipeline.LogStorage/CommonConstants.cs | namespace ValidationPipeline.LogStorage
{
public static class CommonConstants
{
public const string ZipContentType = "application/zip";
public const string StaticFilesPath = "/blob";
}
}
| mit | C# | |
25e3e68a5bec6a1b1655ed7cbf6fe29b9409baf7 | Create ClientContext.cs | hprose/hprose-dotnet | src/Hprose.RPC/ClientContext.cs | src/Hprose.RPC/ClientContext.cs | /*--------------------------------------------------------*\
| |
| hprose |
| |
| Official WebSite: https://hprose.com |
| |
| ClientContext.cs |
| |
| ClientContext class for C#. |
| |
| LastModified: Jan 20, 2019 |
| Author: Ma Bingyao <andot@hprose.com> |
| |
\*________________________________________________________*/
using Hprose.IO;
using System;
using System.Collections.Generic;
namespace Hprose.RPC {
public class ClientContext : Context {
public Client Client { get; private set; }
public string Uri { get; set; }
public bool Simple { get; set; }
public Mode Mode { get; set; }
public LongType LongType { get; set; }
public RealType RealType { get; set; }
public CharType CharType { get; set; }
public ListType ListType { get; set; }
public DictType DictType { get; set; }
public Type Type { get; set; }
private void Copy(IDictionary<string, object> src, IDictionary<string, object> dist) {
if (src != null) {
foreach (var p in src) dist[p.Key] = p.Value;
}
}
public ClientContext(Client client, string fullname, Type type, Settings settings = null) {
Client = client;
Uri = (client.Uris.Count > 0) ? client.Uris[0] : "";
client.Settings.TryGetValue(fullname, out Settings defaultSettings);
Simple = settings?.Simple ?? defaultSettings?.Simple ?? client.Simple;
Mode = settings?.Mode ?? defaultSettings?.Mode ?? client.Mode;
LongType = settings?.LongType ?? defaultSettings?.LongType ?? client.LongType;
RealType = settings?.RealType ?? defaultSettings?.RealType ?? client.RealType;
CharType = settings?.CharType ?? defaultSettings?.CharType ?? client.CharType;
ListType = settings?.ListType ?? defaultSettings?.ListType ?? client.ListType;
DictType = settings?.DictType ?? defaultSettings?.DictType ?? client.DictType;
Type = settings?.Type ?? defaultSettings?.Type;
if (!type.IsAssignableFrom(Type)) Type = type;
Copy(client.RequestHeaders, RequestHeaders);
Copy(defaultSettings?.RequestHeaders, RequestHeaders);
Copy(settings?.RequestHeaders, RequestHeaders);
Copy(defaultSettings?.Context, items);
Copy(settings?.Context, items);
}
}
} | mit | C# | |
067dab149a480784daa1e508cc32834ffe337343 | Add models for user profile. | LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform | src/CompetitionPlatform/Models/UserProfile/UserProfileModel.cs | src/CompetitionPlatform/Models/UserProfile/UserProfileModel.cs | using CompetitionPlatform.Data.AzureRepositories.Project;
using CompetitionPlatform.Models.ProjectViewModels;
using System;
using System.Collections.Generic;
namespace CompetitionPlatform.Models.UserProfile
{
public class UserProfile
{
public string Id { get; set; }
public string UserId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Website { get; set; }
public string Bio { get; set; }
public string FacebookLink { get; set; }
public string TwitterLink { get; set; }
public string GithubLink { get; set; }
public bool ReceiveLykkeNewsletter { get; set; }
}
public class UserProfileViewModel
{
public UserProfile Profile { get; set; }
public double WinningsSum { get; set; }
public List<ProjectCompactViewModel> ParticipatedProjects { get; set; }
public List<ProjectCompactViewModel> WonProjects { get; set; }
public List<ProjectCompactViewModel> CreatedProjects { get; set; }
public List<UserProfileCommentData> Comments { get; set; }
}
public class UserProfileCommentData
{
public string ProjectName { get; set; }
public string ProjectId { get; set; }
public string FullName { get; set; }
public string Comment { get; set; }
public DateTime LastModified { get; set; }
}
}
| mit | C# | |
492a91499824732c2931aeab083cd78cc8fa06a9 | fix AsyncWaitHighlighting | BigBabay/AsyncConverter,BigBabay/AsyncConverter | AsyncConverter/Highlightings/AsyncWaitHighlighting.cs | AsyncConverter/Highlightings/AsyncWaitHighlighting.cs | using AsyncConverter.Highlightings;
using AsyncConverter.Settings;
using JetBrains.Annotations;
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
[assembly: RegisterConfigurableSeverity(AsyncWaitHighlighting.SeverityId, null, AsyncConverterGroupSettings.Id, "Use async wait instead sync wait.", "Use async wait instead sync wait.", Severity.ERROR)]
namespace AsyncConverter.Highlightings
{
[ConfigurableSeverityHighlighting(SeverityId, CSharpLanguage.Name)]
public class AsyncWaitHighlighting : IHighlighting
{
public IInvocationExpression InvocationExpression { get; }
public IReferenceExpression ReferenceExpression { get; }
public const string SeverityId = "AsyncConverter.AsyncWait";
public AsyncWaitHighlighting([NotNull] IReferenceExpression referenceExpression)
{
ReferenceExpression = referenceExpression;
}
public AsyncWaitHighlighting([NotNull] IInvocationExpression invocationExpression)
{
InvocationExpression = invocationExpression;
}
public bool IsValid() => ReferenceExpression.IsValid();
public DocumentRange CalculateRange() => ReferenceExpression?.GetDocumentRange() ?? InvocationExpression.GetDocumentRange();
public string ToolTip => "Use async wait instead sync wait.";
public string ErrorStripeToolTip => "Use async wait.";
}
} | using AsyncConverter.Highlightings;
using AsyncConverter.Settings;
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
[assembly: RegisterConfigurableSeverity(AsyncWaitHighlighting .SeverityId, null, AsyncConverterGroupSettings.Id, "Use async wait instead sync wait.", "Use async wait instead sync wait.", Severity.ERROR)]
namespace AsyncConverter.Highlightings
{
[ConfigurableSeverityHighlighting(SeverityId, CSharpLanguage.Name)]
public class AsyncWaitHighlighting : IHighlighting
{
public IReferenceExpression InvocationExpression { get; }
public const string SeverityId = "AsyncConverter.AsyncWait";
public AsyncWaitHighlighting(IReferenceExpression invocationExpression)
{
InvocationExpression = invocationExpression;
}
public bool IsValid() => InvocationExpression.IsValid();
public DocumentRange CalculateRange() => InvocationExpression.GetDocumentRange();
public string ToolTip => "Use async wait instead sync wait.";
public string ErrorStripeToolTip => "Use async wait.";
}
} | mit | C# |
1f1e95f5351decadeae653c048974b565cde67b7 | Add integration test for entity deletion. | space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content | Content.IntegrationTests/Tests/DeleteInventoryTest.cs | Content.IntegrationTests/Tests/DeleteInventoryTest.cs | using System.Threading.Tasks;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Clothing;
using NUnit.Framework;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.IntegrationTests.Tests
{
[TestFixture]
public class DeleteInventoryTest : ContentIntegrationTest
{
// Test that when deleting an entity with an InventoryComponent,
// any equipped items also get deleted.
[Test]
public async Task Test()
{
var server = StartServerDummyTicker();
server.Assert(() =>
{
// Spawn everything.
var mapMan = IoCManager.Resolve<IMapManager>();
mapMan.CreateNewMapEntity(MapId.Nullspace);
var entMgr = IoCManager.Resolve<IEntityManager>();
var container = entMgr.SpawnEntity(null, MapCoordinates.Nullspace);
var inv = container.AddComponent<InventoryComponent>();
var child = entMgr.SpawnEntity(null, MapCoordinates.Nullspace);
var item = child.AddComponent<ClothingComponent>();
item.SlotFlags = SlotFlags.HEAD;
// Equip item.
Assert.That(inv.Equip(Slots.HEAD, item, false), Is.True);
// Delete parent.
container.Delete();
// Assert that child item was also deleted.
Assert.That(item.Deleted, Is.True);
});
await server.WaitIdleAsync();
}
}
}
| mit | C# | |
a4f3b0c6404074d23442a1d72898a3347478c789 | Introduce generic base movement command handler | HelloKitty/Booma.Proxy | src/Booma.Proxy.Client.Unity.Ship/Handlers/Command/Movement/BaseDefaultPositionChangedEventHandler.cs | src/Booma.Proxy.Client.Unity.Ship/Handlers/Command/Movement/BaseDefaultPositionChangedEventHandler.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using GladNet;
using SceneJect.Common;
using UnityEngine;
namespace Booma.Proxy
{
/// <summary>
/// Base <see cref="BaseSubCommand60"/> handler for default movement generator
/// movement command types.
/// </summary>
/// <typeparam name="TPositionChangeCommandType">The position changing event.</typeparam>
public class BaseDefaultPositionChangedEventHandler<TPositionChangeCommandType> : Command60Handler<TPositionChangeCommandType>
where TPositionChangeCommandType : BaseSubCommand60, IMessageContextIdentifiable, IWorldPositionable<float>
{
/// <summary>
/// Service that translates the incoming position to the correct unit scale that
/// Unity3D expects.
/// </summary>
private IUnitScalerStrategy Scaler { get; }
private IEntityGuidMappable<WorldTransform> WorldTransformMappable { get; }
private IEntityGuidMappable<MovementManager> MovementManagerMappable { get; }
/// <inheritdoc />
public BaseDefaultPositionChangedEventHandler([NotNull] IUnitScalerStrategy scaler, ILog logger, IEntityGuidMappable<WorldTransform> worldTransformMappable, [NotNull] IEntityGuidMappable<MovementManager> movementManagerMappable)
: base(logger)
{
Scaler = scaler ?? throw new ArgumentNullException(nameof(scaler));
WorldTransformMappable = worldTransformMappable;
MovementManagerMappable = movementManagerMappable ?? throw new ArgumentNullException(nameof(movementManagerMappable));
}
/// <inheritdoc />
protected override Task HandleSubMessage(IPeerMessageContext<PSOBBGamePacketPayloadClient> context, TPositionChangeCommandType command)
{
int entityGuid = EntityGuid.ComputeEntityGuid(EntityType.Player, command.Identifier);
//We can safely assume they have a known world transform or they can't have been spawned.
//It's very possible, if this fails, that they are cheating/hacking or something.
Vector2 position = Scaler.ScaleYasZ(command.Position);
MovementManagerMappable[entityGuid].RegisterState(CreateMovementGenerator(position));
//New position commands should be direcly updating the entity's position. Even though "MovementGenerators" handle true movement by learping them.
//They aren't the source of Truth since they aren't deterministic/authorative like is REAL MMOs. So, the true source of truth is the WorldTransform.
Vector3 positionIn3dSpace = new Vector3(position.x, WorldTransformMappable[entityGuid].Position.y, position.y);
WorldTransformMappable[entityGuid] = new WorldTransform(positionIn3dSpace, WorldTransformMappable[entityGuid].Rotation);
return Task.CompletedTask;
}
protected virtual IMovementGeneratorState CreateMovementGenerator(Vector2 position)
{
//By default we use the default.
return new DefaultMovementGeneratorState(new DefaultMovementGenerationStateState(position));
}
}
}
| agpl-3.0 | C# | |
a4d5de067b40d8497032000db94cd1f97813783d | Add screen util | AikenParker/Expanse,LemonLube/Expanse | StandaloneUtility/ScreenUtil.cs | StandaloneUtility/ScreenUtil.cs | using System;
using UnityEngine;
namespace Expanse
{
/// <summary>
/// Collection of Screen related utility functionality.
/// </summary>
public static class ScreenUtil
{
/// <summary>
/// Returns the half extents size of the screen in world coordinates.
/// </summary>
public static Vector2 GetScreenHalfExtents(Camera camera, float depth = 10)
{
float width, height;
if (camera.orthographic == true)
{
Vector3 lowerLeftCorner = camera.ViewportToWorldPoint(Vector2.zero);
Vector3 upperRightCorner = camera.ViewportToWorldPoint(Vector2.one);
width = upperRightCorner.x - lowerLeftCorner.x;
height = upperRightCorner.y - lowerLeftCorner.y;
}
else
{
height = 2.0f * Mathf.Tan(0.5f * camera.fieldOfView * Mathf.Deg2Rad) * depth;
width = height * Screen.width / Screen.height;
}
return new Vector2(width * 0.5f, height * 0.5f);
}
/// <summary>
/// Returns a world position from an anchor.
/// </summary>
public static Vector3 GetWorldPositionFromAnchor(Camera camera, Vector2 anchor, float depth = 10)
{
float xPos, yPos, zPos = camera.transform.position.z + depth;
if (camera.orthographic == true)
{
Vector3 lowerLeftCorner = camera.ViewportToWorldPoint(Vector2.zero);
Vector3 upperRightCorner = camera.ViewportToWorldPoint(Vector2.one);
xPos = Mathf.LerpUnclamped(lowerLeftCorner.x, upperRightCorner.x, anchor.x);
yPos = Mathf.LerpUnclamped(lowerLeftCorner.y, upperRightCorner.y, anchor.y);
}
else
{
float height = 2.0f * Mathf.Tan(0.5f * camera.fieldOfView * Mathf.Deg2Rad) * depth;
float width = height * Screen.width / Screen.height;
xPos = Mathf.LerpUnclamped(width * -0.5f, width * 0.5f, anchor.x);
yPos = Mathf.LerpUnclamped(height * -0.5f, height * 0.5f, anchor.y);
}
return new Vector3(xPos, yPos, zPos);
}
/// <summary>
/// Returns an anchor from a world position.
/// </summary>
public static Vector2 GetAnchorFromWorldPosition(Camera camera, Vector3 worldPosition)
{
throw new NotImplementedException();
}
}
}
| mit | C# | |
ecaf9c332abf189efb3f1d62fe72a6cc1ae74705 | Move reflection initialization eager cctor order above McgModuleManager as it turns out to have a dependency on it in debug mode | krytarowski/corert,krytarowski/corert,mjp41/corert,mjp41/corert,yizhang82/corert,sandreenko/corert,shrah/corert,krytarowski/corert,manu-silicon/corert,schellap/corert,sandreenko/corert,kyulee1/corert,shrah/corert,gregkalapos/corert,botaberg/corert,botaberg/corert,tijoytom/corert,yizhang82/corert,sandreenko/corert,shrah/corert,gregkalapos/corert,botaberg/corert,schellap/corert,manu-silicon/corert,mjp41/corert,botaberg/corert,manu-silicon/corert,kyulee1/corert,sandreenko/corert,gregkalapos/corert,yizhang82/corert,gregkalapos/corert,tijoytom/corert,kyulee1/corert,manu-silicon/corert,tijoytom/corert,schellap/corert,shrah/corert,mjp41/corert,schellap/corert,mjp41/corert,schellap/corert,manu-silicon/corert,kyulee1/corert,krytarowski/corert,yizhang82/corert,tijoytom/corert | src/System.Private.CoreLib/src/System/Runtime/CompilerServices/EagerOrderedStaticConstructorAttribute.cs | src/System.Private.CoreLib/src/System/Runtime/CompilerServices/EagerOrderedStaticConstructorAttribute.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace System.Runtime.CompilerServices
{
// When applied to a type this custom attribute will cause it's cctor to be executed during startup
// rather being deferred.'order' define the order of execution relative to other cctor's marked with the same attribute.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
sealed public class EagerOrderedStaticConstructorAttribute : Attribute
{
private EagerStaticConstructorOrder _order;
public EagerOrderedStaticConstructorAttribute(EagerStaticConstructorOrder order)
{
_order = order;
}
public EagerStaticConstructorOrder Order { get { return _order; } }
}
// Defines all the types which require eager cctor execution ,defined order is the order of execution.The enum is
// grouped by Modules and then by types.
public enum EagerStaticConstructorOrder : int
{
// System.Private.TypeLoader
RuntimeTypeHandleEqualityComparer,
TypeLoaderEnvironment,
SystemRuntimeTypeLoaderExports,
// System.Private.CoreLib
SystemString,
SystemPreallocatedOutOfMemoryException,
SystemEnvironment, // ClassConstructorRunner.Cctor.GetCctor use Lock which inturn use current threadID , so System.Environment
// should come before CompilerServicesClassConstructorRunnerCctor
CompilerServicesClassConstructorRunnerCctor,
CompilerServicesClassConstructorRunner,
// Interop
InteropHeap,
VtableIUnknown,
McgModuleManager,
// System.Private.Reflection.Execution
ReflectionExecution,
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace System.Runtime.CompilerServices
{
// When applied to a type this custom attribute will cause it's cctor to be executed during startup
// rather being deferred.'order' define the order of execution relative to other cctor's marked with the same attribute.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
sealed public class EagerOrderedStaticConstructorAttribute : Attribute
{
private EagerStaticConstructorOrder _order;
public EagerOrderedStaticConstructorAttribute(EagerStaticConstructorOrder order)
{
_order = order;
}
public EagerStaticConstructorOrder Order { get { return _order; } }
}
// Defines all the types which require eager cctor execution ,defined order is the order of execution.The enum is
// grouped by Modules and then by types.
public enum EagerStaticConstructorOrder : int
{
// System.Private.TypeLoader
RuntimeTypeHandleEqualityComparer,
TypeLoaderEnvironment,
SystemRuntimeTypeLoaderExports,
// System.Private.CoreLib
SystemString,
SystemPreallocatedOutOfMemoryException,
SystemEnvironment, // ClassConstructorRunner.Cctor.GetCctor use Lock which inturn use current threadID , so System.Environment
// should come before CompilerServicesClassConstructorRunnerCctor
CompilerServicesClassConstructorRunnerCctor,
CompilerServicesClassConstructorRunner,
// System.Private.Reflection.Execution
ReflectionExecution,
// Interop
InteropHeap,
VtableIUnknown,
McgModuleManager
}
}
| mit | C# |
a984cefd28f58787c69a6780f9ccaedcd762cc55 | Add verify 2FA webhook signature C# snippet | TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets | two-factor-authentication/verify-webhook/verify-webhook.5.x.cs | two-factor-authentication/verify-webhook/verify-webhook.5.x.cs | using System.Security.Cryptography;
namespace Test
{
public class AuthyWebhook
{
private string Verify(System.Web.HttpRequestBase Request, string ApiKey)
{
// Read the nonce from the request
var nonce = Request.Headers["x-authy-signature-nonce"];
var method = Request.HttpMethod;
var url = Request.Url.AbsoluteUri;
var bodyRequest = new string [];
foreach (string key in Request.Form.Keys)
{
bodyRequest.Add(key + "=" + Request.Form[key]);
}
// Sort the params
var params = String.join("&", bodyRequest.Sort());
// concatenate all together and separate by '|'
var data = $"{nonce}|{method}|{url}|{params}";
// compute the signature
var encoding = new System.Text.ASCIIEncoding();
byte[] ApiKeyBytes = encoding.GetBytes(ApiKey);
byte[] DataBytes = encoding.GetBytes(data);
using (var hmacsha256 = new HMACSHA256(ApiKeyBytes))
{
// Read the Authy Signature from the request
var sig = Request.Headers["x-authy-signature"];
// compare the message signature with your calculated signature
byte[] hashmessage = hmacsha256.ComputeHash(DataBytes);
return Convert.ToBase64String(hashmessage) == sig;
}
}
}
}
| mit | C# | |
4d1704a33c06340c68c26e1967f95465048483dc | Add IParser | StevenLiekens/Txt,StevenLiekens/TextFx | src/Txt.Core/IParser.cs | src/Txt.Core/IParser.cs | using JetBrains.Annotations;
namespace Txt.Core
{
public interface IParser<in TElement, out TResult>
where TElement : Element
{
[NotNull]
TResult Parse([NotNull] TElement value);
}
}
| mit | C# | |
2550189c5dfa2bb6e145f944599c17ae55ae461e | Add policy for local only requests | Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype | src/Glimpse.Server.Web/Framework/AllowRemoteSecureRequestPolicy.cs | src/Glimpse.Server.Web/Framework/AllowRemoteSecureRequestPolicy.cs | using System;
using Glimpse.Server.Options;
using Glimpse.Web;
namespace Glimpse.Server.Framework
{
public class AllowRemoteSecureRequestPolicy : ISecureRequestPolicy
{
private readonly IAllowRemoteProvider _allowRemoteProvider;
public AllowRemoteSecureRequestPolicy(IAllowRemoteProvider allowRemoteProvider)
{
_allowRemoteProvider = allowRemoteProvider;
}
public bool AllowUser(IHttpContext context)
{
return _allowRemoteProvider.AllowRemote || context.Request.IsLocal;
}
}
} | mit | C# | |
e567a0315e69956c43ad29db7588a9184645f05a | Create creditReview.cs | alchemz/ARL_Training | CSharpDotNet_Programming/Async_Parallel_Programming/creditReview.cs | CSharpDotNet_Programming/Async_Parallel_Programming/creditReview.cs | //sequential credit review
static void UpdatedPredictionsSequential( AccountsRepository accounts)
{
foreach(Account account in accounts.AllAccounts)
{
Trend trend= SampleUtilities.Fit(account.Balance);
double prediction=trend.Predict(account.Balance.Length+NumberOfMonths);
account.SeqPrediction=prediction;
account.SeqWarning=prediction<account.Overdraft;
}
}
//credit review using Parallel.ForEach
static void UpdatePredictionsParallel(AccountRepository accounts)
{
Parallel.ForEach(accounts.AllAccounts, account =>
{
Trend trend = SampleUtilities.Fit(account.Blance);
double prediction= trend.Prediction(account.Balance.Length+NumberOfMonths);
acount.ParPrediction=prediction;
account.SeqWarning=prediction<account.Overdraft;
});
}
//credit review using PLINQ
static void UpdatePredictionPlinq(AccountRepository accounts)
{
accounts.AllAccounts.AsParallel().ForAll(account=>
{
Trend trend = SampleUtilities.Fit(account.Balance);
double prediction= trend.Predict(account.Balance.Length+NumberOfMonths);
account.PlinqPrediction= prediction;
account.PlinqPrediction<account.Overdraft;
});
}
| mit | C# | |
fbf654e6e0df2ccfb8dad6c626f5c0dc31a5af75 | Fix migration # | alecgorge/RelistenApi,RelistenNet/RelistenApi,alecgorge/RelistenApi,RelistenNet/RelistenApi,RelistenNet/RelistenApi,RelistenNet/RelistenApi | RelistenApi/Migrations/05_AddSourceTrackPlaysIndex.cs | RelistenApi/Migrations/05_AddSourceTrackPlaysIndex.cs | using SimpleMigrations;
namespace Migrations
{
[Migration(5, "Add source track plays index")]
public class AddSourceTrackPlaysIndex : Migration
{
protected override void Up()
{
Execute(@"
CREATE INDEX IF NOT EXISTS idx_source_track_plays_id_btree ON source_track_plays(id);
CREATE INDEX CONCURRENTLY ON setlist_shows (artist_id);
");
}
protected override void Down()
{
throw new System.NotImplementedException();
}
}
} | using SimpleMigrations;
namespace Migrations
{
[Migration(4, "Add source track plays index")]
public class AddSourceTrackPlaysIndex : Migration
{
protected override void Up()
{
Execute(@"CREATE INDEX IF NOT EXISTS idx_source_track_plays_id_btree ON source_track_plays(id);");
}
protected override void Down()
{
throw new System.NotImplementedException();
}
}
} | mit | C# |
59b9f68bc8ab12298c1da6c2c36387d6998f6f10 | add providerId to UserActivationRequest | SnapMD/connectedcare-sdk,dhawalharsora/connectedcare-sdk | SnapMD.VirtualCare.ApiModels/UserActivationRequest.cs | SnapMD.VirtualCare.ApiModels/UserActivationRequest.cs | namespace SnapMD.VirtualCare.ApiModels
{
/// <summary>
/// Request Model for user activation.
/// </summary>
public class UserActivationRequest
{
/// <summary>
/// Gets or sets the provider identifier.
/// </summary>
/// <value>
/// The provider identifier.
/// </value>
public int ProviderId { get; set; }
/// <summary>
/// Gets or sets the email.
/// </summary>
/// <value>
/// The email.
/// </value>
public string Email { get; set; }
/// <summary>
/// Gets or sets the password.
/// </summary>
/// <value>
/// The password.
/// </value>
public string Password { get; set; }
/// <summary>
/// Gets or sets the token.
/// </summary>
/// <value>
/// The token.
/// </value>
public string Token { get; set; }
}
}
| namespace SnapMD.VirtualCare.ApiModels
{
/// <summary>
/// Request Model for user activation.
/// </summary>
public class UserActivationRequest
{
/// <summary>
/// Gets or sets the email.
/// </summary>
/// <value>
/// The email.
/// </value>
public string Email { get; set; }
/// <summary>
/// Gets or sets the password.
/// </summary>
/// <value>
/// The password.
/// </value>
public string Password { get; set; }
/// <summary>
/// Gets or sets the token.
/// </summary>
/// <value>
/// The token.
/// </value>
public string Token { get; set; }
}
}
| apache-2.0 | C# |
4977c444314e49d8db056cf57a1d71b24cbeb6ec | Add ViewModel | chefsteph9/BibleApp | BibleApp/BibleApp/BibleAppViewModel.cs | BibleApp/BibleApp/BibleAppViewModel.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using BibleLibrary;
using System.Net.Http;
using System.Net.Http.Headers;
namespace BibleApp
{
class BibleAppViewModel : INotifyPropertyChanged
{
#region Members
public event PropertyChangedEventHandler PropertyChanged;
private string m_userName;
private string m_userPassword;
private string m_userEmail;
private string m_userToken;
private static HttpClient m_client;
private User m_user;
private List<string> m_errorMessages;
private IDictionary<string, object> m_properties;
#endregion
#region Constructors
public BibleAppViewModel(IDictionary<string, object> properties)
{
m_properties = properties;
InitializeClientAndUser().Wait();
}
#endregion
#region Methods
#region Private Methods
private async Task InitializeClientAndUser()
{
try
{
// Initialize HTTP Client
m_client = new HttpClient();
m_client.BaseAddress = new Uri("http://localhost:8000/");
m_client.DefaultRequestHeaders.Accept.Clear();
m_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
m_user = new User(m_client);
// Check if there is user information stored
List<string> keysNeeded = new List<string>() { "userName", "userPassword", "userEmail" };
bool userKeysStored = true;
foreach (string key in keysNeeded)
{
if (!m_properties.ContainsKey(key))
userKeysStored = false;
}
if (userKeysStored)
{
m_user.name = m_properties["userName"].ToString();
m_user.password = m_properties["userPassword"].ToString();
m_user.email = m_properties["userEmail"].ToString();
var tokenResponse = await User.LoginUserAsync(m_user);
m_user.token = tokenResponse.ToString();
}
else
{
m_user.name = "Eric";
m_user.password = "08frontier";
m_user.email = "test@test.com";
var tokenResponse = await User.LoginUserAsync(m_user).ConfigureAwait(false);
m_user.token = tokenResponse.ToString();
}
//Set the token in the HTTP header to allow the user to access other parts of the API
m_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", m_user.token);
}
catch (Exception e)
{
m_errorMessages.Add(e.Message);
}
}
#endregion
public string UserName
{
set
{
if (m_userName != value)
{
m_userName = value;
// Fire event
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs("userName"));
}
}
}
}
#endregion
}
}
| mit | C# | |
6b4d41fc0b92dcedea85b664469cbe4b3148dd54 | Add view imports page | IliaAnastassov/OdeToFood,IliaAnastassov/OdeToFood | OdeToFood/VIews/_ViewImports.cshtml | OdeToFood/VIews/_ViewImports.cshtml | @using OdeToFood.Entities
@using OdeToFood.Controllers
@using OdeToFood.ViewModels | mit | C# | |
63c2e2a8ec16f37136f79f1b0eff511c27c4c588 | add Office model | Aleksandyr/HR-Agency-System,Aleksandyr/HR-Agency-System | HRAgencySystem/HRAgencySystem.Models/Office.cs | HRAgencySystem/HRAgencySystem.Models/Office.cs | namespace HRAgencySystem.Models
{
using System.ComponentModel.DataAnnotations;
public class Office
{
[Required]
public int Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public string Description { get; set; }
}
}
| mit | C# | |
33271873dd3d50a50c65ed9c7d1765b6d63bdb82 | Remove redirect. | zooba/roslyn,OmarTawfik/roslyn,jeffanders/roslyn,xoofx/roslyn,bartdesmet/roslyn,balajikris/roslyn,kelltrick/roslyn,tvand7093/roslyn,diryboy/roslyn,pdelvo/roslyn,panopticoncentral/roslyn,jcouv/roslyn,natidea/roslyn,reaction1989/roslyn,Giftednewt/roslyn,physhi/roslyn,dotnet/roslyn,genlu/roslyn,orthoxerox/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,kelltrick/roslyn,jmarolf/roslyn,balajikris/roslyn,bkoelman/roslyn,a-ctor/roslyn,MattWindsor91/roslyn,xasx/roslyn,khyperia/roslyn,orthoxerox/roslyn,KevinRansom/roslyn,KiloBravoLima/roslyn,swaroop-sridhar/roslyn,heejaechang/roslyn,jhendrixMSFT/roslyn,AmadeusW/roslyn,sharwell/roslyn,bbarry/roslyn,a-ctor/roslyn,bartdesmet/roslyn,gafter/roslyn,lorcanmooney/roslyn,heejaechang/roslyn,eriawan/roslyn,ErikSchierboom/roslyn,paulvanbrenk/roslyn,tmat/roslyn,physhi/roslyn,jasonmalinowski/roslyn,drognanar/roslyn,shyamnamboodiripad/roslyn,xasx/roslyn,jkotas/roslyn,zooba/roslyn,jmarolf/roslyn,davkean/roslyn,DustinCampbell/roslyn,stephentoub/roslyn,cston/roslyn,agocke/roslyn,MattWindsor91/roslyn,KiloBravoLima/roslyn,OmarTawfik/roslyn,Pvlerick/roslyn,CaptainHayashi/roslyn,amcasey/roslyn,reaction1989/roslyn,wvdd007/roslyn,gafter/roslyn,eriawan/roslyn,TyOverby/roslyn,paulvanbrenk/roslyn,xoofx/roslyn,yeaicc/roslyn,nguerrera/roslyn,weltkante/roslyn,tmeschter/roslyn,cston/roslyn,robinsedlaczek/roslyn,jmarolf/roslyn,diryboy/roslyn,jeffanders/roslyn,reaction1989/roslyn,AlekseyTs/roslyn,drognanar/roslyn,KevinH-MS/roslyn,vslsnap/roslyn,tvand7093/roslyn,stephentoub/roslyn,gafter/roslyn,mgoertz-msft/roslyn,mavasani/roslyn,AnthonyDGreen/roslyn,TyOverby/roslyn,jcouv/roslyn,jcouv/roslyn,KevinRansom/roslyn,tmeschter/roslyn,AArnott/roslyn,ljw1004/roslyn,dotnet/roslyn,VSadov/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,KirillOsenkov/roslyn,Hosch250/roslyn,tmeschter/roslyn,MattWindsor91/roslyn,AmadeusW/roslyn,mmitche/roslyn,AnthonyDGreen/roslyn,robinsedlaczek/roslyn,davkean/roslyn,tmat/roslyn,jhendrixMSFT/roslyn,a-ctor/roslyn,CyrusNajmabadi/roslyn,swaroop-sridhar/roslyn,mattwar/roslyn,bartdesmet/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,Shiney/roslyn,ErikSchierboom/roslyn,tannergooding/roslyn,panopticoncentral/roslyn,pdelvo/roslyn,OmarTawfik/roslyn,yeaicc/roslyn,dpoeschl/roslyn,Giftednewt/roslyn,MichalStrehovsky/roslyn,natidea/roslyn,jamesqo/roslyn,bkoelman/roslyn,bbarry/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,KiloBravoLima/roslyn,DustinCampbell/roslyn,srivatsn/roslyn,wvdd007/roslyn,xasx/roslyn,aelij/roslyn,xoofx/roslyn,jhendrixMSFT/roslyn,kelltrick/roslyn,tannergooding/roslyn,mattscheffer/roslyn,yeaicc/roslyn,Giftednewt/roslyn,cston/roslyn,KevinH-MS/roslyn,Hosch250/roslyn,dpoeschl/roslyn,jeffanders/roslyn,davkean/roslyn,natidea/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mgoertz-msft/roslyn,KevinRansom/roslyn,abock/roslyn,KirillOsenkov/roslyn,Shiney/roslyn,AArnott/roslyn,eriawan/roslyn,zooba/roslyn,bbarry/roslyn,VSadov/roslyn,khyperia/roslyn,lorcanmooney/roslyn,MichalStrehovsky/roslyn,swaroop-sridhar/roslyn,bkoelman/roslyn,srivatsn/roslyn,Pvlerick/roslyn,mattscheffer/roslyn,balajikris/roslyn,stephentoub/roslyn,vslsnap/roslyn,pdelvo/roslyn,mattwar/roslyn,TyOverby/roslyn,genlu/roslyn,mmitche/roslyn,Shiney/roslyn,mgoertz-msft/roslyn,diryboy/roslyn,jamesqo/roslyn,mmitche/roslyn,mavasani/roslyn,mattscheffer/roslyn,drognanar/roslyn,abock/roslyn,tvand7093/roslyn,lorcanmooney/roslyn,agocke/roslyn,CaptainHayashi/roslyn,amcasey/roslyn,wvdd007/roslyn,ErikSchierboom/roslyn,akrisiun/roslyn,aelij/roslyn,panopticoncentral/roslyn,MichalStrehovsky/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,AlekseyTs/roslyn,nguerrera/roslyn,brettfo/roslyn,CaptainHayashi/roslyn,robinsedlaczek/roslyn,agocke/roslyn,VSadov/roslyn,jamesqo/roslyn,tmat/roslyn,tannergooding/roslyn,jkotas/roslyn,brettfo/roslyn,jkotas/roslyn,brettfo/roslyn,DustinCampbell/roslyn,ljw1004/roslyn,genlu/roslyn,AnthonyDGreen/roslyn,mattwar/roslyn,aelij/roslyn,akrisiun/roslyn,Pvlerick/roslyn,MattWindsor91/roslyn,khyperia/roslyn,sharwell/roslyn,orthoxerox/roslyn,Hosch250/roslyn,vslsnap/roslyn,ljw1004/roslyn,nguerrera/roslyn,dpoeschl/roslyn,amcasey/roslyn,heejaechang/roslyn,abock/roslyn,weltkante/roslyn,paulvanbrenk/roslyn,AArnott/roslyn,KevinH-MS/roslyn,akrisiun/roslyn,AlekseyTs/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,srivatsn/roslyn | src/VisualStudio/Setup.Next/AssemblyRedirects.cs | src/VisualStudio/Setup.Next/AssemblyRedirects.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 Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Roslyn.VisualStudio.Setup;
[assembly: ProvideRoslynBindingRedirection("Microsoft.CodeAnalysis.EditorFeatures.Next.dll")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.VisualStudio.CallHierarchy.Package.Definitions",
GenerateCodeBase = false,
PublicKeyToken = "31BF3856AD364E35",
OldVersionLowerBound = "14.0.0.0",
OldVersionUpperBound = "14.9.9.9",
NewVersion = "15.0.0.0")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\StreamJsonRpc.dll")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.ServiceHub.Client.dll")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Newtonsoft.Json.dll")]
| // 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 Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Roslyn.VisualStudio.Setup;
[assembly: ProvideRoslynBindingRedirection("Microsoft.CodeAnalysis.EditorFeatures.Next.dll")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.VisualStudio.CallHierarchy.Package.Definitions",
GenerateCodeBase = false,
PublicKeyToken = "31BF3856AD364E35",
OldVersionLowerBound = "14.0.0.0",
OldVersionUpperBound = "14.9.9.9",
NewVersion = "15.0.0.0")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\StreamJsonRpc.dll")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.ServiceHub.Client.dll")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Newtonsoft.Json.dll")]
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.Shell.Framework.dll")] | mit | C# |
e79dde65ff33edda4ccee52f48a9aab11413d20b | Add lost resources.designer | gdv1811/PdfCodeEditor | PdfCodeEditor/Properties/Resources.Designer.cs | PdfCodeEditor/Properties/Resources.Designer.cs | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PdfCodeEditor.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PdfCodeEditor.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon PdfCodeEditor {
get {
object obj = ResourceManager.GetObject("PdfCodeEditor", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}
| mit | C# | |
1287726078cb92509b1c39aa4a387b6179badad2 | add emulator client | csutorasa/XOutput,csutorasa/XOutput,csutorasa/XOutput,csutorasa/XOutput | XOutput.Client/Emulation/EmulationClient.cs | XOutput.Client/Emulation/EmulationClient.cs | using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using XOutput.Api.Emulation;
using XOutput.Api.Help;
namespace XOutput.Client.Emulation
{
public class EmulationClient : HttpJsonClient
{
public EmulationClient(IHttpClientProvider clientProvider) : base(clientProvider)
{
}
public Task<Dictionary<string, EmulatorResponse>> GetEmulators(int timeoutMillis = 1000)
{
return GetAsync<Dictionary<string, EmulatorResponse>>("/api/emulators", GetToken(timeoutMillis));
}
public Task<IEnumerable<Api.Devices.DeviceInfo>> GetControllers(int timeoutMillis = 1000)
{
return GetAsync<IEnumerable<Api.Devices.DeviceInfo>>("/api/controllers", GetToken(timeoutMillis));
}
}
}
| mit | C# | |
5ee9b4222c62b54c9556e2b400042d18e81b4cfa | add interface | ceee/PocketSharp | PocketSharp/IPocketClient.cs | PocketSharp/IPocketClient.cs | using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PocketSharp
{
class IPocketClient
{
/// <summary>
/// base URL for the API
/// </summary>
Uri BaseUrl { get; set; }
/// <summary>
/// Accessor for the Pocket API key
/// see: http://getpocket.com/developer
/// </summary>
string ConsumerKey { get; set; }
/// <summary>
/// Makes a HTTP REST request to the API
/// </summary>
/// <param name="request">The request.</param>
/// <returns></returns>
IRestResponse Request(RestRequest request);
/// <summary>
/// Makes a typed HTTP REST request to the API
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="request">The request.</param>
/// <returns></returns>
T Request<T>(RestRequest request) where T : class, new();
}
}
| mit | C# | |
478f5a87afc4666a18d7cb84e304e6004d070cc9 | Create StringFrequencyChallenge.cs | Zephyr-Koo/sololearn-challenge | StringFrequencyChallenge.cs | StringFrequencyChallenge.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// https://www.sololearn.com/Discuss/654194/?ref=app
namespace SoloLearn
{
class Program
{
static void Main(string[] zephyr_koo)
{
var input = "PROGRAMMING"; // Console.ReadLine();
DisplayCharacterFrequency(input);
}
static void DisplayCharacterFrequency(string str)
{
foreach (var character in str.Distinct())
{
Console.WriteLine($"{ character } = { str.Count(c => c == character) }");
}
}
}
}
| apache-2.0 | C# | |
f01c1b27d8e9b5e39bed78c0ecb3bc43d4403c47 | Set max and min ( not used yet ) | bradphelan/SketchSolve.NET,bradphelan/SketchSolve.NET,bradphelan/SketchSolve.NET | SketchSolveC#/ObjectMixins.cs | SketchSolveC#/ObjectMixins.cs | using System;
namespace SketchSolveC
{
public class ObjectMixins
{
public ObjectMixins ()
{
}
}
}
| bsd-3-clause | C# | |
59085485ea84da9542821134b54d335195be0149 | Add support for CGLContext | PlayScriptRedux/monomac,dlech/monomac | src/OpenGL/OpenTK/Graphics/OpenGL/CGLContext.cs | src/OpenGL/OpenTK/Graphics/OpenGL/CGLContext.cs | //
// CGLContext.cs: Implements the managed CGLContext
//
// Authors: Mono Team
//
// Copyright 2009 Novell, Inc
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using MonoMac.ObjCRuntime;
using MonoMac.Foundation;
namespace MonoMac.OpenGL {
public class CGLContext : INativeObject, IDisposable {
internal IntPtr handle;
public CGLContext (IntPtr handle)
{
if (handle == IntPtr.Zero)
throw new Exception ("Invalid parameters to context creation");
CGLRetainContext (handle);
this.handle = handle;
}
internal CGLContext ()
{
}
[Preserve (Conditional=true)]
internal CGLContext (IntPtr handle, bool owns)
{
if (!owns)
CGLRetainContext (handle);
this.handle = handle;
}
~CGLContext ()
{
Dispose (false);
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
public IntPtr Handle {
get { return handle; }
}
[DllImport (Constants.OpenGLLibrary)]
extern static void CGLRetainContext (IntPtr handle);
[DllImport (Constants.OpenGLLibrary)]
extern static void CGLReleaseContext (IntPtr handle);
protected virtual void Dispose (bool disposing)
{
if (handle != IntPtr.Zero){
CGLReleaseContext (handle);
handle = IntPtr.Zero;
}
}
[DllImport (Constants.OpenGLLibrary)]
extern static CGLErrorCode CGLLockContext (IntPtr ctx);
public CGLErrorCode Lock ()
{
return CGLLockContext (this.handle);
}
[DllImport (Constants.OpenGLLibrary)]
extern static CGLErrorCode CGLUnlockContext (IntPtr ctx);
public CGLErrorCode Unlock ()
{
return CGLUnlockContext (this.handle);
}
}
}
| apache-2.0 | C# | |
4d684dc090be8ae51b05649b578a5ea2c4c92ac1 | Create ServiceCollectionExtensions.cs | tiksn/TIKSN-Framework | TIKSN.Framework.Android/DependencyInjection/ServiceCollectionExtensions.cs | TIKSN.Framework.Android/DependencyInjection/ServiceCollectionExtensions.cs | using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using TIKSN.FileSystem;
namespace TIKSN.DependencyInjection
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddFrameworkPlatform(this IServiceCollection services)
{
services.AddFrameworkCore();
services.TryAddSingleton<IKnownFolders, KnownFolders>();
return services;
}
}
} | mit | C# | |
77bf17c1a5221f52f8306247a8ee597682ad9d36 | Create _Layout.cshtml | CarmelSoftware/Data-Repository-with-Data-Caching-in-ASP.NET-MVC-4,kelong/Data-Repository-with-Data-Caching-in-ASP.NET-MVC-4 | Views/Shared/_Layout.cshtml | Views/Shared/_Layout.cshtml | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" />
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="container">
<div class="jumbotron">
<h2>Data Repository With Caching</h2>
</div>
<div class="jumbotron">@RenderBody()</div></div>
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)
</body>
</html>
| mit | C# | |
51e5204a6791e1e00adb1ccdb55593955ddf1292 | Add forgotten file | TomDataworks/opensim,TomDataworks/opensim,TomDataworks/opensim,TomDataworks/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TomDataworks/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TomDataworks/opensim,RavenB/opensim,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TomDataworks/opensim,RavenB/opensim,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim | OpenSim/Framework/EntityTransferContext.cs | OpenSim/Framework/EntityTransferContext.cs | /*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Framework
{
public class EntityTransferContext
{
public EntityTransferContext()
{
InboundVersion = VersionInfo.SimulationServiceVersionAcceptedMax;
OutboundVersion = VersionInfo.SimulationServiceVersionSupportedMax;
WearablesCount = -1;
}
public float InboundVersion { get; set; }
public float OutboundVersion { get; set; }
public int WearablesCount { get; set; }
public OSD Pack()
{
OSDMap data = new OSDMap();
data["InboundVersion"] = OSD.FromReal(InboundVersion);
data["OutboundVersion"] = OSD.FromReal(OutboundVersion);
data["WearablesCount"] = OSD.FromInteger(WearablesCount);
return data;
}
public void Unpack(OSD data)
{
OSDMap map = (OSDMap)data;
if (map.ContainsKey("InboundVersion"))
InboundVersion = (float)map["InboundVersion"].AsReal();
if (map.ContainsKey("OutboundVersion"))
OutboundVersion = (float)map["OutboundVersion"].AsReal();
if (map.ContainsKey("WearablesCount"))
WearablesCount = map["WearablesCount"].AsInteger();
}
}
}
| bsd-3-clause | C# | |
e7773ed8438fd9bf25d9a2f0e10b5881e25aa1da | Create Helm.cs | TeamLockheed/LockheedTheGame | Lockheed_Inventory/Slots/Helm.cs | Lockheed_Inventory/Slots/Helm.cs | namespace Lockheed_Inventory
{
using System;
using System.Collections.Generic;
using Slots.Interfaces;
public class Helm : Slot, IArmor
{
private List<Item> armorList;
public Helm() :
base()
{
}
public override void Equip(Item item)
{
this.armorList.Add(item);
this.FreeSlot = false;
}
public override void UnEquip(Item item)
{
this.armorList.Remove(item);
this.FreeSlot = true;
}
public List<Item> ArmorList
{
get { return this.armorList; }
set { this.armorList = value; }
}
public override bool FreeSlot
{
get { return this.freeSlot; }
set { this.freeSlot = value; }
}
}
}
| mit | C# | |
0127cce22903326274c4e40ea6ccc0220c30938d | add detect overrided prefab object | syrntms/HierarchyIconExtension | Editor/HierarchyIconExtension/Feature/OverridePrefabIconExtension.cs | Editor/HierarchyIconExtension/Feature/OverridePrefabIconExtension.cs | using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
using System;
using System.Linq;
[InitializeOnLoad]
public class OverridePrefabIconExtension : IHierarchyIconExtensionFeature {
private static Texture2D iconTexture;
static OverridePrefabIconExtension()
{
HierarchyIconExtension.AddExtension(new OverridePrefabIconExtension());
iconTexture = AssetDatabase.LoadAssetAtPath(
"Assets/HierarchyIconExtension/Editor/HierarchyIconExtension/Feature/Bob.png",
typeof(Texture2D)
) as Texture2D;
}
public int GetPriority()
{
return 1;
}
public Texture2D GetDisplayIcon(GameObject go)
{
var root = PrefabUtility.FindPrefabRoot(go);
if (root != go) {
return null;
}
bool isDisplay = hasOverrideProperty(go)
|| hasOverrideTransformProperty(go);
return isDisplay ? iconTexture : null;
}
private bool hasOverrideProperty(GameObject go)
{
var components = go.GetComponents<Component>();
if (components.Count() <= 0) {
return false;
}
//foreach is for avoiding crash to serialize ugui classes version_uity_4.6.3
foreach (var component in components) {
if (component is Transform) {
continue;
}
var serializedObject = new SerializedObject(component);
var iterator = serializedObject.GetIterator();
while (iterator.Next(true)) {
if (iterator.prefabOverride) {
return true;
}
}
}
return false;
}
private bool hasOverrideTransformProperty(GameObject go)
{
var components = go.GetComponents<Transform>();
if (components.Count() <= 0) {
return false;
}
var serializedObject = new SerializedObject(components);
var iterator = serializedObject.GetIterator();
//these property is automatic overrided when instance was put on hierarchy
string[] ignorePropertyNames = {
"m_LocalRotation",
"m_LocalPosition",
"m_RootOrder",
"m_AnchorMin",
"m_AnchorMax",
"m_AnchoredPosition",
"m_SizeDelta",
"m_Pivot",
};
bool isSkip = false;
while (true) {
bool isContinue = iterator.Next(!isSkip);
if (!isContinue) {
break;
}
isSkip = ignorePropertyNames.Contains(iterator.name);
if (isSkip) {
continue;
}
if (iterator.prefabOverride) {
Debug.Log(iterator.name);
return true;
}
}
return false;
}
}
| mit | C# | |
ff5faa5a28f02da24240e53053b48d7febff32ed | Add tests for multiple calls | northspb/RawRabbit,pardahlman/RawRabbit | src/RawRabbit.IntegrationTests/SimpleUse/MultipleRequestsTests.cs | src/RawRabbit.IntegrationTests/SimpleUse/MultipleRequestsTests.cs | using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using RawRabbit.Client;
using RawRabbit.IntegrationTests.TestMessages;
using Xunit;
namespace RawRabbit.IntegrationTests.SimpleUse
{
public class MultipleRequestsTests
{
[Fact]
public async void Should_Just_Work()
{
/* Setup */
const int numberOfCalls = 1000;
var bag = new ConcurrentBag<Guid>();
var requester = BusClientFactory.CreateDefault();
var responder = BusClientFactory.CreateDefault();
await responder.RespondAsync<FirstRequest, FirstResponse>((req, i) =>
Task.FromResult(new FirstResponse { Infered = Guid.NewGuid() })
);
/* Test */
var sw = new Stopwatch();
sw.Start();
for (var i = 0; i < numberOfCalls; i++)
{
var response = await requester.RequestAsync<FirstRequest, FirstResponse>();
bag.Add(response.Infered);
}
sw.Stop();
/* Assert */
Assert.Equal(numberOfCalls, bag.Count);
}
}
}
| mit | C# | |
2c9711a88b95e1bc1fc3aa0d49da5ac677366b1a | Create /Models/DatabaseModels/Book Class. | Programazing/Open-School-Library,Programazing/Open-School-Library | src/Open-School-Library/Models/DatabaseModels/Book.cs | src/Open-School-Library/Models/DatabaseModels/Book.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Open_School_Library.Models.DatabaseModels
{
public class Book
{
public int BookID { get; set; }
public string Title { get; set; }
public string SubTitle { get; set; }
public string Author { get; set; }
public int GenreID { get; set; }
public int DeweyID { get; set; }
public int ISBN { get; set; }
}
}
| mit | C# | |
3ab07f5ef33a687b75753f83a270a8a8dd66b679 | Add display template for Soldier | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | Battery-Commander.Web/Views/Shared/DisplayTemplates/Soldier.cshtml | Battery-Commander.Web/Views/Shared/DisplayTemplates/Soldier.cshtml | @model Soldier
@{
var display = $"{Model.Rank.ShortName()} {Model.LastName}, {Model.FirstName}";
}
<div>@display</div> | mit | C# | |
8fd43238f93a7507e1565b97bfb22c3c337e29e8 | Create SystemProcessServices.cs | siuccwd/IOER,siuccwd/IOER,siuccwd/IOER | Services/Isle.BizServices/SystemProcessServices.cs | Services/Isle.BizServices/SystemProcessServices.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity = LRWarehouse.Business.SystemProcess;
using LRWarehouse.DAL;
namespace Isle.BizServices
{
public class SystemProcessServices
{
SystemProcessManager systemProcessManager;
public SystemProcessServices()
{
systemProcessManager = new SystemProcessManager();
}
public int Create(Entity entity, ref string status)
{
return systemProcessManager.Create(entity, ref status);
}
public Entity Get(int id, ref string status)
{
return systemProcessManager.Get(id, ref status);
}
public Entity GetByCode(string code, ref string status)
{
return systemProcessManager.GetByCode(code, ref status);
}
public string Update(Entity entity)
{
return systemProcessManager.Update(entity);
}
public string UpdateLastRun(Entity entity)
{
return systemProcessManager.UpdateLastRun(entity);
}
}
}
| apache-2.0 | C# | |
bd210af413dc13da3240c9b9c6e94a5b8776d0b9 | Remove DocValues numeric fielddata format | elastic/elasticsearch-net,TheFireCookie/elasticsearch-net,CSGOpenSource/elasticsearch-net,TheFireCookie/elasticsearch-net,adam-mccoy/elasticsearch-net,adam-mccoy/elasticsearch-net,CSGOpenSource/elasticsearch-net,adam-mccoy/elasticsearch-net,TheFireCookie/elasticsearch-net,elastic/elasticsearch-net,CSGOpenSource/elasticsearch-net | src/Nest/Modules/Indices/Fielddata/Numeric/NumericFielddataFormat.cs | src/Nest/Modules/Indices/Fielddata/Numeric/NumericFielddataFormat.cs | using System.Runtime.Serialization;
namespace Nest
{
public enum NumericFielddataFormat
{
[EnumMember(Value = "array")]
Array,
[EnumMember(Value = "disabled")]
Disabled
}
}
| using System.Runtime.Serialization;
namespace Nest
{
public enum NumericFielddataFormat
{
[EnumMember(Value = "array")]
Array,
[EnumMember(Value = "doc_values")]
DocValues,
[EnumMember(Value = "disabled")]
Disabled
}
}
| apache-2.0 | C# |
27a5609bfe5435ce349d24f1bf0590a631964f1d | Add CommandExecutorTest.cs | WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common | samples/DotNetCoreSample/CommandExecutorTest.cs | samples/DotNetCoreSample/CommandExecutorTest.cs | // Copyright (c) Weihan Li. All rights reserved.
// Licensed under the MIT license.
using static WeihanLi.Common.Helpers.CommandExecutor;
namespace DotNetCoreSample;
internal class CommandExecutorTest
{
public static void MainTest()
{
var result = ExecuteAndCapture("hostname");
result.EnsureSuccessfulExitCode();
Console.WriteLine(result.StandardOut);
}
}
| mit | C# | |
d71dc42c1d20b7256b98c85f85701105a51e047d | Create ForumContext | DimitarDKirov/Forum-Paulo-Coelho,DimitarDKirov/Forum-Paulo-Coelho,DimitarDKirov/Forum-Paulo-Coelho | Forum-Paulo-Coelho/DataLayer/ForumContext.cs | Forum-Paulo-Coelho/DataLayer/ForumContext.cs | namespace DataLayer
{
using ForumSystem.Models;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ForumContext : DbContext
{
public ForumContext()
: base("ForumDb")
{
}
public DbSet<User> Users { get; set; }
public DbSet<Category> Categories { get; set; }
public DbSet<Post> Posts { get; set; }
public DbSet<Thread> Threads { get; set; }
public DbSet<Comment> Comments { get; set; }
public DbSet<Vote> Votes { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<User>()
.Property(usr => usr.SessionKey)
.IsFixedLength()
.HasMaxLength(50);
base.OnModelCreating(modelBuilder);
}
}
} | mit | C# | |
091a671fa37dab287e854b7b561c0dbe885e3fe9 | Add posts service | Branimir123/PhotoLife,Branimir123/PhotoLife,Branimir123/PhotoLife | PhotoLife/PhotoLife.Services/PostsService.cs | PhotoLife/PhotoLife.Services/PostsService.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
using PhotoLife.Services.Contracts;
namespace PhotoLife.Services
{
public class PostsService: IPostService
{
private readonly IRepository<Post> postsRepository;
private readonly IUnitOfWork unitOfWork;
public PostsService(
IRepository<Post> postsRepository,
IUnitOfWork unitOfWork)
{
if (postsRepository == null)
{
throw new ArgumentNullException("postsRepository");
}
if (unitOfWork == null)
{
throw new ArgumentNullException("unitOfWorks");
}
this.postsRepository = postsRepository;
this.unitOfWork = unitOfWork;
}
public Post GetPostById(string id)
{
return this.postsRepository.GetById(id);
}
}
}
| mit | C# | |
da9c23f3478356b9183fecbe82d0d416c039a26d | Add beatmap availability tracker component for multiplayer | smoogipoo/osu,peppy/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu | osu.Game/Online/Rooms/MultiplayerBeatmapTracker.cs | osu.Game/Online/Rooms/MultiplayerBeatmapTracker.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.Linq;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
namespace osu.Game.Online.Rooms
{
public class MultiplayerBeatmapTracker : DownloadTrackingComposite<BeatmapSetInfo, BeatmapManager>
{
public readonly IBindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
/// <summary>
/// The availability state of the currently selected playlist item.
/// </summary>
public IBindable<BeatmapAvailability> Availability => availability;
private readonly Bindable<BeatmapAvailability> availability = new Bindable<BeatmapAvailability>();
public MultiplayerBeatmapTracker()
{
State.BindValueChanged(_ => updateAvailability());
Progress.BindValueChanged(_ => updateAvailability());
updateAvailability();
}
protected override void LoadComplete()
{
base.LoadComplete();
SelectedItem.BindValueChanged(item => Model.Value = item.NewValue?.Beatmap.Value.BeatmapSet, true);
}
protected override bool VerifyDatabasedModel(BeatmapSetInfo databasedSet)
{
int? beatmapId = SelectedItem.Value.Beatmap.Value.OnlineBeatmapID;
string checksum = SelectedItem.Value.Beatmap.Value.MD5Hash;
BeatmapInfo matchingBeatmap;
if (databasedSet.Beatmaps == null)
{
// The given databased beatmap set is not passed in a usable state to check with.
// Perform a full query instead, as per https://github.com/ppy/osu/pull/11415.
matchingBeatmap = Manager.QueryBeatmap(b => b.OnlineBeatmapID == beatmapId && b.MD5Hash == checksum);
return matchingBeatmap != null;
}
matchingBeatmap = databasedSet.Beatmaps.FirstOrDefault(b => b.OnlineBeatmapID == beatmapId && b.MD5Hash == checksum);
return matchingBeatmap != null;
}
protected override bool IsModelAvailableLocally()
{
int? beatmapId = SelectedItem.Value.Beatmap.Value.OnlineBeatmapID;
string checksum = SelectedItem.Value.Beatmap.Value.MD5Hash;
var beatmap = Manager.QueryBeatmap(b => b.OnlineBeatmapID == beatmapId && b.MD5Hash == checksum);
return beatmap?.BeatmapSet.DeletePending == false;
}
private void updateAvailability()
{
switch (State.Value)
{
case DownloadState.NotDownloaded:
availability.Value = BeatmapAvailability.NotDownloaded();
break;
case DownloadState.Downloading:
availability.Value = BeatmapAvailability.Downloading(Progress.Value);
break;
case DownloadState.Importing:
availability.Value = BeatmapAvailability.Importing();
break;
case DownloadState.LocallyAvailable:
availability.Value = BeatmapAvailability.LocallyAvailable();
break;
default:
throw new ArgumentOutOfRangeException(nameof(State));
}
}
}
}
| mit | C# | |
234fdf8942dd61346ae1643a56326e92a52df1f4 | Disable warning about unused class. | sitofabi/duplicati,mnaiman/duplicati,mnaiman/duplicati,duplicati/duplicati,duplicati/duplicati,sitofabi/duplicati,sitofabi/duplicati,sitofabi/duplicati,duplicati/duplicati,sitofabi/duplicati,mnaiman/duplicati,duplicati/duplicati,mnaiman/duplicati,duplicati/duplicati,mnaiman/duplicati | Duplicati/Library/Backend/SharePoint/OneDriveForBusinessBackend.cs | Duplicati/Library/Backend/SharePoint/OneDriveForBusinessBackend.cs | #region Disclaimer / License
// Copyright (C) 2016, The Duplicati Team
// http://www.duplicati.com, info@duplicati.com
//
// 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
//
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Duplicati.Library.Interface;
namespace Duplicati.Library.Backend
{
/// <summary>
/// Shadow class above SharePointBackend to provide an extra protocol key for OneDrive for Business.
/// Right now, OneDrive for Business *IS* SharePoint. But if MS turns funny sometimes in the future and
/// moves away from SharePoint as OD4B base, this allows to reimplement it without breaking existing
/// configurations...
/// </summary>
// ReSharper disable once UnusedMember.Global
// This constructor is needed by the BackendLoader.
public class OneDriveForBusinessBackend : SharePointBackend
{
public override string ProtocolKey
{
get { return "od4b"; }
}
public override string DisplayName
{
get { return Strings.OneDriveForBusiness.DisplayName; }
}
public override string Description
{
get { return Strings.OneDriveForBusiness.Description; }
}
public OneDriveForBusinessBackend()
:base ()
{ }
public OneDriveForBusinessBackend(string url, Dictionary<string, string> options)
: base(url, options)
{ }
}
}
| #region Disclaimer / License
// Copyright (C) 2016, The Duplicati Team
// http://www.duplicati.com, info@duplicati.com
//
// 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
//
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Duplicati.Library.Interface;
namespace Duplicati.Library.Backend
{
/// <summary>
/// Shadow class above SharePointBackend to provide an extra protocol key for OneDrive for Business.
/// Right now, OneDrive for Business *IS* SharePoint. But if MS turns funny sometimes in the future and
/// moves away from SharePoint as OD4B base, this allows to reimplement it without breaking existing
/// configurations...
/// </summary>
public class OneDriveForBusinessBackend : SharePointBackend
{
public override string ProtocolKey
{
get { return "od4b"; }
}
public override string DisplayName
{
get { return Strings.OneDriveForBusiness.DisplayName; }
}
public override string Description
{
get { return Strings.OneDriveForBusiness.Description; }
}
public OneDriveForBusinessBackend()
:base ()
{ }
public OneDriveForBusinessBackend(string url, Dictionary<string, string> options)
: base(url, options)
{ }
}
}
| lgpl-2.1 | C# |
572e95097a433df02f5ae531d7f0cb58c44c5d57 | add PublishedOnCreateOption | vinhch/BizwebSharp | src/BizwebSharp/Options/PublishedOnCreateOption.cs | src/BizwebSharp/Options/PublishedOnCreateOption.cs | using BizwebSharp.Infrastructure;
using Newtonsoft.Json;
namespace BizwebSharp.Options
{
public class PublishedOnCreateOption : Parameterizable
{
[JsonProperty("published")]
public bool? Published { get; set; }
}
}
| mit | C# | |
fd24147afa9c7c6e40f50ad0038e7eb1432d1b82 | Add initial test for checking that specifying a parameter in LSL state_entry() generates a syntax error. | ft-/arribasim-dev-tests,ft-/arribasim-dev-extras,TomDataworks/opensim,ft-/opensim-optimizations-wip,TomDataworks/opensim,ft-/opensim-optimizations-wip-extras,OpenSimian/opensimulator,justinccdev/opensim,QuillLittlefeather/opensim-1,OpenSimian/opensimulator,BogusCurry/arribasim-dev,ft-/opensim-optimizations-wip-extras,justinccdev/opensim,ft-/arribasim-dev-tests,ft-/arribasim-dev-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip-extras,OpenSimian/opensimulator,RavenB/opensim,QuillLittlefeather/opensim-1,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-extras,OpenSimian/opensimulator,BogusCurry/arribasim-dev,Michelle-Argus/ArribasimExtract,TomDataworks/opensim,M-O-S-E-S/opensim,RavenB/opensim,TomDataworks/opensim,justinccdev/opensim,ft-/arribasim-dev-tests,QuillLittlefeather/opensim-1,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-tests,ft-/opensim-optimizations-wip-tests,Michelle-Argus/ArribasimExtract,ft-/arribasim-dev-extras,ft-/arribasim-dev-extras,OpenSimian/opensimulator,Michelle-Argus/ArribasimExtract,M-O-S-E-S/opensim,QuillLittlefeather/opensim-1,justinccdev/opensim,OpenSimian/opensimulator,QuillLittlefeather/opensim-1,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim,Michelle-Argus/ArribasimExtract,RavenB/opensim,BogusCurry/arribasim-dev,OpenSimian/opensimulator,TomDataworks/opensim,QuillLittlefeather/opensim-1,RavenB/opensim,justinccdev/opensim,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-extras,QuillLittlefeather/opensim-1,M-O-S-E-S/opensim,justinccdev/opensim,ft-/opensim-optimizations-wip,ft-/opensim-optimizations-wip,BogusCurry/arribasim-dev,M-O-S-E-S/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,ft-/arribasim-dev-tests,TomDataworks/opensim,M-O-S-E-S/opensim,Michelle-Argus/ArribasimExtract,RavenB/opensim,BogusCurry/arribasim-dev,TomDataworks/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip-tests,ft-/opensim-optimizations-wip-tests,ft-/opensim-optimizations-wip-tests,BogusCurry/arribasim-dev,Michelle-Argus/ArribasimExtract | OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/LSL_EventTests.cs | OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/LSL_EventTests.cs | /*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using NUnit.Framework;
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
using OpenSim.Tests.Common;
namespace OpenSim.Region.ScriptEngine.Shared.Tests
{
public class LSL_EventTests : OpenSimTestCase
{
[Test]
public void TestStateEntryEvent()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
CSCodeGenerator cg = new CSCodeGenerator();
cg.Convert("default { state_entry() {} }");
{
bool gotException = false;
try
{
cg.Convert("default { state_entry(integer n) {} }");
}
catch (Exception )
{
gotException = true;
}
Assert.That(gotException, Is.True);
}
}
}
} | bsd-3-clause | C# | |
42215109ffe5c759dbb5eb04282532fbd13da1f7 | add job project tests | mzrimsek/resume-site-api | Test.Integration/ControllerTests/JobProjectControllerTests/AddJobProjectShould.cs | Test.Integration/ControllerTests/JobProjectControllerTests/AddJobProjectShould.cs | using Microsoft.AspNetCore.TestHost;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Net;
using System.Net.Http;
using Test.Integration.TestHelpers;
using Web.Models.JobModels;
using Web.Models.JobProjectModels;
namespace Test.Integration.ControllerTests.JobProjectControllerTests
{
[TestClass]
public class AddJobProjectShould
{
private TestServer _server;
private HttpClient _client;
private int _jobId;
[TestInitialize]
public void SetUp()
{
(_server, _client) = new TestSetupHelper().GetTestServerAndClient();
}
[TestCleanup]
public void TearDown()
{
var _ = _client.DeleteAsync($"{ControllerRouteEnum.JOB}/{_jobId}").Result;
_client.Dispose();
_server.Dispose();
}
[TestMethod]
public void ReturnStatusCodeCreated_WhenGivenValidModel()
{
var jobModel = TestObjectCreator.GetAddUpdateJobViewModel();
var requestContent = RequestHelper.GetRequestContentFromObject(jobModel);
var jobPostResponse = _client.PostAsync($"{ControllerRouteEnum.JOB}", requestContent).Result;
_jobId = RequestHelper.GetObjectFromResponseContent<JobViewModel>(jobPostResponse).Id;
var jobProjectModel = TestObjectCreator.GetAddUpdateJobProjectViewModel(_jobId);
requestContent = RequestHelper.GetRequestContentFromObject(jobProjectModel);
var jobProjectPostReponse = _client.PostAsync($"{ControllerRouteEnum.JOB_PROJECT}", requestContent).Result;
Assert.AreEqual(HttpStatusCode.Created, jobProjectPostReponse.StatusCode);
}
[TestMethod]
public void ReturnStatusCodeBadRequest_WhenGivenInvalidModel_WithInvalidName()
{
var jobModel = TestObjectCreator.GetAddUpdateJobViewModel();
var requestContent = RequestHelper.GetRequestContentFromObject(jobModel);
var jobPostResponse = _client.PostAsync($"{ControllerRouteEnum.JOB}", requestContent).Result;
_jobId = RequestHelper.GetObjectFromResponseContent<JobViewModel>(jobPostResponse).Id;
var jobProjectModel = TestObjectCreator.GetAddUpdateJobProjectViewModel(_jobId, null);
requestContent = RequestHelper.GetRequestContentFromObject(jobProjectModel);
var response = _client.PostAsync($"{ControllerRouteEnum.JOB_PROJECT}", requestContent).Result;
Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
}
[TestMethod]
public void ReturnStatusCodeBadRequest_WhenGivenInvalidModel_WithInvalidJobId()
{
var model = TestObjectCreator.GetAddUpdateJobProjectViewModel(0);
var requestContent = RequestHelper.GetRequestContentFromObject(model);
var response = _client.PostAsync($"{ControllerRouteEnum.JOB_PROJECT}", requestContent).Result;
Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
}
[TestMethod]
public void ReturnStatusCodeNotFound_WhenGivenValidModel_WithNonExistentJobId()
{
var model = TestObjectCreator.GetAddUpdateJobProjectViewModel(1);
var requestContent = RequestHelper.GetRequestContentFromObject(model);
var response = _client.PostAsync($"{ControllerRouteEnum.JOB_PROJECT}", requestContent).Result;
Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
}
[TestMethod]
public void ReturnCorrectViewModel()
{
var jobModel = TestObjectCreator.GetAddUpdateJobViewModel();
var requestContent = RequestHelper.GetRequestContentFromObject(jobModel);
var jobPostResponse = _client.PostAsync($"{ControllerRouteEnum.JOB}", requestContent).Result;
_jobId = RequestHelper.GetObjectFromResponseContent<JobViewModel>(jobPostResponse).Id;
var jobProjectModel = TestObjectCreator.GetAddUpdateJobProjectViewModel(_jobId);
requestContent = RequestHelper.GetRequestContentFromObject(jobProjectModel);
var jobProjectPostReponse = _client.PostAsync($"{ControllerRouteEnum.JOB_PROJECT}", requestContent).Result;
var serializedContent = RequestHelper.GetObjectFromResponseContent<JobProjectViewModel>(jobProjectPostReponse);
var isCorrectViewModel = AssertHelper.AreJobProjectViewModelsEqual(jobProjectModel, serializedContent);
Assert.IsTrue(isCorrectViewModel);
}
}
} | mit | C# | |
66f106f6770f21eb5b6b6e4a607a6f724884e093 | Remove unused usings | mattwar/roslyn,dotnet/roslyn,swaroop-sridhar/roslyn,balajikris/roslyn,KevinRansom/roslyn,MattWindsor91/roslyn,mavasani/roslyn,orthoxerox/roslyn,mattscheffer/roslyn,dpoeschl/roslyn,heejaechang/roslyn,mmitche/roslyn,weltkante/roslyn,VSadov/roslyn,jeffanders/roslyn,jhendrixMSFT/roslyn,genlu/roslyn,MichalStrehovsky/roslyn,tannergooding/roslyn,AnthonyDGreen/roslyn,CyrusNajmabadi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,MattWindsor91/roslyn,genlu/roslyn,eriawan/roslyn,brettfo/roslyn,OmarTawfik/roslyn,ErikSchierboom/roslyn,zooba/roslyn,mattscheffer/roslyn,lorcanmooney/roslyn,kelltrick/roslyn,jeffanders/roslyn,swaroop-sridhar/roslyn,agocke/roslyn,jamesqo/roslyn,gafter/roslyn,cston/roslyn,DustinCampbell/roslyn,yeaicc/roslyn,panopticoncentral/roslyn,shyamnamboodiripad/roslyn,aelij/roslyn,agocke/roslyn,KevinH-MS/roslyn,mattscheffer/roslyn,ljw1004/roslyn,jkotas/roslyn,jmarolf/roslyn,paulvanbrenk/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,ErikSchierboom/roslyn,mmitche/roslyn,nguerrera/roslyn,mattwar/roslyn,akrisiun/roslyn,weltkante/roslyn,jhendrixMSFT/roslyn,physhi/roslyn,jamesqo/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,KiloBravoLima/roslyn,Shiney/roslyn,davkean/roslyn,AmadeusW/roslyn,wvdd007/roslyn,mgoertz-msft/roslyn,Giftednewt/roslyn,KirillOsenkov/roslyn,genlu/roslyn,VSadov/roslyn,jasonmalinowski/roslyn,eriawan/roslyn,Pvlerick/roslyn,bartdesmet/roslyn,Pvlerick/roslyn,KevinH-MS/roslyn,vslsnap/roslyn,pdelvo/roslyn,natidea/roslyn,aelij/roslyn,Hosch250/roslyn,Hosch250/roslyn,drognanar/roslyn,dpoeschl/roslyn,Giftednewt/roslyn,ljw1004/roslyn,xoofx/roslyn,tmat/roslyn,lorcanmooney/roslyn,jkotas/roslyn,heejaechang/roslyn,swaroop-sridhar/roslyn,drognanar/roslyn,MatthieuMEZIL/roslyn,robinsedlaczek/roslyn,drognanar/roslyn,VSadov/roslyn,tannergooding/roslyn,diryboy/roslyn,MattWindsor91/roslyn,natidea/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,panopticoncentral/roslyn,OmarTawfik/roslyn,bbarry/roslyn,gafter/roslyn,KirillOsenkov/roslyn,KirillOsenkov/roslyn,xoofx/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,AnthonyDGreen/roslyn,KiloBravoLima/roslyn,heejaechang/roslyn,robinsedlaczek/roslyn,stephentoub/roslyn,amcasey/roslyn,tmat/roslyn,jmarolf/roslyn,amcasey/roslyn,mavasani/roslyn,AArnott/roslyn,MatthieuMEZIL/roslyn,cston/roslyn,a-ctor/roslyn,vslsnap/roslyn,AArnott/roslyn,xasx/roslyn,a-ctor/roslyn,Shiney/roslyn,yeaicc/roslyn,dpoeschl/roslyn,khyperia/roslyn,panopticoncentral/roslyn,tvand7093/roslyn,orthoxerox/roslyn,CaptainHayashi/roslyn,AlekseyTs/roslyn,CaptainHayashi/roslyn,nguerrera/roslyn,jeffanders/roslyn,pdelvo/roslyn,brettfo/roslyn,yeaicc/roslyn,KevinH-MS/roslyn,Hosch250/roslyn,Shiney/roslyn,jmarolf/roslyn,sharwell/roslyn,jcouv/roslyn,stephentoub/roslyn,srivatsn/roslyn,diryboy/roslyn,pdelvo/roslyn,bbarry/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,tmeschter/roslyn,mavasani/roslyn,khyperia/roslyn,agocke/roslyn,bkoelman/roslyn,jcouv/roslyn,abock/roslyn,balajikris/roslyn,tvand7093/roslyn,akrisiun/roslyn,physhi/roslyn,wvdd007/roslyn,a-ctor/roslyn,akrisiun/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,TyOverby/roslyn,stephentoub/roslyn,weltkante/roslyn,AlekseyTs/roslyn,KevinRansom/roslyn,CaptainHayashi/roslyn,kelltrick/roslyn,vslsnap/roslyn,OmarTawfik/roslyn,jkotas/roslyn,jhendrixMSFT/roslyn,bkoelman/roslyn,jamesqo/roslyn,abock/roslyn,AmadeusW/roslyn,eriawan/roslyn,cston/roslyn,zooba/roslyn,xasx/roslyn,xoofx/roslyn,budcribar/roslyn,reaction1989/roslyn,tvand7093/roslyn,srivatsn/roslyn,zooba/roslyn,MatthieuMEZIL/roslyn,TyOverby/roslyn,tannergooding/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,davkean/roslyn,Giftednewt/roslyn,nguerrera/roslyn,gafter/roslyn,mgoertz-msft/roslyn,ljw1004/roslyn,dotnet/roslyn,MattWindsor91/roslyn,xasx/roslyn,aelij/roslyn,DustinCampbell/roslyn,tmeschter/roslyn,natidea/roslyn,amcasey/roslyn,shyamnamboodiripad/roslyn,khyperia/roslyn,bkoelman/roslyn,MichalStrehovsky/roslyn,abock/roslyn,kelltrick/roslyn,AArnott/roslyn,DustinCampbell/roslyn,AlekseyTs/roslyn,srivatsn/roslyn,TyOverby/roslyn,AnthonyDGreen/roslyn,robinsedlaczek/roslyn,mattwar/roslyn,bartdesmet/roslyn,bbarry/roslyn,tmat/roslyn,diryboy/roslyn,budcribar/roslyn,paulvanbrenk/roslyn,mgoertz-msft/roslyn,mmitche/roslyn,orthoxerox/roslyn,jcouv/roslyn,balajikris/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,physhi/roslyn,reaction1989/roslyn,lorcanmooney/roslyn,KiloBravoLima/roslyn,davkean/roslyn,MichalStrehovsky/roslyn,reaction1989/roslyn,Pvlerick/roslyn,budcribar/roslyn,paulvanbrenk/roslyn,ErikSchierboom/roslyn,tmeschter/roslyn,brettfo/roslyn | src/Workspaces/Core/Portable/Shared/Extensions/SymbolInfoExtensions.cs | src/Workspaces/Core/Portable/Shared/Extensions/SymbolInfoExtensions.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
using System.Linq;
namespace Microsoft.CodeAnalysis.Shared.Extensions
{
// Note - these methods are called in fairly hot paths in the IDE, so we try to be responsible about allocations.
internal static class SymbolInfoExtensions
{
public static ImmutableArray<ISymbol> GetAllSymbols(this SymbolInfo info)
{
return GetAllSymbolsWorker(info).Distinct();
}
private static ImmutableArray<ISymbol> GetAllSymbolsWorker(this SymbolInfo info)
{
if (info.Symbol == null)
{
return info.CandidateSymbols;
}
else
{
var builder = ImmutableArray.CreateBuilder<ISymbol>(info.CandidateSymbols.Length + 1);
builder.Add(info.Symbol);
builder.AddRange(info.CandidateSymbols);
return builder.ToImmutable();
}
}
public static ISymbol GetAnySymbol(this SymbolInfo info)
{
return info.Symbol != null
? info.Symbol
: info.CandidateSymbols.FirstOrDefault();
}
public static ImmutableArray<ISymbol> GetBestOrAllSymbols(this SymbolInfo info)
{
if (info.Symbol != null)
{
return ImmutableArray.Create(info.Symbol);
}
else if (info.CandidateSymbols.Length > 0)
{
return info.CandidateSymbols;
}
return ImmutableArray<ISymbol>.Empty;
}
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Shared.Extensions
{
// Note - these methods are called in fairly hot paths in the IDE, so we try to be responsible about allocations.
internal static class SymbolInfoExtensions
{
public static ImmutableArray<ISymbol> GetAllSymbols(this SymbolInfo info)
{
return GetAllSymbolsWorker(info).Distinct();
}
private static ImmutableArray<ISymbol> GetAllSymbolsWorker(this SymbolInfo info)
{
if (info.Symbol == null)
{
return info.CandidateSymbols;
}
else
{
var builder = ImmutableArray.CreateBuilder<ISymbol>(info.CandidateSymbols.Length + 1);
builder.Add(info.Symbol);
builder.AddRange(info.CandidateSymbols);
return builder.ToImmutable();
}
}
public static ISymbol GetAnySymbol(this SymbolInfo info)
{
return info.Symbol != null
? info.Symbol
: info.CandidateSymbols.FirstOrDefault();
}
public static ImmutableArray<ISymbol> GetBestOrAllSymbols(this SymbolInfo info)
{
if (info.Symbol != null)
{
return ImmutableArray.Create(info.Symbol);
}
else if (info.CandidateSymbols.Length > 0)
{
return info.CandidateSymbols;
}
return ImmutableArray<ISymbol>.Empty;
}
}
}
| mit | C# |
a222c2348de465a15544f638e0ec2b7cf510b61e | Add Bindable. | cube-soft/Cube.Net,cube-soft/Cube.Net,cube-soft/Cube.Net | Applications/Rss.Reader/Xui/Bindable.cs | Applications/Rss.Reader/Xui/Bindable.cs | /* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/* ------------------------------------------------------------------------- */
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading;
namespace Cube.Xui
{
/* --------------------------------------------------------------------- */
///
/// Bindable(T)
///
/// <summary>
/// 値を Binding 可能にするためのクラスです。
/// </summary>
///
/// <remarks>
/// Value プロパティを通じて実際の値にアクセスします。
/// PropertyChanged イベントは、コンストラクタで指定された同期
/// コンテキストを用いて発生します。
/// </remarks>
///
/* --------------------------------------------------------------------- */
public class Bindable<T> : INotifyPropertyChanged where T : class
{
#region Constructors
/* ----------------------------------------------------------------- */
///
/// Bindable
///
/// <summary>
/// オブジェクトを初期化します。
/// </summary>
///
/* ----------------------------------------------------------------- */
public Bindable() : this(SynchronizationContext.Current) { }
/* ----------------------------------------------------------------- */
///
/// Bindable
///
/// <summary>
/// オブジェクトを初期化します。
/// </summary>
///
/// <param name="context">同期コンテキスト</param>
///
/* ----------------------------------------------------------------- */
public Bindable(SynchronizationContext context)
{
_context = context;
}
#endregion
#region Properties
/* ----------------------------------------------------------------- */
///
/// Value
///
/// <summary>
/// 実際の値を取得または設定します。
/// </summary>
///
/* ----------------------------------------------------------------- */
public T Value
{
get => _value;
set
{
if (_value == value) return;
_value = value;
RaisePropertyChanged();
}
}
#endregion
#region Events
/* ----------------------------------------------------------------- */
///
/// PropertyChanged
///
/// <summary>
/// プロパティの内容変更時に発生するイベントです。
/// </summary>
///
/* ----------------------------------------------------------------- */
public event PropertyChangedEventHandler PropertyChanged;
/* ----------------------------------------------------------------- */
///
/// OnPropertyChanged
///
/// <summary>
/// PropertyChanged イベントを発生させます。
/// </summary>
///
/* ----------------------------------------------------------------- */
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
=> PropertyChanged?.Invoke(this, e);
/* ----------------------------------------------------------------- */
///
/// RaisePropertyChanged
///
/// <summary>
/// PropertyChanged イベントを発生させます。
/// </summary>
///
/* ----------------------------------------------------------------- */
protected void RaisePropertyChanged([CallerMemberName] string name = null)
{
var e = new PropertyChangedEventArgs(name);
if (_context != null) _context.Post(_ => OnPropertyChanged(e), null);
else OnPropertyChanged(e);
}
#endregion
#region Fields
private T _value;
private SynchronizationContext _context;
#endregion
}
}
| apache-2.0 | C# | |
cdce7818baedd704ed8ac4a858298bd68be83674 | add internship model | barld/portfolio,barld/portfolio,barld/portfolio | src/Portfolio/Models/Internships.cs | src/Portfolio/Models/Internships.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Portfolio.Models
{
public class Internships : MarkDownFactory<Internship>
{
public Internships(string webRootPath) : base(webRootPath, "Internships/") { }
public override Internship Create(string fileName) => new Internship(fileName);
}
public class Internship : MarkDownModel
{
public Internship(string fileName) : base(fileName){ }
}
}
| mit | C# | |
602e6e4aaccd8878a3fb7f21a0f2ec8d65854eeb | Add OperationResult | denismaster/dcs,denismaster/dcs,denismaster/dcs,denismaster/dcs | src/Diploms.Dto/OperationResult.cs | src/Diploms.Dto/OperationResult.cs | using System;
using System.Collections.Generic;
namespace Diploms.Dto
{
public class OperationResult
{
public List<string> Errors { get; set; }
public bool HasError => Errors.Count!=0;
}
}
| mit | C# | |
3396858dd4bc3c80c5ad379c4c26de0438c004f9 | add azure ml bach scoring activity | pinwang81/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,ailn/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,gubookgu/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,dominiqa/azure-sdk-for-net,Nilambari/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,pilor/azure-sdk-for-net,jamestao/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,pankajsn/azure-sdk-for-net,mihymel/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,vladca/azure-sdk-for-net,akromm/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,zaevans/azure-sdk-for-net,AuxMon/azure-sdk-for-net,hovsepm/azure-sdk-for-net,shipram/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,namratab/azure-sdk-for-net,pomortaz/azure-sdk-for-net,dasha91/azure-sdk-for-net,shuagarw/azure-sdk-for-net,dominiqa/azure-sdk-for-net,oburlacu/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,samtoubia/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,mabsimms/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,mihymel/azure-sdk-for-net,amarzavery/azure-sdk-for-net,hovsepm/azure-sdk-for-net,juvchan/azure-sdk-for-net,xindzhan/azure-sdk-for-net,yoreddy/azure-sdk-for-net,alextolp/azure-sdk-for-net,pattipaka/azure-sdk-for-net,alextolp/azure-sdk-for-net,stankovski/azure-sdk-for-net,amarzavery/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,hyonholee/azure-sdk-for-net,samtoubia/azure-sdk-for-net,xindzhan/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,nathannfan/azure-sdk-for-net,r22016/azure-sdk-for-net,smithab/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,enavro/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,naveedaz/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,abhing/azure-sdk-for-net,dominiqa/azure-sdk-for-net,pomortaz/azure-sdk-for-net,jamestao/azure-sdk-for-net,jtlibing/azure-sdk-for-net,tpeplow/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,namratab/azure-sdk-for-net,peshen/azure-sdk-for-net,pinwang81/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,pilor/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,atpham256/azure-sdk-for-net,enavro/azure-sdk-for-net,jamestao/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,kagamsft/azure-sdk-for-net,begoldsm/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,herveyw/azure-sdk-for-net,AzCiS/azure-sdk-for-net,samtoubia/azure-sdk-for-net,hyonholee/azure-sdk-for-net,nacaspi/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,gubookgu/azure-sdk-for-net,rohmano/azure-sdk-for-net,olydis/azure-sdk-for-net,pattipaka/azure-sdk-for-net,pankajsn/azure-sdk-for-net,herveyw/azure-sdk-for-net,amarzavery/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,shipram/azure-sdk-for-net,oaastest/azure-sdk-for-net,shutchings/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,begoldsm/azure-sdk-for-net,samtoubia/azure-sdk-for-net,oaastest/azure-sdk-for-net,enavro/azure-sdk-for-net,shuagarw/azure-sdk-for-net,hovsepm/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,cwickham3/azure-sdk-for-net,akromm/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,atpham256/azure-sdk-for-net,robertla/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,btasdoven/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,scottrille/azure-sdk-for-net,btasdoven/azure-sdk-for-net,ailn/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,pinwang81/azure-sdk-for-net,cwickham3/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,juvchan/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,hyonholee/azure-sdk-for-net,olydis/azure-sdk-for-net,makhdumi/azure-sdk-for-net,r22016/azure-sdk-for-net,nathannfan/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,olydis/azure-sdk-for-net,gubookgu/azure-sdk-for-net,AuxMon/azure-sdk-for-net,ogail/azure-sdk-for-net,marcoippel/azure-sdk-for-net,oaastest/azure-sdk-for-net,lygasch/azure-sdk-for-net,AzCiS/azure-sdk-for-net,dasha91/azure-sdk-for-net,scottrille/azure-sdk-for-net,oburlacu/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,robertla/azure-sdk-for-net,r22016/azure-sdk-for-net,tpeplow/azure-sdk-for-net,smithab/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,yoreddy/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,jtlibing/azure-sdk-for-net,djyou/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,ogail/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,mabsimms/azure-sdk-for-net,jamestao/azure-sdk-for-net,rohmano/azure-sdk-for-net,cwickham3/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,AuxMon/azure-sdk-for-net,peshen/azure-sdk-for-net,marcoippel/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,namratab/azure-sdk-for-net,dasha91/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,Nilambari/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,nemanja88/azure-sdk-for-net,alextolp/azure-sdk-for-net,hyonholee/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,kagamsft/azure-sdk-for-net,abhing/azure-sdk-for-net,makhdumi/azure-sdk-for-net,xindzhan/azure-sdk-for-net,hyonholee/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,peshen/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,lygasch/azure-sdk-for-net,tpeplow/azure-sdk-for-net,akromm/azure-sdk-for-net,makhdumi/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,begoldsm/azure-sdk-for-net,guiling/azure-sdk-for-net,kagamsft/azure-sdk-for-net,vladca/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,atpham256/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,pankajsn/azure-sdk-for-net,rohmano/azure-sdk-for-net,zaevans/azure-sdk-for-net,djyou/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,naveedaz/azure-sdk-for-net,bgold09/azure-sdk-for-net,ailn/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,relmer/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,shutchings/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,nathannfan/azure-sdk-for-net,naveedaz/azure-sdk-for-net,mabsimms/azure-sdk-for-net,stankovski/azure-sdk-for-net,ogail/azure-sdk-for-net,herveyw/azure-sdk-for-net,markcowl/azure-sdk-for-net,pattipaka/azure-sdk-for-net,djyou/azure-sdk-for-net,relmer/azure-sdk-for-net,smithab/azure-sdk-for-net,shipram/azure-sdk-for-net,pomortaz/azure-sdk-for-net,relmer/azure-sdk-for-net,nemanja88/azure-sdk-for-net,jtlibing/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,juvchan/azure-sdk-for-net,scottrille/azure-sdk-for-net,guiling/azure-sdk-for-net,robertla/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,shuagarw/azure-sdk-for-net,guiling/azure-sdk-for-net,bgold09/azure-sdk-for-net,btasdoven/azure-sdk-for-net,vladca/azure-sdk-for-net,marcoippel/azure-sdk-for-net,mihymel/azure-sdk-for-net,zaevans/azure-sdk-for-net,pilor/azure-sdk-for-net,abhing/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,nemanja88/azure-sdk-for-net,lygasch/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,oburlacu/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,yoreddy/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,nacaspi/azure-sdk-for-net,AzCiS/azure-sdk-for-net,bgold09/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,Nilambari/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,shutchings/azure-sdk-for-net | src/DataFactoryManagement/Generated/Models/AzureMLBatchScoringActivity.cs | src/DataFactoryManagement/Generated/Models/AzureMLBatchScoringActivity.cs | //
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.
using System;
using System.Linq;
using Microsoft.Azure.Management.DataFactories.Models;
namespace Microsoft.Azure.Management.DataFactories.Models
{
/// <summary>
/// AzureML Web Service batch scoring activity.
/// </summary>
public partial class AzureMLBatchScoringActivity : BaseActivity
{
/// <summary>
/// Initializes a new instance of the AzureMLBatchScoringActivity class.
/// </summary>
public AzureMLBatchScoringActivity()
{
}
/// <summary>
/// Initializes a new instance of the AzureMLBatchScoringActivity class
/// with required arguments.
/// </summary>
public AzureMLBatchScoringActivity(string name)
: this()
{
if (name == null)
{
throw new ArgumentNullException("name");
}
this.Name = name;
}
}
}
| mit | C# | |
9e5dc9ee3bb60176c9e2f40593434cf5a9496673 | Add IBase32Encoding interface | wiry-net/Base32,wiry-net/Base32,wiry-net/Wiry.Base32,wiry-net/Wiry.Base32 | src/Wiry.Base32/IBase32Encoding.cs | src/Wiry.Base32/IBase32Encoding.cs | // Copyright (c) Dmitry Razumikhin, 2016-2019.
// Licensed under the MIT License.
// See LICENSE in the project root for license information.
namespace Wiry.Base32
{
/// <summary>
/// Base32 encoding interface.
/// </summary>
public interface IBase32Encoding
{
/// <summary>
/// Encodes bytes to a string.
/// </summary>
string GetString(byte[] bytes, int index, int count);
/// <summary>
/// Decodes string data to bytes.
/// </summary>
byte[] ToBytes(string encoded, int index, int length);
/// <summary>
/// Validate input data.
/// </summary>
ValidationResult Validate(string encoded, int index, int length);
}
} | mit | C# | |
f6d371e7ee5cc0c910a8b914b9421300c3ca0951 | Refactor code | khoale/WebServiceSample | src/WcfDataServiceToolkitAdvanced/Extensions/ReflectionExtensions.cs | src/WcfDataServiceToolkitAdvanced/Extensions/ReflectionExtensions.cs | namespace WcfDataServiceToolkitAdvanced.Extensions
{
using System;
public static class ReflectionExtensions
{
public static bool IsImplementGenericType(this Type type, Type genericType)
{
return
type.BaseType != null && type.BaseType.IsGenericType && type.BaseType.GetGenericTypeDefinition() == genericType;
}
public static bool IsConcreteType(this Type type)
{
return type.IsClass && !type.IsAbstract && !type.IsInterface;
}
}
} | mit | C# | |
a9d934b6d008dce6cab215587cbf8f4fc0b33cbe | Update unit test | WaltChen/NDatabase,WaltChen/NDatabase | test/NDatabase/Odb/Test/ODBTest.cs | test/NDatabase/Odb/Test/ODBTest.cs | /*
NDatabase ODB : Native Object Database (odb.info@NDatabase.org)
Copyright (C) 2008 NDatabase Inc. http://www.NDatabase.org
"This file is part of the NDatabase ODB open source object database".
NDatabase ODB 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.
NDatabase ODB 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
*/
using System;
using System.IO;
using NDatabase.Odb;
using NDatabase.Tool.Wrappers.IO;
namespace Test.Odb.Test
{
public class ODBTest : NDatabaseAssert
{
public static String HOST = "localhost";
public static int PORT = 10000;
public static bool useSameVmOptimization;
public static bool testNewFeature;
public static bool testPerformance;
public string GetBaseName()
{
var guid = Guid.NewGuid();
return string.Format("{0}{1}.neodatis", GetName(), guid.ToString());
}
public virtual IOdb Open(String fileName, String user, String password)
{
return OdbFactory.Open(fileName);
}
public virtual IOdb Open(String fileName)
{
return OdbFactory.Open(fileName);
}
public virtual IOdb OpenLocal(String fileName)
{
return OdbFactory.Open(fileName);
}
public virtual void failCS()
{
AssertTrue(true);
}
protected internal virtual void FailNotImplemented(String string_Renamed)
{
AssertTrue(true);
}
protected internal virtual void DeleteBase(String baseName)
{
if (File.Exists(baseName))
OdbFile.DeleteFile(baseName);
}
public void Println(object o)
{
Console.WriteLine(o.ToString());
}
}
}
| apache-2.0 | C# | |
2808e09ef58f6e8dc72b2c032abce74d9d2baff2 | Allow binding to state changes of OverlayContainers. | ZLima12/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,default0/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,paparony03/osu-framework,RedNesto/osu-framework,EVAST9919/osu-framework,naoey/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,naoey/osu-framework,Tom94/osu-framework,paparony03/osu-framework,Tom94/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,default0/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework | osu.Framework/Graphics/Containers/OverlayContainer.cs | osu.Framework/Graphics/Containers/OverlayContainer.cs | // Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
namespace osu.Framework.Graphics.Containers
{
/// <summary>
/// An element which starts hidden and can be toggled to visible.
/// </summary>
public abstract class OverlayContainer : Container, IStateful<Visibility>
{
protected override void LoadComplete()
{
if (state == Visibility.Hidden)
{
PopOut();
Flush();
}
base.LoadComplete();
}
private Visibility state;
public Visibility State
{
get { return state; }
set
{
if (value == state) return;
state = value;
switch (value)
{
case Visibility.Hidden:
PopOut();
break;
case Visibility.Visible:
PopIn();
break;
}
StateChanged?.Invoke();
}
}
public event Action StateChanged;
protected abstract void PopIn();
protected abstract void PopOut();
public override void Hide() => State = Visibility.Hidden;
public override void Show() => State = Visibility.Visible;
public void ToggleVisibility() => State = (State == Visibility.Visible ? Visibility.Hidden : Visibility.Visible);
}
public enum Visibility
{
Hidden,
Visible
}
}
| // Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
namespace osu.Framework.Graphics.Containers
{
/// <summary>
/// An element which starts hidden and can be toggled to visible.
/// </summary>
public abstract class OverlayContainer : Container, IStateful<Visibility>
{
protected override void LoadComplete()
{
if (state == Visibility.Hidden)
{
PopOut();
Flush();
}
base.LoadComplete();
}
private Visibility state;
public Visibility State
{
get { return state; }
set
{
if (value == state) return;
state = value;
switch (value)
{
case Visibility.Hidden:
PopOut();
break;
case Visibility.Visible:
PopIn();
break;
}
}
}
protected abstract void PopIn();
protected abstract void PopOut();
public override void Hide() => State = Visibility.Hidden;
public override void Show() => State = Visibility.Visible;
public void ToggleVisibility() => State = (State == Visibility.Visible ? Visibility.Hidden : Visibility.Visible);
}
public enum Visibility
{
Hidden,
Visible
}
}
| mit | C# |
8a121137bf6a25ba59dbff008a1db8be35593bc9 | Update StorageBackedResourceStore.cs | naoey/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,default0/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,Tom94/osu-framework,ZLima12/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,ppy/osu-framework,paparony03/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,naoey/osu-framework,paparony03/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,RedNesto/osu-framework,default0/osu-framework | osu.Framework/IO/Stores/StorageBackedResourceStore.cs | osu.Framework/IO/Stores/StorageBackedResourceStore.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.IO;
using osu.Framework.Platform;
namespace osu.Framework.IO.Stores
{
/// <summary>
/// A resource store that uses an underlying <see cref="Storage"/> backing.
/// </summary>
public class StorageBackedResourceStore : IResourceStore<byte[]>
{
private readonly Storage storage;
public StorageBackedResourceStore(Storage storage)
{
this.storage = storage;
}
public byte[] Get(string name)
{
using (Stream stream = storage.GetStream(name))
using (var ms = new MemoryStream())
{
stream.CopyTo(ms);
return ms.ToArray();
}
}
public Stream GetStream(string name)
{
return storage.GetStream(name);
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.IO;
using osu.Framework.Platform;
namespace osu.Framework.IO.Stores
{
/// <summary>
/// A resource store that uses an underlying <see cref="Storage"/> backing.
/// </summary>
public class StorageBackedResourceStore : IResourceStore<byte[]>
{
private Storage storage;
public StorageBackedResourceStore(Storage storage)
{
this.storage = storage;
}
public byte[] Get(string name)
{
using (Stream stream = storage.GetStream(name))
using (var ms = new MemoryStream())
{
stream.CopyTo(ms);
return ms.ToArray();
}
}
public Stream GetStream(string name)
{
return storage.GetStream(name);
}
}
}
| mit | C# |
eb0cf43e9a0b0d893636020f22eb2eefcbdde537 | Test deserializing sorted set subclass (#1852) | JamesNK/Newtonsoft.Json,bfriesen/Newtonsoft.Json,TylerBrinkley/Newtonsoft.Json,PKRoma/Newtonsoft.Json,jkorell/Newtonsoft.Json,ze-pequeno/Newtonsoft.Json,oxwanawxo/Newtonsoft.Json,brjohnstmsft/Newtonsoft.Json | Src/Newtonsoft.Json.Tests/Issues/Issue1796.cs | Src/Newtonsoft.Json.Tests/Issues/Issue1796.cs | #region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET20 || NET35)
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
#if !(NET20 || NET35 || NET40 || PORTABLE40)
using System.Threading.Tasks;
#endif
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Utilities;
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Issues
{
[TestFixture]
public class Issue1796 : TestFixtureBase
{
[Test]
public void Test()
{
string json = "[{}]";
TestStack c = JsonConvert.DeserializeObject<TestStack>(json);
Assert.AreEqual(1, c.Count);
}
[Test]
public void Test_Generic()
{
string json = "['hi']";
TestStack<string> c = JsonConvert.DeserializeObject<TestStack<string>>(json);
Assert.AreEqual(1, c.Count);
}
public class TestStack : SortedSet<object>
{
}
public class TestStack<T> : SortedSet<T>
{
}
}
}
#endif | mit | C# | |
17458926998842e3745ee9ececd44a794bc988bd | Add SummonerId to CurrentGame/Participant (#327) | frederickrogan/RiotSharp,jono-90/RiotSharp,Oucema90/RiotSharp,oisindoherty/RiotSharp,Challengermode/RiotSharp,Shidesu/RiotSharp,florinciubotariu/RiotSharp,JanOuborny/RiotSharp,BenFradet/RiotSharp | RiotSharp/CurrentGameEndpoint/Participant.cs | RiotSharp/CurrentGameEndpoint/Participant.cs | using Newtonsoft.Json;
using System.Collections.Generic;
namespace RiotSharp.CurrentGameEndpoint
{
/// <summary>
/// Class representing a Participant in the API.
/// </summary>
public class Participant
{
/// <summary>
/// Flag indicating whether or not this participant is a bot
/// </summary>
[JsonProperty("bot")]
public bool Bot { get; set; }
/// <summary>
/// The ID of the champion played by this participant
/// </summary>
[JsonProperty("championId")]
public long ChampionId { get; set; }
/// <summary>
/// The masteries used by this participant
/// </summary>
[JsonProperty("masteries")]
public List<Mastery> Masteries { get; set; }
/// <summary>
/// The ID of the profile icon used by this participant
/// </summary>
[JsonProperty("profileIconId")]
public long ProfileIconId { get; set; }
/// <summary>
/// The runes used by this participant
/// </summary>
[JsonProperty("runes")]
public List<Rune> Runes { get; set; }
/// <summary>
/// The ID of the first summoner spell used by this participant
/// </summary>
[JsonProperty("spell1Id")]
public long SummonerSpell1 { get; set; }
/// <summary>
/// The ID of the second summoner spell used by this participant
/// </summary>
[JsonProperty("spell2Id")]
public long SummonerSpell2 { get; set; }
/// <summary>
/// The summoner ID of this participant
/// Only available for ranked matches
/// </summary>
[JsonProperty("summonerId")]
public long SummonerId { get; set; }
/// <summary>
/// The summoner name of this participant
/// </summary>
[JsonProperty("summonerName")]
public string SummonerName { get; set; }
/// <summary>
/// The team ID of this participant, indicating the participant's team
/// </summary>
[JsonProperty("teamId")]
public long TeamId { get; set; }
}
}
| using Newtonsoft.Json;
using System.Collections.Generic;
namespace RiotSharp.CurrentGameEndpoint
{
/// <summary>
/// Class representing a Participant in the API.
/// </summary>
public class Participant
{
/// <summary>
/// Flag indicating whether or not this participant is a bot
/// </summary>
[JsonProperty("bot")]
public bool Bot { get; set; }
/// <summary>
/// The ID of the champion played by this participant
/// </summary>
[JsonProperty("championId")]
public long ChampionId { get; set; }
/// <summary>
/// The masteries used by this participant
/// </summary>
[JsonProperty("masteries")]
public List<Mastery> Masteries { get; set; }
/// <summary>
/// The ID of the profile icon used by this participant
/// </summary>
[JsonProperty("profileIconId")]
public long ProfileIconId { get; set; }
/// <summary>
/// The runes used by this participant
/// </summary>
[JsonProperty("runes")]
public List<Rune> Runes { get; set; }
/// <summary>
/// The ID of the first summoner spell used by this participant
/// </summary>
[JsonProperty("spell1Id")]
public long SummonerSpell1 { get; set; }
/// <summary>
/// The ID of the second summoner spell used by this participant
/// </summary>
[JsonProperty("spell2Id")]
public long SummonerSpell2 { get; set; }
/// <summary>
/// The summoner name of this participant
/// </summary>
[JsonProperty("summonerName")]
public string SummonerName { get; set; }
/// <summary>
/// The team ID of this participant, indicating the participant's team
/// </summary>
[JsonProperty("teamId")]
public long TeamId { get; set; }
}
}
| mit | C# |
f4ce66710b909bb250c11cee4040b45b35e5b333 | Add InstanceRoleCredentialTests | carbon/Amazon | src/Amazon.Tests/InstanceRoleCredentialTests.cs | src/Amazon.Tests/InstanceRoleCredentialTests.cs | using System;
using Xunit;
namespace Amazon.Security.Tests
{
public class InstanceRoleCredentialTests
{
[Fact]
public void EmptyRoleNeedsRenewed()
{
var credential = new InstanceRoleCredential();
Assert.Equal(0, credential.RenewCount);
Assert.True(credential.ShouldRenew);
}
[Fact]
public void EmptyExpiresNeedsRenewed()
{
var credential = new InstanceRoleCredential("roleName");
Assert.Equal("roleName", credential.RoleName);
Assert.Equal(0, credential.RenewCount);
Assert.True(credential.Expires == default(DateTime));
Assert.True(credential.ShouldRenew);
}
}
} | mit | C# | |
c7c52a8f36c000b77056a60d527bb7656a3f74a8 | Add tests for ChaCha20Poly1305 class | ektrah/nsec | tests/Algorithms/ChaCha20Poly1305Tests.cs | tests/Algorithms/ChaCha20Poly1305Tests.cs | using System;
using NSec.Cryptography;
using Xunit;
namespace NSec.Tests.Algorithms
{
public static class ChaCha20Poly1305Tests
{
public static readonly TheoryData<string[]> Rfc7539TestVectors = new TheoryData<string[]>
{
new string[] { "4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e", "50515253c0c1c2c3c4c5c6c7", "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f", "07000000" + "4041424344454647", "d31a8d34648e60db7b86afbc53ef7ec2a4aded51296e08fea9e2b5a736ee62d63dbea45e8ca9671282fafb69da92728b1a71de0a9e060b2905d6a5b67ecd3b3692ddbd7f2d778b8c9803aee328091b58fab324e4fad675945585808b4831d7bc3ff4def08e4b7a9de576d26586cec64b6116", "1ae10b594f09e26a7e902ecbd0600691" },
};
[Theory]
[MemberData(nameof(Rfc7539TestVectors))]
public static void TestRfc7539(string[] testVector)
{
var plaintext = testVector[0];
var aad = testVector[1];
var key = testVector[2];
var nonce = testVector[3];
var ciphertext = testVector[4];
var tag = testVector[5];
var a = new ChaCha20Poly1305();
using (var k = Key.Import(a, key.DecodeHex(), KeyBlobFormat.RawSymmetricKey))
{
var b = a.Encrypt(k, nonce.DecodeHex(), aad.DecodeHex(), plaintext.DecodeHex());
Assert.Equal((ciphertext + tag).DecodeHex(), b);
var r = a.Decrypt(k, nonce.DecodeHex(), aad.DecodeHex(), b);
Assert.Equal(plaintext.DecodeHex(), r);
}
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.