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 |
|---|---|---|---|---|---|---|---|---|
fd8a940e0e8b8f1958d40fdeb6c2703e87d854d4 | fix tabs | ilovepi/Compiler,ilovepi/Compiler | compiler/frontend/Parser.cs | compiler/frontend/Parser.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using compiler.frontend;
namespace compiler.frontend
{
class Parser
{
public Token t;
public Lexer s;
string filename;
public void getExpected(Token expected)
{
if (t == expected)
{
next();
}
else {error();
}
}
public void error(string str)
{
//TODO: determine location in file
Console.WriteLine ("Error Parsing file: " + filename + ", " + str);
error_fatal();
}
public void error_fatal(){
//TODO: determine location in file
throw new Exception("Fatal Error Parsing file: " + filename + ". Unable to continue";
}
public void next() {
t = s.getNextToken();
}
public void Designator() {
getExpected(Token.IDENTIFIER);
getExpected(Token.OPEN_BRACKET);
Expression();
getExpected(Token.CLOSE_BRACKET);
}
public void Factor(){
if ((t == Token.IDENTIFIER) || (t == Token.IDENTIFIER))
{
next();
}
else error();
}
public void Term(){
}
public void Expression(){
}
public void Relation(){
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using compiler.frontend;
namespace compiler.frontend
{
class Parser
{
public Token t;
public Lexer s;
string filename;
public void getExpected(Token expected)
{
if (t == expected)
{
next();
}
else error();
}
public void error(string str)
{
//TODO: determine location in file
Console.WriteLine ("Error Parsing file: " + filename + ", " + str);
error_fatal();
}
public void error_fatal(){
//TODO: determine location in file
throw new Exception("Fatal Error Parsing file: " + filename + ". Unable to continue";
}
public void next() {
t = s.getNextToken();
}
public void Designator() {
getExpected(Token.IDENTIFIER);
getExpected(Token.OPEN_BRACKET);
Expression();
getExpected(Token.CLOSE_BRACKET);
}
public void Factor(){
if ((t == Token.IDENTIFIER) || (t == Token.IDENTIFIER))
{
next();
}
else error();
}
public void Term(){
}
public void Expression(){
}
public void Relation(){
}
}
}
| mit | C# |
bfa275ad1c32e0cda7eab918a8de14d7269f0491 | Change some small classes to struct to avoid potential null check. | UselessToucan/osu,johnneijzen/osu,EVAST9919/osu,UselessToucan/osu,2yangk23/osu,ppy/osu,naoey/osu,DrabWeb/osu,smoogipoo/osu,naoey/osu,EVAST9919/osu,2yangk23/osu,ZLima12/osu,peppy/osu-new,Damnae/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,Drezi126/osu,ZLima12/osu,Nabile-Rahmani/osu,johnneijzen/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,naoey/osu,DrabWeb/osu,UselessToucan/osu,ppy/osu,peppy/osu,DrabWeb/osu,NeoAdonis/osu,Frontear/osuKyzer | osu.Game/Users/UserStatistics.cs | osu.Game/Users/UserStatistics.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
namespace osu.Game.Users
{
public class UserStatistics
{
[JsonProperty(@"level")]
public LevelInfo Level;
public struct LevelInfo
{
[JsonProperty(@"current")]
public int Current;
[JsonProperty(@"progress")]
public int Progress;
}
[JsonProperty(@"pp")]
public decimal? PP;
[JsonProperty(@"pp_rank")]
public int Rank;
[JsonProperty(@"ranked_score")]
public long RankedScore;
[JsonProperty(@"hit_accuracy")]
public decimal Accuracy;
[JsonProperty(@"play_count")]
public int PlayCount;
[JsonProperty(@"total_score")]
public long TotalScore;
[JsonProperty(@"total_hits")]
public int TotalHits;
[JsonProperty(@"maximum_combo")]
public int MaxCombo;
[JsonProperty(@"replays_watched_by_others")]
public int ReplayWatched;
[JsonProperty(@"grade_counts")]
public Grades GradesCount;
public struct Grades
{
[JsonProperty(@"ss")]
public int SS;
[JsonProperty(@"s")]
public int S;
[JsonProperty(@"a")]
public int A;
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
namespace osu.Game.Users
{
public class UserStatistics
{
[JsonProperty(@"level")]
public LevelInfo Level;
public class LevelInfo
{
[JsonProperty(@"current")]
public int Current;
[JsonProperty(@"progress")]
public int Progress;
}
[JsonProperty(@"pp")]
public decimal? PP;
[JsonProperty(@"pp_rank")]
public int Rank;
[JsonProperty(@"ranked_score")]
public long RankedScore;
[JsonProperty(@"hit_accuracy")]
public decimal Accuracy;
[JsonProperty(@"play_count")]
public int PlayCount;
[JsonProperty(@"total_score")]
public long TotalScore;
[JsonProperty(@"total_hits")]
public int TotalHits;
[JsonProperty(@"maximum_combo")]
public int MaxCombo;
[JsonProperty(@"replays_watched_by_others")]
public int ReplayWatched;
[JsonProperty(@"grade_counts")]
public Grades GradesCount;
public class Grades
{
[JsonProperty(@"ss")]
public int SS;
[JsonProperty(@"s")]
public int S;
[JsonProperty(@"a")]
public int A;
}
}
}
| mit | C# |
def744e1359f5adadac492ac8903c626713183d4 | Bump version number for release | nickdevore/griddly,jehhynes/griddly,nickdevore/griddly,jehhynes/griddly,programcsharp/griddly,programcsharp/griddly,programcsharp/griddly | Build/CommonAssemblyInfo.cs | Build/CommonAssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Griddly")]
[assembly: AssemblyCopyright("Copyright © 2015 Chris Hynes and Data Research Group")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.5.18")]
[assembly: AssemblyFileVersion("1.5.18")]
//[assembly: AssemblyInformationalVersion("1.4.5-editlyalpha2")]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Griddly")]
[assembly: AssemblyCopyright("Copyright © 2015 Chris Hynes and Data Research Group")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.5.17")]
[assembly: AssemblyFileVersion("1.5.17")]
//[assembly: AssemblyInformationalVersion("1.4.5-editlyalpha2")]
| mit | C# |
c278b3e7f7dd2782502f1f45ea1cf8a54856bc71 | Bump version for release | programcsharp/griddly,programcsharp/griddly,jehhynes/griddly,jehhynes/griddly,nickdevore/griddly,programcsharp/griddly,nickdevore/griddly | Build/CommonAssemblyInfo.cs | Build/CommonAssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Griddly")]
[assembly: AssemblyCopyright("Copyright © 2015 Chris Hynes and Data Research Group")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.5.22")]
[assembly: AssemblyFileVersion("1.5.22")]
//[assembly: AssemblyInformationalVersion("1.4.5-editlyalpha2")]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Griddly")]
[assembly: AssemblyCopyright("Copyright © 2015 Chris Hynes and Data Research Group")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.5.21")]
[assembly: AssemblyFileVersion("1.5.21")]
//[assembly: AssemblyInformationalVersion("1.4.5-editlyalpha2")]
| mit | C# |
cbde90e5ed1119332cd5b19f6958fdfc5814a544 | Add english as well as german | ashfordl/cards | ConsoleTesting/WhistTest.cs | ConsoleTesting/WhistTest.cs | // WhistTest.cs
// <copyright file="WhistTest.cs"> This code is protected under the MIT License. </copyright>
using System;
using CardGames.Whist;
namespace ConsoleTesting
{
/// <summary>
/// The whist test class
/// </summary>
public class WhistTest : IGameTest
{
/// <summary>
/// Run the test
/// </summary>
public void RunTest()
{
Whist whist = new Whist();
ConsolePlayer p1 = new ConsolePlayer();
ConsolePlayer p2 = new ConsolePlayer();
ConsolePlayer p3 = new ConsolePlayer();
whist.AddPlayer(p1);
whist.AddPlayer(p2);
whist.AddPlayer(p3);
whist.Start();
}
public void RunWithAi()
{
Console.WriteLine("Es gibt kein AI");
Console.WriteLine("There is no AI");
}
}
}
| // WhistTest.cs
// <copyright file="WhistTest.cs"> This code is protected under the MIT License. </copyright>
using System;
using CardGames.Whist;
namespace ConsoleTesting
{
/// <summary>
/// The whist test class
/// </summary>
public class WhistTest : IGameTest
{
/// <summary>
/// Run the test
/// </summary>
public void RunTest()
{
Whist whist = new Whist();
ConsolePlayer p1 = new ConsolePlayer();
ConsolePlayer p2 = new ConsolePlayer();
ConsolePlayer p3 = new ConsolePlayer();
whist.AddPlayer(p1);
whist.AddPlayer(p2);
whist.AddPlayer(p3);
whist.Start();
}
public void RunWithAi()
{
Console.WriteLine("Es gibt kein AI");
Console.WriteLine("There is no AI")
}
}
}
| mit | C# |
58083acc70ca562cb5f8f5678c17ded612adb0e9 | Reorder checks. | dotnet/roslyn,jkotas/roslyn,mattwar/roslyn,sharwell/roslyn,nguerrera/roslyn,gafter/roslyn,genlu/roslyn,jamesqo/roslyn,MichalStrehovsky/roslyn,shyamnamboodiripad/roslyn,tvand7093/roslyn,physhi/roslyn,TyOverby/roslyn,xasx/roslyn,dpoeschl/roslyn,eriawan/roslyn,dpoeschl/roslyn,tannergooding/roslyn,davkean/roslyn,mattscheffer/roslyn,yeaicc/roslyn,Giftednewt/roslyn,KirillOsenkov/roslyn,bkoelman/roslyn,pdelvo/roslyn,yeaicc/roslyn,amcasey/roslyn,robinsedlaczek/roslyn,sharwell/roslyn,reaction1989/roslyn,lorcanmooney/roslyn,kelltrick/roslyn,drognanar/roslyn,AlekseyTs/roslyn,lorcanmooney/roslyn,AlekseyTs/roslyn,bkoelman/roslyn,mmitche/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,aelij/roslyn,jamesqo/roslyn,genlu/roslyn,orthoxerox/roslyn,aelij/roslyn,mattscheffer/roslyn,yeaicc/roslyn,shyamnamboodiripad/roslyn,brettfo/roslyn,tmeschter/roslyn,genlu/roslyn,amcasey/roslyn,mattwar/roslyn,dotnet/roslyn,bartdesmet/roslyn,wvdd007/roslyn,cston/roslyn,mavasani/roslyn,khyperia/roslyn,Giftednewt/roslyn,stephentoub/roslyn,pdelvo/roslyn,VSadov/roslyn,eriawan/roslyn,ErikSchierboom/roslyn,Hosch250/roslyn,wvdd007/roslyn,swaroop-sridhar/roslyn,tmat/roslyn,VSadov/roslyn,orthoxerox/roslyn,mmitche/roslyn,mattscheffer/roslyn,AnthonyDGreen/roslyn,physhi/roslyn,wvdd007/roslyn,AmadeusW/roslyn,lorcanmooney/roslyn,swaroop-sridhar/roslyn,tannergooding/roslyn,diryboy/roslyn,reaction1989/roslyn,paulvanbrenk/roslyn,stephentoub/roslyn,xasx/roslyn,bartdesmet/roslyn,jcouv/roslyn,MattWindsor91/roslyn,CaptainHayashi/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,MattWindsor91/roslyn,DustinCampbell/roslyn,weltkante/roslyn,KirillOsenkov/roslyn,jmarolf/roslyn,heejaechang/roslyn,MichalStrehovsky/roslyn,Giftednewt/roslyn,TyOverby/roslyn,diryboy/roslyn,jkotas/roslyn,bkoelman/roslyn,dotnet/roslyn,jmarolf/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,Hosch250/roslyn,tvand7093/roslyn,panopticoncentral/roslyn,KevinRansom/roslyn,abock/roslyn,sharwell/roslyn,agocke/roslyn,DustinCampbell/roslyn,CaptainHayashi/roslyn,panopticoncentral/roslyn,AnthonyDGreen/roslyn,orthoxerox/roslyn,robinsedlaczek/roslyn,kelltrick/roslyn,aelij/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tvand7093/roslyn,Hosch250/roslyn,reaction1989/roslyn,TyOverby/roslyn,eriawan/roslyn,mavasani/roslyn,paulvanbrenk/roslyn,amcasey/roslyn,jmarolf/roslyn,MichalStrehovsky/roslyn,khyperia/roslyn,jkotas/roslyn,tmat/roslyn,brettfo/roslyn,KevinRansom/roslyn,gafter/roslyn,dpoeschl/roslyn,diryboy/roslyn,khyperia/roslyn,OmarTawfik/roslyn,gafter/roslyn,weltkante/roslyn,heejaechang/roslyn,mavasani/roslyn,physhi/roslyn,heejaechang/roslyn,DustinCampbell/roslyn,brettfo/roslyn,cston/roslyn,paulvanbrenk/roslyn,agocke/roslyn,jasonmalinowski/roslyn,AlekseyTs/roslyn,srivatsn/roslyn,kelltrick/roslyn,srivatsn/roslyn,ErikSchierboom/roslyn,ErikSchierboom/roslyn,abock/roslyn,davkean/roslyn,AnthonyDGreen/roslyn,jasonmalinowski/roslyn,tannergooding/roslyn,tmeschter/roslyn,mgoertz-msft/roslyn,jcouv/roslyn,MattWindsor91/roslyn,agocke/roslyn,drognanar/roslyn,davkean/roslyn,stephentoub/roslyn,cston/roslyn,panopticoncentral/roslyn,mattwar/roslyn,OmarTawfik/roslyn,MattWindsor91/roslyn,robinsedlaczek/roslyn,nguerrera/roslyn,mgoertz-msft/roslyn,tmat/roslyn,VSadov/roslyn,AmadeusW/roslyn,tmeschter/roslyn,jcouv/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,weltkante/roslyn,CaptainHayashi/roslyn,xasx/roslyn,srivatsn/roslyn,KevinRansom/roslyn,OmarTawfik/roslyn,AmadeusW/roslyn,drognanar/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,swaroop-sridhar/roslyn,pdelvo/roslyn,bartdesmet/roslyn,jamesqo/roslyn,nguerrera/roslyn,abock/roslyn,mmitche/roslyn,mgoertz-msft/roslyn | src/Workspaces/CSharp/Portable/Extensions/DefaultExpressionSyntaxExtensions.cs | src/Workspaces/CSharp/Portable/Extensions/DefaultExpressionSyntaxExtensions.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 Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp.Utilities;
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.CSharp.Extensions
{
internal static class DefaultExpressionSyntaxExtensions
{
private static readonly LiteralExpressionSyntax s_defaultLiteralExpression = SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression);
public static bool CanReplaceWithDefaultLiteral(
this DefaultExpressionSyntax defaultExpression,
CSharpParseOptions parseOptions,
OptionSet options,
SemanticModel semanticModel,
CancellationToken cancellationToken)
{
if (parseOptions.LanguageVersion >= LanguageVersion.CSharp7_1 &&
options.GetOption(CSharpCodeStyleOptions.PreferDefaultLiteral).Value)
{
var speculationAnalyzer = new SpeculationAnalyzer(
defaultExpression, s_defaultLiteralExpression, semanticModel,
cancellationToken,
skipVerificationForReplacedNode: true,
failOnOverloadResolutionFailuresInOriginalCode: true);
return !speculationAnalyzer.ReplacementChangesSemantics();
}
return false;
}
}
}
| // 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 Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp.Utilities;
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.CSharp.Extensions
{
internal static class DefaultExpressionSyntaxExtensions
{
private static readonly LiteralExpressionSyntax s_defaultLiteralExpression = SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression);
public static bool CanReplaceWithDefaultLiteral(
this DefaultExpressionSyntax defaultExpression,
CSharpParseOptions parseOptions,
OptionSet options,
SemanticModel semanticModel,
CancellationToken cancellationToken)
{
if (!options.GetOption(CSharpCodeStyleOptions.PreferDefaultLiteral).Value)
{
return false;
}
if (parseOptions.LanguageVersion < LanguageVersion.CSharp7_1)
{
return false;
}
var speculationAnalyzer = new SpeculationAnalyzer(
defaultExpression, s_defaultLiteralExpression, semanticModel,
cancellationToken,
skipVerificationForReplacedNode: true,
failOnOverloadResolutionFailuresInOriginalCode: true);
return !speculationAnalyzer.ReplacementChangesSemantics();
}
}
}
| mit | C# |
e5568d0ec815e301b297b478e7d33bde907b5be4 | fix conferma partenza demo | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.FakePersistance.ExternalAPI/Servizi/Gac/SetUscitaMezzo.cs | src/backend/SO115App.FakePersistance.ExternalAPI/Servizi/Gac/SetUscitaMezzo.cs | using Microsoft.Extensions.Configuration;
using SO115App.ExternalAPI.Client;
using SO115App.Models.Classi.ServiziEsterni.Gac;
using SO115App.Models.Servizi.Infrastruttura.Composizione;
using System.Collections.Generic;
using Newtonsoft.Json;
using SO115App.ExternalAPI.Fake.Classi;
using System;
using System.Linq;
using System.Net.Http;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Territorio;
namespace SO115App.ExternalAPI.Fake.Servizi.Gac
{
public class SetUscitaMezzo : ISetUscitaMezzo
{
private readonly IGetToken _getToken;
private readonly IHttpRequestManager<List<Response>> _client;
private readonly IConfiguration _configuration;
private readonly IGetDescComuneProvincia _comuneService;
public SetUscitaMezzo(IHttpRequestManager<List<Response>> client, IGetToken getToken, IConfiguration configuration, IGetDescComuneProvincia comuneService)
{
_getToken = getToken;
_configuration = configuration;
_client = client;
_comuneService = comuneService;
}
public void Set(UscitaGAC uscita)
{
//OTTENGO PROVINCIA E COMUNE
var territorio = _comuneService.GetComuneBy(uscita.comune.descrizione).Result;
uscita.comune.codice = territorio.FirstOrDefault(x => x.descrizione.ToLower().Contains(uscita.comune.descrizione.ToLower()))?.codice;
uscita.provincia.codice = territorio.FirstOrDefault(x => x.provincia.descrizione.ToLower().Contains(uscita.provincia.descrizione.ToLower()))?.codice;
//USCITA GAC
var lstUscite = new List<UscitaGAC>() { uscita };
var jsonString = JsonConvert.SerializeObject(lstUscite);
var content = new StringContent(jsonString);
var uri = new Uri(_configuration.GetSection("UrlExternalApi").GetSection("GacApi").Value + Costanti.GacUscitaMezzo);
var result = _client.PutAsync(uri, content, _getToken.GeneraToken()).Result;
if (result != null && result.TrueForAll(item => item.codiceEsito != "200" && item.codiceEsito != "201"))
{
throw new Exception($"Errore servizio uscita GAC: {result.First().codiceEsito}, {result.First().descrizioneEsito}");
}
}
}
}
| using Microsoft.Extensions.Configuration;
using SO115App.ExternalAPI.Client;
using SO115App.Models.Classi.ServiziEsterni.Gac;
using SO115App.Models.Servizi.Infrastruttura.Composizione;
using System.Collections.Generic;
using Newtonsoft.Json;
using SO115App.ExternalAPI.Fake.Classi;
using System;
using System.Linq;
using System.Net.Http;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Territorio;
namespace SO115App.ExternalAPI.Fake.Servizi.Gac
{
public class SetUscitaMezzo : ISetUscitaMezzo
{
private readonly IGetToken _getToken;
private readonly IHttpRequestManager<List<Response>> _client;
private readonly IConfiguration _configuration;
private readonly IGetDescComuneProvincia _comuneService;
public SetUscitaMezzo(IHttpRequestManager<List<Response>> client, IGetToken getToken, IConfiguration configuration, IGetDescComuneProvincia comuneService)
{
_getToken = getToken;
_configuration = configuration;
_client = client;
_comuneService = comuneService;
}
public void Set(UscitaGAC uscita)
{
//OTTENGO PROVINCIA E COMUNE
var territorio = _comuneService.GetComuneBy(uscita.comune.descrizione).Result;
uscita.comune.codice = territorio.First(x => x.descrizione.ToLower().Equals(uscita.comune.descrizione.ToLower())).codice;
uscita.provincia.codice = territorio.First(x => x.provincia.descrizione.ToLower().Equals(uscita.provincia.descrizione.ToLower())).codice;
//USCITA GAC
var lstUscite = new List<UscitaGAC>() { uscita };
var jsonString = JsonConvert.SerializeObject(lstUscite);
var content = new StringContent(jsonString);
var uri = new Uri(_configuration.GetSection("UrlExternalApi").GetSection("GacApi").Value + Costanti.GacUscitaMezzo);
var result = _client.PutAsync(uri, content, _getToken.GeneraToken()).Result;
if (result != null && result.TrueForAll(item => item.codiceEsito != "200" && item.codiceEsito != "201"))
{
throw new Exception($"Errore servizio uscita GAC: {result.First().codiceEsito}, {result.First().descrizioneEsito}");
}
}
}
}
| agpl-3.0 | C# |
ddfc87dd9d165e89d1b2feb3725e36722d2937a7 | add unit test to demonstrate "PromoteActiveSecondaryToPrimary" | loekd/ServiceFabric.Mocks | test/ServiceFabric.Mocks.Tests/ServiceTests/MockStatefulServiceReplicaTests.cs | test/ServiceFabric.Mocks.Tests/ServiceTests/MockStatefulServiceReplicaTests.cs | using Microsoft.ServiceFabric.Data;
using Microsoft.ServiceFabric.Services.Communication.Runtime;
using Microsoft.ServiceFabric.Services.Remoting;
using Microsoft.ServiceFabric.Services.Runtime;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ServiceFabric.Mocks.ReplicaSet;
using System;
using System.Collections.Generic;
using System.Fabric;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace ServiceFabric.Mocks.Tests.ServiceTests
{
[TestClass]
public class MockStatefulServiceReplicaTests
{
[TestMethod]
public async Task TestPrimaryReplicaShouldHaveOpenListenersAsync()
{
Func<StatefulServiceContext, IReliableStateManagerReplica2, StatefulServiceWithReplicaListener> serviceFactory = (StatefulServiceContext context, IReliableStateManagerReplica2 stateManager) => new StatefulServiceWithReplicaListener(context);
var replicaSet = new MockStatefulServiceReplicaSet<StatefulServiceWithReplicaListener>(serviceFactory);
await replicaSet.AddReplicaAsync(ReplicaRole.Primary, 1);
var openListeners = replicaSet.Primary.OpenListeners;
Assert.AreEqual(1, openListeners.Count());
}
[TestMethod]
public async Task TestPromoteActiveSecondaryToPrimaryAsync()
{
Func<StatefulServiceContext, IReliableStateManagerReplica2, StatefulServiceWithReplicaListener> serviceFactory = (StatefulServiceContext context, IReliableStateManagerReplica2 stateManager) => new StatefulServiceWithReplicaListener(context);
var replicaSet = new MockStatefulServiceReplicaSet<StatefulServiceWithReplicaListener>(serviceFactory);
await replicaSet.AddReplicaAsync(ReplicaRole.Primary, 1);
await replicaSet.AddReplicaAsync(ReplicaRole.ActiveSecondary, 2);
await replicaSet.PromoteActiveSecondaryToPrimaryAsync(2);
Assert.AreEqual(2, replicaSet.Primary.ReplicaId);
}
}
public class StatefulServiceWithReplicaListener : StatefulService, IService
{
public StatefulServiceWithReplicaListener(StatefulServiceContext serviceContext) : base(serviceContext)
{
}
protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
{
return new List<ServiceReplicaListener>() {
new ServiceReplicaListener((context) => new Listener()),
};
}
}
public class Listener : ICommunicationListener
{
public void Abort()
{
throw new NotImplementedException();
}
public Task CloseAsync(CancellationToken cancellationToken)
{
return Task.FromResult(true);
}
public async Task<string> OpenAsync(CancellationToken cancellationToken)
{
return await Task.FromResult(string.Empty);
}
}
}
| using System;
using System.Collections.Generic;
using System.Fabric;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.ServiceFabric.Data;
using Microsoft.ServiceFabric.Services.Communication.Runtime;
using Microsoft.ServiceFabric.Services.Remoting;
using Microsoft.ServiceFabric.Services.Runtime;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ServiceFabric.Mocks.ReplicaSet;
namespace ServiceFabric.Mocks.Tests.ServiceTests
{
[TestClass]
public class MockStatefulServiceReplicaTests
{
[TestMethod]
public async Task TestPrimaryReplicaShouldHaveOpenListenersAsync()
{
Func<StatefulServiceContext, IReliableStateManagerReplica2, StatefulServiceWithReplicaListener> serviceFactory = (StatefulServiceContext context, IReliableStateManagerReplica2 stateManager) => new StatefulServiceWithReplicaListener(context);
var replicaSet = new MockStatefulServiceReplicaSet<StatefulServiceWithReplicaListener>(serviceFactory);
await replicaSet.AddReplicaAsync(ReplicaRole.Primary, 1);
var openListeners = replicaSet.Primary.OpenListeners;
Assert.AreEqual(1, openListeners.Count());
}
}
public class StatefulServiceWithReplicaListener : StatefulService, IService
{
public StatefulServiceWithReplicaListener(StatefulServiceContext serviceContext) : base(serviceContext)
{
}
protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
{
return new List<ServiceReplicaListener>() {
new ServiceReplicaListener((context) => new Listener()),
};
}
}
public class Listener : ICommunicationListener
{
public void Abort()
{
throw new NotImplementedException();
}
public Task CloseAsync(CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
public async Task<string> OpenAsync(CancellationToken cancellationToken)
{
return await Task.FromResult(string.Empty);
}
}
}
| mit | C# |
ce314653af35383f730ffd1c19d31dc5283e4d23 | add instalpath to info | SPBTV/Bugsnager.Net | Bugsnager/Payload/Device/MobileDeviceInfo.cs | Bugsnager/Payload/Device/MobileDeviceInfo.cs | using Newtonsoft.Json;
namespace Bugsnager.Payload.Device
{
public class MobileDeviceInfo
{
/// <summary>
/// Gets or sets the version of operating system (optional)
/// </summary>
[JsonProperty("osVersion")]
public string OSVersion { get; set; }
/// <summary>
/// Gets the name of mobile operator
/// </summary>
[JsonProperty("mobileOperator")]
public string MobileOperator { get; set; }
/// <summary>
/// Gets the type of connection (wifi or 3g)
/// </summary>
[JsonProperty("connectionType")]
public string ConnectionType { get; set; }
/// <summary>
/// Gets the model of the device
/// </summary>
[JsonProperty("deviceModel")]
public string DeviceModel { get; set; }
/// <summary>
/// Gets the region of the device
/// </summary>
[JsonProperty("deviceRegion")]
public string DeviceGeographicRegion { get; set; }
/// <summary>
/// Gets the manufacturer of the device
/// </summary>
[JsonProperty("deviceManufacturer")]
public string DeviceManufacturer { get; set; }
/// <summary>
/// Gets the device timezone
/// </summary>
[JsonProperty("deviceTimeZone")]
public string DeviceTimezone { get; set; }
/// <summary>
/// Gets the device timezone
/// </summary>
[JsonProperty("deviceId")]
public string DeviceId { get; set; }
/// <summary>
/// Gets the region of the device
/// </summary>
[JsonProperty("installPath")]
public string InstallPath { get; set; }
}
}
| using Newtonsoft.Json;
namespace Bugsnager.Payload.Device
{
public class MobileDeviceInfo
{
/// <summary>
/// Gets or sets the version of operating system (optional)
/// </summary>
[JsonProperty("osVersion")]
public string OSVersion { get; set; }
/// <summary>
/// Gets the name of mobile operator
/// </summary>
[JsonProperty("mobileOperator")]
public string MobileOperator { get; set; }
/// <summary>
/// Gets the type of connection (wifi or 3g)
/// </summary>
[JsonProperty("connectionType")]
public string ConnectionType { get; set; }
/// <summary>
/// Gets the model of the device
/// </summary>
[JsonProperty("deviceModel")]
public string DeviceModel { get; set; }
/// <summary>
/// Gets the region of the device
/// </summary>
[JsonProperty("deviceRegion")]
public string DeviceGeographicRegion { get; set; }
/// <summary>
/// Gets the manufacturer of the device
/// </summary>
[JsonProperty("deviceManufacturer")]
public string DeviceManufacturer { get; set; }
/// <summary>
/// Gets the device timezone
/// </summary>
[JsonProperty("deviceTimeZone")]
public string DeviceTimezone { get; set; }
/// <summary>
/// Gets the device timezone
/// </summary>
[JsonProperty("deviceId")]
public string DeviceId { get; set; }
}
}
| apache-2.0 | C# |
e53035cb8a0815a3c97b2d3be3e6522bc81a59a1 | Correct Logging Issue with ExpandXrmCMData.cs (#262) | WaelHamze/xrm-ci-framework,WaelHamze/xrm-ci-framework,WaelHamze/xrm-ci-framework | MSDYNV9/Xrm.Framework.CI/Xrm.Framework.CI.PowerShell.Cmdlets/ExpandXrmCMData.cs | MSDYNV9/Xrm.Framework.CI/Xrm.Framework.CI.PowerShell.Cmdlets/ExpandXrmCMData.cs | using System;
using System.Collections.Generic;
using System.Management.Automation;
using Microsoft.Crm.Sdk.Messages;
using Xrm.Framework.CI.Common;
namespace Xrm.Framework.CI.PowerShell.Cmdlets
{
/// <summary>
/// <para type="synopsis">Expands data zip file generated by Configuration Migration Tool</para>
/// <para type="description">Expands the data zip files and optionally created a file per entity
/// </para>
/// </summary>
/// <example>
/// <code>C:\PS>Expand-XrmSolution -ConnectionString "" -EntityName "account"</code>
/// <para>Exports the "" managed solution to "" location</para>
/// </example>
[Cmdlet(VerbsData.Expand, "XrmCMData")]
public class ExpandXrmCMData : CommandBase
{
#region Parameters
/// <summary>
/// <para type="description">The absolute path to the data zip file</para>
/// </summary>
[Parameter(Mandatory = true)]
public string DataZip { get; set; }
/// <para type="description">The target folder for the extracted files</para>
/// </summary>
[Parameter(Mandatory = true)]
public string Folder { get; set; }
/// <summary>
/// <para type="description">Splits the xml data into mutiple files per entity</para>
/// </summary>
[Parameter(Mandatory = false)]
public bool SplitDataXmlFile { get; set; }
/// <summary>
/// <para type="description">Sorts the data xml file based on record ids</para>
/// </summary>
[Parameter(Mandatory = false)]
public bool SortDataXmlFile { get; set; }
#endregion
#region Process Record
protected override void ProcessRecord()
{
base.ProcessRecord();
Logger.LogInformation("Expanding data file {0} to path: {1}", DataZip, Folder);
ConfigurationMigrationManager manager = new ConfigurationMigrationManager(Logger);
manager.ExpandData(DataZip, Folder);
if (SortDataXmlFile)
{
manager.SortDataXml(Folder);
}
if (SplitDataXmlFile)
{
manager.SplitData(Folder);
}
Logger.LogInformation("Exracting Data Completed");
}
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Management.Automation;
using Microsoft.Crm.Sdk.Messages;
using Xrm.Framework.CI.Common;
namespace Xrm.Framework.CI.PowerShell.Cmdlets
{
/// <summary>
/// <para type="synopsis">Expands data zip file generated by Configuration Migration Tool</para>
/// <para type="description">Expands the data zip files and optionally created a file per entity
/// </para>
/// </summary>
/// <example>
/// <code>C:\PS>Expand-XrmSolution -ConnectionString "" -EntityName "account"</code>
/// <para>Exports the "" managed solution to "" location</para>
/// </example>
[Cmdlet(VerbsData.Expand, "XrmCMData")]
public class ExpandXrmCMData : CommandBase
{
#region Parameters
/// <summary>
/// <para type="description">The absolute path to the data zip file</para>
/// </summary>
[Parameter(Mandatory = true)]
public string DataZip { get; set; }
/// <para type="description">The target folder for the extracted files</para>
/// </summary>
[Parameter(Mandatory = true)]
public string Folder { get; set; }
/// <summary>
/// <para type="description">Splits the xml data into mutiple files per entity</para>
/// </summary>
[Parameter(Mandatory = false)]
public bool SplitDataXmlFile { get; set; }
/// <summary>
/// <para type="description">Sorts the data xml file based on record ids</para>
/// </summary>
[Parameter(Mandatory = false)]
public bool SortDataXmlFile { get; set; }
#endregion
#region Process Record
protected override void ProcessRecord()
{
base.ProcessRecord();
Logger.LogInformation("Expanding data file {0} to path: {0}", DataZip, Folder);
ConfigurationMigrationManager manager = new ConfigurationMigrationManager(Logger);
manager.ExpandData(DataZip, Folder);
if (SortDataXmlFile)
{
manager.SortDataXml(Folder);
}
if (SplitDataXmlFile)
{
manager.SplitData(Folder);
}
Logger.LogInformation("Exracting Data Completed");
}
#endregion
}
} | mit | C# |
f41d01c860b6fca1d36fed446d50aa483ed566f0 | refactor snapshots save+load tests | Pondidum/Ledger,Pondidum/Ledger | Ledger.Stores.Fs.Tests/SnapshotSaveLoadTests.cs | Ledger.Stores.Fs.Tests/SnapshotSaveLoadTests.cs | using System;
using System.IO;
using Shouldly;
using TestsDomain;
using Xunit;
namespace Ledger.Stores.Fs.Tests
{
public class SnapshotSaveLoadTests : IDisposable
{
private readonly string _root;
private readonly FileEventStore<Guid> _store;
public SnapshotSaveLoadTests()
{
_root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(_root);
_store = new FileEventStore<Guid>(_root);
}
[Fact]
public void A_snapshot_should_maintain_type()
{
var id = Guid.NewGuid();
_store.SaveSnapshot(id, new CandidateMemento());
var loaded = _store.LoadLatestSnapshotFor(id);
loaded.ShouldBeOfType<CandidateMemento>();
}
[Fact]
public void Only_the_latest_snapshot_should_be_loaded()
{
var id = Guid.NewGuid();
_store.SaveSnapshot(id, new CandidateMemento { SequenceID = 4 });
_store.SaveSnapshot(id, new CandidateMemento { SequenceID = 5 });
_store
.LoadLatestSnapshotFor(id)
.SequenceID
.ShouldBe(5);
}
[Fact]
public void The_most_recent_snapshot_id_should_be_found()
{
var id = Guid.NewGuid();
_store.SaveSnapshot(id, new CandidateMemento { SequenceID = 4 });
_store.SaveSnapshot(id, new CandidateMemento { SequenceID = 5 });
_store
.GetLatestSnapshotSequenceFor(id)
.ShouldBe(5);
}
[Fact]
public void When_there_is_no_snapshot_file_and_load_is_called()
{
var id = Guid.NewGuid();
var loaded = _store.LoadLatestSnapshotFor(id);
loaded.ShouldBe(null);
}
public void Dispose()
{
try
{
Directory.Delete(_root, true);
}
catch (Exception)
{
}
}
}
}
| using System;
using System.IO;
using Shouldly;
using TestsDomain;
using Xunit;
namespace Ledger.Stores.Fs.Tests
{
public class SnapshotSaveLoadTests : IDisposable
{
private readonly string _root;
public SnapshotSaveLoadTests()
{
_root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(_root);
}
[Fact]
public void A_snapshot_should_maintain_type()
{
var id = Guid.NewGuid();
var store = new FileEventStore<Guid>(_root);
store.SaveSnapshot(id, new CandidateMemento());
var loaded = store.LoadLatestSnapshotFor(id);
loaded.ShouldBeOfType<CandidateMemento>();
}
[Fact]
public void Only_the_latest_snapshot_should_be_loaded()
{
var id = Guid.NewGuid();
var store = new FileEventStore<Guid>(_root);
store.SaveSnapshot(id, new CandidateMemento { SequenceID = 4 });
store.SaveSnapshot(id, new CandidateMemento { SequenceID = 5 });
store
.LoadLatestSnapshotFor(id)
.SequenceID
.ShouldBe(5);
}
[Fact]
public void The_most_recent_snapshot_id_should_be_found()
{
var id = Guid.NewGuid();
var store = new FileEventStore<Guid>(_root);
store.SaveSnapshot(id, new CandidateMemento { SequenceID = 4 });
store.SaveSnapshot(id, new CandidateMemento { SequenceID = 5 });
store
.GetLatestSnapshotSequenceFor(id)
.ShouldBe(5);
}
[Fact]
public void When_there_is_no_snapshot_file_and_load_is_called()
{
var id = Guid.NewGuid();
var store = new FileEventStore<Guid>(_root);
var loaded = store.LoadLatestSnapshotFor(id);
loaded.ShouldBe(null);
}
public void Dispose()
{
try
{
Directory.Delete(_root, true);
}
catch (Exception)
{
}
}
}
}
| lgpl-2.1 | C# |
7f654c8833437971ea4f463d17fad622b2cfc05d | Check trigger before setting | MrJaqbq/Unity3DFramework | Base/Gameplay/Damageable.cs | Base/Gameplay/Damageable.cs | using UnityEngine;
using UnityEngine.Events;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class Damageable : MonoBehaviour
{
public bool InitOnStart;
public bool Invincible;
public int MaxHealth;
public int StartingHealth;
public float Delay = 1;
private float LastHurt;
public int CurrentHealth { get; private set; }
public bool IsAlive { get { return CurrentHealth > 0; } }
public Animator Anim;
public string OnHit;
public string OnDed;
public AnimationPlayer DeathAnim;
void Start()
{
if (!InitOnStart)
return;
Init();
}
public void Init()
{
CurrentHealth = StartingHealth;
Anim = GetComponentInChildren<Animator>();
}
public void Heal(int amount)
{
CurrentHealth += amount;
CurrentHealth = Mathf.Clamp(CurrentHealth, 0, MaxHealth);
}
public void Hurt(int amount)
{
if (Invincible || !IsAlive)
return;
if (Time.time - LastHurt < Delay)
return;
if (Anim)
Anim.SetTrigger(OnHit);
LastHurt = Time.time;
CurrentHealth -= amount;
CurrentHealth = Mathf.Clamp(CurrentHealth, 0, MaxHealth);
if (!IsAlive)
Dead();
}
public void Dead()
{
if (Anim)
Anim.SetBool(OnDed, true);
DeathAnim.Play();
}
void Update()
{
if (Anim && string.IsNullOrEmpty(OnDed))
{
Anim.SetBool(OnDed, !IsAlive);
}
DeathAnim.Update();
}
#if UNITY_EDITOR
void OnValidate()
{
if (!Application.isEditor)
return;
StartingHealth = Mathf.Clamp(StartingHealth, 0, MaxHealth);
}
void OnDrawGizmosSelected()
{
Handles.Label(transform.position + Vector3.up * 1, "HP : " + CurrentHealth + "/" + MaxHealth);
}
#endif
}
| using UnityEngine;
using UnityEngine.Events;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class Damageable : MonoBehaviour
{
public bool InitOnStart;
public bool Invincible;
public int MaxHealth;
public int StartingHealth;
public float Delay = 1;
private float LastHurt;
public int CurrentHealth { get; private set; }
public bool IsAlive { get { return CurrentHealth > 0; } }
public Animator Anim;
public string OnHit;
public string OnDed;
public AnimationPlayer DeathAnim;
void Start()
{
if (!InitOnStart)
return;
Init();
}
public void Init()
{
CurrentHealth = StartingHealth;
Anim = GetComponentInChildren<Animator>();
}
public void Heal(int amount)
{
CurrentHealth += amount;
CurrentHealth = Mathf.Clamp(CurrentHealth, 0, MaxHealth);
}
public void Hurt(int amount)
{
if (Invincible || !IsAlive)
return;
if (Time.time - LastHurt < Delay)
return;
if (Anim)
Anim.SetTrigger(OnHit);
LastHurt = Time.time;
CurrentHealth -= amount;
CurrentHealth = Mathf.Clamp(CurrentHealth, 0, MaxHealth);
if (!IsAlive)
Dead();
}
public void Dead()
{
if (Anim)
Anim.SetBool(OnDed, true);
DeathAnim.Play();
}
void Update()
{
if (Anim)
{
Anim.SetBool(OnDed, !IsAlive);
}
DeathAnim.Update();
}
#if UNITY_EDITOR
void OnValidate()
{
if (!Application.isEditor)
return;
StartingHealth = Mathf.Clamp(StartingHealth, 0, MaxHealth);
}
void OnDrawGizmosSelected()
{
Handles.Label(transform.position + Vector3.up * 1, "HP : " + CurrentHealth + "/" + MaxHealth);
}
#endif
}
| mit | C# |
c87d27a7ce47ec4208c60a4aec188081e03d105a | Update the Copyright year to 2013 | fjxhkj/PTVS,fjxhkj/PTVS,jkorell/PTVS,modulexcite/PTVS,gomiero/PTVS,int19h/PTVS,DinoV/PTVS,gilbertw/PTVS,DinoV/PTVS,msunardi/PTVS,denfromufa/PTVS,DinoV/PTVS,jkorell/PTVS,Microsoft/PTVS,gilbertw/PTVS,huguesv/PTVS,jkorell/PTVS,DEVSENSE/PTVS,zooba/PTVS,mlorbetske/PTVS,DEVSENSE/PTVS,dut3062796s/PTVS,fjxhkj/PTVS,Habatchii/PTVS,MetSystem/PTVS,DEVSENSE/PTVS,juanyaw/PTVS,DEVSENSE/PTVS,denfromufa/PTVS,MetSystem/PTVS,jkorell/PTVS,ChinaQuants/PTVS,christer155/PTVS,int19h/PTVS,bolabola/PTVS,denfromufa/PTVS,Habatchii/PTVS,zooba/PTVS,fjxhkj/PTVS,DinoV/PTVS,Microsoft/PTVS,Habatchii/PTVS,int19h/PTVS,modulexcite/PTVS,christer155/PTVS,fjxhkj/PTVS,msunardi/PTVS,gilbertw/PTVS,gomiero/PTVS,crwilcox/PTVS,ChinaQuants/PTVS,Microsoft/PTVS,xNUTs/PTVS,int19h/PTVS,bolabola/PTVS,mlorbetske/PTVS,fivejjs/PTVS,huguesv/PTVS,xNUTs/PTVS,mlorbetske/PTVS,gilbertw/PTVS,Habatchii/PTVS,DEVSENSE/PTVS,alanch-ms/PTVS,christer155/PTVS,xNUTs/PTVS,msunardi/PTVS,xNUTs/PTVS,msunardi/PTVS,bolabola/PTVS,ChinaQuants/PTVS,gomiero/PTVS,jkorell/PTVS,dut3062796s/PTVS,juanyaw/PTVS,fivejjs/PTVS,msunardi/PTVS,MetSystem/PTVS,Habatchii/PTVS,mlorbetske/PTVS,juanyaw/PTVS,Microsoft/PTVS,ChinaQuants/PTVS,bolabola/PTVS,mlorbetske/PTVS,zooba/PTVS,MetSystem/PTVS,alanch-ms/PTVS,fivejjs/PTVS,mlorbetske/PTVS,gomiero/PTVS,modulexcite/PTVS,crwilcox/PTVS,int19h/PTVS,dut3062796s/PTVS,bolabola/PTVS,modulexcite/PTVS,ChinaQuants/PTVS,MetSystem/PTVS,DinoV/PTVS,fjxhkj/PTVS,Microsoft/PTVS,DEVSENSE/PTVS,crwilcox/PTVS,xNUTs/PTVS,alanch-ms/PTVS,gomiero/PTVS,zooba/PTVS,jkorell/PTVS,modulexcite/PTVS,christer155/PTVS,huguesv/PTVS,DinoV/PTVS,ChinaQuants/PTVS,juanyaw/PTVS,gilbertw/PTVS,christer155/PTVS,christer155/PTVS,huguesv/PTVS,dut3062796s/PTVS,denfromufa/PTVS,dut3062796s/PTVS,Microsoft/PTVS,fivejjs/PTVS,denfromufa/PTVS,zooba/PTVS,MetSystem/PTVS,gomiero/PTVS,gilbertw/PTVS,alanch-ms/PTVS,fivejjs/PTVS,msunardi/PTVS,juanyaw/PTVS,int19h/PTVS,alanch-ms/PTVS,alanch-ms/PTVS,crwilcox/PTVS,crwilcox/PTVS,juanyaw/PTVS,zooba/PTVS,modulexcite/PTVS,huguesv/PTVS,crwilcox/PTVS,fivejjs/PTVS,Habatchii/PTVS,bolabola/PTVS,dut3062796s/PTVS,huguesv/PTVS,denfromufa/PTVS,xNUTs/PTVS | Build/AssemblyInfoCommon.cs | Build/AssemblyInfoCommon.cs | // <copyright>
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// The following assembly information is common to all Python Tools for Visual
// Studio assemblies.
// If you get compiler errors CS0579, "Duplicate '<attributename>' attribute", check your
// Properties\AssemblyInfo.cs file and remove any lines duplicating the ones below.
// (See also AssemblyVersion.cs in this same directory.)
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Python Tools for Visual Studio")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
| // <copyright>
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// The following assembly information is common to all Python Tools for Visual
// Studio assemblies.
// If you get compiler errors CS0579, "Duplicate '<attributename>' attribute", check your
// Properties\AssemblyInfo.cs file and remove any lines duplicating the ones below.
// (See also AssemblyVersion.cs in this same directory.)
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Python Tools for Visual Studio")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
| apache-2.0 | C# |
14143c1f258a4e2fa9b6fde14c52be304d062fb2 | Fix report abuse wording on contact support page. | skbkontur/NuGetGallery,mtian/SiteExtensionGallery,ScottShingler/NuGetGallery,JetBrains/ReSharperGallery,mtian/SiteExtensionGallery,grenade/NuGetGallery_download-count-patch,projectkudu/SiteExtensionGallery,JetBrains/ReSharperGallery,grenade/NuGetGallery_download-count-patch,skbkontur/NuGetGallery,ScottShingler/NuGetGallery,ScottShingler/NuGetGallery,projectkudu/SiteExtensionGallery,KuduApps/NuGetGallery,skbkontur/NuGetGallery,KuduApps/NuGetGallery,KuduApps/NuGetGallery,KuduApps/NuGetGallery,projectkudu/SiteExtensionGallery,KuduApps/NuGetGallery,mtian/SiteExtensionGallery,JetBrains/ReSharperGallery,grenade/NuGetGallery_download-count-patch | Website/Views/Packages/ReportMyPackage.cshtml | Website/Views/Packages/ReportMyPackage.cshtml | @using PoliteCaptcha
@model ReportAbuseViewModel
@{
ViewBag.Tab = "Packages";
}
<h1 class="page-heading">Contact Support About My Package</h1>
<p>Please select the reason for contacting support about your package.</p>
@using (Html.BeginForm())
{
<fieldset class="form">
<legend>Contact Support</legend>
@Html.AntiForgeryToken()
<div class="form-field">
@if (!Model.ConfirmedUser)
{
@Html.LabelFor(m => m.Email)
@Html.EditorFor(m => m.Email)
<span class="field-hint-message">Provide your email address so we can follow up with you.</span>
@Html.ValidationMessageFor(m => m.Email)
}
else
{
<input type="hidden" name="Email" value="test@example.com" />
}
</div>
<div class="form-field">
@Html.LabelFor(m => m.Reason)
@Html.DropDownListFor(m => m.Reason, Model.AllowedReasons.Select(
x => new SelectListItem { Value = x.ToString(), Text = ReportAbuseViewModel.ReasonDescriptions[x]}))
@Html.LabelFor(m => m.Message, "Problem")
<p>In addition to selecting the reason for reporting the package, you <em>must</em> provide details of the problem.</p>
@Html.TextAreaFor(m => m.Message, 10, 50, null)
@Html.ValidationMessageFor(m => m.Message)
</div>
@Html.SpamPreventionFields()
<input type="submit" value="Report" title="Report your problem with '@Model.PackageId'" />
</fieldset>
}
@section BottomScripts {
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@Html.SpamPreventionScript()
} | @using PoliteCaptcha
@model ReportAbuseViewModel
@{
ViewBag.Tab = "Packages";
}
<h1 class="page-heading">Contact Support About My Package</h1>
<p>Please select the reason for contacting support about your package.</p>
@using (Html.BeginForm())
{
<fieldset class="form">
<legend>Report Abuse</legend>
@Html.AntiForgeryToken()
<div class="form-field">
@if (!Model.ConfirmedUser)
{
@Html.LabelFor(m => m.Email)
@Html.EditorFor(m => m.Email)
<span class="field-hint-message">Provide your email address so we can follow up with you.</span>
@Html.ValidationMessageFor(m => m.Email)
}
else
{
<input type="hidden" name="Email" value="test@example.com" />
}
</div>
<div class="form-field">
@Html.LabelFor(m => m.Reason)
@Html.DropDownListFor(m => m.Reason, Model.AllowedReasons.Select(
x => new SelectListItem { Value = x.ToString(), Text = ReportAbuseViewModel.ReasonDescriptions[x]}))
@Html.LabelFor(m => m.Message, "Problem")
<p>In addition to selecting the reason for reporting the package, you <em>must</em> provide details of the problem.</p>
@Html.TextAreaFor(m => m.Message, 10, 50, null)
@Html.ValidationMessageFor(m => m.Message)
</div>
@Html.SpamPreventionFields()
<input type="submit" value="Report" title="Report your problem with '@Model.PackageId'" />
</fieldset>
}
@section BottomScripts {
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@Html.SpamPreventionScript()
} | apache-2.0 | C# |
7b8c56b792ba0287a94d0910dea77f9884a11ca8 | Fix broken projects | atbyrd/Withings.NET,atbyrd/Withings.NET | Withings.Specifications/AuthenticatorTests.cs | Withings.Specifications/AuthenticatorTests.cs | using System;
using System.Threading.Tasks;
using AsyncOAuth;
using NUnit.Framework;
using Withings.NET.Client;
namespace Withings.Specifications
{
[TestFixture]
public class AuthenticatorTests
{
Authenticator _authenticator;
WithingsCredentials _credentials = new WithingsCredentials();
private RequestToken _requestToken;
[SetUp]
public async Task Init()
{
_credentials = new WithingsCredentials();
_credentials.SetCallbackUrl("http://localhost:56617/api/oauth/callback");
_credentials.SetConsumerProperties("fb97731ef7cc787067ff5912d13663520e9428038044d198ded8d3009c52", "36b51e76c54f49558de84756c1c613b9ec450011b6481e6424dfe905bcb3c6");
_authenticator = new Authenticator(_credentials);
_requestToken = await _authenticator.GetRequestToken();
}
[Test]
public void RequestTokenTest()
{
Assert.IsNotEmpty(_requestToken.Key);
Assert.IsNotNull(_requestToken.Key);
Assert.IsNotEmpty(_requestToken.Secret);
Assert.IsNotNull(_requestToken.Secret);
}
[Test]
public void AuthorizeUrlTest()
{
var url = _authenticator.UserRequestUrl(_requestToken);
Assert.IsNotNull(url);
Assert.IsNotEmpty(url);
}
[Test]
public void InvalidAuthorizeUrlTest()
{
Assert.Throws<ArgumentNullException>(() => _authenticator.UserRequestUrl(null));
}
[Test]
public void ExchangeInvalidRequestTokenForAccessTokenTest()
{
Assert.Throws<AggregateException>(InvalidExchangeRequestForAccessToken);
}
private void InvalidExchangeRequestForAccessToken()
{
var unused = _authenticator.ExchangeRequestTokenForAccessToken(_requestToken, _requestToken.Secret).Result;
}
}
}
| using System;
using System.Threading.Tasks;
using AsyncOAuth;
using NUnit.Framework;
using Withings.NET.Client;
namespace Withings.Specifications
{
[TestFixture]
public class AuthenticatorTests
{
Authenticator _authenticator;
WithingsCredentials _credentials = new WithingsCredentials();
private RequestToken _requestToken;
[SetUp]
public async Task Init()
{
_credentials = new WithingsCredentials();
_credentials.SetCallbackUrl("http://localhost:56617/api/oauth/callback");
_credentials.SetConsumerProperties("fb97731ef7cc787067ff5912d13663520e9428038044d198ded8d3009c52", "36b51e76c54f49558de84756c1c613b9ec450011b6481e6424dfe905bcb3c6");
_authenticator = new Authenticator(_credentials);
_requestToken = await _authenticator.GetRequestToken();
}
[Test]
public void RequestTokenTest()
{
Assert.IsNotEmpty(_requestToken.Key);
Assert.IsNotNull(_requestToken.Key);
Assert.IsNotEmpty(_requestToken.Secret);
Assert.IsNotNull(_requestToken.Secret);
}
[Test]
public void AuthorizeUrlTest()
{
var url = _authenticator.UserRequestUrl(_requestToken);
Assert.IsNotNull(url);
Assert.IsNotEmpty(url);
}
[Test]
public void InvalidAuthorizeUrlTest()
{
Assert.Throws<ArgumentNullException>(() => _authenticator.UserRequestUrl(null));
}
[Test]
public void ExchangeInvalidRequestTokenForAccessTokenTest()
{
Assert.Throws<AggregateException>(InvalidExchangeRequestForAccessToken);
}
void InvalidExchangeRequestForAccessToken()
{
var unused = _authenticator.ExchangeRequestTokenForAccessToken(_requestToken, _requestToken.Secret).Result;
}
}
}
| mit | C# |
b28ff45d8f126fcd62f048945ba017ff68b57e8b | Update sentry to send data necessary for linking events with users | Piotrekol/StreamCompanion,Piotrekol/StreamCompanion | osu!StreamCompanion/Code/Core/Loggers/SentryLogger.cs | osu!StreamCompanion/Code/Core/Loggers/SentryLogger.cs | using System;
using System.Collections.Generic;
using osu_StreamCompanion.Code.Helpers;
using Sentry;
using StreamCompanionTypes.Enums;
using StreamCompanionTypes.Interfaces.Services;
namespace osu_StreamCompanion.Code.Core.Loggers
{
public class SentryLogger : IContextAwareLogger
{
public static string SentryDsn =
"https://3187b2a91f23411ab7ec5f85ad7d80b8@sentry.pioo.space/2";
public static SentryClient SentryClient { get; } = new SentryClient(new SentryOptions
{
Dsn = SentryDsn,
Release = Program.ScVersion,
SendDefaultPii = true,
BeforeSend = BeforeSend
});
private static SentryEvent? BeforeSend(SentryEvent arg)
{
arg.User.IpAddress = null;
return arg;
}
public static Dictionary<string, string> ContextData { get; } = new Dictionary<string, string>();
private object _lockingObject = new object();
public void Log(object logMessage, LogLevel logLevel, params string[] vals)
{
if (logLevel == LogLevel.Critical && logMessage is Exception exception && !(exception is NonLoggableException))
{
var sentryEvent = new SentryEvent(exception);
lock (_lockingObject)
{
foreach (var contextKeyValue in ContextData)
{
sentryEvent.SetExtra(contextKeyValue.Key, contextKeyValue.Value);
}
SentryClient.CaptureEvent(sentryEvent);
}
}
}
public void SetContextData(string key, string value)
{
lock (_lockingObject)
ContextData[key] = value;
}
}
} | using System;
using System.Collections.Generic;
using osu_StreamCompanion.Code.Helpers;
using Sentry;
using StreamCompanionTypes.Enums;
using StreamCompanionTypes.Interfaces.Services;
namespace osu_StreamCompanion.Code.Core.Loggers
{
public class SentryLogger : IContextAwareLogger
{
public static string SentryDsn =
"https://3187b2a91f23411ab7ec5f85ad7d80b8@sentry.pioo.space/2";
public static SentryClient SentryClient { get; } = new SentryClient(new SentryOptions
{
Dsn = SentryDsn,
Release = Program.ScVersion
});
public static Dictionary<string, string> ContextData { get; } = new Dictionary<string, string>();
private object _lockingObject = new object();
public void Log(object logMessage, LogLevel logLevel, params string[] vals)
{
if (logLevel == LogLevel.Critical && logMessage is Exception exception && !(exception is NonLoggableException))
{
var sentryEvent = new SentryEvent(exception);
lock (_lockingObject)
{
foreach (var contextKeyValue in ContextData)
{
sentryEvent.SetExtra(contextKeyValue.Key, contextKeyValue.Value);
}
SentryClient.CaptureEvent(sentryEvent);
}
}
}
public void SetContextData(string key, string value)
{
lock (_lockingObject)
ContextData[key] = value;
}
}
} | mit | C# |
8de30c9255bb16722e4edcc874b809046d22adab | Bump Facebook sdk versions | SotoiGhost/FacebookComponents,SotoiGhost/FacebookComponents | Facebook.Android/build.cake | Facebook.Android/build.cake |
#load "../common.cake"
var FB_VERSION = "4.11.0";
var FB_URL = string.Format ("http://search.maven.org/remotecontent?filepath=com/facebook/android/facebook-android-sdk/{0}/facebook-android-sdk-{0}.aar", FB_VERSION);
var FB_DOCS_URL = string.Format ("http://search.maven.org/remotecontent?filepath=com/facebook/android/facebook-android-sdk/{0}/facebook-android-sdk-{0}-javadoc.jar", FB_VERSION);
var AN_VERSION = "4.11.0";
var AN_URL = string.Format ("http://search.maven.org/remotecontent?filepath=com/facebook/android/audience-network-sdk/{0}/audience-network-sdk-{0}.aar", AN_VERSION);
var TARGET = Argument ("t", Argument ("target", "Default"));
var buildSpec = new BuildSpec () {
Libs = new [] {
new DefaultSolutionBuilder {
SolutionPath = "./Xamarin.Facebook.sln",
BuildsOn = BuildPlatforms.Mac,
OutputFiles = new [] {
new OutputFileCopy {
FromFile = "./source/Xamarin.Facebook/bin/Release/Xamarin.Facebook.dll",
},
new OutputFileCopy {
FromFile = "./source/Xamarin.Facebook.AudienceNetwork/bin/Release/Xamarin.Facebook.AudienceNetwork.dll",
}
}
}
},
Samples = new [] {
new DefaultSolutionBuilder { SolutionPath = "./samples/HelloFacebookSample.sln" },
new DefaultSolutionBuilder { SolutionPath = "./samples/MessengerSendSample.sln" },
new DefaultSolutionBuilder { SolutionPath = "./samples/AudienceNetworkSample.sln" },
},
NuGets = new [] {
new NuGetInfo { NuSpec = "./nuget/Xamarin.Facebook.Android.nuspec"},
new NuGetInfo { NuSpec = "./nuget/Xamarin.Facebook.AudienceNetwork.Android.nuspec"},
},
Components = new [] {
new Component {ManifestDirectory = "./component"},
},
};
Task ("externals")
.WithCriteria (!FileExists ("./externals/facebook.aar"))
.Does (() =>
{
if (!DirectoryExists ("./externals/"))
CreateDirectory ("./externals");
// Download the FB aar
DownloadFile (FB_URL, "./externals/facebook.aar");
// Download, and unzip the docs .jar
DownloadFile (FB_DOCS_URL, "./externals/facebook-docs.jar");
if (!DirectoryExists ("./externals/fb-docs"))
CreateDirectory ("./externals/fb-docs");
Unzip ("./externals/facebook-docs.jar", "./externals/fb-docs");
// Download the FB aar
DownloadFile (AN_URL, "./externals/audiencenetwork.aar");
});
Task ("clean").IsDependentOn ("clean-base").Does (() =>
{
if (DirectoryExists ("./externals/"))
DeleteDirectory ("./externals", true);
});
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
RunTarget (TARGET);
|
#load "../common.cake"
var FB_VERSION = "4.10.1";
var FB_URL = string.Format ("http://search.maven.org/remotecontent?filepath=com/facebook/android/facebook-android-sdk/{0}/facebook-android-sdk-{0}.aar", FB_VERSION);
var FB_DOCS_URL = string.Format ("http://search.maven.org/remotecontent?filepath=com/facebook/android/facebook-android-sdk/{0}/facebook-android-sdk-{0}-javadoc.jar", FB_VERSION);
var AN_VERSION = "4.10.1";
var AN_URL = string.Format ("http://search.maven.org/remotecontent?filepath=com/facebook/android/audience-network-sdk/{0}/audience-network-sdk-{0}.aar", AN_VERSION);
var TARGET = Argument ("t", Argument ("target", "Default"));
var buildSpec = new BuildSpec () {
Libs = new [] {
new DefaultSolutionBuilder {
SolutionPath = "./Xamarin.Facebook.sln",
BuildsOn = BuildPlatforms.Mac,
OutputFiles = new [] {
new OutputFileCopy {
FromFile = "./source/Xamarin.Facebook/bin/Release/Xamarin.Facebook.dll",
},
new OutputFileCopy {
FromFile = "./source/Xamarin.Facebook.AudienceNetwork/bin/Release/Xamarin.Facebook.AudienceNetwork.dll",
}
}
}
},
Samples = new [] {
new DefaultSolutionBuilder { SolutionPath = "./samples/HelloFacebookSample.sln" },
new DefaultSolutionBuilder { SolutionPath = "./samples/MessengerSendSample.sln" },
new DefaultSolutionBuilder { SolutionPath = "./samples/AudienceNetworkSample.sln" },
},
NuGets = new [] {
new NuGetInfo { NuSpec = "./nuget/Xamarin.Facebook.Android.nuspec"},
new NuGetInfo { NuSpec = "./nuget/Xamarin.Facebook.AudienceNetwork.Android.nuspec"},
},
Components = new [] {
new Component {ManifestDirectory = "./component"},
},
};
Task ("externals")
.WithCriteria (!FileExists ("./externals/facebook.aar"))
.Does (() =>
{
if (!DirectoryExists ("./externals/"))
CreateDirectory ("./externals");
// Download the FB aar
DownloadFile (FB_URL, "./externals/facebook.aar");
// Download, and unzip the docs .jar
DownloadFile (FB_DOCS_URL, "./externals/facebook-docs.jar");
if (!DirectoryExists ("./externals/fb-docs"))
CreateDirectory ("./externals/fb-docs");
Unzip ("./externals/facebook-docs.jar", "./externals/fb-docs");
// Download the FB aar
DownloadFile (AN_URL, "./externals/audiencenetwork.aar");
});
Task ("clean").IsDependentOn ("clean-base").Does (() =>
{
if (DirectoryExists ("./externals/"))
DeleteDirectory ("./externals", true);
});
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
RunTarget (TARGET);
| mit | C# |
8a5cc04072fad69524b9222e2ef3e174d07e4a1f | support custom results for exceptions | Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate,Pondidum/Magistrate | Magistrate/Api/ExceptionHandlerMiddleware.cs | Magistrate/Api/ExceptionHandlerMiddleware.cs | using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using Magistrate.Domain;
using Microsoft.Owin;
using Newtonsoft.Json;
using Owin.Routing;
using Serilog;
namespace Magistrate.Api
{
public class ExceptionHandlerMiddleware : OwinMiddleware
{
private static readonly ILogger Log = Serilog.Log.ForContext<ExceptionHandlerMiddleware>();
private readonly JsonSerializerSettings _jsonSettings;
private readonly Dictionary<Type, Func<IOwinContext, Exception, Task>> _handlers;
public ExceptionHandlerMiddleware(OwinMiddleware next, JsonSerializerSettings jsonSettings)
: base(next)
{
_jsonSettings = jsonSettings;
_handlers = new Dictionary<Type, Func<IOwinContext, Exception, Task>>();
Register<DuplicatePermissionException>(async (context, ex) =>
{
context.Response.StatusCode = 409; // 409:Conflict
await context.WriteJson(new { Message = ex.Message }, _jsonSettings);
});
}
private void Register<TException>(Func<IOwinContext, TException, Task> apply)
where TException : Exception
{
_handlers[typeof(TException)] = (context, ex) => apply(context, (TException)ex);
}
public override async Task Invoke(IOwinContext context)
{
try
{
await Next.Invoke(context);
}
catch (Exception ex)
{
Log.Error(ex, ex.ToString());
Func<IOwinContext, Exception, Task> handler;
if (_handlers.TryGetValue(ex.GetType(), out handler))
{
await handler(context, ex);
}
else
{
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
await context.WriteJson(ex, _jsonSettings);
}
}
}
}
}
| using System;
using System.Net;
using System.Threading.Tasks;
using Microsoft.Owin;
using Newtonsoft.Json;
using Owin.Routing;
using Serilog;
namespace Magistrate.Api
{
public class ExceptionHandlerMiddleware : OwinMiddleware
{
private static readonly ILogger Log = Serilog.Log.ForContext<ExceptionHandlerMiddleware>();
private readonly JsonSerializerSettings _jsonSettings;
public ExceptionHandlerMiddleware(OwinMiddleware next, JsonSerializerSettings jsonSettings)
: base(next)
{
_jsonSettings = jsonSettings;
}
public override async Task Invoke(IOwinContext context)
{
try
{
await Next.Invoke(context);
}
catch (Exception ex)
{
Log.Error(ex, ex.ToString());
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
await context.WriteJson(ex, _jsonSettings);
}
}
}
} | lgpl-2.1 | C# |
88742bf3732d255f5892def8d072c5231e3abe45 | Use var | Williams-Forrest/CachedCRUD | CachedCrudLib/CachedCrud.cs | CachedCrudLib/CachedCrud.cs |
namespace CachedCrudLib {
/// <typeparam name="K">Key type</typeparam>
/// <typeparam name="T">Data type</typeparam>
public class CachedCrud<K, T> : ICrud<K, T> where T : class {
protected ICache _cache;
protected ICrud<K, T> _service;
public CachedCrud(ICache cache, ICrud<K, T> service) {
_cache = cache;
_service = service;
}
public K Create(T obj) {
var k = _service.Create(obj);
return k;
}
public T Read(K key) {
var cacheKey = GetCacheKey(key);
var obj = _cache.Get(cacheKey) as T;
if (obj == null) {
obj = _service.Read(key);
if (obj != null) {
_cache.Insert(cacheKey, obj);
}
}
return obj;
}
public void Update(K key, T obj) {
var cacheKey = GetCacheKey(key);
_cache.Remove(cacheKey);
_service.Update(key, obj);
}
public void Delete(K key) {
var cacheKey = GetCacheKey(key);
_cache.Remove(cacheKey);
_service.Delete(key);
}
public void ClearCache(K key) {
var cacheKey = GetCacheKey(key);
_cache.Remove(cacheKey);
}
public string GetCacheKey(K key) {
return typeof(T).Name + ":" + key;
}
}
}
|
namespace CachedCrudLib {
/// <typeparam name="K">Key type</typeparam>
/// <typeparam name="T">Data type</typeparam>
public class CachedCrud<K, T> : ICrud<K, T> where T : class {
protected ICache _cache;
protected ICrud<K, T> _service;
public CachedCrud(ICache cache, ICrud<K, T> service) {
_cache = cache;
_service = service;
}
public K Create(T obj) {
var k = _service.Create(obj);
return k;
}
public T Read(K key) {
string cacheKey = GetCacheKey(key);
var obj = _cache.Get(cacheKey) as T;
if (obj == null) {
obj = _service.Read(key);
if (obj != null) {
_cache.Insert(cacheKey, obj);
}
}
return obj;
}
public void Update(K key, T obj) {
string cacheKey = GetCacheKey(key);
_cache.Remove(cacheKey);
_service.Update(key, obj);
}
public void Delete(K key) {
string cacheKey = GetCacheKey(key);
_cache.Remove(cacheKey);
_service.Delete(key);
}
public void ClearCache(K key) {
string cacheKey = GetCacheKey(key);
_cache.Remove(cacheKey);
}
public string GetCacheKey(K key) {
return typeof(T).Name + ":" + key;
}
}
}
| mit | C# |
d31fae10d565d6f2a212b2ff19e00103bdbce799 | Add an overload that automatically uses the default security headers without extra parameters #25 | andrewlock/NetEscapades.AspNetCore.SecurityHeaders,andrewlock/NetEscapades.AspNetCore.SecurityHeaders,andrewlock/NetEscapades.AspNetCore.SecurityHeaders,andrewlock/NetEscapades.AspNetCore.SecurityHeaders | src/NetEscapades.AspNetCore.SecurityHeaders/CustomHeaderMiddlewareExtensions.cs | src/NetEscapades.AspNetCore.SecurityHeaders/CustomHeaderMiddlewareExtensions.cs | using System;
using NetEscapades.AspNetCore.SecurityHeaders;
using NetEscapades.AspNetCore.SecurityHeaders.Infrastructure;
namespace Microsoft.AspNetCore.Builder
{
/// <summary>
/// The <see cref="IApplicationBuilder"/> extensions for adding Security headers middleware support.
/// </summary>
public static class CustomHeadersMiddlewareExtensions
{
/// <summary>
/// Adds middleware to your web application pipeline to automatically add security headers to requests
/// </summary>
/// <param name="app">The IApplicationBuilder passed to your Configure method</param>
/// <param name="policyName">The policy name of a configured policy.</param>
/// <returns>The original app parameter</returns>
public static IApplicationBuilder UseCustomHeadersMiddleware(this IApplicationBuilder app, string policyName)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
return app.UseMiddleware<CustomHeadersMiddleware>(policyName);
}
/// <summary>
/// Adds middleware to your web application pipeline to automatically add security headers to requests
/// </summary>
/// <param name="app">The IApplicationBuilder passed to your Configure method.</param>
/// <param name="policies">A configured policy collection.</param>
/// <returns>The original app parameter</returns>
public static IApplicationBuilder UseCustomHeadersMiddleware(this IApplicationBuilder app, HeaderPolicyCollection policies)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (policies == null)
{
throw new ArgumentNullException(nameof(policies));
}
return app.UseMiddleware<CustomHeadersMiddleware>(policies);
}
/// <summary>
/// Adds middleware to your web application pipeline to automatically add security headers to requests
///
/// Adds a policy collection configured using the default security headers, as in <see cref="HeaderPolicyCollectionExtensions.AddDefaultSecurityHeaders"/>
/// </summary>
/// <param name="app">The IApplicationBuilder passed to your Configure method.</param>
/// <returns>The original app parameter</returns>
public static IApplicationBuilder UseCustomHeadersMiddleware(this IApplicationBuilder app)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
var policies = new HeaderPolicyCollection()
.AddDefaultSecurityHeaders();
return app.UseMiddleware<CustomHeadersMiddleware>(policies);
}
}
} | using System;
using NetEscapades.AspNetCore.SecurityHeaders;
using NetEscapades.AspNetCore.SecurityHeaders.Infrastructure;
namespace Microsoft.AspNetCore.Builder
{
/// <summary>
/// The <see cref="IApplicationBuilder"/> extensions for adding Security headers middleware support.
/// </summary>
public static class CustomHeadersMiddlewareExtensions
{
/// <summary>
/// Adds middleware to your web application pipeline to automatically add security headers to requests
/// </summary>
/// <param name="app">The IApplicationBuilder passed to your Configure method</param>
/// <param name="policyName">The policy name of a configured policy.</param>
/// <returns>The original app parameter</returns>
public static IApplicationBuilder UseCustomHeadersMiddleware(this IApplicationBuilder app, string policyName)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
return app.UseMiddleware<CustomHeadersMiddleware>(policyName);
}
/// <summary>
/// Adds middleware to your web application pipeline to automatically add security headers to requests
/// </summary>
/// <param name="app">The IApplicationBuilder passed to your Configure method.</param>
/// <param name="policies">A configured policy collection.</param>
/// <returns>The original app parameter</returns>
public static IApplicationBuilder UseCustomHeadersMiddleware(this IApplicationBuilder app, HeaderPolicyCollection policies)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (policies == null)
{
throw new ArgumentNullException(nameof(policies));
}
return app.UseMiddleware<CustomHeadersMiddleware>(policies);
}
}
} | mit | C# |
1bcff8a3e26c43c31890456cc3528d1c63bcd0ce | Make generic covariant | johnneijzen/osu,NeoAdonis/osu,UselessToucan/osu,johnneijzen/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu-new,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,peppy/osu,ppy/osu,UselessToucan/osu,EVAST9919/osu,smoogipoo/osu,ZLima12/osu,peppy/osu,smoogipoo/osu,2yangk23/osu,2yangk23/osu,ppy/osu,ZLima12/osu,ppy/osu,peppy/osu,NeoAdonis/osu | osu.Game/Database/IModelManager.cs | osu.Game/Database/IModelManager.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;
namespace osu.Game.Database
{
/// <summary>
/// Represents a model manager that publishes events when <see cref="TModel"/>s are added or removed.
/// </summary>
/// <typeparam name="TModel">The model type.</typeparam>
public interface IModelManager<out TModel>
where TModel : class
{
event Action<TModel, bool> ItemAdded;
event Action<TModel> ItemRemoved;
}
}
| // 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;
namespace osu.Game.Database
{
/// <summary>
/// Represents a model manager that publishes events when <see cref="TModel"/>s are added or removed.
/// </summary>
/// <typeparam name="TModel">The model type.</typeparam>
public interface IModelManager<TModel>
where TModel : class
{
event Action<TModel, bool> ItemAdded;
event Action<TModel> ItemRemoved;
}
}
| mit | C# |
0bc338f25c2a30d4892d24e353f6cc3ed2d611c4 | Fix OAuth2 token header template | dfensgmbh/biz.dfch.CS.Abiquo.Client | src/biz.dfch.CS.Abiquo.Client/Authentication/OAuth2AuthenticationInformation.cs | src/biz.dfch.CS.Abiquo.Client/Authentication/OAuth2AuthenticationInformation.cs | /**
* Copyright 2016 d-fens GmbH
*
* 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.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace biz.dfch.CS.Abiquo.Client.Authentication
{
public class OAuth2AuthenticationInformation : IAuthenticationInformation
{
private readonly string _oAuth2Token;
private int _tenantId;
public OAuth2AuthenticationInformation(string oAuth2Token, int tenantId)
{
Contract.Requires(!string.IsNullOrWhiteSpace(oAuth2Token));
Contract.Requires(0 < tenantId);
_oAuth2Token = oAuth2Token;
_tenantId = tenantId;
}
public IDictionary<string, string> GetAuthorizationHeaders()
{
var headerValue = string.Format(Constants.BEARER_AUTHORIZATION_HEADER_VALUE_TEMPLATE, _oAuth2Token);
var headers = new Dictionary<string, string>
{
{Constants.AUTHORIZATION_HEADER_KEY, headerValue}
};
return headers;
}
public int GetTenantId()
{
return _tenantId;
}
}
}
| /**
* Copyright 2016 d-fens GmbH
*
* 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.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace biz.dfch.CS.Abiquo.Client.Authentication
{
public class OAuth2AuthenticationInformation : IAuthenticationInformation
{
private readonly string _oAuth2Token;
private int _tenantId;
public OAuth2AuthenticationInformation(string oAuth2Token, int tenantId)
{
Contract.Requires(!string.IsNullOrWhiteSpace(oAuth2Token));
Contract.Requires(0 < tenantId);
_oAuth2Token = oAuth2Token;
_tenantId = tenantId;
}
public IDictionary<string, string> GetAuthorizationHeaders()
{
var headerValue = string.Format(Constants.BASIC_AUTHORIZATION_HEADER_VALUE_TEMPLATE, _oAuth2Token);
var headers = new Dictionary<string, string>
{
{Constants.AUTHORIZATION_HEADER_KEY, headerValue}
};
return headers;
}
public int GetTenantId()
{
return _tenantId;
}
}
}
| apache-2.0 | C# |
2689a546a2f26745a42245a74acdc96b04d84806 | Fix to returning response | syl20bnr/omnisharp-server,x335/omnisharp-server,mispencer/OmniSharpServer,x335/omnisharp-server,OmniSharp/omnisharp-server,corngood/omnisharp-server,corngood/omnisharp-server,syl20bnr/omnisharp-server,svermeulen/omnisharp-server | OmniSharp/AddReference/AddReferenceModule.cs | OmniSharp/AddReference/AddReferenceModule.cs | using Nancy;
using Nancy.ModelBinding;
namespace OmniSharp.AddReference
{
public class AddReferenceModule : NancyModule
{
public AddReferenceModule(AddReferenceHandler handler)
{
Post["/addreference"] = x =>
{
var req = this.Bind<AddReferenceRequest>();
var res = handler.AddReference(req);
return Response.AsJson(res);
};
}
}
}
| using Nancy;
using Nancy.ModelBinding;
namespace OmniSharp.AddReference
{
public class AddReferenceModule : NancyModule
{
public AddReferenceModule(AddReferenceHandler handler)
{
Post["/addreference"] = x =>
{
var req = this.Bind<AddReferenceRequest>();
var res = handler.AddReference(req);
return res;
};
}
}
} | mit | C# |
91f9880c8fda1576abc97ba13ca66820225b7353 | Update #283 - Make provider get more performant for the average case | gabrielweyer/Glimpse,SusanaL/Glimpse,elkingtonmcb/Glimpse,sorenhl/Glimpse,elkingtonmcb/Glimpse,dudzon/Glimpse,sorenhl/Glimpse,rho24/Glimpse,Glimpse/Glimpse,codevlabs/Glimpse,Glimpse/Glimpse,paynecrl97/Glimpse,rho24/Glimpse,codevlabs/Glimpse,gabrielweyer/Glimpse,paynecrl97/Glimpse,gabrielweyer/Glimpse,flcdrg/Glimpse,SusanaL/Glimpse,dudzon/Glimpse,SusanaL/Glimpse,rho24/Glimpse,sorenhl/Glimpse,flcdrg/Glimpse,codevlabs/Glimpse,elkingtonmcb/Glimpse,dudzon/Glimpse,flcdrg/Glimpse,paynecrl97/Glimpse,rho24/Glimpse,Glimpse/Glimpse,paynecrl97/Glimpse | source/Glimpse.Ado/AlternateType/Support.cs | source/Glimpse.Ado/AlternateType/Support.cs | using System.Data.Common;
using System.Reflection;
namespace Glimpse.Ado.AlternateType
{
public static class Support
{
public static DbProviderFactory TryGetProviderFactory(this DbConnection connection)
{
// If we can pull it out quickly and easily
var profiledConnection = connection as GlimpseDbConnection;
if (profiledConnection != null)
{
return profiledConnection.InnerProviderFactory;
}
#if (NET45)
return DbProviderFactories.GetFactory(connection);
#else
return connection.GetType().GetProperty("ProviderFactory", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(connection, null) as DbProviderFactory;
#endif
}
public static DbProviderFactory TryGenerateProfileProviderFactory(this DbConnection connection)
{
var factory = connection.TryGetProviderFactory();
if (factory != null && !(factory is GlimpseDbProviderFactory))
{
var factoryType = typeof(GlimpseDbProviderFactory<>).MakeGenericType(factory.GetType());
factory = (DbProviderFactory)factoryType.GetField("Instance").GetValue(null);
}
return factory;
}
}
}
| using System.Data.Common;
using System.Reflection;
namespace Glimpse.Ado.AlternateType
{
public static class Support
{
public static DbProviderFactory TryGetProviderFactory(this DbConnection connection)
{
#if (NET45)
return DbProviderFactories.GetFactory(connection);
#else
return connection.GetType().GetProperty("ProviderFactory", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(connection, null) as DbProviderFactory;
#endif
}
public static DbProviderFactory TryGenerateProfileProviderFactory(this DbConnection connection)
{
var factory = connection.TryGetProviderFactory();
if (factory != null && !(factory is GlimpseDbProviderFactory))
{
var factoryType = typeof(GlimpseDbProviderFactory<>).MakeGenericType(factory.GetType());
factory = (DbProviderFactory)factoryType.GetField("Instance").GetValue(null);
}
return factory;
}
}
}
| apache-2.0 | C# |
2b392ed03ad2ae3fdfaa827fdf077504e7040839 | add missing model: ProGetPackage | lvermeulen/ProGet.Net | src/ProGet.Net/Native/Models/ProGetPackage.cs | src/ProGet.Net/Native/Models/ProGetPackage.cs | // ReSharper disable InconsistentNaming
namespace ProGet.Net.Native.Models
{
public class ProGetPackage
{
public int ProGetPackage_Id { get; set; }
public int Feed_Id { get; set; }
public string Group_Name { get; set; }
public string Package_Name { get; set; }
public string Title_Text { get; set; }
public string Description_Text { get; set; }
public string IconUrl_Text { get; set; }
public string LatestVersion_Text { get; set; }
public int Download_Count { get; set; }
}
}
| namespace ProGet.Net.Native.Models
{
public class ProGetPackage
{
}
}
| mit | C# |
2c1c2530972922640e393f9e28c0f423818a44cc | Make internals visible to the testing project | nerdfury/Slack.Webhooks,nerdfury/Slack.Webhooks | src/Slack.Webhooks/Properties/AssemblyInfo.cs | src/Slack.Webhooks/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Slack.Webhooks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Slack.Webhooks")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("98c19dcd-28da-4ebf-8e81-c9e051d65625")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.8.*")]
[assembly: AssemblyFileVersion("0.1.8.0")]
[assembly: InternalsVisibleTo("Slack.Webhooks.Tests")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Slack.Webhooks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Slack.Webhooks")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("98c19dcd-28da-4ebf-8e81-c9e051d65625")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.8.*")]
[assembly: AssemblyFileVersion("0.1.8.0")]
| mit | C# |
ddfff5a0f542e6082489983373bd2df8f11089a7 | Change namespace of Publisher | Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype | src/Glimpse.Common/Broker/IBrokerPublisher.cs | src/Glimpse.Common/Broker/IBrokerPublisher.cs | using System;
namespace Glimpse
{
public interface IBrokerPublisher
{
void PublishMessage(IMessage message);
}
} | using System;
namespace Glimpse.Broker
{
public interface IBrokerPublisher
{
void PublishMessage(IMessage message);
}
} | mit | C# |
d7c468a488895f58887cf3a9e042ba5a62c3d02e | Refactor - Program - List Items from a new Method call | dtro-devuk/Kata.Solved.GildedRose.CSharp,TheTalkingDev/Kata.Solved.GildedRose.CSharp | src/Kata.GildedRose.CSharp.Console/Program.cs | src/Kata.GildedRose.CSharp.Console/Program.cs | using Kata.GildedRose.CSharp.Domain;
using Kata.GildedRose.CSharp.Domain.Factory;
using System.Collections.Generic;
namespace Kata.GildedRose.CSharp.Console
{
public class Program
{
public IList<Item> Items; //You can't touch this
IUpdateItemStrategyFactory _updateFactory;
public Program()
{
_updateFactory = new UpdateItemStrategyFactory();
}
static void Main(string[] args)
{
System.Console.WriteLine("OMGHAI!");
var app = new Program()
{
Items = GetDefaultInventory()
};
app.UpdateQuality();
System.Console.ReadKey();
}
public static List<Item> GetDefaultInventory()
{
return new List<Item>
{
new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20},
new Item {Name = "Aged Brie", SellIn = 2, Quality = 0},
new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7},
new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80},
new Item
{
Name = "Backstage passes to a TAFKAL80ETC concert",
SellIn = 15,
Quality = 20
},
new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
};
}
public void UpdateQuality()
{
foreach (var item in Items)
{
var strategy = _updateFactory.Create(item);
strategy.UpdateItem(item);
}
}
}
} | using Kata.GildedRose.CSharp.Domain;
using Kata.GildedRose.CSharp.Domain.Factory;
using System.Collections.Generic;
namespace Kata.GildedRose.CSharp.Console
{
public class Program
{
public IList<Item> Items;
IUpdateItemStrategyFactory _updateFactory;
public Program()
{
_updateFactory = new UpdateItemStrategyFactory();
}
static void Main(string[] args)
{
System.Console.WriteLine("OMGHAI!");
var app = new Program()
{
Items = new List<Item>
{
new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20},
new Item {Name = "Aged Brie", SellIn = 2, Quality = 0},
new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7},
new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80},
new Item
{
Name = "Backstage passes to a TAFKAL80ETC concert",
SellIn = 15,
Quality = 20
},
new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
}
};
app.UpdateQuality();
System.Console.ReadKey();
}
public void UpdateQuality()
{
foreach (var item in Items)
{
var strategy = _updateFactory.Create(item);
strategy.UpdateItem(item);
}
}
}
} | mit | C# |
d0693d2ef232d9344d823e51890d1faf2d6fdffa | Use the new method for rule seed urls | samfun123/KtaneTwitchPlays,CaitSith2/KtaneTwitchPlays | TwitchPlaysAssembly/Src/Helpers/UrlHelper.cs | TwitchPlaysAssembly/Src/Helpers/UrlHelper.cs | using System.Text.RegularExpressions;
using UnityEngine;
public class UrlHelper : MonoBehaviour
{
public static UrlHelper Instance;
private void Awake()
{
Instance = this;
}
public void ChangeMode(bool toShort)
{
TwitchPlaySettings.data.LogUploaderShortUrls = toShort;
TwitchPlaySettings.WriteDataToFile();
}
public bool ToggleMode()
{
TwitchPlaySettings.data.LogUploaderShortUrls = !TwitchPlaySettings.data.LogUploaderShortUrls;
TwitchPlaySettings.WriteDataToFile();
return TwitchPlaySettings.data.LogUploaderShortUrls;
}
private string Escape(string toEscape)
{
return Regex.Replace(toEscape, @"[^\w%]", m => "%" + ((int)m.Value[0]).ToString("X2"));
}
public string LogAnalyserFor(string url)
{
return string.Format(TwitchPlaySettings.data.AnalyzerUrl + "#url={0}", url);
}
public string CommandReference => TwitchPlaySettings.data.LogUploaderShortUrls ? "https://goo.gl/rQUH8y" : "https://github.com/samfun123/KtaneTwitchPlays/wiki/Commands";
public string ManualFor(string module, string type = "html", bool useVanillaRuleModifier = false)
{
return string.Format(TwitchPlaySettings.data.RepositoryUrl + "{0}/{1}.{2}{3}", type.ToUpper(), Escape(module), type, (useVanillaRuleModifier && type.Equals("html")) ? $"#{VanillaRuleModifier.GetRuleSeed()}" : "");
}
public string VanillaManual = "http://www.bombmanual.com/";
}
| using System.Text.RegularExpressions;
using UnityEngine;
public class UrlHelper : MonoBehaviour
{
public static UrlHelper Instance;
private void Awake()
{
Instance = this;
}
public void ChangeMode(bool toShort)
{
TwitchPlaySettings.data.LogUploaderShortUrls = toShort;
TwitchPlaySettings.WriteDataToFile();
}
public bool ToggleMode()
{
TwitchPlaySettings.data.LogUploaderShortUrls = !TwitchPlaySettings.data.LogUploaderShortUrls;
TwitchPlaySettings.WriteDataToFile();
return TwitchPlaySettings.data.LogUploaderShortUrls;
}
private string Escape(string toEscape)
{
return Regex.Replace(toEscape, @"[^\w%]", m => "%" + ((int)m.Value[0]).ToString("X2"));
}
public string LogAnalyserFor(string url)
{
return string.Format(TwitchPlaySettings.data.AnalyzerUrl + "#url={0}", url);
}
public string CommandReference => TwitchPlaySettings.data.LogUploaderShortUrls ? "https://goo.gl/rQUH8y" : "https://github.com/samfun123/KtaneTwitchPlays/wiki/Commands";
public string ManualFor(string module, string type = "html", bool useVanillaRuleModifier = false)
{
if (useVanillaRuleModifier && VanillaRuleModifier.GetRuleSeed() != 1)
{
return $"{TwitchPlaySettings.data.RepositoryUrl}manual/{Escape(module)}.html?VanillaRuleSeed={VanillaRuleModifier.GetRuleSeed()}";
}
return string.Format(TwitchPlaySettings.data.RepositoryUrl + "{0}/{1}.{2}", type.ToUpper(), Escape(module), type);
}
public string VanillaManual = "http://www.bombmanual.com/";
}
| mit | C# |
9b9206d3e447f81801c1f184884319243777f99f | Remove unused references | cefsharp/CefSharp.MinimalExample,KarlWenzel/CefSharp.MinimalExample,Briaker/CefSharp.MinimalExample,robinwassen/CefSharp.MinimalExample.Issue.1277,SergeyAvd/MinExample2,modulexcite/CefSharp.MinimalExample,SergeyAvd/MinExample2 | CefSharp.MinimalExample.Wpf/MainWindow.xaml.cs | CefSharp.MinimalExample.Wpf/MainWindow.xaml.cs | using System.Windows;
namespace CefSharp.MinimalExample.Wpf
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
| using CefSharp.MinimalExample.Wpf.Mvvm;
using CefSharp.Wpf;
using System.ComponentModel;
using System.Windows;
namespace CefSharp.MinimalExample.Wpf
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
| mit | C# |
389a40335f0e45f896b9a989a094b74db600b6c4 | Fix stle comments | cbcrc/LinkIt | HeterogeneousDataSources/LoadLinkExpression.cs | HeterogeneousDataSources/LoadLinkExpression.cs | using System;
using System.Collections.Generic;
namespace HeterogeneousDataSources {
public class LoadLinkExpression<TLinkedSource, TReference, TId> : ILoadLinkExpression<TId>, ILoadLinkExpression
{
public LoadLinkExpression(Func<TLinkedSource, TId> getLookupIdFunc, Action<TLinkedSource, TReference> linkAction)
{
GetLookupIdFunc = getLookupIdFunc;
LinkAction = linkAction;
}
#region Load
public List<TId> GetLookupIds(object linkedSource) {
if (!(linkedSource is TLinkedSource)) { return new List<TId>(); }
return GetLookupIds((TLinkedSource) linkedSource);
}
private List<TId> GetLookupIds(TLinkedSource linkedSource) {
return new List<TId> { GetLookupIdFunc(linkedSource) };
}
private Func<TLinkedSource, TId> GetLookupIdFunc { get; set; }
public Type ReferenceType { get { return typeof(TReference); } }
#endregion
#region Link
public void Link(object linkedSource, DataContext dataContext) {
if (!(linkedSource is TLinkedSource)) { return; }
Link((TLinkedSource)linkedSource, dataContext);
}
private void Link(TLinkedSource linkedSource, DataContext dataContext) {
var id = GetLookupIdFunc(linkedSource);
var reference = dataContext.GetOptionalReference<TReference, TId>(id);
LinkAction(linkedSource, reference);
}
private Action<TLinkedSource, TReference> LinkAction { get; set; }
#endregion
}
}
| using System;
using System.Collections.Generic;
namespace HeterogeneousDataSources {
public class LoadLinkExpression<TLinkedSource, TReference, TId> : ILoadLinkExpression<TId>, ILoadLinkExpression
{
public LoadLinkExpression(Func<TLinkedSource, TId> getLookupIdFunc, Action<TLinkedSource, TReference> linkAction)
{
GetLookupIdFunc = getLookupIdFunc;
LinkAction = linkAction;
}
#region Load
public List<TId> GetLookupIds(object linkedSource) {
//stle: what should we do here? preconditions or defensive?
if (!(linkedSource is TLinkedSource)) { throw new NotImplementedException(); }
return GetLookupIds((TLinkedSource) linkedSource);
}
private List<TId> GetLookupIds(TLinkedSource linkedSource) {
return new List<TId> { GetLookupIdFunc(linkedSource) };
}
private Func<TLinkedSource, TId> GetLookupIdFunc { get; set; }
public Type ReferenceType { get { return typeof(TReference); } }
#endregion
#region Link
public void Link(object linkedSource, DataContext dataContext) {
//stle: what should we do here? preconditions or defensive?
if (!(linkedSource is TLinkedSource)) { throw new NotImplementedException(); }
Link((TLinkedSource)linkedSource, dataContext);
}
private void Link(TLinkedSource linkedSource, DataContext dataContext) {
var id = GetLookupIdFunc(linkedSource);
var reference = dataContext.GetOptionalReference<TReference, TId>(id);
LinkAction(linkedSource, reference);
}
private Action<TLinkedSource, TReference> LinkAction { get; set; }
#endregion
}
}
| mit | C# |
2b7608fcd7ad021ec64407f0bdbb2a76b5a34efe | clean up | dkataskin/bstrkr | bstrkr.mobile/bstrkr.core/Consts/AppConsts.cs | bstrkr.mobile/bstrkr.core/Consts/AppConsts.cs | using System;
using bstrkr.core.spatial;
namespace bstrkr.core.consts
{
public static class AppConsts
{
public const string ConfigFileName = "config.json";
public const double MaxDistanceFromCityCenter = 50.0f;
public const double MaxDistanceFromBusStop = 300.0f;
public static GeoPoint DefaultLocation = new GeoPoint(55.7503798d, 37.6182293d);
public const float DefaultZoom = 14.0f;
}
} | using System;
using bstrkr.core.spatial;
namespace bstrkr.core.consts
{
public static class AppConsts
{
public const string ConfigFileName = "config.json";
public const double MaxDistanceFromCityCenter = 50.0f;
public const double MaxDistanceFromBusStop = 300.0f;
public static GeoPoint DefaultLocation = new GeoPoint(55.7503798d, 37.6182293d);
public const float DefaultZoom = 14.0f;
public const string LocalizationGeneralNamespace = "BusTracker";
}
} | bsd-2-clause | C# |
b628b0090d79988027a8621a57352383dcc325cd | Support svg images. | lukehoban/JabbR,borisyankov/JabbR,AAPT/jean0226case1322,meebey/JabbR,SonOfSam/JabbR,CrankyTRex/JabbRMirror,huanglitest/JabbRTest2,meebey/JabbR,fuzeman/vox,LookLikeAPro/JabbR,LookLikeAPro/JabbR,borisyankov/JabbR,18098924759/JabbR,huanglitest/JabbRTest2,CrankyTRex/JabbRMirror,mzdv/JabbR,CrankyTRex/JabbRMirror,yadyn/JabbR,mzdv/JabbR,timgranstrom/JabbR,LookLikeAPro/JabbR,lukehoban/JabbR,yadyn/JabbR,lukehoban/JabbR,timgranstrom/JabbR,AAPT/jean0226case1322,yadyn/JabbR,meebey/JabbR,ajayanandgit/JabbR,JabbR/JabbR,M-Zuber/JabbR,18098924759/JabbR,ajayanandgit/JabbR,M-Zuber/JabbR,fuzeman/vox,SonOfSam/JabbR,borisyankov/JabbR,fuzeman/vox,JabbR/JabbR,e10/JabbR,huanglitest/JabbRTest2,e10/JabbR | JabbR/ContentProviders/ImageContentProvider.cs | JabbR/ContentProviders/ImageContentProvider.cs | using System;
using System.Threading.Tasks;
using JabbR.ContentProviders.Core;
using Microsoft.Security.Application;
namespace JabbR.ContentProviders
{
public class ImageContentProvider : CollapsibleContentProvider
{
protected override Task<ContentProviderResult> GetCollapsibleContent(ContentProviderHttpRequest request)
{
string url = request.RequestUri.ToString();
return TaskAsyncHelper.FromResult(new ContentProviderResult()
{
Content = String.Format(@"<img src=""proxy?url={0}"" />", Encoder.HtmlAttributeEncode(url)),
Title = url
});
}
public override bool IsValidContent(Uri uri)
{
return IsValidImagePath(uri);
}
public static bool IsValidImagePath(Uri uri)
{
string path = uri.LocalPath.ToLowerInvariant();
return path.EndsWith(".png") ||
path.EndsWith(".bmp") ||
path.EndsWith(".jpg") ||
path.EndsWith(".jpeg") ||
path.EndsWith(".gif");
}
public static bool IsValidContentType(string contentType)
{
return contentType.Equals("image/bmp", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/gif", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/jpeg", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/tiff", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/x-tiff", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/png", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/svg+xml", StringComparison.OrdinalIgnoreCase);
}
}
} | using System;
using System.Threading.Tasks;
using JabbR.ContentProviders.Core;
using Microsoft.Security.Application;
namespace JabbR.ContentProviders
{
public class ImageContentProvider : CollapsibleContentProvider
{
protected override Task<ContentProviderResult> GetCollapsibleContent(ContentProviderHttpRequest request)
{
string url = request.RequestUri.ToString();
return TaskAsyncHelper.FromResult(new ContentProviderResult()
{
Content = String.Format(@"<img src=""proxy?url={0}"" />", Encoder.HtmlAttributeEncode(url)),
Title = url
});
}
public override bool IsValidContent(Uri uri)
{
return IsValidImagePath(uri);
}
public static bool IsValidImagePath(Uri uri)
{
string path = uri.LocalPath.ToLowerInvariant();
return path.EndsWith(".png") ||
path.EndsWith(".bmp") ||
path.EndsWith(".jpg") ||
path.EndsWith(".jpeg") ||
path.EndsWith(".gif");
}
public static bool IsValidContentType(string contentType)
{
return contentType.Equals("image/bmp", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/gif", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/jpeg", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/tiff", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/x-tiff", StringComparison.OrdinalIgnoreCase) ||
contentType.Equals("image/png", StringComparison.OrdinalIgnoreCase);
}
}
} | mit | C# |
a5b42df63f3ab8bd0e68db5422719e0c14526bb9 | check project in solution for <Misc Files> | lennyomg/VsAutoDeploy | src/VsAutoDeploy/VsAutoDeploy/DteHelpers.cs | src/VsAutoDeploy/VsAutoDeploy/DteHelpers.cs | using System.Collections.Generic;
using System.Linq;
using EnvDTE;
namespace EnvDTE80
{
public static class DteHelpers
{
private const string vsProjectKindSolutionFolder = ProjectKinds.vsProjectKindSolutionFolder;
private const string vsProjectKindMiscFiles = "{66A2671D-8FB5-11D2-AA7E-00C04F688DDE}";
public static IEnumerable<Project> GetProjects(this Solution solution)
{
var result = new List<Project>();
foreach (var project in solution.Projects.OfType<Project>())
{
if (project.Kind == vsProjectKindMiscFiles)
continue;
if (project.Kind == vsProjectKindSolutionFolder)
{
result.AddRange(GetSolutionFolderProjects(project));
}
else
{
result.Add(project);
}
}
return result;
}
private static IEnumerable<Project> GetSolutionFolderProjects(Project solutionFolder)
{
var result = new List<Project>();
foreach (var projectItem in solutionFolder.ProjectItems.OfType<ProjectItem>())
{
var subProject = projectItem.SubProject;
if (subProject == null)
continue;
if (subProject.Kind == vsProjectKindMiscFiles)
continue;
if (subProject.Kind == ProjectKinds.vsProjectKindSolutionFolder)
{
result.AddRange(GetSolutionFolderProjects(subProject));
}
else
{
result.Add(subProject);
}
}
return result;
}
}
} | using System.Collections.Generic;
using System.Linq;
using EnvDTE;
namespace EnvDTE80
{
public static class DteHelpers
{
public static IEnumerable<Project> GetProjects(this Solution solution)
{
var result = new List<Project>();
foreach (var project in solution.Projects.OfType<Project>())
{
if (project.Kind == ProjectKinds.vsProjectKindSolutionFolder)
{
result.AddRange(GetSolutionFolderProjects(project));
}
else
{
result.Add(project);
}
}
return result;
}
private static IEnumerable<Project> GetSolutionFolderProjects(Project solutionFolder)
{
var result = new List<Project>();
foreach (var projectItem in solutionFolder.ProjectItems.OfType<ProjectItem>())
{
var subProject = projectItem.SubProject;
if (subProject == null)
continue;
if (subProject.Kind == ProjectKinds.vsProjectKindSolutionFolder)
{
result.AddRange(GetSolutionFolderProjects(subProject));
}
else
{
result.Add(subProject);
}
}
return result;
}
}
} | mit | C# |
ff57281f9d7c7f99ed816e93ad95fca345a872c4 | Update AssemblyInfo.cs | TrackerMigrator/IssueMigrator | src/IssueMigrator/Properties/AssemblyInfo.cs | src/IssueMigrator/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("IssueMigrator")]
[assembly: AssemblyDescription("Universal Issue Tracker-to-Tracker Migration Tool")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Tracker Migrator")]
[assembly: AssemblyProduct("Issue Migrator")]
[assembly: AssemblyCopyright("Copyright © Tracker Migrator, 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f1870d5c-018f-4631-967a-62b891957611")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("IssueMigrator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("IssueMigrator")]
[assembly: AssemblyCopyright("Copyright © objorke 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f1870d5c-018f-4631-967a-62b891957611")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
27fa5a0407fe6e4410c4bb3725b1a90b9afc8332 | Compress playlistexception | ceddlyburge/canoe-polo-league-organiser-backend | CanoePoloLeagueOrganiser/PlayListException.cs | CanoePoloLeagueOrganiser/PlayListException.cs | using System;
namespace CanoePoloLeagueOrganiser
{
public class PlayListException : Exception
{
public PlayListException() { }
public PlayListException(string message) : base(message) { }
public PlayListException(string message, Exception innerException) : base(message, innerException) { }
}
} | using System;
namespace CanoePoloLeagueOrganiser
{
public class PlayListException : Exception
{
public PlayListException()
{
}
public PlayListException(string message) : base(message)
{
}
public PlayListException(string message, Exception innerException) : base(message, innerException)
{
}
}
} | mit | C# |
f762d450e2b667c14a69cf5193033f273941b065 | Fix no args | Zolomon/decision-tree | decision-tree/Classifier.cs | decision-tree/Classifier.cs | using System;
using System.IO;
namespace decisiontree
{
class Classifier
{
Arff arff { get; set; }
DecisionBuilder builder { get; set; }
bool prune { get; set; }
public Classifier (Arff arff, bool prune=false)
{
this.arff = arff;
this.builder = new DecisionBuilder (this.arff);
this.prune = prune;
}
public void DrawTree ()
{
var tree = builder.BuildTree (arff.Data, arff.Attributes, true);
Console.WriteLine(tree.Display(0));
}
public static void Main (string[] args)
{
if (args.Length > 2 || args.Length == 0) {
Console.WriteLine ("Bad usage. Use:\t./decision-tree.exe <arff file> \t[prune]");
Console.WriteLine ("Example: \t./decision-tree.exe data/example.arff \tprune");
Environment.Exit (1);
}
bool prune = false;
string filename = args [0];
if (args.Length == 2) {
prune = args [1].Equals ("prune");
if (!prune) {
Console.WriteLine ("Pruning is disabled, could not parse \"prune\".");
}
}
if (!File.Exists (filename)) {
Console.WriteLine("File \"{0}\" does not exist.", filename);
Environment.Exit(1);
}
Console.WriteLine ("File: \t\t{0}\nPruning: \t{1}", filename, prune);
ARFFReader reader = new ARFFReader();
Arff arff = reader.Parse(new StreamReader(filename));
Classifier c = new Classifier(arff, prune);
c.DrawTree();
}
}
}
| using System;
using System.IO;
namespace decisiontree
{
class Classifier
{
Arff arff { get; set; }
DecisionBuilder builder { get; set; }
bool prune { get; set; }
public Classifier (Arff arff, bool prune=false)
{
this.arff = arff;
this.builder = new DecisionBuilder (this.arff);
this.prune = prune;
}
public void DrawTree ()
{
var tree = builder.BuildTree (arff.Data, arff.Attributes, true);
Console.WriteLine(tree.Display(0));
}
public static void Main (string[] args)
{
if (args.Length > 2) {
Console.WriteLine ("Bad usage. Use:\t./decision-tree.exe <arff file> \t[prune]");
Console.WriteLine ("Example: \t./decision-tree.exe data/example.arff \tprune");
Environment.Exit (1);
}
bool prune = false;
string filename = args [0];
if (args.Length == 2) {
prune = args [1].Equals ("prune");
if (!prune) {
Console.WriteLine ("Pruning is disabled, could not parse \"prune\".");
}
}
if (!File.Exists (filename)) {
Console.WriteLine("File \"{0}\" does not exist.", filename);
Environment.Exit(1);
}
Console.WriteLine ("File: \t\t{0}\nPruning: \t{1}", filename, prune);
ARFFReader reader = new ARFFReader();
Arff arff = reader.Parse(new StreamReader(filename));
Classifier c = new Classifier(arff, prune);
c.DrawTree();
}
}
}
| mit | C# |
4db52c87ef53e50fad05a1e218871f4eaa3c3b72 | fix reyes voicelines not extracting | overtools/OWLib | DataTool/ToolLogic/Extract/ExtractNPCVoice.cs | DataTool/ToolLogic/Extract/ExtractNPCVoice.cs | using System;
using System.Collections.Generic;
using System.IO;
using DataTool.FindLogic;
using DataTool.Flag;
using DataTool.Helper;
using DataTool.JSON;
using TankLib.STU.Types;
using static DataTool.Helper.STUHelper;
using static DataTool.Helper.IO;
namespace DataTool.ToolLogic.Extract {
[Tool("extract-npc-voice", Description = "Extracts NPC voicelines.", CustomFlags = typeof(ExtractFlags))]
class ExtractNPCVoice : JSONTool, ITool {
private const string Container = "NPCVoice";
private static readonly List<string> WhitelistedNPCs = new List<string> {"OR14-NS", "B73-NS"};
public void Parse(ICLIFlags toolFlags) {
string basePath;
if (toolFlags is ExtractFlags flags) {
basePath = Path.Combine(flags.OutputPath, Container);
} else {
throw new Exception("no output path");
}
foreach (var guid in Program.TrackedFiles[0x5F]) {
var voiceSet = GetInstance<STUVoiceSet>(guid);
if (voiceSet == null) continue;
var npcName = $"{GetString(voiceSet.m_269FC4E9)} {GetString(voiceSet.m_C0835C08)}".Trim();
if (string.IsNullOrEmpty(npcName)) {
continue;
}
var npcFileName = GetValidFilename(npcName);
Logger.Log($"Processing NPC {npcName}");
var info = new Combo.ComboInfo();
var ignoreGroups = !WhitelistedNPCs.Contains(npcName);
ExtractHeroVoiceBetter.SaveVoiceSet(flags, basePath, npcFileName, guid, ref info, ignoreGroups: ignoreGroups);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using DataTool.FindLogic;
using DataTool.Flag;
using DataTool.Helper;
using DataTool.JSON;
using TankLib.STU.Types;
using static DataTool.Helper.STUHelper;
using static DataTool.Helper.IO;
namespace DataTool.ToolLogic.Extract {
[Tool("extract-npc-voice", Description = "Extracts NPC voicelines.", CustomFlags = typeof(ExtractFlags))]
class ExtractNPCVoice : JSONTool, ITool {
private const string Container = "NPCVoice";
private static readonly List<string> WhitelistedNPCs = new List<string> {"OR14-NS", "B73-NS"};
public void Parse(ICLIFlags toolFlags) {
string basePath;
if (toolFlags is ExtractFlags flags) {
basePath = Path.Combine(flags.OutputPath, Container);
} else {
throw new Exception("no output path");
}
foreach (var guid in Program.TrackedFiles[0x5F]) {
var voiceSet = GetInstance<STUVoiceSet>(guid);
if (voiceSet == null) continue;
var npcName = GetValidFilename(GetString(voiceSet.m_269FC4E9));
if (npcName == null) continue;
Logger.Log($"Processing NPC {npcName}");
var info = new Combo.ComboInfo();
var ignoreGroups = !WhitelistedNPCs.Contains(npcName);
ExtractHeroVoiceBetter.SaveVoiceSet(flags, basePath, npcName, guid, ref info, ignoreGroups: ignoreGroups);
}
}
}
}
| mit | C# |
d2aaa8fbf0799ac74056df613cc2cefcc0c1ed4f | Implement MD5 Hash | Apuju/EncryptDecryptPOC.NET | EncryptDecryptHelper/Bussiness/HashWrapper.cs | EncryptDecryptHelper/Bussiness/HashWrapper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
namespace EncryptDecryptHelper.Bussiness
{
public class HashWrapper
{
public byte[] HashMD5(byte[] data)
{
byte[] hashText = null;
try
{
using (MD5 hasher = MD5.Create())
{
hashText = hasher.ComputeHash(data);
}
}
catch (Exception)
{
throw;
}
return hashText;
}
public byte[] HashSHA256(byte[] data)
{
byte[] hashText = null;
try
{
using (SHA256 hasher = SHA256Managed.Create())
{
hashText = hasher.ComputeHash(data);
}
}
catch (Exception)
{
throw;
}
return hashText;
}
public byte[] HashRFC2898(byte[] data, byte[] salt, int iteration, int hashByteLength)
{
byte[] hashText = null;
try
{
using (Rfc2898DeriveBytes hasher = new Rfc2898DeriveBytes(data, salt, iteration))
{
hashText = hasher.GetBytes(hashByteLength);
}
}
catch (Exception)
{
throw;
}
return hashText;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
namespace EncryptDecryptHelper.Bussiness
{
public class HashWrapper
{
public byte[] HashSHA256(byte[] data)
{
byte[] hashText = null;
try
{
using (SHA256 hasher = SHA256Managed.Create())
{
hashText = hasher.ComputeHash(data);
}
}
catch (Exception)
{
throw;
}
return hashText;
}
public byte[] HashRFC2898(byte[] data, byte[] salt, int iteration, int hashByteLength)
{
byte[] hashText = null;
try
{
using (Rfc2898DeriveBytes hasher = new Rfc2898DeriveBytes(data, salt, iteration))
{
hashText = hasher.GetBytes(hashByteLength);
}
}
catch (Exception)
{
throw;
}
return hashText;
}
}
}
| mit | C# |
db19617b8b69a9b9102b8594ed34d881f36d5ede | Add `JsonConstructor` attribute to `SkinnableTargetWrapper` | NeoAdonis/osu,peppy/osu,smoogipooo/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,ppy/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu | osu.Game/Skinning/SkinnableTargetWrapper.cs | osu.Game/Skinning/SkinnableTargetWrapper.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 Newtonsoft.Json;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Skinning
{
/// <summary>
/// A container which is serialised and can encapsulate multiple skinnable elements into a single return type (for consumption via <see cref="ISkin.GetDrawableComponent"/>.
/// Will also optionally apply default cross-element layout dependencies when initialised from a non-deserialised source.
/// </summary>
[Serializable]
public class SkinnableTargetWrapper : Container, ISkinSerialisable
{
private readonly Action<Container> applyDefaults;
/// <summary>
/// Construct a wrapper with defaults that should be applied once.
/// </summary>
/// <param name="applyDefaults">A function with default to apply after the initial layout (ie. consuming autosize)</param>
public SkinnableTargetWrapper(Action<Container> applyDefaults)
: this()
{
this.applyDefaults = applyDefaults;
}
[JsonConstructor]
public SkinnableTargetWrapper()
{
RelativeSizeAxes = Axes.Both;
}
protected override void LoadComplete()
{
base.LoadComplete();
// schedule is required to allow children to run their LoadComplete and take on their correct sizes.
Schedule(() => applyDefaults?.Invoke(this));
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Skinning
{
/// <summary>
/// A container which is serialised and can encapsulate multiple skinnable elements into a single return type (for consumption via <see cref="ISkin.GetDrawableComponent"/>.
/// Will also optionally apply default cross-element layout dependencies when initialised from a non-deserialised source.
/// </summary>
public class SkinnableTargetWrapper : Container, ISkinSerialisable
{
private readonly Action<Container> applyDefaults;
/// <summary>
/// Construct a wrapper with defaults that should be applied once.
/// </summary>
/// <param name="applyDefaults">A function with default to apply after the initial layout (ie. consuming autosize)</param>
public SkinnableTargetWrapper(Action<Container> applyDefaults)
: this()
{
this.applyDefaults = applyDefaults;
}
public SkinnableTargetWrapper()
{
RelativeSizeAxes = Axes.Both;
}
protected override void LoadComplete()
{
base.LoadComplete();
// schedule is required to allow children to run their LoadComplete and take on their correct sizes.
Schedule(() => applyDefaults?.Invoke(this));
}
}
}
| mit | C# |
312db085247162ce4fcb21882c9bab02f1425360 | Remove JetBrains annotations | pixelballoon/unity-extensions | extensions/EditorUpdate.cs | extensions/EditorUpdate.cs | using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[ExecuteInEditMode]
public class EditorUpdate : MonoBehaviour
{
#if UNITY_EDITOR
private HashSet<MonoBehaviour> _monoBehaviours;
protected void Awake()
{
if (Application.isPlaying)
return;
GameObject[] gameObjects = FindObjectsOfType<GameObject>();
foreach (GameObject go in gameObjects)
{
if (PrefabUtility.GetPrefabType(go) == PrefabType.Prefab)
continue;
foreach (MonoBehaviour mb in go.GetComponents<MonoBehaviour>())
{
IEditorUpdate editorUpdate = mb as IEditorUpdate;
if (editorUpdate != null)
{
editorUpdate.OnEditorInit();
}
}
}
}
protected void Update()
{
if (Application.isPlaying)
return;
foreach (GameObject go in Selection.gameObjects)
{
if (PrefabUtility.GetPrefabType(go) == PrefabType.Prefab)
continue;
foreach (MonoBehaviour mb in go.GetComponents<MonoBehaviour>())
{
IEditorUpdate editorUpdate = mb as IEditorUpdate;
if (editorUpdate != null)
{
editorUpdate.OnEditorUpdate();
}
}
}
}
protected void OnRenderObject()
{
if (Application.isPlaying)
return;
if (_monoBehaviours == null)
{
_monoBehaviours = new HashSet<MonoBehaviour>();
}
if (Selection.gameObjects.Length == 0)
{
_monoBehaviours.Clear();
}
else
{
foreach (GameObject go in Selection.gameObjects)
{
if (PrefabUtility.GetPrefabType(go) == PrefabType.Prefab)
continue;
foreach (MonoBehaviour mb in go.GetComponents<MonoBehaviour>())
{
IEditorUpdate editorUpdate = mb as IEditorUpdate;
if (editorUpdate != null)
{
if (!_monoBehaviours.Contains(mb))
{
_monoBehaviours.Add(mb);
editorUpdate.OnEditorInit();
}
}
}
}
}
}
#endif
}
| using System.Collections;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[ExecuteInEditMode]
public class EditorUpdate : MonoBehaviour
{
#if UNITY_EDITOR
private HashSet<MonoBehaviour> _monoBehaviours;
[UsedImplicitly]
protected void Awake()
{
if (Application.isPlaying)
return;
GameObject[] gameObjects = FindObjectsOfType<GameObject>();
foreach (GameObject go in gameObjects)
{
if (PrefabUtility.GetPrefabType(go) == PrefabType.Prefab)
continue;
foreach (MonoBehaviour mb in go.GetComponents<MonoBehaviour>())
{
IEditorUpdate editorUpdate = mb as IEditorUpdate;
if (editorUpdate != null)
{
editorUpdate.OnEditorInit();
}
}
}
}
[UsedImplicitly]
protected void Update()
{
if (Application.isPlaying)
return;
foreach (GameObject go in Selection.gameObjects)
{
if (PrefabUtility.GetPrefabType(go) == PrefabType.Prefab)
continue;
foreach (MonoBehaviour mb in go.GetComponents<MonoBehaviour>())
{
IEditorUpdate editorUpdate = mb as IEditorUpdate;
if (editorUpdate != null)
{
editorUpdate.OnEditorUpdate();
}
}
}
}
[UsedImplicitly]
protected void OnRenderObject()
{
if (Application.isPlaying)
return;
if (_monoBehaviours == null)
{
_monoBehaviours = new HashSet<MonoBehaviour>();
}
if (Selection.gameObjects.Length == 0)
{
_monoBehaviours.Clear();
}
else
{
foreach (GameObject go in Selection.gameObjects)
{
if (PrefabUtility.GetPrefabType(go) == PrefabType.Prefab)
continue;
foreach (MonoBehaviour mb in go.GetComponents<MonoBehaviour>())
{
IEditorUpdate editorUpdate = mb as IEditorUpdate;
if (editorUpdate != null)
{
if (!_monoBehaviours.Contains(mb))
{
_monoBehaviours.Add(mb);
editorUpdate.OnEditorInit();
}
}
}
}
}
}
#endif
}
| mit | C# |
a64aa5bafc690ea044c1675d6361d78b22b39ad7 | Add IsLocked to audit for account locked message | SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers | src/SFA.DAS.EmployerUsers.Domain/Auditing/AccountLockedAuditMessage.cs | src/SFA.DAS.EmployerUsers.Domain/Auditing/AccountLockedAuditMessage.cs | using System.Collections.Generic;
using SFA.DAS.Audit.Types;
namespace SFA.DAS.EmployerUsers.Domain.Auditing
{
public class AccountLockedAuditMessage : EmployerUsersAuditMessage
{
public AccountLockedAuditMessage(User user)
{
Category = "ACCOUNT_LOCKED";
Description = $"User {user.Email} (id: {user.Id}) has exceeded the limit of failed logins and the account has been locked";
AffectedEntity = new Entity
{
Type = "User",
Id = user.Id
};
ChangedProperties = new List<PropertyUpdate>
{
PropertyUpdate.FromInt(nameof(user.FailedLoginAttempts), user.FailedLoginAttempts),
PropertyUpdate.FromBool(nameof(user.IsLocked), user.IsLocked)
};
}
}
}
| using System.Collections.Generic;
using SFA.DAS.Audit.Types;
namespace SFA.DAS.EmployerUsers.Domain.Auditing
{
public class AccountLockedAuditMessage : EmployerUsersAuditMessage
{
public AccountLockedAuditMessage(User user)
{
Category = "ACCOUNT_LOCKED";
Description = $"User {user.Email} (id: {user.Id}) has exceeded the limit of failed logins and the account has been locked";
AffectedEntity = new Entity
{
Type = "User",
Id = user.Id
};
ChangedProperties = new List<PropertyUpdate>
{
PropertyUpdate.FromInt(nameof(user.FailedLoginAttempts), user.FailedLoginAttempts)
};
}
}
}
| mit | C# |
419afc4b116abcb1ffeac736e7138b22971fdd0e | 修改Redis信号量键名称,使其不易重复 | Kation/ComBoost,Kation/ComBoost,Kation/ComBoost,Kation/ComBoost | src/Wodsoft.ComBoost.Redis/RedisSemaphore.cs | src/Wodsoft.ComBoost.Redis/RedisSemaphore.cs | using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace Wodsoft.ComBoost.Redis
{
public class RedisSemaphore : ISemaphore
{
private IDatabase _Database;
private string _Key;
private TimeSpan _ExpireTime;
public RedisSemaphore(IDatabase database, string key, TimeSpan expireTime)
{
if (database == null)
throw new ArgumentNullException(nameof(database));
if (key == null)
throw new ArgumentNullException(nameof(key));
if (expireTime.TotalMilliseconds <= 0)
throw new ArgumentOutOfRangeException(nameof(expireTime), "超时时间不能小于零。");
_Database = database;
_Key = "__ComBoostSemaphore_" + key;
_ExpireTime = expireTime;
}
public async Task EnterAsync()
{
while (true)
{
if (await TryEnterAsync())
return;
await Task.Delay(10);
}
}
public async Task<bool> EnterAsync(int timeout)
{
Stopwatch watch = new Stopwatch();
while (watch.ElapsedMilliseconds < timeout)
{
if (await TryEnterAsync())
return true;
await Task.Delay(10);
}
return false;
}
public Task ExitAsync()
{
return _Database.LockReleaseAsync(_Key, true);
}
public Task<bool> TryEnterAsync()
{
return _Database.LockTakeAsync(_Key, true, _ExpireTime);
}
}
}
| using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace Wodsoft.ComBoost.Redis
{
public class RedisSemaphore : ISemaphore
{
private IDatabase _Database;
private string _Key;
private TimeSpan _ExpireTime;
public RedisSemaphore(IDatabase database, string key, TimeSpan expireTime)
{
if (database == null)
throw new ArgumentNullException(nameof(database));
if (key == null)
throw new ArgumentNullException(nameof(key));
if (expireTime.TotalMilliseconds <= 0)
throw new ArgumentOutOfRangeException(nameof(expireTime), "超时时间不能小于零。");
_Database = database;
_Key = key;
_ExpireTime = expireTime;
}
public async Task EnterAsync()
{
while (true)
{
if (await TryEnterAsync())
return;
await Task.Delay(10);
}
}
public async Task<bool> EnterAsync(int timeout)
{
Stopwatch watch = new Stopwatch();
while (watch.ElapsedMilliseconds < timeout)
{
if (await TryEnterAsync())
return true;
await Task.Delay(10);
}
return false;
}
public Task ExitAsync()
{
return _Database.LockReleaseAsync(_Key, true);
}
public Task<bool> TryEnterAsync()
{
return _Database.LockTakeAsync(_Key, true, _ExpireTime);
}
}
}
| mit | C# |
c14b9b62fabd9512979e0c513bd4495f9ad687d3 | Update ProviderController.cs | gyrosworkshop/Wukong,gyrosworkshop/Wukong | src/Wukong/Controllers/ProviderController.cs | src/Wukong/Controllers/ProviderController.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using Wukong.Services;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace Wukong.Controllers
{
[Authorize]
[Route("[controller]")]
public class ProviderController : Controller
{
private readonly IProvider Provider;
public ProviderController(IProvider provider)
{
Provider = provider;
}
// GET: /<controller>/
[HttpPost("{feature}")]
public async Task<IActionResult> Index(string feature, [FromBody] JObject body)
{
var result = await Provider.ApiProxy(feature, body);
if (result != null)
{
return new ObjectResult(result);
}
else
{
return StatusCode(500, "ApiProxy null (feature not exists?)");
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using Wukong.Services;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace Wukong.Controllers
{
//[Authorize]
[Route("[controller]")]
public class ProviderController : Controller
{
private readonly IProvider Provider;
public ProviderController(IProvider provider)
{
Provider = provider;
}
// GET: /<controller>/
[HttpPost("{feature}")]
public async Task<IActionResult> Index(string feature, [FromBody] JObject body)
{
var result = await Provider.ApiProxy(feature, body);
if (result != null)
{
return new ObjectResult(result);
}
else
{
return StatusCode(500, "ApiProxy null (feature not exists?)");
}
}
}
}
| mit | C# |
8c615626bdf67e9ab16d225abb663e9578d7e847 | Add time the item is added to the database when the item is saved. | lukecahill/NutritionTracker | food_tracker/NutritionItem.cs | food_tracker/NutritionItem.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace food_tracker {
public class NutritionItem {
[Key]
public int NutritionItemId { get; set; }
public string name { get; set; }
public double amount { get; set; }
public string dayId { get; set; }
public double calories { get; set; }
public double carbohydrates { get; set; }
public double sugars { get; set; }
public double fats { get; set; }
public double saturatedFats { get; set; }
public double protein { get; set; }
public double salt { get; set; }
public double fibre { get; set; }
public DateTime dateTime { get; set; }
[ForeignKey("dayId")]
public WholeDay wholeDay { get; set; }
[Obsolete("Only needed for serialization and materialization", true)]
public NutritionItem() { }
public NutritionItem(string name, string day, List<double> values, double amount) {
this.name = name;
this.dayId = day;
this.calories = values[0];
this.fats = values[1];
this.saturatedFats = values[2];
this.carbohydrates = values[3];
this.sugars = values[4];
this.fibre = values[5];
this.protein = values[6];
this.salt = values[7];
this.amount = amount;
this.dateTime = DateTime.UtcNow;
}
public override string ToString() {
return this.name;
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace food_tracker {
public class NutritionItem {
[Key]
public int NutritionItemId { get; set; }
public string name { get; set; }
public double amount { get; set; }
public string dayId { get; set; }
public double calories { get; set; }
public double carbohydrates { get; set; }
public double sugars { get; set; }
public double fats { get; set; }
public double saturatedFats { get; set; }
public double protein { get; set; }
public double salt { get; set; }
public double fibre { get; set; }
[ForeignKey("dayId")]
public WholeDay wholeDay { get; set; }
[Obsolete("Only needed for serialization and materialization", true)]
public NutritionItem() { }
public NutritionItem(string name, string day, List<double> values, double amount) {
this.name = name;
this.dayId = day;
this.calories = values[0];
this.fats = values[1];
this.saturatedFats = values[2];
this.carbohydrates = values[3];
this.sugars = values[4];
this.fibre = values[5];
this.protein = values[6];
this.salt = values[7];
this.amount = amount;
}
public override string ToString() {
return this.name;
}
}
}
| mit | C# |
759dbc8a8d9a52a12b1cbeca3c957cc8f5bc8c25 | fix copyright | tym32167/arma3beclient | src/GlobalAssemblyInfo.cs | src/GlobalAssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Arma 3 BattlEye Client")]
[assembly: AssemblyDescription("This program is designed specifically for the TEHGAM community, with the main intended purpose of managing players and bans through the BattlEye protocol.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("tym32167")]
[assembly: AssemblyProduct("Arma 3 BattlEye Client")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.8.*")]
[assembly: System.Resources.NeutralResourcesLanguage("en")] | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Arma 3 BattlEye Client")]
[assembly: AssemblyDescription("This program is designed specifically for the TEHGAM community, with the main intended purpose of managing players and bans through the BattlEye protocol.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("tym32167")]
[assembly: AssemblyProduct("Arma 3 BattlEye Client")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.8.*")]
[assembly: System.Resources.NeutralResourcesLanguage("en")] | apache-2.0 | C# |
9cffe0222c6451b48aa9418c1d3dc88d97374bb3 | Bump version | UniqProject/BDInfo | BDInfo/Properties/AssemblyInfo.cs | BDInfo/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BDInfo")]
[assembly: AssemblyDescription("Blu-ray Video and Audio Specifications Collection Tool")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cinema Squid & UniqProject")]
[assembly: AssemblyProduct("BDInfo")]
[assembly: AssemblyCopyright("Copyright © Cinema Squid 2011 & UniqProject 2017-2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6a516a5c-6c0d-4ab0-bb8d-f113d544355e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.5.1")]
[assembly: AssemblyFileVersion("0.7.5.1")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BDInfo")]
[assembly: AssemblyDescription("Blu-ray Video and Audio Specifications Collection Tool")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cinema Squid & UniqProject")]
[assembly: AssemblyProduct("BDInfo")]
[assembly: AssemblyCopyright("Copyright © Cinema Squid 2011 & UniqProject 2017-2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6a516a5c-6c0d-4ab0-bb8d-f113d544355e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.5.0")]
[assembly: AssemblyFileVersion("0.7.5.0")]
| lgpl-2.1 | C# |
646bd37096e64a4884df3e1fb6782486dbcbe23f | clean up | dkataskin/bstrkr | bstrkr.mobile/bstrkr.android/Views/RouteView.cs | bstrkr.mobile/bstrkr.android/Views/RouteView.cs | using System;
using Android.OS;
using Android.Views;
using Cirrious.MvvmCross.Binding.Droid.BindingContext;
using Cirrious.MvvmCross.Droid.FullFragging.Fragments;
using bstrkr.mvvm.viewmodels;
using bstrkr.core;
namespace bstrkr.android.views
{
public class RouteView : MvxFragment
{
public RouteView()
{
this.RetainInstance = true;
}
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var ignored = base.OnCreateView(inflater, container, savedInstanceState);
return this.BindingInflate(Resource.Layout.fragment_routes_view, null);
}
}
} | using System;
using Android.OS;
using Android.Views;
using Cirrious.MvvmCross.Binding.Droid.BindingContext;
using Cirrious.MvvmCross.Droid.FullFragging.Fragments;
using bstrkr.mvvm.viewmodels;
using bstrkr.core;
namespace bstrkr.android.views
{
public class RoutesView : MvxFragment
{
public RoutesView()
{
this.RetainInstance = true;
}
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
this.SetHasOptionsMenu(true);
this.Activity.ActionBar.Title = AppResources.routes_view_title;
var ignored = base.OnCreateView(inflater, container, savedInstanceState);
return this.BindingInflate(Resource.Layout.fragment_routes_view, null);
}
}
} | bsd-2-clause | C# |
873e9e1e7979fa43bbc5415aea25d50a8c0988ff | Bump version | akatakritos/PygmentSharp | src/PygmentSharp/PygmentSharp.Core/Properties/AssemblyInfo.cs | src/PygmentSharp/PygmentSharp.Core/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PygmentSharp.Core")]
[assembly: AssemblyDescription("Port of Python's Pygments syntax highlighter")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PygmentSharp.Core")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9eb63a83-0f9d-4c49-bc2a-95e37eb1cb15")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.2")]
[assembly: AssemblyFileVersion("0.0.2")]
[assembly: InternalsVisibleTo("PygmentSharp.UnitTests")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PygmentSharp.Core")]
[assembly: AssemblyDescription("Port of Python's Pygments syntax highlighter")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PygmentSharp.Core")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9eb63a83-0f9d-4c49-bc2a-95e37eb1cb15")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.1")]
[assembly: AssemblyFileVersion("0.0.1")]
[assembly: InternalsVisibleTo("PygmentSharp.UnitTests")]
| mit | C# |
36426c6f1aec566fd849a720e6aaeff7700b0fac | Update FindByCssStrategy.Find method to throw more detailed exception | YevgeniyShunevych/Atata,atata-framework/atata,atata-framework/atata,YevgeniyShunevych/Atata | src/Atata/ScopeSearch/Strategies/FindByCssStrategy.cs | src/Atata/ScopeSearch/Strategies/FindByCssStrategy.cs | using OpenQA.Selenium;
namespace Atata
{
public class FindByCssStrategy : IComponentScopeLocateStrategy
{
private readonly IComponentScopeLocateStrategy sequalStrategy = new FindFirstDescendantOrSelfStrategy();
public ComponentScopeLocateResult Find(IWebElement scope, ComponentScopeLocateOptions options, SearchOptions searchOptions)
{
By by = By.CssSelector(string.Join(",", options.Terms));
if (options.OuterXPath != null)
by = By.XPath(options.OuterXPath + "*").Then(by);
if (options.Index.HasValue)
{
var elements = scope.GetAll(by.With(searchOptions));
if (elements.Count <= options.Index.Value)
{
if (searchOptions.IsSafely)
{
return new MissingComponentScopeLocateResult();
}
else
{
throw ExceptionFactory.CreateForNoSuchElement(
new SearchFailureData
{
ElementName = $"{(options.Index.Value + 1).Ordinalize()} matching selector",
By = by,
SearchOptions = searchOptions,
SearchContext = scope
});
}
}
else
{
return new SequalComponentScopeLocateResult(elements[options.Index.Value], sequalStrategy);
}
}
else
{
return new SequalComponentScopeLocateResult(by, sequalStrategy);
}
}
}
}
| using OpenQA.Selenium;
namespace Atata
{
public class FindByCssStrategy : IComponentScopeLocateStrategy
{
private readonly IComponentScopeLocateStrategy sequalStrategy = new FindFirstDescendantOrSelfStrategy();
public ComponentScopeLocateResult Find(IWebElement scope, ComponentScopeLocateOptions options, SearchOptions searchOptions)
{
By by = By.CssSelector(string.Join(",", options.Terms));
if (options.OuterXPath != null)
by = By.XPath(options.OuterXPath + "*").Then(by);
if (options.Index.HasValue)
{
var elements = scope.GetAll(by.With(searchOptions));
if (elements.Count <= options.Index.Value)
{
if (searchOptions.IsSafely)
return new MissingComponentScopeLocateResult();
else
throw ExceptionFactory.CreateForNoSuchElement(by: by, searchContext: scope);
}
else
{
return new SequalComponentScopeLocateResult(elements[options.Index.Value], sequalStrategy);
}
}
else
{
return new SequalComponentScopeLocateResult(by, sequalStrategy);
}
}
}
}
| apache-2.0 | C# |
4dbbde9888c496f18e01d50a13473f7321bcf3aa | Fix design-time errors. | ForNeVeR/fornever.me,ForNeVeR/fornever.me,ForNeVeR/fornever.me | ForneverMind/Views/_Layout.cshtml | ForneverMind/Views/_Layout.cshtml | @using RazorEngine.Templating
@inherits TemplateBase
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>F. von Never — @ViewBag.Title</title>
<link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS Feed"/>
<link rel="stylesheet" type="text/css" href="/css/main.css" />
</head>
<body>
<div id="header">
<div id="logo">
<a href="/">Инженер, программист, джентльмен</a>
</div>
<div id="navigation">
<a href="/archive.html">Посты</a>
<a href="/contact.html">Контакты</a>
<a href="/plans/index.html">Планы</a>
</div>
</div>
<div id="content">
<h1>@ViewBag.Title</h1>
@RenderBody()
</div>
<footer>
<div>
<a class="tag" href="/rss.xml">RSS</a>
<a class="tag" href="https://github.com/ForNeVeR/fornever.me">GitHub</a>
</div>
<div>
Сайт сгенерирован при помощи
<a href="http://jaspervdj.be/hakyll">Hakyll</a>
</div>
</footer>
</body>
</html>
| <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>F. von Never — @ViewBag.Title</title>
<link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS Feed"/>
<link rel="stylesheet" type="text/css" href="/css/main.css" />
</head>
<body>
<div id="header">
<div id="logo">
<a href="/">Инженер, программист, джентльмен</a>
</div>
<div id="navigation">
<a href="/archive.html">Посты</a>
<a href="/contact.html">Контакты</a>
<a href="/plans/index.html">Планы</a>
</div>
</div>
<div id="content">
<h1>@ViewBag.Title</h1>
@RenderBody()
</div>
<footer>
<div>
<a class="tag" href="/rss.xml">RSS</a>
<a class="tag" href="https://github.com/ForNeVeR/fornever.me">GitHub</a>
</div>
<div>
Сайт сгенерирован при помощи
<a href="http://jaspervdj.be/hakyll">Hakyll</a>
</div>
</footer>
</body>
</html>
| mit | C# |
7711975dcee5e26b2c62167b115fa5186f2ca0c4 | Revert "tabs to spaces" | NathanLBCooper/git-tfs,codemerlin/git-tfs,hazzik/git-tfs,hazzik/git-tfs,allansson/git-tfs,adbre/git-tfs,steveandpeggyb/Public,modulexcite/git-tfs,steveandpeggyb/Public,allansson/git-tfs,NathanLBCooper/git-tfs,WolfVR/git-tfs,timotei/git-tfs,WolfVR/git-tfs,PKRoma/git-tfs,allansson/git-tfs,steveandpeggyb/Public,kgybels/git-tfs,andyrooger/git-tfs,git-tfs/git-tfs,guyboltonking/git-tfs,jeremy-sylvis-tmg/git-tfs,bleissem/git-tfs,irontoby/git-tfs,WolfVR/git-tfs,codemerlin/git-tfs,jeremy-sylvis-tmg/git-tfs,bleissem/git-tfs,NathanLBCooper/git-tfs,timotei/git-tfs,TheoAndersen/git-tfs,jeremy-sylvis-tmg/git-tfs,irontoby/git-tfs,spraints/git-tfs,bleissem/git-tfs,codemerlin/git-tfs,modulexcite/git-tfs,irontoby/git-tfs,pmiossec/git-tfs,kgybels/git-tfs,adbre/git-tfs,vzabavnov/git-tfs,adbre/git-tfs,spraints/git-tfs,guyboltonking/git-tfs,TheoAndersen/git-tfs,hazzik/git-tfs,spraints/git-tfs,guyboltonking/git-tfs,allansson/git-tfs,TheoAndersen/git-tfs,timotei/git-tfs,modulexcite/git-tfs,kgybels/git-tfs,hazzik/git-tfs,TheoAndersen/git-tfs | GitTfs.Vs2008/TfsHelper.Vs2008.cs | GitTfs.Vs2008/TfsHelper.Vs2008.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
using Sep.Git.Tfs.Core.TfsInterop;
using Sep.Git.Tfs.Util;
using Sep.Git.Tfs.VsCommon;
using StructureMap;
namespace Sep.Git.Tfs.Vs2008
{
public class TfsHelper : TfsHelperBase
{
private TeamFoundationServer _server;
public TfsHelper(TextWriter stdout, TfsApiBridge bridge, IContainer container) : base(stdout, bridge, container)
{
}
public override string TfsClientLibraryVersion
{
get { return "" + typeof (TeamFoundationServer).Assembly.GetName().Version + " (MS)"; }
}
public override void EnsureAuthenticated()
{
if (string.IsNullOrEmpty(Url))
{
_server = null;
}
else
{
_server = HasCredentials ?
new TeamFoundationServer(Url, GetCredential(), new UICredentialsProvider()) :
new TeamFoundationServer(Url, new UICredentialsProvider());
_server.EnsureAuthenticated();
}
}
protected override T GetService<T>()
{
return (T) _server.GetService(typeof (T));
}
protected override string GetAuthenticatedUser()
{
return VersionControl.AuthenticatedUser;
}
public override bool CanShowCheckinDialog
{
get { return false; }
}
public override long ShowCheckinDialog(IWorkspace workspace, IPendingChange[] pendingChanges, IEnumerable<IWorkItemCheckedInfo> checkedInfos, string checkinComment)
{
throw new NotImplementedException();
}
}
public class ItemDownloadStrategy : IItemDownloadStrategy
{
private readonly TfsApiBridge _bridge;
public ItemDownloadStrategy(TfsApiBridge bridge)
{
_bridge = bridge;
}
public Stream DownloadFile(IItem item)
{
return _bridge.Unwrap<Item>(item).DownloadFile();
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
using Sep.Git.Tfs.Core.TfsInterop;
using Sep.Git.Tfs.Util;
using Sep.Git.Tfs.VsCommon;
using StructureMap;
namespace Sep.Git.Tfs.Vs2008
{
public class TfsHelper : TfsHelperBase
{
private TeamFoundationServer _server;
public TfsHelper(TextWriter stdout, TfsApiBridge bridge, IContainer container) : base(stdout, bridge, container)
{
}
public override string TfsClientLibraryVersion
{
get { return "" + typeof (TeamFoundationServer).Assembly.GetName().Version + " (MS)"; }
}
public override void EnsureAuthenticated()
{
if (string.IsNullOrEmpty(Url))
{
_server = null;
}
else
{
_server = HasCredentials ?
new TeamFoundationServer(Url, GetCredential(), new UICredentialsProvider()) :
new TeamFoundationServer(Url, new UICredentialsProvider());
_server.EnsureAuthenticated();
}
}
protected override T GetService<T>()
{
return (T) _server.GetService(typeof (T));
}
protected override string GetAuthenticatedUser()
{
return VersionControl.AuthenticatedUser;
}
public override bool CanShowCheckinDialog
{
get { return false; }
}
public override long ShowCheckinDialog(IWorkspace workspace, IPendingChange[] pendingChanges, IEnumerable<IWorkItemCheckedInfo> checkedInfos, string checkinComment)
{
throw new NotImplementedException();
}
}
public class ItemDownloadStrategy : IItemDownloadStrategy
{
private readonly TfsApiBridge _bridge;
public ItemDownloadStrategy(TfsApiBridge bridge)
{
_bridge = bridge;
}
public Stream DownloadFile(IItem item)
{
return _bridge.Unwrap<Item>(item).DownloadFile();
}
}
}
| apache-2.0 | C# |
482e34cd95cf01a54cee426bb25cbbd027f38531 | Change date format to iso format | daniellee/fluentmigrator,FabioNascimento/fluentmigrator,MetSystem/fluentmigrator,dealproc/fluentmigrator,lcharlebois/fluentmigrator,bluefalcon/fluentmigrator,KaraokeStu/fluentmigrator,fluentmigrator/fluentmigrator,fluentmigrator/fluentmigrator,barser/fluentmigrator,mstancombe/fluentmig,DefiSolutions/fluentmigrator,tohagan/fluentmigrator,igitur/fluentmigrator,drmohundro/fluentmigrator,tommarien/fluentmigrator,tommarien/fluentmigrator,spaccabit/fluentmigrator,eloekset/fluentmigrator,dealproc/fluentmigrator,igitur/fluentmigrator,bluefalcon/fluentmigrator,eloekset/fluentmigrator,itn3000/fluentmigrator,mstancombe/fluentmigrator,spaccabit/fluentmigrator,mstancombe/fluentmigrator,DefiSolutions/fluentmigrator,swalters/fluentmigrator,mstancombe/fluentmig,KaraokeStu/fluentmigrator,jogibear9988/fluentmigrator,jogibear9988/fluentmigrator,amroel/fluentmigrator,schambers/fluentmigrator,tohagan/fluentmigrator,swalters/fluentmigrator,MetSystem/fluentmigrator,lahma/fluentmigrator,istaheev/fluentmigrator,amroel/fluentmigrator,alphamc/fluentmigrator,IRlyDontKnow/fluentmigrator,lahma/fluentmigrator,modulexcite/fluentmigrator,IRlyDontKnow/fluentmigrator,modulexcite/fluentmigrator,akema-fr/fluentmigrator,DefiSolutions/fluentmigrator,wolfascu/fluentmigrator,wolfascu/fluentmigrator,daniellee/fluentmigrator,istaheev/fluentmigrator,tohagan/fluentmigrator,lcharlebois/fluentmigrator,itn3000/fluentmigrator,lahma/fluentmigrator,FabioNascimento/fluentmigrator,akema-fr/fluentmigrator,vgrigoriu/fluentmigrator,istaheev/fluentmigrator,barser/fluentmigrator,stsrki/fluentmigrator,mstancombe/fluentmig,alphamc/fluentmigrator,daniellee/fluentmigrator,vgrigoriu/fluentmigrator,stsrki/fluentmigrator,drmohundro/fluentmigrator,schambers/fluentmigrator | src/FluentMigrator.Runner/Generators/Jet/JetQuoter.cs | src/FluentMigrator.Runner/Generators/Jet/JetQuoter.cs | using System;
using FluentMigrator.Runner.Generators.Generic;
namespace FluentMigrator.Runner.Generators.Jet
{
public class JetQuoter : GenericQuoter
{
public override string OpenQuote { get { return "["; } }
public override string CloseQuote { get { return "]"; } }
public override string CloseQuoteEscapeString { get { return string.Empty; } }
public override string OpenQuoteEscapeString { get { return string.Empty; } }
public override string FormatDateTime(DateTime value)
{
return ValueQuote + (value).ToString("YYYY-MM-DD HH:mm:ss") + ValueQuote;
}
}
}
| using System;
using FluentMigrator.Runner.Generators.Generic;
namespace FluentMigrator.Runner.Generators.Jet
{
public class JetQuoter : GenericQuoter
{
public override string OpenQuote { get { return "["; } }
public override string CloseQuote { get { return "]"; } }
public override string CloseQuoteEscapeString { get { return string.Empty; } }
public override string OpenQuoteEscapeString { get { return string.Empty; } }
public override string FormatDateTime(DateTime value)
{
return ValueQuote + (value).ToString("MM/dd/yyyy HH:mm:ss") + ValueQuote;
}
}
}
| apache-2.0 | C# |
e85d1e3b1216aac5579f678ecf004ae3077c7861 | update comment | volkanceylan/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,volkanceylan/Serenity | src/Serenity.Net.Data.Entity/Row/RowFieldsProvider.cs | src/Serenity.Net.Data.Entity/Row/RowFieldsProvider.cs | using System;
using System.Threading;
namespace Serenity.Data
{
public class RowFieldsProvider
{
private static IRowFieldsProvider defaultProvider;
private static readonly AsyncLocal<IRowFieldsProvider> localProvider;
static RowFieldsProvider()
{
defaultProvider = new DefaultRowFieldsProvider();
localProvider = new AsyncLocal<IRowFieldsProvider>();
}
/// <summary>
/// Gets current row fields provider. Returns async local provider if available,
/// otherwise the default provider.
/// </summary>
public static IRowFieldsProvider Current => localProvider.Value ?? defaultProvider;
/// <summary>
/// Sets default row fields provider. This instance is required
/// as rows might have to be created in contexts where dependency injection
/// is not possible, like deserialization. If using a DI container,
/// set this at startup to the same singleton service you register with DI.
/// </summary>
/// <param name="provider">Provider. Required.</param>
/// <returns>Old default provider</returns>
public static IRowFieldsProvider SetDefault(IRowFieldsProvider provider)
{
var old = defaultProvider;
defaultProvider = provider ?? throw new ArgumentNullException(nameof(provider));
return old;
}
/// <summary>
/// Sets local row fields provider for current thread and async context.
/// Useful for background tasks, async methods, and testing to set provider locally and for
/// auto spawned threads.
/// </summary>
/// <param name="provider">Row fields provider. Can be null.</param>
/// <returns>Old local provider if any.</returns>
public static IRowFieldsProvider SetLocal(IRowFieldsProvider provider)
{
var old = localProvider.Value;
localProvider.Value = provider;
return old;
}
}
} | using System;
using System.Threading;
namespace Serenity.Data
{
public class RowFieldsProvider
{
private static IRowFieldsProvider defaultProvider;
private static readonly AsyncLocal<IRowFieldsProvider> localProvider;
static RowFieldsProvider()
{
defaultProvider = new DefaultRowFieldsProvider();
localProvider = new AsyncLocal<IRowFieldsProvider>();
}
/// <summary>
/// Gets current row fields provider. Returns async local provider if available,
/// otherwise the default provider.
/// </summary>
public static IRowFieldsProvider Current => localProvider.Value ?? defaultProvider;
/// <summary>
/// Sets default row fields provider. This instance is required
/// as rows might have to be created in contexts where dependency injection
/// is not possible, like deserialization. If using a DI container,
/// set this at startup to the same singleton service you register with DI.
/// </summary>
/// <param name="provider">Provider. Required.</param>
/// <returns>Old default provider</returns>
public static IRowFieldsProvider SetDefault(IRowFieldsProvider provider)
{
var old = defaultProvider;
defaultProvider = provider ?? throw new ArgumentNullException(nameof(provider));
return old;
}
/// <summary>
/// Sets local row fields provider for current thread and async context.
/// Useful for testing and async methods to set provider locally and for
/// auto spawned threads.
/// </summary>
/// <param name="provider">Row fields provider. Can be null.</param>
/// <returns>Old local provider if any.</returns>
public static IRowFieldsProvider SetLocal(IRowFieldsProvider provider)
{
var old = localProvider.Value;
localProvider.Value = provider;
return old;
}
}
} | mit | C# |
c8019c83a7db517d39035b29054ce46fbaa41abd | Fix failing tests. | TheCloudlessSky/Harbour.RedisTempData | tests/Harbour.RedisTempData.Test/RedisTest.cs | tests/Harbour.RedisTempData.Test/RedisTest.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StackExchange.Redis;
namespace Harbour.RedisTempData.Test
{
public abstract class RedisTest : IDisposable
{
// Use a different DB than development.
private const int testDb = 15;
private readonly string testHost = "localhost";
private readonly int testPort = 6379;
public ConnectionMultiplexer Multiplexer { get; private set; }
public IDatabase Redis { get; private set; }
protected RedisTest()
{
var config = new ConfigurationOptions() { AllowAdmin = true };
config.EndPoints.Add(testHost, testPort);
Multiplexer = ConnectionMultiplexer.Connect(config);
Redis = GetRedis();
}
protected virtual IDatabase GetRedis()
{
var client = Multiplexer.GetDatabase(testDb);
var server = Multiplexer.GetServer(testHost + ":" + testPort);
server.FlushDatabase(testDb);
return client;
}
public virtual void Dispose()
{
Multiplexer.Dispose();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StackExchange.Redis;
namespace Harbour.RedisTempData.Test
{
public abstract class RedisTest : IDisposable
{
// Use a different DB than development.
private const int testDb = 15;
private readonly string testHost = "localhost";
public ConnectionMultiplexer Multiplexer { get; private set; }
public IDatabase Redis { get; private set; }
protected RedisTest()
{
var config = new ConfigurationOptions() { AllowAdmin = true };
config.EndPoints.Add(testHost);
Multiplexer = ConnectionMultiplexer.Connect(config);
Redis = GetRedis();
}
protected virtual IDatabase GetRedis()
{
var client = Multiplexer.GetDatabase(testDb);
var server = Multiplexer.GetServer(testHost);
server.FlushDatabase(testDb);
return client;
}
public virtual void Dispose()
{
Multiplexer.Dispose();
}
}
}
| mit | C# |
7e5a2f1710946038d91ee3a204c4c8205a57b7b7 | Make NotSupportedException partial to allow XI to add an helper method | esdrubal/referencesource,evincarofautumn/referencesource,mono/referencesource,ludovic-henry/referencesource,directhex/referencesource,stormleoxia/referencesource | mscorlib/system/notsupportedexception.cs | mscorlib/system/notsupportedexception.cs | // ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*=============================================================================
**
** Class: NotSupportedException
**
**
** Purpose: For methods that should be implemented on subclasses.
**
**
=============================================================================*/
namespace System {
using System;
using System.Runtime.Serialization;
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
public partial class NotSupportedException : SystemException
{
public NotSupportedException()
: base(Environment.GetResourceString("Arg_NotSupportedException")) {
SetErrorCode(__HResults.COR_E_NOTSUPPORTED);
}
public NotSupportedException(String message)
: base(message) {
SetErrorCode(__HResults.COR_E_NOTSUPPORTED);
}
public NotSupportedException(String message, Exception innerException)
: base(message, innerException) {
SetErrorCode(__HResults.COR_E_NOTSUPPORTED);
}
protected NotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) {
}
}
}
| // ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*=============================================================================
**
** Class: NotSupportedException
**
**
** Purpose: For methods that should be implemented on subclasses.
**
**
=============================================================================*/
namespace System {
using System;
using System.Runtime.Serialization;
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
public class NotSupportedException : SystemException
{
public NotSupportedException()
: base(Environment.GetResourceString("Arg_NotSupportedException")) {
SetErrorCode(__HResults.COR_E_NOTSUPPORTED);
}
public NotSupportedException(String message)
: base(message) {
SetErrorCode(__HResults.COR_E_NOTSUPPORTED);
}
public NotSupportedException(String message, Exception innerException)
: base(message, innerException) {
SetErrorCode(__HResults.COR_E_NOTSUPPORTED);
}
protected NotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) {
}
}
}
| mit | C# |
5d131c493b8f813822faf19f267b40d47a82f200 | Increase precision of decimals in the event log | LANDIS-II-Foundation/Extension-Biomass-Harvest | src/EventsLog.cs | src/EventsLog.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Landis.Library.Metadata;
using Landis.Core;
namespace Landis.Extension.BiomassHarvest
{
public class EventsLog
{
[DataFieldAttribute(Unit = FieldUnits.Year, Desc = "Harvest Year")]
public int Time { set; get; }
[DataFieldAttribute(Desc = "Management Area")]
public uint ManagementArea { set; get; }
[DataFieldAttribute(Desc = "Prescription Name")]
public string Prescription { set; get; }
[DataFieldAttribute(Desc = "Stand")]
public uint Stand { set; get; }
[DataFieldAttribute(Desc = "Event ID")]
public int EventID { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Year, Desc = "Stand Age")]
public int StandAge { set; get; }
[DataFieldAttribute(Desc = "Stand Rank")]
public int StandRank { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Count, Desc = "Number of Sites")]
public int NumberOfSites { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Count, Desc = "Number of Sites Harvested")]
public int HarvestedSites { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Mg_ha, Desc = "Biomass Removed (Mg)", Format = "0.0000")]
public double MgBiomassRemoved { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Mg_ha, Desc = "Biomass Removed (Mg) per damaged hectare", Format = "0.0000")]
public double MgBioRemovedPerDamagedHa { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Count, Desc = "Number of Cohorts Partially Harvested")]
public int TotalCohortsPartialHarvest { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Count, Desc = "Number of Cohorts Completely Harvested")]
public int TotalCohortsCompleteHarvest { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Count, Desc = "Species Cohorts Harvested by Species", SppList = true)]
public double[] CohortsHarvested_ { set; get; }
[DataFieldAttribute(Unit = FieldUnits.None, Desc = "Biomass Harvested by Species (Mg)", SppList = true)]
public double[] BiomassHarvestedMg_ { set; get; }
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Landis.Library.Metadata;
using Landis.Core;
namespace Landis.Extension.BiomassHarvest
{
public class EventsLog
{
[DataFieldAttribute(Unit = FieldUnits.Year, Desc = "Harvest Year")]
public int Time {set; get;}
[DataFieldAttribute(Desc = "Management Area")]
public uint ManagementArea { set; get; }
[DataFieldAttribute(Desc = "Prescription Name")]
public string Prescription { set; get; }
[DataFieldAttribute(Desc = "Stand")]
public uint Stand { set; get; }
[DataFieldAttribute(Desc = "Event ID")]
public int EventID { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Year, Desc = "Stand Age")]
public int StandAge { set; get; }
[DataFieldAttribute(Desc = "Stand Rank")]
public int StandRank { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Count, Desc = "Number of Sites")]
public int NumberOfSites { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Count, Desc = "Number of Sites Harvested")]
public int HarvestedSites { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Mg_ha, Desc = "Biomass Removed (Mg)", Format = "0.00")]
public double MgBiomassRemoved { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Mg_ha, Desc = "Biomass Removed (Mg) per damaged hectare", Format = "0.00")]
public double MgBioRemovedPerDamagedHa { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Count, Desc = "Number of Cohorts Partially Harvested")]
public int TotalCohortsPartialHarvest { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Count, Desc = "Number of Cohorts Completely Harvested")]
public int TotalCohortsCompleteHarvest { set; get; }
[DataFieldAttribute(Unit = FieldUnits.Count, Desc = "Species Cohorts Harvested by Species", SppList = true)]
public double[] CohortsHarvested_ { set; get; }
[DataFieldAttribute(Unit = FieldUnits.None, Desc = "Biomass Harvested by Species (Mg)", SppList = true)]
public double[] BiomassHarvestedMg_ { set; get; }
}
}
| apache-2.0 | C# |
1b0e7cb1da116e33303d7873c40500ce4dc21db9 | Support API Key authentication using header | mycroes/SupportManager,mycroes/SupportManager,mycroes/SupportManager | SupportManager.Web/Infrastructure/ApiKey/ApiKeyAuthenticationHandler.cs | SupportManager.Web/Infrastructure/ApiKey/ApiKeyAuthenticationHandler.cs | using System.Data.Entity;
using System.Linq;
using System.Security.Claims;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using SupportManager.DAL;
namespace SupportManager.Web.Infrastructure.ApiKey
{
public class ApiKeyAuthenticationHandler : AuthenticationHandler<ApiKeyAuthenticationOptions>
{
private readonly SupportManagerContext db;
public ApiKeyAuthenticationHandler(SupportManagerContext db, IOptionsMonitor<ApiKeyAuthenticationOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder, clock)
{
this.db = db;
}
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
{
string key;
if (Request.Headers["X-API-Key"].Count == 1) key = Request.Headers["X-API-Key"][0];
else if (Request.Query["apikey"].Count == 1) key = Request.Query["apikey"][0];
else return AuthenticateResult.Fail("Invalid request");
var user = await db.ApiKeys.Where(apiKey => apiKey.Value == key).Select(apiKey => apiKey.User)
.SingleOrDefaultAsync();
if (user == null) return AuthenticateResult.Fail("Invalid API Key");
var claims = new[] {new Claim(ClaimTypes.Name, user.Login)};
var identity = new ClaimsIdentity(claims, Scheme.Name);
var principal = new ClaimsPrincipal(identity);
var ticket = new AuthenticationTicket(principal, Scheme.Name);
return AuthenticateResult.Success(ticket);
}
}
}
| using System.Data.Entity;
using System.Linq;
using System.Security.Claims;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using SupportManager.DAL;
namespace SupportManager.Web.Infrastructure.ApiKey
{
public class ApiKeyAuthenticationHandler : AuthenticationHandler<ApiKeyAuthenticationOptions>
{
private readonly SupportManagerContext db;
public ApiKeyAuthenticationHandler(SupportManagerContext db, IOptionsMonitor<ApiKeyAuthenticationOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder, clock)
{
this.db = db;
}
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
{
if (Request.Query["apikey"].Count != 1) return AuthenticateResult.Fail("Invalid request");
var key = Request.Query["apikey"][0];
var user = await db.ApiKeys.Where(apiKey => apiKey.Value == key).Select(apiKey => apiKey.User)
.SingleOrDefaultAsync();
if (user == null) return AuthenticateResult.Fail("Invalid API Key");
var claims = new[] {new Claim(ClaimTypes.Name, user.Login)};
var identity = new ClaimsIdentity(claims, Scheme.Name);
var principal = new ClaimsPrincipal(identity);
var ticket = new AuthenticationTicket(principal, Scheme.Name);
return AuthenticateResult.Success(ticket);
}
}
}
| mit | C# |
9fe47cb9e850ca028a72f0a4e99f5c2ec87e4220 | update version to v10.1 | 68681395/JexusManager | JexusManager/Properties/AssemblyInfo.cs | JexusManager/Properties/AssemblyInfo.cs | // Copyright (c) Lex Li. All rights reserved.
//
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("JexusManager")]
[assembly: AssemblyDescription("Management Console for Jexus web server.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LeXtudio")]
[assembly: AssemblyProduct("JexusManager")]
[assembly: AssemblyCopyright("Copyright (C) Lex Li 2014. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3ea9b8b4-3e15-4f86-a4b2-1108084000c9")]
[assembly: InternalsVisibleTo("Tests.JexusManager, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f7030532c52524"
+ "993841a0d09420340f3814e1b65473851bdcd18815510b035a2ae9ecee69c4cd2d9e4d6e6d5fbf"
+ "a564e86c4a4cddc9597619a31c060846ebb2e99511a0323ff82b1ebd95d6a4912502945f0e769f"
+ "190a69a439dbfb969ebad72a6f7e2e047907da4a7b9c08c6e98d5f1be8b8cafaf3eb978914059a"
+ "245d4bc1")]
[assembly: AssemblyVersion("10.1.0.0")]
[assembly: AssemblyFileVersion("10.1.0.0")]
| // Copyright (c) Lex Li. All rights reserved.
//
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("JexusManager")]
[assembly: AssemblyDescription("Management Console for Jexus web server.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LeXtudio")]
[assembly: AssemblyProduct("JexusManager")]
[assembly: AssemblyCopyright("Copyright (C) Lex Li 2014. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3ea9b8b4-3e15-4f86-a4b2-1108084000c9")]
[assembly: InternalsVisibleTo("Tests.JexusManager, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f7030532c52524"
+ "993841a0d09420340f3814e1b65473851bdcd18815510b035a2ae9ecee69c4cd2d9e4d6e6d5fbf"
+ "a564e86c4a4cddc9597619a31c060846ebb2e99511a0323ff82b1ebd95d6a4912502945f0e769f"
+ "190a69a439dbfb969ebad72a6f7e2e047907da4a7b9c08c6e98d5f1be8b8cafaf3eb978914059a"
+ "245d4bc1")]
| mit | C# |
0801ebc93bd8844aea371f922a424902dbec0377 | Remove var keyword in tests | TelegramBots/telegram.bot,MrRoundRobin/telegram.bot | test/Telegram.Bot.Tests.Unit/Serialization/MethodNameTests.cs | test/Telegram.Bot.Tests.Unit/Serialization/MethodNameTests.cs | using Newtonsoft.Json;
using Telegram.Bot.Requests;
using Xunit;
namespace Telegram.Bot.Tests.Unit.Serialization
{
public class MethodNameTests
{
[Fact(DisplayName = "Should serialize method name in webhook responses")]
public void Should_Serialize_MethodName_In_Webhook_Responses()
{
SendMessageRequest sendMessageRequest = new SendMessageRequest(1, "text")
{
IsWebhookResponse = true
};
var request = JsonConvert.SerializeObject(sendMessageRequest);
Assert.Contains(@"""method"":""sendMessage""", request);
}
[Fact(DisplayName = "Should not serialize method name in webhook responses")]
public void Should_Not_Serialize_MethodName_In_Webhook_Responses()
{
SendMessageRequest sendMessageRequest = new SendMessageRequest(1, "text")
{
IsWebhookResponse = false
};
var request = JsonConvert.SerializeObject(sendMessageRequest);
Assert.DoesNotContain(@"""method"":""sendMessage""", request);
}
}
}
| using Newtonsoft.Json;
using Telegram.Bot.Requests;
using Xunit;
namespace Telegram.Bot.Tests.Unit.Serialization
{
public class MethodNameTests
{
[Fact(DisplayName = "Should serialize method name in webhook responses")]
public void Should_Serialize_MethodName_In_Webhook_Responses()
{
var sendMessageRequest = new SendMessageRequest(1, "text")
{
IsWebhookResponse = true
};
var request = JsonConvert.SerializeObject(sendMessageRequest);
Assert.Contains(@"""method"":""sendMessage""", request);
}
[Fact(DisplayName = "Should not serialize method name in webhook responses")]
public void Should_Not_Serialize_MethodName_In_Webhook_Responses()
{
var sendMessageRequest = new SendMessageRequest(1, "text")
{
IsWebhookResponse = false
};
var request = JsonConvert.SerializeObject(sendMessageRequest);
Assert.DoesNotContain(@"""method"":""sendMessage""", request);
}
}
}
| mit | C# |
71f3a64165f81d50b00cf4cb2b6a82ca8be6dba6 | Fix APIPlaylistItem serialisation | peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu | osu.Game/Online/Rooms/APIPlaylistItem.cs | osu.Game/Online/Rooms/APIPlaylistItem.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.
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using MessagePack;
using osu.Game.Online.API;
namespace osu.Game.Online.Rooms
{
[Serializable]
[MessagePackObject]
public class APIPlaylistItem
{
[Key(0)]
public long ID { get; set; }
[Key(1)]
public int BeatmapID { get; set; }
[Key(2)]
public string BeatmapChecksum { get; set; } = string.Empty;
[Key(3)]
public int RulesetID { get; set; }
[Key(4)]
public IEnumerable<APIMod> RequiredMods { get; set; } = Enumerable.Empty<APIMod>();
[Key(5)]
public IEnumerable<APIMod> AllowedMods { get; set; } = Enumerable.Empty<APIMod>();
[Key(6)]
public bool Expired { get; set; }
public APIPlaylistItem()
{
}
public APIPlaylistItem(PlaylistItem item)
{
ID = item.ID;
BeatmapID = item.BeatmapID;
BeatmapChecksum = item.Beatmap.Value?.MD5Hash ?? string.Empty;
RulesetID = item.RulesetID;
RequiredMods = item.RequiredMods.Select(m => new APIMod(m)).ToArray();
AllowedMods = item.AllowedMods.Select(m => new APIMod(m)).ToArray();
Expired = item.Expired;
}
}
}
| // 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.
#nullable enable
using System.Collections.Generic;
using System.Linq;
using MessagePack;
using osu.Game.Online.API;
namespace osu.Game.Online.Rooms
{
public class APIPlaylistItem
{
[Key(0)]
public long ID { get; set; }
[Key(1)]
public int BeatmapID { get; set; }
[Key(2)]
public string BeatmapChecksum { get; set; } = string.Empty;
[Key(3)]
public int RulesetID { get; set; }
[Key(4)]
public IEnumerable<APIMod> RequiredMods { get; set; } = Enumerable.Empty<APIMod>();
[Key(5)]
public IEnumerable<APIMod> AllowedMods { get; set; } = Enumerable.Empty<APIMod>();
[Key(6)]
public bool Expired { get; set; }
public APIPlaylistItem()
{
}
public APIPlaylistItem(PlaylistItem item)
{
ID = item.ID;
BeatmapID = item.BeatmapID;
BeatmapChecksum = item.Beatmap.Value?.MD5Hash ?? string.Empty;
RulesetID = item.RulesetID;
RequiredMods = item.RequiredMods.Select(m => new APIMod(m)).ToArray();
AllowedMods = item.AllowedMods.Select(m => new APIMod(m)).ToArray();
Expired = item.Expired;
}
}
}
| mit | C# |
58220b613210fed8a44d6fe364dcc370724e1bcf | move map in surface scene for animation | reinterpretcat/utymap,reinterpretcat/utymap,reinterpretcat/utymap | unity/demo/Assets/Scripts/Scene/Animations/SurfaceAnimator.cs | unity/demo/Assets/Scripts/Scene/Animations/SurfaceAnimator.cs | using System;
using System.Collections.Generic;
using Assets.Scripts.Scene.Tiling;
using UnityEngine;
using UtyMap.Unity;
using UtyMap.Unity.Animations.Time;
using Animation = UtyMap.Unity.Animations.Animation;
namespace Assets.Scripts.Scene.Animations
{
/// <summary> Handles surface animations. </summary>
internal sealed class SurfaceAnimator : SpaceAnimator
{
public SurfaceAnimator(TileController tileController) : base(tileController)
{
}
/// <inheritdoc />
protected override Animation CreateAnimationTo(GeoCoordinate coordinate, float zoom, TimeSpan duration, ITimeInterpolator timeInterpolator)
{
var position = Pivot.localPosition;
var position2D = TileController.Projection.Project(coordinate, 0);
return CreatePathAnimation(Pivot, duration, timeInterpolator, new List<Vector3>()
{
position,
new Vector3(position2D.x, TileController.GetHeight(zoom), position2D.z)
});
}
}
}
| using System;
using System.Collections.Generic;
using Assets.Scripts.Scene.Tiling;
using UnityEngine;
using UtyMap.Unity;
using UtyMap.Unity.Animations.Time;
using Animation = UtyMap.Unity.Animations.Animation;
namespace Assets.Scripts.Scene.Animations
{
/// <summary> Handles surface animations. </summary>
internal sealed class SurfaceAnimator : SpaceAnimator
{
public SurfaceAnimator(TileController tileController) : base(tileController)
{
}
/// <inheritdoc />
protected override Animation CreateAnimationTo(GeoCoordinate coordinate, float zoom, TimeSpan duration, ITimeInterpolator timeInterpolator)
{
var position = Pivot.localPosition;
return CreatePathAnimation(Pivot, duration, timeInterpolator, new List<Vector3>()
{
position,
new Vector3(position.x, TileController.GetHeight(zoom), position.z)
});
}
}
}
| apache-2.0 | C# |
435b9137bf2e3fa6623bd23a43c06748174ae306 | delete duplicate MC input in ppc64-encoding-bookIII.s.cs | 07151129/capstone,bSr43/capstone,bigendiansmalls/capstone,dynm/capstone,sigma-random/capstone,07151129/capstone,8l/capstone,code4bones/capstone,techvoltage/capstone,NeilBryant/capstone,07151129/capstone,capturePointer/capstone,pranith/capstone,nplanel/capstone,pyq881120/capstone,pombredanne/capstone,bigendiansmalls/capstone,fvrmatteo/capstone,techvoltage/capstone,bowlofstew/capstone,bSr43/capstone,sigma-random/capstone,bigendiansmalls/capstone,dynm/capstone,pyq881120/capstone,dynm/capstone,angelabier1/capstone,bSr43/capstone,NeilBryant/capstone,AmesianX/capstone,pombredanne/capstone,nplanel/capstone,fvrmatteo/capstone,angelabier1/capstone,NeilBryant/capstone,pyq881120/capstone,zneak/capstone,bigendiansmalls/capstone,8l/capstone,xia0pin9/capstone,07151129/capstone,sigma-random/capstone,krytarowski/capstone,bSr43/capstone,bowlofstew/capstone,krytarowski/capstone,techvoltage/capstone,nplanel/capstone,bughoho/capstone,bughoho/capstone,8l/capstone,dynm/capstone,zneak/capstone,capturePointer/capstone,sephiroth99/capstone,xia0pin9/capstone,bowlofstew/capstone,pranith/capstone,zuloloxi/capstone,bughoho/capstone,bowlofstew/capstone,xia0pin9/capstone,capturePointer/capstone,zuloloxi/capstone,fvrmatteo/capstone,dynm/capstone,pombredanne/capstone,pranith/capstone,krytarowski/capstone,bowlofstew/capstone,sephiroth99/capstone,code4bones/capstone,code4bones/capstone,pyq881120/capstone,AmesianX/capstone,nplanel/capstone,07151129/capstone,pranith/capstone,zneak/capstone,NeilBryant/capstone,pyq881120/capstone,sigma-random/capstone,zneak/capstone,techvoltage/capstone,AmesianX/capstone,pombredanne/capstone,fvrmatteo/capstone,zuloloxi/capstone,NeilBryant/capstone,pombredanne/capstone,AmesianX/capstone,NeilBryant/capstone,pombredanne/capstone,code4bones/capstone,8l/capstone,techvoltage/capstone,07151129/capstone,AmesianX/capstone,AmesianX/capstone,pranith/capstone,code4bones/capstone,capturePointer/capstone,bowlofstew/capstone,dynm/capstone,angelabier1/capstone,sephiroth99/capstone,sigma-random/capstone,sephiroth99/capstone,angelabier1/capstone,sephiroth99/capstone,krytarowski/capstone,8l/capstone,fvrmatteo/capstone,nplanel/capstone,bowlofstew/capstone,angelabier1/capstone,code4bones/capstone,xia0pin9/capstone,capturePointer/capstone,sephiroth99/capstone,zuloloxi/capstone,pombredanne/capstone,8l/capstone,xia0pin9/capstone,sigma-random/capstone,bSr43/capstone,pranith/capstone,pyq881120/capstone,fvrmatteo/capstone,xia0pin9/capstone,zneak/capstone,bigendiansmalls/capstone,bSr43/capstone,bigendiansmalls/capstone,zuloloxi/capstone,bughoho/capstone,zuloloxi/capstone,zneak/capstone,sigma-random/capstone,bigendiansmalls/capstone,krytarowski/capstone,bughoho/capstone,nplanel/capstone,capturePointer/capstone,capturePointer/capstone,fvrmatteo/capstone,krytarowski/capstone,bSr43/capstone,zuloloxi/capstone,techvoltage/capstone,NeilBryant/capstone,sephiroth99/capstone,code4bones/capstone,pyq881120/capstone,zneak/capstone,8l/capstone,angelabier1/capstone,AmesianX/capstone,techvoltage/capstone,07151129/capstone,bughoho/capstone,pranith/capstone,nplanel/capstone,bughoho/capstone,xia0pin9/capstone,dynm/capstone,krytarowski/capstone,angelabier1/capstone | suite/MC/PowerPC/ppc64-encoding-bookIII.s.cs | suite/MC/PowerPC/ppc64-encoding-bookIII.s.cs | # CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, CS_OPT_SYNTAX_NOREGNAME
0x7c,0x80,0x01,0x24 = mtmsr 4, 0
0x7c,0x81,0x01,0x24 = mtmsr 4, 1
0x7c,0x80,0x00,0xa6 = mfmsr 4
0x7c,0x80,0x01,0x64 = mtmsrd 4, 0
0x7c,0x81,0x01,0x64 = mtmsrd 4, 1
0x7c,0x90,0x42,0xa6 = mfspr 4, 272
0x7c,0x91,0x42,0xa6 = mfspr 4, 273
0x7c,0x92,0x42,0xa6 = mfspr 4, 274
0x7c,0x93,0x42,0xa6 = mfspr 4, 275
0x7c,0x90,0x43,0xa6 = mtspr 272, 4
0x7c,0x91,0x43,0xa6 = mtspr 273, 4
0x7c,0x92,0x43,0xa6 = mtspr 274, 4
0x7c,0x93,0x43,0xa6 = mtspr 275, 4
0x7c,0x90,0x43,0xa6 = mtspr 272, 4
0x7c,0x91,0x43,0xa6 = mtspr 273, 4
0x7c,0x92,0x43,0xa6 = mtspr 274, 4
0x7c,0x93,0x43,0xa6 = mtspr 275, 4
0x7c,0x98,0x43,0xa6 = mtspr 280, 4
0x7c,0x96,0x02,0xa6 = mfspr 4, 22
0x7c,0x96,0x03,0xa6 = mtspr 22, 4
0x7c,0x9f,0x42,0xa6 = mfspr 4, 287
0x7c,0x99,0x02,0xa6 = mfspr 4, 25
0x7c,0x99,0x03,0xa6 = mtspr 25, 4
0x7c,0x9a,0x02,0xa6 = mfspr 4, 26
0x7c,0x9a,0x03,0xa6 = mtspr 26, 4
0x7c,0x9b,0x02,0xa6 = mfspr 4, 27
0x7c,0x9b,0x03,0xa6 = mtspr 27, 4
0x7c,0x00,0x23,0x64 = slbie 4
0x7c,0x80,0x2b,0x24 = slbmte 4, 5
0x7c,0x80,0x2f,0x26 = slbmfee 4, 5
0x7c,0x00,0x03,0xe4 = slbia
0x7c,0x00,0x04,0x6c = tlbsync
0x7c,0x00,0x22,0x24 = tlbiel 4
0x7c,0x00,0x22,0x64 = tlbie 4,0
| # CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, CS_OPT_SYNTAX_NOREGNAME
0x7c,0x80,0x01,0x24 = mtmsr 4, 0
0x7c,0x81,0x01,0x24 = mtmsr 4, 1
0x7c,0x80,0x00,0xa6 = mfmsr 4
0x7c,0x80,0x01,0x64 = mtmsrd 4, 0
0x7c,0x81,0x01,0x64 = mtmsrd 4, 1
0x7c,0x90,0x42,0xa6 = mfspr 4, 272
0x7c,0x91,0x42,0xa6 = mfspr 4, 273
0x7c,0x92,0x42,0xa6 = mfspr 4, 274
0x7c,0x93,0x42,0xa6 = mfspr 4, 275
0x7c,0x90,0x43,0xa6 = mtspr 272, 4
0x7c,0x91,0x43,0xa6 = mtspr 273, 4
0x7c,0x92,0x43,0xa6 = mtspr 274, 4
0x7c,0x93,0x43,0xa6 = mtspr 275, 4
0x7c,0x90,0x43,0xa6 = mtspr 272, 4
0x7c,0x91,0x43,0xa6 = mtspr 273, 4
0x7c,0x92,0x43,0xa6 = mtspr 274, 4
0x7c,0x93,0x43,0xa6 = mtspr 275, 4
0x7c,0x98,0x43,0xa6 = mtspr 280, 4
0x7c,0x96,0x02,0xa6 = mfspr 4, 22
0x7c,0x96,0x03,0xa6 = mtspr 22, 4
0x7c,0x9f,0x42,0xa6 = mfspr 4, 287
0x7c,0x99,0x02,0xa6 = mfspr 4, 25
0x7c,0x99,0x03,0xa6 = mtspr 25, 4
0x7c,0x9a,0x02,0xa6 = mfspr 4, 26
0x7c,0x9a,0x03,0xa6 = mtspr 26, 4
0x7c,0x9b,0x02,0xa6 = mfspr 4, 27
0x7c,0x9b,0x03,0xa6 = mtspr 27, 4
0x7c,0x00,0x23,0x64 = slbie 4
0x7c,0x80,0x2b,0x24 = slbmte 4, 5
0x7c,0x80,0x2f,0x26 = slbmfee 4, 5
0x7c,0x00,0x03,0xe4 = slbia
0x7c,0x00,0x04,0x6c = tlbsync
0x7c,0x00,0x22,0x24 = tlbiel 4
0x7c,0x00,0x22,0x64 = tlbie 4,0
0x7c,0x00,0x22,0x64 = tlbie 4,0
| bsd-3-clause | C# |
cc8591bb3cd7046a9b4bf703fdc03a081ea4df9d | Fix warnings. | JohanLarsson/Gu.Wpf.ValidationScope | Gu.Wpf.ValidationScope.Demo/UiTestWindows/SimpleWindow.xaml.cs | Gu.Wpf.ValidationScope.Demo/UiTestWindows/SimpleWindow.xaml.cs | namespace Gu.Wpf.ValidationScope.Demo.UiTestWindows
{
using System.Windows;
public partial class SimpleWindow : Window
{
public SimpleWindow()
{
this.InitializeComponent();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Gu.Wpf.ValidationScope.Demo.UiTestWindows
{
/// <summary>
/// Interaction logic for SimpleWindow.xaml
/// </summary>
public partial class SimpleWindow : Window
{
public SimpleWindow()
{
InitializeComponent();
}
}
}
| mit | C# |
76b7bdffc58517ff2e43ce5d08b5567d658babe7 | Update AssemblyInfo.cs | Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal | Master/Appleseed/WebSites/Appleseed/Properties/AssemblyInfo.cs | Master/Appleseed/WebSites/Appleseed/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Appleseed Portal")]
[assembly: AssemblyDescription("Appleseed Portal and Content Management System")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("Appleseed Portal")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2040171a-ea5e-4c30-be7b-1d59f138009e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
| using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Appleseed Portal")]
[assembly: AssemblyDescription("Appleseed Portal and Content Management System")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("Appleseed Portal")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2040171a-ea5e-4c30-be7b-1d59f138009e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.3.69.342")]
[assembly: AssemblyFileVersion("1.3.69.342")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
| apache-2.0 | C# |
b3a6bc00343815e07c457cba3c3b338485962b13 | Allow multiple httpmethodattribute | Code-Sharp/uHttpSharp,habibmasuro/uhttpsharp,lstefano71/uhttpsharp,raistlinthewiz/uhttpsharp,int6/uhttpsharp,habibmasuro/uhttpsharp,int6/uhttpsharp,Code-Sharp/uHttpSharp,lstefano71/uhttpsharp,raistlinthewiz/uhttpsharp | uhttpsharp/Attributes/HttpMethodAttribute.cs | uhttpsharp/Attributes/HttpMethodAttribute.cs | using System;
namespace uhttpsharp.Attributes
{
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
public class HttpMethodAttribute : Attribute
{
private readonly HttpMethods _httpMethod;
public HttpMethodAttribute(HttpMethods httpMethod)
{
_httpMethod = httpMethod;
}
public HttpMethods HttpMethod
{
get { return _httpMethod; }
}
}
} | using System;
namespace uhttpsharp.Attributes
{
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public class HttpMethodAttribute : Attribute
{
private readonly HttpMethods _httpMethod;
public HttpMethodAttribute(HttpMethods httpMethod)
{
_httpMethod = httpMethod;
}
public HttpMethods HttpMethod
{
get { return _httpMethod; }
}
}
} | lgpl-2.1 | C# |
47ff6ff930004eea8c883a409fdb460515d1abd6 | Fix nullability warning. | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Tor/Socks5/Models/Fields/OctetFields/AtypField.cs | WalletWasabi/Tor/Socks5/Models/Fields/OctetFields/AtypField.cs | using System.Net;
using System.Net.Sockets;
using WalletWasabi.Helpers;
using WalletWasabi.Tor.Socks5.Models.Bases;
namespace WalletWasabi.Tor.Socks5.Models.Fields.OctetFields
{
public class AtypField : OctetSerializableBase
{
// https://gitweb.torproject.org/torspec.git/tree/socks-extensions.txt
// IPv6 is not supported in CONNECT commands.
public static readonly AtypField IPv4 = new AtypField(0x01);
public static readonly AtypField DomainName = new AtypField(0x03);
public AtypField(byte value)
{
ByteValue = value;
}
public AtypField(string dstAddr)
{
dstAddr = Guard.NotNullOrEmptyOrWhitespace(nameof(dstAddr), dstAddr, true);
if (IPAddress.TryParse(dstAddr, out IPAddress? address))
{
Guard.Same($"{nameof(address)}.{nameof(address.AddressFamily)}", AddressFamily.InterNetwork, address.AddressFamily);
ByteValue = IPv4.ToByte();
}
else
{
ByteValue = DomainName.ToByte();
}
}
}
}
| using System.Net;
using System.Net.Sockets;
using WalletWasabi.Helpers;
using WalletWasabi.Tor.Socks5.Models.Bases;
namespace WalletWasabi.Tor.Socks5.Models.Fields.OctetFields
{
public class AtypField : OctetSerializableBase
{
// https://gitweb.torproject.org/torspec.git/tree/socks-extensions.txt
// IPv6 is not supported in CONNECT commands.
public static readonly AtypField IPv4 = new AtypField(0x01);
public static readonly AtypField DomainName = new AtypField(0x03);
public AtypField(byte value)
{
ByteValue = value;
}
public AtypField(string dstAddr)
{
dstAddr = Guard.NotNullOrEmptyOrWhitespace(nameof(dstAddr), dstAddr, true);
if (IPAddress.TryParse(dstAddr, out IPAddress address))
{
Guard.Same($"{nameof(address)}.{nameof(address.AddressFamily)}", AddressFamily.InterNetwork, address.AddressFamily);
ByteValue = IPv4.ToByte();
}
else
{
ByteValue = DomainName.ToByte();
}
}
}
}
| mit | C# |
f1e8df716b59f291445f20b25f73e20edabe277f | Fix DateHelper | serial-labs/SharedLibraries | Source/SerialLabs/Helpers/DateHelper.cs | Source/SerialLabs/Helpers/DateHelper.cs | using System;
namespace SerialLabs
{
/// <summary>
/// Provides helping method for manipulating dates. Provides DateTime extension methods too
/// </summary>
public static class DateHelper
{
/// <summary>
/// Ensures that local times are converted to UTC times. Unspecified kinds are recast to UTC with no conversion.
/// </summary>
/// <param name="value">The date-time to convert.</param>
/// <returns>The date-time in UTC time.</returns>
public static DateTime AsUtc(this DateTime value)
{
if (value.Kind == DateTimeKind.Unspecified)
{
return new DateTime(value.Ticks, DateTimeKind.Utc);
}
return value.ToUniversalTime();
}
/// <summary>
/// Ensures that local times are converted to UTC times. Unspecified kinds are recast to UTC with no conversion.
/// </summary>
/// <param name="value">The nullable date-time to convert.</param>
/// <returns>The nullable date-time in UTC time.</returns>
public static DateTime? AsUtc(this DateTime? value)
{
if (!value.HasValue) { return null; }
if (value.Value.Kind == DateTimeKind.Unspecified)
{
return new DateTime(value.Value.Ticks, DateTimeKind.Utc);
}
return value.Value.ToUniversalTime();
}
/// <summary>
/// Convert a unix timestamp to the corresponding datetime.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static DateTime FromUnixTime(double value)
{
DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0);
return unixStart.AddSeconds(value);
}
/// <summary>
/// Convert a datetime to its corresponding unix timestamp value.
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
public static double ToUnixTime(DateTime date)
{
DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0);
TimeSpan timespan = date - unixStart;
return timespan.TotalSeconds;
}
}
}
| using System;
namespace SerialLabs
{
/// <summary>
/// Provides helping method for manipulating dates. Provides DateTime extension methods too
/// </summary>
public static class DateHelper
{
/// <summary>
/// Ensures that local times are converted to UTC times. Unspecified kinds are recast to UTC with no conversion.
/// </summary>
/// <param name="value">The date-time to convert.</param>
/// <returns>The date-time in UTC time.</returns>
public static DateTime AsUtc(this DateTime value)
{
if (value.Kind == DateTimeKind.Unspecified)
{
return new DateTime(value.Ticks, DateTimeKind.Utc);
}
return value.ToUniversalTime();
}
/// <summary>
/// Ensures that local times are converted to UTC times. Unspecified kinds are recast to UTC with no conversion.
/// </summary>
/// <param name="value">The nullable date-time to convert.</param>
/// <returns>The nullable date-time in UTC time.</returns>
public static DateTime? AsUtc(this DateTime? value)
{
if (value.Value.Kind == DateTimeKind.Unspecified)
{
return new DateTime(value.Value.Ticks, DateTimeKind.Utc);
}
return value.Value.ToUniversalTime();
}
/// <summary>
/// Convert a unix timestamp to the corresponding datetime.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static DateTime FromUnixTime(double value)
{
DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0);
return unixStart.AddSeconds(value);
}
/// <summary>
/// Convert a datetime to its corresponding unix timestamp value.
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
public static double ToUnixTime(DateTime date)
{
DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0);
TimeSpan timespan = date - unixStart;
return timespan.TotalSeconds;
}
}
}
| mit | C# |
ce91c4e45dc19931eb5d1ad8b0e26a10167280f8 | Update Register.cshtml | seancpeters/templating,mlorbetske/templating,seancpeters/templating,seancpeters/templating,mlorbetske/templating,seancpeters/templating | template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Views/Account/Register.cshtml | template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Views/Account/Register.cshtml | @model RegisterViewModel
@{
ViewData["Title"] = "Register";
}
<h2>@ViewData["Title"]</h2>
<div class="row">
<div class="col-md-4">
<form asp-route-returnUrl="@ViewData["ReturnUrl"]" method="post">
<h4>Create a new account.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Email"></label>
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Password"></label>
<input asp-for="Password" class="form-control" />
<span asp-validation-for="Password" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="ConfirmPassword"></label>
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-default">Register</button>
</form>
</div>
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
| @model RegisterViewModel
@{
ViewData["Title"] = "Register";
}
<h2>@ViewData["Title"]</h2>
<div class="row">
<div class="col-md-4">
<form asp-route-returnUrl="@ViewData["ReturnUrl"] method="post">
<h4>Create a new account.</h4>
<hr />
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Email"></label>
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Password"></label>
<input asp-for="Password" class="form-control" />
<span asp-validation-for="Password" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="ConfirmPassword"></label>
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-default">Register</button>
</form>
</div>
</div>
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
| mit | C# |
24a613d71ce9794ac16e0d89767521b6937064db | Fix HelpWriter substring index bug | ermshiperete/GitVersion,ermshiperete/GitVersion,asbjornu/GitVersion,GitTools/GitVersion,asbjornu/GitVersion,ermshiperete/GitVersion,gep13/GitVersion,GitTools/GitVersion,gep13/GitVersion,ermshiperete/GitVersion | src/GitVersion.App/HelpWriter.cs | src/GitVersion.App/HelpWriter.cs | using System;
using System.IO;
using System.Reflection;
using GitVersion.Logging;
namespace GitVersion
{
public class HelpWriter : IHelpWriter
{
private readonly IVersionWriter versionWriter;
private readonly IConsole console;
public HelpWriter(IVersionWriter versionWriter, IConsole console)
{
this.versionWriter = versionWriter ?? throw new ArgumentNullException(nameof(versionWriter));
this.console = console ?? throw new ArgumentNullException(nameof(console));
}
public void Write()
{
WriteTo(console.WriteLine);
}
public void WriteTo(Action<string> writeAction)
{
var version = string.Empty;
var assembly = Assembly.GetExecutingAssembly();
versionWriter.WriteTo(assembly, v => version = v);
var args = ArgumentList();
var nl = System.Environment.NewLine;
var message = "GitVersion " + version + nl + nl + args;
writeAction(message);
}
private string ArgumentList()
{
using var argumentsMarkdownStream = GetType().Assembly.GetManifestResourceStream("GitVersion.arguments.md");
using var sr = new StreamReader(argumentsMarkdownStream);
var argsMarkdown = sr.ReadToEnd();
var codeBlockStart = argsMarkdown.IndexOf("```") + 3;
var codeBlockEnd = argsMarkdown.LastIndexOf("```") - codeBlockStart;
return argsMarkdown.Substring(codeBlockStart, codeBlockEnd).Trim();
}
}
}
| using System;
using System.IO;
using System.Reflection;
using GitVersion.Logging;
namespace GitVersion
{
public class HelpWriter : IHelpWriter
{
private readonly IVersionWriter versionWriter;
private readonly IConsole console;
public HelpWriter(IVersionWriter versionWriter, IConsole console)
{
this.versionWriter = versionWriter ?? throw new ArgumentNullException(nameof(versionWriter));
this.console = console ?? throw new ArgumentNullException(nameof(console));
}
public void Write()
{
WriteTo(console.WriteLine);
}
public void WriteTo(Action<string> writeAction)
{
var version = string.Empty;
var assembly = Assembly.GetExecutingAssembly();
versionWriter.WriteTo(assembly, v => version = v);
using var argumentsMarkdownStream = GetType().Assembly.GetManifestResourceStream("GitVersion.App.arguments.md");
using var sr = new StreamReader(argumentsMarkdownStream);
var argsMarkdown = sr.ReadToEnd();
var codeBlockStart = argsMarkdown.IndexOf("```");
var codeBlockEnd = argsMarkdown.LastIndexOf("```");
argsMarkdown = argsMarkdown.Substring(codeBlockStart + 3, codeBlockEnd).Trim();
var nl = System.Environment.NewLine;
var message = "GitVersion "
+ version + nl
+ "Use convention to derive a SemVer product version from a GitFlow or GitHub based repository."
+ nl + nl + "GitVersion [path]"
+ nl + nl + argsMarkdown;
writeAction(message);
}
}
}
| mit | C# |
5f500c89ce9df27910fa6007d4d87aa238a8a2ba | Fix a bug in pCampbot grabbing behaviour where an exception would be thrown if the bot was not yet aware of any objects. | ft-/arribasim-dev-extras,QuillLittlefeather/opensim-1,TomDataworks/opensim,ft-/opensim-optimizations-wip,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,Michelle-Argus/ArribasimExtract,OpenSimian/opensimulator,BogusCurry/arribasim-dev,RavenB/opensim,ft-/arribasim-dev-tests,justinccdev/opensim,OpenSimian/opensimulator,rryk/omp-server,ft-/arribasim-dev-tests,rryk/omp-server,ft-/opensim-optimizations-wip-tests,OpenSimian/opensimulator,RavenB/opensim,M-O-S-E-S/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip-extras,BogusCurry/arribasim-dev,RavenB/opensim,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-tests,RavenB/opensim,OpenSimian/opensimulator,QuillLittlefeather/opensim-1,Michelle-Argus/ArribasimExtract,rryk/omp-server,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-extras,bravelittlescientist/opensim-performance,ft-/opensim-optimizations-wip,TomDataworks/opensim,justinccdev/opensim,ft-/arribasim-dev-extras,TomDataworks/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,OpenSimian/opensimulator,RavenB/opensim,QuillLittlefeather/opensim-1,rryk/omp-server,ft-/opensim-optimizations-wip,BogusCurry/arribasim-dev,rryk/omp-server,ft-/arribasim-dev-extras,BogusCurry/arribasim-dev,ft-/arribasim-dev-extras,bravelittlescientist/opensim-performance,justinccdev/opensim,QuillLittlefeather/opensim-1,TomDataworks/opensim,ft-/opensim-optimizations-wip-extras,RavenB/opensim,rryk/omp-server,TomDataworks/opensim,ft-/opensim-optimizations-wip,Michelle-Argus/ArribasimExtract,QuillLittlefeather/opensim-1,M-O-S-E-S/opensim,Michelle-Argus/ArribasimExtract,ft-/opensim-optimizations-wip-tests,BogusCurry/arribasim-dev,TomDataworks/opensim,bravelittlescientist/opensim-performance,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,BogusCurry/arribasim-dev,RavenB/opensim,justinccdev/opensim,Michelle-Argus/ArribasimExtract,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim,ft-/arribasim-dev-tests,justinccdev/opensim,bravelittlescientist/opensim-performance,justinccdev/opensim,M-O-S-E-S/opensim,TomDataworks/opensim,QuillLittlefeather/opensim-1,OpenSimian/opensimulator,ft-/arribasim-dev-extras,OpenSimian/opensimulator,ft-/opensim-optimizations-wip-tests,QuillLittlefeather/opensim-1,M-O-S-E-S/opensim,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip-tests,ft-/opensim-optimizations-wip-extras,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-tests,M-O-S-E-S/opensim,ft-/arribasim-dev-tests,bravelittlescientist/opensim-performance,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,bravelittlescientist/opensim-performance,Michelle-Argus/ArribasimExtract | OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs | OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.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 OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Linq;
using pCampBot.Interfaces;
namespace pCampBot
{
/// <summary>
/// Click (grab) on random objects in the scene.
/// </summary>
/// <remarks>
/// The viewer itself does not give the option of grabbing objects that haven't been signalled as grabbable.
/// </remarks>
public class GrabbingBehaviour : AbstractBehaviour
{
public GrabbingBehaviour() { Name = "Grabbing"; }
public override void Action()
{
Dictionary<UUID, Primitive> objects = Bot.Objects;
if (objects.Count <= 0)
return;
Primitive prim = objects.ElementAt(Bot.Random.Next(0, objects.Count - 1)).Value;
// This appears to be a typical message sent when a viewer user clicks a clickable object
Bot.Client.Self.Grab(prim.LocalID);
Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero);
Bot.Client.Self.DeGrab(prim.LocalID);
}
}
} | /*
* 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 OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Linq;
using pCampBot.Interfaces;
namespace pCampBot
{
/// <summary>
/// Click (grab) on random objects in the scene.
/// </summary>
/// <remarks>
/// The viewer itself does not give the option of grabbing objects that haven't been signalled as grabbable.
/// </remarks>
public class GrabbingBehaviour : AbstractBehaviour
{
public GrabbingBehaviour() { Name = "Grabbing"; }
public override void Action()
{
Dictionary<UUID, Primitive> objects = Bot.Objects;
Primitive prim = objects.ElementAt(Bot.Random.Next(0, objects.Count - 1)).Value;
// This appears to be a typical message sent when a viewer user clicks a clickable object
Bot.Client.Self.Grab(prim.LocalID);
Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero);
Bot.Client.Self.DeGrab(prim.LocalID);
}
}
} | bsd-3-clause | C# |
c1ea016eca61083f2c9e8950f7368e38718dea4a | Add Sum method | rmterra/NesZord | src/NesZord.Core/MemoryLocation.cs | src/NesZord.Core/MemoryLocation.cs | using NesZord.Core.Extensions;
namespace NesZord.Core
{
public class MemoryLocation
{
public MemoryLocation(byte offset, byte page)
{
this.Offset = offset;
this.Page = page;
}
public byte Offset { get; private set; }
public byte Page { get; private set; }
public int FullLocation
{
get { return (this.Page << 8) + this.Offset; }
}
public MemoryLocation Sum(byte value)
{
var fullLocation = this.FullLocation;
var newLocation = fullLocation + value;
return new MemoryLocation(newLocation.GetOffset(), newLocation.GetPage());
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NesZord.Core
{
public class MemoryLocation
{
public MemoryLocation(byte offset, byte page)
{
this.Offset = offset;
this.Page = page;
}
public byte Offset { get; private set; }
public byte Page { get; private set; }
public int FullLocation
{
get { return (this.Page << 8) + this.Offset; }
}
}
}
| apache-2.0 | C# |
236b3147c8b0f06b4559d51ae1bc0cb8a41c7c23 | Add assembly configuration | arvydas/BlinkStickInterop,arvydas/BlinkStickInterop,arvydas/BlinkStickInterop,arvydas/BlinkStickInterop | BlinkStickInterop/Properties/AssemblyInfo.cs | BlinkStickInterop/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("BlinkStickDotNet.Interop")]
[assembly: AssemblyDescription ("")]
#if DEBUG
[assembly: AssemblyConfiguration("debug")]
#else
[assembly: AssemblyConfiguration("alpha1")] //Set beta1, beta2, beta3 and etc
#endif
[assembly: AssemblyCompany ("Agile Innovative Ltd")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("(c) Agile Innovative Ltd")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
[assembly: GuidAttribute("1147AA5E-F138-4B3D-8759-0CDB6665DBB3")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("BlinkStickDotNet.Interop")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Agile Innovative Ltd")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("(c) Agile Innovative Ltd")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
[assembly: GuidAttribute("1147AA5E-F138-4B3D-8759-0CDB6665DBB3")]
| mit | C# |
ce56b9fe722c8f5573bb03f914a1faffd1f1e59f | use the short name for MOS on soldiers list | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | BatteryCommander.Web/Views/Soldier/List.cshtml | BatteryCommander.Web/Views/Soldier/List.cshtml | @model IEnumerable<BatteryCommander.Common.Models.Soldier>
@{
ViewBag.Title = "Soldiers";
}
<h2>@ViewBag.Title</h2>
<div class="btn-group" role="group">
@Html.ActionLink("Add a Soldier", "Edit", null, new { @class = "btn btn-primary" })
@Html.ActionLink("Bulk Add/Edit Soldiers", "Bulk", null, new { @class = "btn btn-default" })
@Html.ActionLink("Include Inactive Soldiers", "List", new { activeOnly = false }, new { @class = "btn btn-default" })
</div>
<table class="table table-striped">
<tr>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Group)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Position)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Rank)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().LastName)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().FirstName)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().MOS)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Notes)</th>
<th></th>
</tr>
@foreach (var soldier in Model)
{
<tr>
<td>@Html.DisplayFor(s => soldier.Group)</td>
<td>@Html.DisplayFor(s => soldier.Position, new { UseShortName = true })</td>
<td>@Html.DisplayFor(s => soldier.Rank, new { UseShortName = true })</td>
<td>@Html.DisplayFor(s => soldier.LastName)</td>
<td>@Html.DisplayFor(s => soldier.FirstName)</td>
<td>@Html.DisplayFor(s => soldier.MOS, new { UseShortName = true })</td>
<td>@Html.DisplayFor(s => soldier.Notes)</td>
<td>@Html.ActionLink("View", "View", new { soldierId = soldier.Id })</td>
</tr>
}
</table> | @model IEnumerable<BatteryCommander.Common.Models.Soldier>
@{
ViewBag.Title = "Soldiers";
}
<h2>@ViewBag.Title</h2>
<div class="btn-group" role="group">
@Html.ActionLink("Add a Soldier", "Edit", null, new { @class = "btn btn-primary" })
@Html.ActionLink("Bulk Add/Edit Soldiers", "Bulk", null, new { @class = "btn btn-default" })
@Html.ActionLink("Include Inactive Soldiers", "List", new { activeOnly = false }, new { @class = "btn btn-default" })
</div>
<table class="table table-striped">
<tr>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Group)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Position)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Rank)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().LastName)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().FirstName)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().MOS)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Status)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Notes)</th>
<th></th>
</tr>
@foreach (var soldier in Model)
{
<tr>
<td>@Html.DisplayFor(s => soldier.Group)</td>
<td>@Html.DisplayFor(s => soldier.Position, new { UseShortName = true })</td>
<td>@Html.DisplayFor(s => soldier.Rank, new { UseShortName = true })</td>
<td>@Html.DisplayFor(s => soldier.LastName)</td>
<td>@Html.DisplayFor(s => soldier.FirstName)</td>
<td>@Html.DisplayFor(s => soldier.MOS)</td>
<td>@Html.DisplayFor(s => soldier.Status)</td>
<td>@Html.DisplayFor(s => soldier.Notes)</td>
<td>@Html.ActionLink("View", "View", new { soldierId = soldier.Id })</td>
</tr>
}
</table> | mit | C# |
db2aa64868eed38e43ec08b6f92815301ff8dd62 | Format code | mstrother/BmpListener | BmpListener/Bgp/CapabilityFourOctetAsNumber.cs | BmpListener/Bgp/CapabilityFourOctetAsNumber.cs | using System;
namespace BmpListener.Bgp
{
public class CapabilityFourOctetAsNumber : Capability
{
public CapabilityFourOctetAsNumber(byte[] data, int offset)
: base(data, offset)
{
Decode(data, offset + 2);
}
public int Asn { get; private set; }
public void Decode(byte[] data, int offset)
{
Array.Reverse(data, offset, 4);
Asn = BitConverter.ToInt32(data, offset);
}
}
} | using System;
namespace BmpListener.Bgp
{
public class CapabilityFourOctetAsNumber : Capability
{
public CapabilityFourOctetAsNumber(byte[] data, int offset) : base(data, offset)
{
Decode(data, offset + 2);
}
public int Asn { get; private set; }
public void Decode(byte[] data, int offset)
{
Array.Reverse(data, offset, 4);
Asn = BitConverter.ToInt32(data, offset);
}
}
} | mit | C# |
469291b90d41ad5e5808186a72b5c45e46e071ae | Fix TokenProviderTestFixture | Proligence/OrchardTesting | Proligence.Orchard.Testing/TokenProviderTestFixture.cs | Proligence.Orchard.Testing/TokenProviderTestFixture.cs | namespace Proligence.Orchard.Testing
{
using System.Collections.Generic;
using System.Reflection;
#if (NUNIT)
using NUnit.Framework;
#endif
using Autofac;
using global::Orchard.Localization;
using global::Orchard.Tokens;
using global::Orchard.Tokens.Implementation;
public abstract class TokenProviderTestFixture<TProvider> : ContainerTestFixture
where TProvider : ITokenProvider
{
#if (XUNIT)
protected TokenProviderTestFixture()
{
Initialize();
}
#endif
public TProvider Provider { get; private set; }
public ITokenizer Tokenizer { get; private set; }
#if (NUNIT)
[SetUp]
public void Setup()
{
Initialize();
}
#endif
protected override void Register(ContainerBuilder builder)
{
base.Register(builder);
builder.RegisterType<TProvider>().As<TProvider>().As<ITokenProvider>();
}
private void Initialize()
{
Provider = Container.Resolve<TProvider>();
PropertyInfo localizerProperty = typeof(TProvider).GetProperty("T", typeof(Localizer));
if (localizerProperty != null)
{
localizerProperty.SetValue(Provider, NullLocalizer.Instance, null);
}
Tokenizer = new Tokenizer(new TokenManager(Container.Resolve<IEnumerable<ITokenProvider>>()));
}
}
} | namespace Proligence.Orchard.Testing
{
using System.Reflection;
#if (NUNIT)
using NUnit.Framework;
#endif
using Autofac;
using global::Orchard.Localization;
using global::Orchard.Tokens;
using global::Orchard.Tokens.Implementation;
public abstract class TokenProviderTestFixture<TProvider> : ContainerTestFixture
where TProvider : ITokenProvider
{
#if (XUNIT)
protected TokenProviderTestFixture()
{
Initialize();
}
#endif
public TProvider Provider { get; private set; }
public ITokenizer Tokenizer { get; private set; }
#if (NUNIT)
[SetUp]
public void Setup()
{
Initialize();
}
#endif
private void Initialize()
{
Provider = Container.Resolve<TProvider>();
PropertyInfo localizerProperty = typeof(TProvider).GetProperty("T", typeof(Localizer));
if (localizerProperty != null)
{
localizerProperty.SetValue(Provider, NullLocalizer.Instance, null);
}
Tokenizer = new Tokenizer(new TokenManager(new ITokenProvider[] { Provider }));
}
}
} | mit | C# |
ea4709604858a950d6cbc870412f8fcc42515762 | Tidy up Tree Node code | jamiepollock/Umbraco-MigrationsViewer,jamiepollock/Umbraco-MigrationsViewer,jamiepollock/Umbraco-MigrationsViewer | src/Our.Umbraco.MigrationsViewer.Core/Controllers/MigrationsViewerTreeController.cs | src/Our.Umbraco.MigrationsViewer.Core/Controllers/MigrationsViewerTreeController.cs | using System;
using System.Globalization;
using System.Net.Http.Formatting;
using Our.Umbraco.MigrationsViewer.Core.Services;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.Mvc;
using Umbraco.Web.Trees;
using Umbraco.Web.WebApi.Filters;
namespace Our.Umbraco.MigrationsViewer.Core.Controllers
{
[UmbracoApplicationAuthorize(Constants.Applications.Developer)]
[PluginController(PluginConstants.Name)]
[Tree(Constants.Applications.Developer, PluginConstants.Name, PluginConstants.Title)]
public class MigrationsViewerTreeController : TreeController
{
private const string MigrationNameTreeNodeIcon = "icon-tactics";
private readonly IMigrationNamesService _service = new DatabaseMigrationNamesService(ApplicationContext.Current.DatabaseContext.Database);
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
{
var nodes = new TreeNodeCollection();
if (IsRoot(id) == false)
{
throw new NotSupportedException();
}
var migrationNames = _service.GetUniqueMigrationNames();
foreach (var name in migrationNames)
{
var node = CreateTreeNode(name, id, null, name, MigrationNameTreeNodeIcon, false);
nodes.Add(node);
}
return nodes;
}
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
var menu = new MenuItemCollection();
if (IsRoot(id) == false) return menu;
var text = ApplicationContext.Services.TextService.Localize(ActionRefresh.Instance.Alias,
CultureInfo.CurrentUICulture);
menu.Items.Add<RefreshNode, ActionRefresh>(text);
return menu;
}
private static bool IsRoot(string id)
{
return string.Equals(id, Constants.System.Root.ToString());
}
}
} | using System;
using System.Globalization;
using System.Net.Http.Formatting;
using Our.Umbraco.MigrationsViewer.Core.Services;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.Mvc;
using Umbraco.Web.Trees;
using Umbraco.Web.WebApi.Filters;
namespace Our.Umbraco.MigrationsViewer.Core.Controllers
{
[UmbracoApplicationAuthorize(Constants.Applications.Developer)]
[PluginController(PluginConstants.Name)]
[Tree(Constants.Applications.Developer, PluginConstants.Name, PluginConstants.Title)]
public class MigrationsViewerTreeController : TreeController
{
private readonly IMigrationNamesService _service = new DatabaseMigrationNamesService(ApplicationContext.Current.DatabaseContext.Database);
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
{
var nodes = new TreeNodeCollection();
if (IsRoot(id) == false)
{
throw new NotSupportedException();
}
var products = _service.GetUniqueMigrationNames();
foreach (var product in products)
{
var node = CreateTreeNode(product, id, null, product, "icon-tactics", false);
nodes.Add(node);
}
return nodes;
}
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
var menu = new MenuItemCollection();
if (IsRoot(id) == false) return menu;
var text = ApplicationContext.Services.TextService.Localize(ActionRefresh.Instance.Alias,
CultureInfo.CurrentUICulture);
menu.Items.Add<RefreshNode, ActionRefresh>(text);
return menu;
}
private static bool IsRoot(string id)
{
return string.Equals(id, Constants.System.Root.ToString());
}
}
}
| apache-2.0 | C# |
4c4204a1466a3b0622d60d10c8da94a08fc9f327 | Add String.IsNullOrWhiteSpace | nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke | source/Nuke.Common/Utilities/String.Emptiness.cs | source/Nuke.Common/Utilities/String.Emptiness.cs | // Copyright 2020 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
namespace Nuke.Common.Utilities
{
public static partial class StringExtensions
{
public static bool IsNullOrEmpty(this string str)
{
return string.IsNullOrEmpty(str);
}
public static bool IsNullOrWhiteSpace(this string str)
{
return string.IsNullOrWhiteSpace(str);
}
}
}
| // Copyright 2020 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
namespace Nuke.Common.Utilities
{
public static partial class StringExtensions
{
public static bool IsNullOrEmpty(this string str)
{
return string.IsNullOrEmpty(str);
}
}
}
| mit | C# |
32e2abfd801ead4697050f16838f982894039e52 | Fix merge conflict | rmillikin/MetaMorpheus,XRSHEERAN/MetaMorpheus,zrolfs/MetaMorpheus,lonelu/MetaMorpheus,hoffmann4/MetaMorpheus,lschaffer2/MetaMorpheus,smith-chem-wisc/MetaMorpheus | EngineLayer/MatchedIonMassesListOnlyMatches.cs | EngineLayer/MatchedIonMassesListOnlyMatches.cs | using System.Collections;
using System.Collections.Generic;
namespace EngineLayer
{
public class MatchedIonMassesListOnlyMatches : IEnumerable<KeyValuePair<ProductType, double[]>>
{
#region Private Fields
private readonly Dictionary<ProductType, double[]> matchedIonDictPositiveIsMatch;
#endregion Private Fields
#region Public Constructors
public MatchedIonMassesListOnlyMatches(Dictionary<ProductType, double[]> matchedIonDictPositiveIsMatch)
{
this.matchedIonDictPositiveIsMatch = matchedIonDictPositiveIsMatch;
}
#endregion Public Constructors
#region Public Indexers
public double[] this[ProductType y]
{
get
{
return matchedIonDictPositiveIsMatch[y];
}
}
#endregion Public Indexers
#region Public Methods
public IEnumerator<KeyValuePair<ProductType, double[]>> GetEnumerator()
{
return matchedIonDictPositiveIsMatch.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return matchedIonDictPositiveIsMatch.GetEnumerator();
}
#endregion Public Methods
#region Internal Methods
internal bool ContainsKey(ProductType y)
{
return matchedIonDictPositiveIsMatch.ContainsKey(y);
}
#endregion Internal Methods
}
} | using System.Collections;
using System.Collections.Generic;
namespace EngineLayer
{
public class MatchedIonMassesListOnlyMasses : IEnumerable<KeyValuePair<ProductType, double[]>>
{
#region Private Fields
private readonly Dictionary<ProductType, double[]> matchedIonDictPositiveIsMatch;
#endregion Private Fields
#region Public Constructors
public MatchedIonMassesListOnlyMatches(Dictionary<ProductType, double[]> matchedIonDictPositiveIsMatch)
{
this.matchedIonDictPositiveIsMatch = matchedIonDictPositiveIsMatch;
}
#endregion Public Constructors
#region Public Indexers
public double[] this[ProductType y]
{
get
{
return matchedIonDictPositiveIsMatch[y];
}
}
#endregion Public Indexers
#region Public Methods
public IEnumerator<KeyValuePair<ProductType, double[]>> GetEnumerator()
{
return matchedIonDictPositiveIsMatch.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return matchedIonDictPositiveIsMatch.GetEnumerator();
}
#endregion Public Methods
#region Internal Methods
internal bool ContainsKey(ProductType y)
{
return matchedIonDictPositiveIsMatch.ContainsKey(y);
}
#endregion Internal Methods
}
} | mit | C# |
081d8b9f1d5a1b41936b7f21fa998d01c0665c29 | use Debug.WriteLine in Log.CW | Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns | TCC.Utils/Log.cs | TCC.Utils/Log.cs | using System;
using System.Diagnostics;
using System.IO;
using TCC.Data;
namespace TCC.Utils
{
public static class Log
{
public static event Action<ChatChannel, string, string> NewChatMessage;
public static event Func<string, string, NotificationType, int, NotificationTemplate, int> NewNotification;
private static string _logPath = "logs";
private static string _version = "";
public static void CW(string line)
{
Debug.WriteLine(line);
//if (Debugger.IsAttached) Debug.WriteLine(line);
//else
//{
//Console.WriteLine(line);
//}
}
public static void F(string line, string fileName = "error.log")
{
try
{
if (!Directory.Exists(_logPath))
Directory.CreateDirectory(_logPath);
File.AppendAllText(Path.Combine(_logPath, fileName), $"############### {_version} - {DateTime.Now:dd/MM/yyyy HH:mm:ss} ###############\n{line}\n\n");
}
catch { }
}
public static int N(string title, string line, NotificationType type, int duration = -1, NotificationTemplate template = NotificationTemplate.Default)
{
return NewNotification?.Invoke(title, line, type, duration, template) ?? -1;
}
public static void Config(string path, string version)
{
_logPath = path;
_version = version;
}
public static void Chat(ChatChannel channel, string author, string message)
{
if (!message.StartsWith("<font")) message = ChatUtils.Font(message);
NewChatMessage?.Invoke(channel, message, author);
}
}
}
| using System;
using System.IO;
using TCC.Data;
namespace TCC.Utils
{
public static class Log
{
public static event Action<ChatChannel, string, string> NewChatMessage;
public static event Func<string, string, NotificationType, int, NotificationTemplate, int > NewNotification;
private static string _logPath = "logs";
private static string _version = "";
public static void CW(string line)
{
Console.WriteLine(line);
}
public static void F(string line, string fileName = "error.log")
{
try
{
if (!Directory.Exists(_logPath))
Directory.CreateDirectory(_logPath);
File.AppendAllText(Path.Combine(_logPath, fileName), $"############### {_version} - {DateTime.Now:dd/MM/yyyy HH:mm:ss} ###############\n{line}\n\n");
}
catch { }
}
public static int N(string title, string line, NotificationType type, int duration = -1, NotificationTemplate template = NotificationTemplate.Default)
{
return NewNotification?.Invoke(title, line, type, duration, template) ?? -1;
}
public static void Config(string path, string version)
{
_logPath = path;
_version = version;
}
public static void Chat(ChatChannel channel, string author, string message)
{
if (!message.StartsWith("<font")) message = ChatUtils.Font(message);
NewChatMessage?.Invoke(channel, message, author);
}
}
}
| mit | C# |
fed5701cd398c29f500477f65718f433d0f19df9 | Prepare Program.cs for REPL/Console mode | vejuhust/msft-scooter | ScooterController/ScooterController/Program.cs | ScooterController/ScooterController/Program.cs | using System;
namespace ScooterController
{
class Program
{
private static void ExecuteInstructionFromFile(string filename)
{
var parser = new InstructionInterpreter(filename);
var controller = new HardwareController();
HardwareInstruction instruction;
while ((instruction = parser.GetNextInstruction()) != null)
{
Console.WriteLine("\n[{0}{1}]", instruction.Operator, instruction.HasOperand ? " " + instruction.Operand : string.Empty);
if (instruction.Operator == HardwareOperator.NoOp || instruction.Operator == HardwareOperator.Exit)
{
break;
}
controller.ExecuteInstruction(instruction);
}
}
static void Main(string[] args)
{
if (args.Length >= 1)
{
ExecuteInstructionFromFile(args[0]);
}
}
}
}
| using System;
namespace ScooterController
{
class Program
{
static void Main(string[] args)
{
var parser = args.Length >= 1
? new InstructionInterpreter(args[0])
: new InstructionInterpreter();
var controller = new HardwareController();
HardwareInstruction instruction;
while ((instruction = parser.GetNextInstruction()) != null)
{
Console.WriteLine("\n[{0}{1}]", instruction.Operator, instruction.HasOperand ? " " + instruction.Operand.ToString() : string.Empty);
if (instruction.Operator == HardwareOperator.NoOp || instruction.Operator == HardwareOperator.Exit)
{
break;
}
controller.ExecuteInstruction(instruction);
}
}
}
}
| mit | C# |
d53f62e9316653a16ce420995d5959793a27e323 | Fix changelog list component | patchkit-net/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity,mohsansaleem/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity,mohsansaleem/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity | src/Assets/Scripts/UI/Changelog/ChangelogList.cs | src/Assets/Scripts/UI/Changelog/ChangelogList.cs | using System.Collections;
using System.Linq;
using PatchKit.Api.Models.Main;
using PatchKit.Unity.UI;
using PatchKit.Unity.Utilities;
namespace PatchKit.Unity.Patcher.UI
{
public class ChangelogList : UIApiComponent
{
public ChangelogElement TitlePrefab;
public ChangelogElement ChangePrefab;
protected override IEnumerator LoadCoroutine()
{
while (!Patcher.Instance.Data.HasValue || Patcher.Instance.Data.Value.AppSecret == null)
{
yield return null;
}
yield return
Threading.StartThreadCoroutine(() => MainApiConnection.GetAppVersionList(Patcher.Instance.Data.Value.AppSecret),
response =>
{
foreach (var version in response.OrderByDescending(version => version.Id))
{
CreateVersionChangelog(version);
}
});
}
private void CreateVersionChangelog(AppVersion version)
{
CreateVersionTitle(version.Label);
CreateVersionChangeList(version.Changelog);
}
private void CreateVersionTitle(string label)
{
var title = Instantiate(TitlePrefab);
title.Text.text = string.Format("Changelog {0}", label);
title.transform.SetParent(transform, false);
title.transform.SetAsLastSibling();
}
private void CreateVersionChangeList(string changelog)
{
var changeList = (changelog ?? string.Empty).Split('\n');
foreach (var change in changeList.Where(s => !string.IsNullOrEmpty(s)))
{
string formattedChange = change.TrimStart(' ', '-', '*');
CreateVersionChange(formattedChange);
}
}
private void CreateVersionChange(string changeText)
{
var change = Instantiate(ChangePrefab);
change.Text.text = changeText;
change.transform.SetParent(transform, false);
change.transform.SetAsLastSibling();
}
}
} | using System.Collections;
using System.Linq;
using PatchKit.Api.Models.Main;
using PatchKit.Unity.UI;
using PatchKit.Unity.Utilities;
namespace PatchKit.Unity.Patcher.UI
{
public class ChangelogList : UIApiComponent
{
public ChangelogElement TitlePrefab;
public ChangelogElement ChangePrefab;
protected override IEnumerator LoadCoroutine()
{
yield return
Threading.StartThreadCoroutine(() => MainApiConnection.GetAppVersionList(Patcher.Instance.Data.Value.AppSecret),
response =>
{
foreach (var version in response.OrderByDescending(version => version.Id))
{
CreateVersionChangelog(version);
}
});
}
private void CreateVersionChangelog(AppVersion version)
{
CreateVersionTitle(version.Label);
CreateVersionChangeList(version.Changelog);
}
private void CreateVersionTitle(string label)
{
var title = Instantiate(TitlePrefab);
title.Text.text = string.Format("Changelog {0}", label);
title.transform.SetParent(transform, false);
title.transform.SetAsLastSibling();
}
private void CreateVersionChangeList(string changelog)
{
var changeList = (changelog ?? string.Empty).Split('\n');
foreach (var change in changeList.Where(s => !string.IsNullOrEmpty(s)))
{
string formattedChange = change.TrimStart(' ', '-', '*');
CreateVersionChange(formattedChange);
}
}
private void CreateVersionChange(string changeText)
{
var change = Instantiate(ChangePrefab);
change.Text.text = changeText;
change.transform.SetParent(transform, false);
change.transform.SetAsLastSibling();
}
}
} | mit | C# |
7c1ecd4b70449d07c36570ba2217ca26e6e7d9b1 | Fix DirectoryInfo.IsSymbolicLinkValid() | michaelmelancon/symboliclinksupport | SymbolicLinkSupport/DirectoryInfoExtensions.cs | SymbolicLinkSupport/DirectoryInfoExtensions.cs | using System;
using System.IO;
namespace SymbolicLinkSupport
{
/// <summary>
/// A class which provides extensions for <see cref="DirectoryInfo"/> to handle symbolic directory links.
/// </summary>
public static class DirectoryInfoExtensions
{
/// <summary>
/// Creates a symbolic link to this directory at the specified path.
/// </summary>
/// <param name="directoryInfo">the source directory for the symbolic link.</param>
/// <param name="path">the path of the symbolic link.</param>
public static void CreateSymbolicLink(this DirectoryInfo directoryInfo, string path)
{
SymbolicLink.CreateDirectoryLink(path, directoryInfo.FullName);
}
/// <summary>
/// Determines whether this directory is a symbolic link.
/// </summary>
/// <param name="directoryInfo">the directory in question.</param>
/// <returns><code>true</code> if the directory is, indeed, a symbolic link, <code>false</code> otherwise.</returns>
public static bool IsSymbolicLink(this DirectoryInfo directoryInfo)
{
return SymbolicLink.GetTarget(directoryInfo.FullName) != null;
}
/// <summary>
/// Determines whether the target of this symbolic link still exists.
/// </summary>
/// <param name="directoryInfo">The symbolic link in question.</param>
/// <returns><code>true</code> if this symbolic link is valid, <code>false</code> otherwise.</returns>
/// <exception cref="System.ArgumentException">If the directory is not a symbolic link.</exception>
public static bool IsSymbolicLinkValid(this DirectoryInfo directoryInfo)
{
return Directory.Exists(directoryInfo.GetSymbolicLinkTarget());
}
/// <summary>
/// Returns the full path to the target of this symbolic link.
/// </summary>
/// <param name="directoryInfo">The symbolic link in question.</param>
/// <returns>The path to the target of the symbolic link.</returns>
/// <exception cref="System.ArgumentException">If the directory in question is not a symbolic link.</exception>
public static string GetSymbolicLinkTarget(this DirectoryInfo directoryInfo)
{
if (!directoryInfo.IsSymbolicLink())
throw new ArgumentException("Specified directory is not a symbolic link.");
return SymbolicLink.GetTarget(directoryInfo.FullName);
}
}
} | using System;
using System.IO;
namespace SymbolicLinkSupport
{
/// <summary>
/// A class which provides extensions for <see cref="DirectoryInfo"/> to handle symbolic directory links.
/// </summary>
public static class DirectoryInfoExtensions
{
/// <summary>
/// Creates a symbolic link to this directory at the specified path.
/// </summary>
/// <param name="directoryInfo">the source directory for the symbolic link.</param>
/// <param name="path">the path of the symbolic link.</param>
public static void CreateSymbolicLink(this DirectoryInfo directoryInfo, string path)
{
SymbolicLink.CreateDirectoryLink(path, directoryInfo.FullName);
}
/// <summary>
/// Determines whether this directory is a symbolic link.
/// </summary>
/// <param name="directoryInfo">the directory in question.</param>
/// <returns><code>true</code> if the directory is, indeed, a symbolic link, <code>false</code> otherwise.</returns>
public static bool IsSymbolicLink(this DirectoryInfo directoryInfo)
{
return SymbolicLink.GetTarget(directoryInfo.FullName) != null;
}
/// <summary>
/// Determines whether the target of this symbolic link still exists.
/// </summary>
/// <param name="directoryInfo">The symbolic link in question.</param>
/// <returns><code>true</code> if this symbolic link is valid, <code>false</code> otherwise.</returns>
/// <exception cref="System.ArgumentException">If the directory is not a symbolic link.</exception>
public static bool IsSymbolicLinkValid(this DirectoryInfo directoryInfo)
{
return File.Exists(directoryInfo.GetSymbolicLinkTarget());
}
/// <summary>
/// Returns the full path to the target of this symbolic link.
/// </summary>
/// <param name="directoryInfo">The symbolic link in question.</param>
/// <returns>The path to the target of the symbolic link.</returns>
/// <exception cref="System.ArgumentException">If the directory in question is not a symbolic link.</exception>
public static string GetSymbolicLinkTarget(this DirectoryInfo directoryInfo)
{
if (!directoryInfo.IsSymbolicLink())
throw new ArgumentException("Specified directory is not a symbolic link.");
return SymbolicLink.GetTarget(directoryInfo.FullName);
}
}
} | mit | C# |
328ad9e2d0e8b5698c602f4f42e6813b3f4c949f | Fix copyright | Tdue21/Markdown-Edit,mike-ward/Markdown-Edit,dsuess/Markdown-Edit,Pulgafree/Markdown-Edit,jokamjohn/Markdown-Edit,punker76/Markdown-Edit,chris84948/Markdown-Edit | src/MarkdownEdit/Properties/AssemblyInfo.cs | src/MarkdownEdit/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Markdown Edit")]
[assembly: AssemblyDescription("A Markdown editor with preview")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MarkdownEdit")]
[assembly: AssemblyCopyright("Copyright © 2015, Mike Ward")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: Guid("A9A0AE86-ED91-498F-A9F9-DB669C9879CE")] | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Markdown Edit")]
[assembly: AssemblyDescription("A Markdown editor with preview")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MarkdownEdit")]
[assembly: AssemblyCopyright("Copyright © 2014, Mike Ward")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: Guid("A9A0AE86-ED91-498F-A9F9-DB669C9879CE")] | mit | C# |
99f2ee0e48244308897b1a7bac23bce0ff08a09d | Fix CI issues | UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,ZLima12/osu,johnneijzen/osu,ppy/osu,ppy/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu,smoogipooo/osu,ZLima12/osu,smoogipoo/osu,johnneijzen/osu,ppy/osu,peppy/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,EVAST9919/osu,EVAST9919/osu,peppy/osu-new,2yangk23/osu | osu.Game/Online/Leaderboards/DrawableRank.cs | osu.Game/Online/Leaderboards/DrawableRank.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Scoring;
namespace osu.Game.Online.Leaderboards
{
public class DrawableRank : Container
{
private readonly Sprite rankSprite;
private TextureStore textures;
public ScoreRank Rank { get; private set; }
public DrawableRank(ScoreRank rank)
{
Rank = rank;
Children = new Drawable[]
{
rankSprite = new Sprite
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fit
},
};
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
this.textures = textures;
updateTexture();
}
private void updateTexture()
{
string textureName;
switch (Rank)
{
default:
textureName = Rank.GetDescription();
break;
case ScoreRank.SH:
textureName = "SPlus";
break;
case ScoreRank.XH:
textureName = "SSPlus";
break;
}
rankSprite.Texture = textures.Get($@"Grades/{textureName}");
}
public void UpdateRank(ScoreRank newRank)
{
Rank = newRank;
if (LoadState >= LoadState.Ready)
updateTexture();
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Scoring;
namespace osu.Game.Online.Leaderboards
{
public class DrawableRank : Container
{
private readonly Sprite rankSprite;
private TextureStore textures;
public ScoreRank Rank { get; private set; }
public DrawableRank(ScoreRank rank)
{
Rank = rank;
Children = new Drawable[]
{
rankSprite = new Sprite
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fit
},
};
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
this.textures = textures;
updateTexture();
}
private void updateTexture()
{
string textureName;
switch (Rank)
{
default:
textureName = Rank.GetDescription();
break;
case ScoreRank.SH:
textureName = "SPlus";
break;
case ScoreRank.XH:
textureName = "SSPlus";
break;
}
rankSprite.Texture = textures.Get($@"Grades/{textureName}");
}
public void UpdateRank(ScoreRank newRank)
{
Rank = newRank;
if (LoadState >= LoadState.Ready)
updateTexture();
}
}
}
| mit | C# |
b01aa1f6c994781550b8ac3b9cc016d28ba3dfe1 | Fix buggy type lookup when Type.FindType fails | nuverian/fullserializer,jacobdufault/fullserializer,shadowmint/fullserializer,jagt/fullserializer,Ksubaka/fullserializer,lazlo-bonin/fullserializer,shadowmint/fullserializer,jagt/fullserializer,karlgluck/fullserializer,Ksubaka/fullserializer,shadowmint/fullserializer,darress/fullserializer,Ksubaka/fullserializer,jacobdufault/fullserializer,caiguihou/myprj_02,zodsoft/fullserializer,jacobdufault/fullserializer,jagt/fullserializer | Source/Reflection/fsTypeLookup.cs | Source/Reflection/fsTypeLookup.cs | using System;
using System.Reflection;
namespace FullSerializer.Internal {
/// <summary>
/// Provides APIs for looking up types based on their name.
/// </summary>
internal static class fsTypeLookup {
/// <summary>
/// Attempts to lookup the given type. Returns null if the type lookup fails.
/// </summary>
public static Type GetType(string typeName) {
Type type = null;
// Try a direct type lookup
type = Type.GetType(typeName);
if (type != null) {
return type;
}
// If we still haven't found the proper type, we can enumerate all of the loaded
// assemblies and see if any of them define the type
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) {
// See if that assembly defines the named type
type = assembly.GetType(typeName);
if (type != null) {
return type;
}
}
return null;
}
}
} | using System;
using System.Reflection;
namespace FullSerializer.Internal {
/// <summary>
/// Provides APIs for looking up types based on their name.
/// </summary>
internal static class fsTypeLookup {
public static Type GetType(string typeName) {
//--
// see
// http://answers.unity3d.com/questions/206665/typegettypestring-does-not-work-in-unity.html
// Try Type.GetType() first. This will work with types defined by the Mono runtime, in
// the same assembly as the caller, etc.
var type = Type.GetType(typeName);
// If it worked, then we're done here
if (type != null)
return type;
// If the TypeName is a full name, then we can try loading the defining assembly
// directly
if (typeName.Contains(".")) {
// Get the name of the assembly (Assumption is that we are using fully-qualified
// type names)
var assemblyName = typeName.Substring(0, typeName.IndexOf('.'));
// Attempt to load the indicated Assembly
var assembly = Assembly.Load(assemblyName);
if (assembly == null)
return null;
// Ask that assembly to return the proper Type
type = assembly.GetType(typeName);
if (type != null)
return type;
}
// If we still haven't found the proper type, we can enumerate all of the loaded
// assemblies and see if any of them define the type
var currentAssembly = Assembly.GetExecutingAssembly();
var referencedAssemblies = currentAssembly.GetReferencedAssemblies();
foreach (var assemblyName in referencedAssemblies) {
// Load the referenced assembly
var assembly = Assembly.Load(assemblyName);
if (assembly != null) {
// See if that assembly defines the named type
type = assembly.GetType(typeName);
if (type != null)
return type;
}
}
// The type just couldn't be found...
return null;
}
}
} | mit | C# |
cca6fce30cb1cdc31673359701964e047a7a37df | Make time advance in editor. Closes #199 | DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer | LmpClient/Systems/KscScene/KscSceneSystem.cs | LmpClient/Systems/KscScene/KscSceneSystem.cs | using Harmony;
using KSP.UI.Screens;
using LmpClient.Base;
using LmpClient.Events;
using System.Reflection;
using UnityEngine;
namespace LmpClient.Systems.KscScene
{
/// <summary>
/// This class controls what happens when we are in KSC screen
/// </summary>
public class KscSceneSystem : System<KscSceneSystem>
{
private static MethodInfo BuildSpaceTrackingVesselList { get; } = typeof(SpaceTracking).GetMethod("buildVesselsList", AccessTools.all);
private static KscSceneEvents KscSceneEvents { get; } = new KscSceneEvents();
#region Base overrides
public override string SystemName { get; } = nameof(KscSceneSystem);
protected override void OnEnabled()
{
LockEvent.onLockAcquireUnityThread.Add(KscSceneEvents.OnLockAcquire);
LockEvent.onLockReleaseUnityThread.Add(KscSceneEvents.OnLockRelease);
GameEvents.onGameSceneLoadRequested.Add(KscSceneEvents.OnSceneRequested);
GameEvents.onLevelWasLoadedGUIReady.Add(KscSceneEvents.LevelLoaded);
SetupRoutine(new RoutineDefinition(0, RoutineExecution.FixedUpdate, IncreaseTimeWhileInEditor));
}
protected override void OnDisabled()
{
LockEvent.onLockAcquireUnityThread.Remove(KscSceneEvents.OnLockAcquire);
LockEvent.onLockReleaseUnityThread.Remove(KscSceneEvents.OnLockRelease);
GameEvents.onGameSceneLoadRequested.Remove(KscSceneEvents.OnSceneRequested);
GameEvents.onLevelWasLoadedGUIReady.Remove(KscSceneEvents.LevelLoaded);
}
#endregion
#region Routines
/// <summary>
/// While in editor the time doesn't advance so here we make it advance
/// </summary>
private static void IncreaseTimeWhileInEditor()
{
if (!HighLogic.LoadedSceneHasPlanetarium)
{
Planetarium.fetch.time += Time.fixedDeltaTime;
HighLogic.CurrentGame.flightState.universalTime = Planetarium.fetch.time;
}
}
#endregion
#region Public methods
/// <summary>
/// Refreshes the vessels displayed in the tracking station panel
/// </summary>
public void RefreshTrackingStationVessels()
{
if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
{
var spaceTracking = Object.FindObjectOfType<SpaceTracking>();
if (spaceTracking != null)
BuildSpaceTrackingVesselList?.Invoke(spaceTracking, null);
}
}
#endregion
}
}
| using System.Reflection;
using Harmony;
using KSP.UI.Screens;
using LmpClient.Base;
using LmpClient.Events;
using UnityEngine;
namespace LmpClient.Systems.KscScene
{
/// <summary>
/// This class controls what happens when we are in KSC screen
/// </summary>
public class KscSceneSystem : System<KscSceneSystem>
{
private static MethodInfo BuildSpaceTrackingVesselList { get; } = typeof(SpaceTracking).GetMethod("buildVesselsList", AccessTools.all);
private static KscSceneEvents KscSceneEvents { get; } = new KscSceneEvents();
#region Base overrides
public override string SystemName { get; } = nameof(KscSceneSystem);
protected override void OnEnabled()
{
LockEvent.onLockAcquireUnityThread.Add(KscSceneEvents.OnLockAcquire);
LockEvent.onLockReleaseUnityThread.Add(KscSceneEvents.OnLockRelease);
GameEvents.onGameSceneLoadRequested.Add(KscSceneEvents.OnSceneRequested);
GameEvents.onLevelWasLoadedGUIReady.Add(KscSceneEvents.LevelLoaded);
}
protected override void OnDisabled()
{
LockEvent.onLockAcquireUnityThread.Remove(KscSceneEvents.OnLockAcquire);
LockEvent.onLockReleaseUnityThread.Remove(KscSceneEvents.OnLockRelease);
GameEvents.onGameSceneLoadRequested.Remove(KscSceneEvents.OnSceneRequested);
GameEvents.onLevelWasLoadedGUIReady.Remove(KscSceneEvents.LevelLoaded);
}
#endregion
#region Public methods
/// <summary>
/// Refreshes the vessels displayed in the tracking station panel
/// </summary>
public void RefreshTrackingStationVessels()
{
if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
{
var spaceTracking = Object.FindObjectOfType<SpaceTracking>();
if (spaceTracking != null)
BuildSpaceTrackingVesselList?.Invoke(spaceTracking, null);
}
}
#endregion
}
}
| mit | C# |
80f520d616663b1b0b6a5e451a70fac11946522b | set global linter option value | jwldnr/VisualLinter | VisualLinter/OptionsDialogPage.cs | VisualLinter/OptionsDialogPage.cs | using jwldnr.VisualLinter.Helpers;
using Microsoft.VisualStudio.Shell;
using System;
using System.ComponentModel;
using System.Windows;
namespace jwldnr.VisualLinter
{
internal class OptionsDialogPage : UIElementDialogPage
{
protected override UIElement Child => _optionsDialogControl
?? (_optionsDialogControl = new OptionsDialogPageControl());
internal const string PageName = "General";
private readonly IVisualLinterOptions _options;
private OptionsDialogPageControl _optionsDialogControl;
public OptionsDialogPage()
{
_options = ServiceProvider.GlobalProvider.GetMefService<IVisualLinterOptions>()
?? throw new Exception("fatal: unable to retrieve options.");
}
protected override void OnActivate(CancelEventArgs e)
{
base.OnActivate(e);
_optionsDialogControl.UseGlobalConfig = _options.UseGlobalConfig;
_optionsDialogControl.UseGlobalLinter = _options.UseGlobalLinter;
}
protected override void OnApply(PageApplyEventArgs args)
{
if (args.ApplyBehavior == ApplyKind.Apply)
{
_options.UseGlobalConfig = _optionsDialogControl.UseGlobalConfig;
_options.UseGlobalLinter = _optionsDialogControl.UseGlobalLinter;
}
base.OnApply(args);
}
}
} | using jwldnr.VisualLinter.Helpers;
using Microsoft.VisualStudio.Shell;
using System;
using System.ComponentModel;
using System.Windows;
namespace jwldnr.VisualLinter
{
internal class OptionsDialogPage : UIElementDialogPage
{
protected override UIElement Child => _optionsDialogControl
?? (_optionsDialogControl = new OptionsDialogPageControl());
internal const string PageName = "General";
private readonly IVisualLinterOptions _options;
private OptionsDialogPageControl _optionsDialogControl;
public OptionsDialogPage()
{
_options = ServiceProvider.GlobalProvider.GetMefService<IVisualLinterOptions>()
?? throw new Exception("fatal: unable to retrieve options.");
}
protected override void OnActivate(CancelEventArgs e)
{
base.OnActivate(e);
_optionsDialogControl.UseGlobalConfig = _options.UseGlobalConfig;
}
protected override void OnApply(PageApplyEventArgs args)
{
if (args.ApplyBehavior == ApplyKind.Apply)
{
_options.UseGlobalConfig = _optionsDialogControl.UseGlobalConfig;
_options.UseGlobalLinter = _optionsDialogControl.UseGlobalLinter;
}
base.OnApply(args);
}
}
} | mit | C# |
d7d423cf1a470e497acaee4793c358174a0a8592 | remove channel id from ChannelController (#28) | gyrosworkshop/Wukong,gyrosworkshop/Wukong | src/Wukong/Controllers/ChannelController.cs | src/Wukong/Controllers/ChannelController.cs | using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using System.Security.Claims;
using Wukong.Services;
using Wukong.Models;
using Wukong.Options;
using Microsoft.Extensions.Logging;
namespace Wukong.Controllers
{
[Authorize]
[Route("api/[controller]")]
public class ChannelController : Controller
{
private readonly ILogger Logger;
private readonly IChannelManager ChannelManager;
private readonly IStorage Storage;
private readonly IUserService UserService;
public ChannelController(IOptions<ProviderOption> providerOption, ILoggerFactory loggerFactory, IChannelManager channelManager, IStorage storage, IUserService userService)
{
Logger = loggerFactory.CreateLogger("ChannelController");
ChannelManager = channelManager;
Storage = storage;
UserService = userService;
}
string UserId => HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
// POST api/channel/join
[HttpPost("join/{channelId}")]
public ActionResult Join(string channelId)
{
ChannelManager.JoinAndLeavePreviousChannel(channelId, UserId);
return NoContent();
}
[HttpPost("finished")]
public ActionResult Finished([FromBody] ClientSong song)
{
var success = Storage.GetChannelByUser(UserService.User.Id)?.ReportFinish(UserId, song);
if (success == true) return NoContent();
return BadRequest();
}
[HttpPost("updateNextSong")]
public ActionResult UpdateNextSong([FromBody] ClientSong song)
{
if (song.IsEmpty()) song = null;
var channel = Storage.GetChannelByUser(UserService.User.Id);
channel?.UpdateSong(UserId, song);
return NoContent();
}
[HttpPost("downVote")]
public ActionResult DownVote([FromBody] ClientSong song)
{
// FIXME: test whether user joined this channel.
var channel = Storage.GetChannelByUser(UserService.User.Id);
var success = channel?.ReportFinish(UserId, song, true);
if (success == true) return NoContent();
return BadRequest();
}
}
}
| using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using System.Security.Claims;
using Wukong.Services;
using Wukong.Models;
using Wukong.Options;
using Microsoft.Extensions.Logging;
namespace Wukong.Controllers
{
[Authorize]
[Route("api/[controller]")]
public class ChannelController : Controller
{
private readonly ILogger Logger;
private readonly IChannelManager ChannelManager;
private readonly IStorage Storage;
private readonly IUserService UserService;
public ChannelController(IOptions<ProviderOption> providerOption, ILoggerFactory loggerFactory, IChannelManager channelManager, IStorage storage, IUserService userService)
{
Logger = loggerFactory.CreateLogger("ChannelController");
ChannelManager = channelManager;
Storage = storage;
UserService = userService;
}
string UserId => HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
// POST api/channel/join
[HttpPost("join/{channelId}")]
public ActionResult Join(string channelId)
{
ChannelManager.JoinAndLeavePreviousChannel(channelId, UserId);
return NoContent();
}
[HttpPost("finished/{channelId}")]
public ActionResult Finished(string channelId, [FromBody] ClientSong song)
{
var success = Storage.GetChannelByUser(UserService.User.Id)?.ReportFinish(UserId, song);
if (success == true) return NoContent();
return BadRequest();
}
[HttpPost("updateNextSong/{channelId}")]
public ActionResult UpdateNextSong(string channelId, [FromBody] ClientSong song)
{
if (song.IsEmpty()) song = null;
var channel = Storage.GetChannelByUser(UserService.User.Id);
channel?.UpdateSong(UserId, song);
return NoContent();
}
[HttpPost("downVote/{channelId}")]
public ActionResult DownVote(string channelId, [FromBody] ClientSong song)
{
// FIXME: test whether user joined this channel.
var channel = Storage.GetChannelByUser(UserService.User.Id);
var success = channel?.ReportFinish(UserId, song, true);
if (success == true) return NoContent();
return BadRequest();
}
}
}
| mit | C# |
cac8255904a3381233d8f276266f6d95d5528b59 | Verify that "to-project" is a valid queue name | modulexcite/lokad-cqrs | Framework/Lokad.Cqrs.Azure.Tests/MiscTests.cs | Framework/Lokad.Cqrs.Azure.Tests/MiscTests.cs | using Lokad.Cqrs.Build.Engine;
using NUnit.Framework;
namespace Lokad.Cqrs
{
[TestFixture]
public sealed class MiscTests
{
// ReSharper disable InconsistentNaming
[Test]
public void Azure_queues_regex_is_valid()
{
Assert.IsTrue(AzureEngineModule.QueueName.IsMatch("some-queue"));
Assert.IsTrue(AzureEngineModule.QueueName.IsMatch("to-watchtower"));
Assert.IsFalse(AzureEngineModule.QueueName.IsMatch("-some-queue"));
}
}
} | using Lokad.Cqrs.Build.Engine;
using NUnit.Framework;
namespace Lokad.Cqrs
{
[TestFixture]
public sealed class MiscTests
{
// ReSharper disable InconsistentNaming
[Test]
public void Azure_queues_regex_is_valid()
{
Assert.IsTrue(AzureEngineModule.QueueName.IsMatch("some-queue"));
Assert.IsFalse(AzureEngineModule.QueueName.IsMatch("-some-queue"));
}
}
} | bsd-3-clause | C# |
e6076b22ca817c70af364b3f39f333f623e7ef45 | Add FuelUsedLitres to MiX Integrate's Event object | MiXTelematics/MiX.Integrate.Api.Client | MiX.Integrate.Shared/Entities/Events/Event.cs | MiX.Integrate.Shared/Entities/Events/Event.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MiX.Integrate.Shared.Entities.Positions;
namespace MiX.Integrate.Shared.Entities.Events
{
/// <summary>
/// Definition of a recorded Event.
/// </summary>
public class Event
{
/// <summary>
/// Identifier for the Asset associated to this event.
/// </summary>
public Int64 AssetId { get; set; }
/// <summary>
/// Identifier for the Driver associated to this event.
/// </summary>
public long DriverId { get; set; }
/// <summary>
/// Unique identifier for this event.
/// </summary>
public long EventId { get; set; }
/// <summary>
/// The type of the event description
/// </summary>
public long EventTypeId { get; set; }
/// <summary>
/// category of the event: Detail, Summary, Notify or Terminal
/// </summary>
public string EventCategory { get; set; }
/// <summary>
/// The date and time at the start of the event. For a Summary category this is the start of the period being summarised.
/// </summary>
public DateTime? StartDateTime { get; set; }
/// <summary>
/// Odometer of the asset at the end of the trip.
/// </summary>
public decimal? StartOdometerKilometres { get; set; }
/// <summary>
/// Start position of the event.
/// </summary>
public Position StartPosition { get; set; }
/// <summary>
/// The date and time at the end of the event. For a Summary category this is the end of the period being summarised.
/// </summary>
public DateTime? EndDateTime { get; set; }
/// <summary>
/// Odometer of the asset at the end of the event.
/// </summary>
public decimal? EndOdometerKilometres { get; set; }
/// <summary>
/// End position of the event.
/// </summary>
public Position EndPosition { get; set; }
/// <summary>
/// The value recorded for the event.
/// </summary>
public double? Value { get; set; }
/// <summary>The amount of fuel used, in litres, during the event</summary>
public float? FuelUsedLitres { get; set; }
/// <summary>
/// The type of value recorded for the event, Minumum, Maximum, Average or current.
/// </summary>
public string ValueType { get; set; }
/// <summary>
/// The dispaly units from the event type definition
/// </summary>
public string ValueUnits { get; set; }
/// <summary>
/// The duration the event's condition was true.
/// </summary>
public int TotalTimeSeconds { get; set; }
/// <summary>
/// The number of occurances for the instance of the event. If the category is not Summary this will be 1.
/// </summary>
public int TotalOccurances { get; set; }
/// <summary>
/// URLs to media recorded with this event, if available.
/// </summary>
public IDictionary<string, string> MediaUrls { get; set; }
/// <summary>
/// The Location ID of a Location for this event, if available
/// </summary>
public long? LocationId { get; set; }
/// <summary>
/// The speed limit of the location event occured in
/// </summary>
public float? SpeedLimit { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MiX.Integrate.Shared.Entities.Positions;
namespace MiX.Integrate.Shared.Entities.Events
{
/// <summary>
/// Definition of a recorded Event.
/// </summary>
public class Event
{
/// <summary>
/// Identifier for the Asset associated to this event.
/// </summary>
public Int64 AssetId { get; set; }
/// <summary>
/// Identifier for the Driver associated to this event.
/// </summary>
public long DriverId { get; set; }
/// <summary>
/// Unique identifier for this event.
/// </summary>
public long EventId { get; set; }
/// <summary>
/// The type of the event description
/// </summary>
public long EventTypeId { get; set; }
/// <summary>
/// category of the event: Detail, Summary, Notify or Terminal
/// </summary>
public string EventCategory { get; set; }
/// <summary>
/// The date and time at the start of the event. For a Summary category this is the start of the period being summarised.
/// </summary>
public DateTime? StartDateTime { get; set; }
/// <summary>
/// Odometer of the asset at the end of the trip.
/// </summary>
public decimal? StartOdometerKilometres { get; set; }
/// <summary>
/// Start position of the event.
/// </summary>
public Position StartPosition { get; set; }
/// <summary>
/// The date and time at the end of the event. For a Summary category this is the end of the period being summarised.
/// </summary>
public DateTime? EndDateTime { get; set; }
/// <summary>
/// Odometer of the asset at the end of the event.
/// </summary>
public decimal? EndOdometerKilometres { get; set; }
/// <summary>
/// End position of the event.
/// </summary>
public Position EndPosition { get; set; }
/// <summary>
/// The value recorded for the event.
/// </summary>
public double? Value { get; set; }
/// <summary>
/// The type of value recorded for the event, Minumum, Maximum, Average or current.
/// </summary>
public string ValueType { get; set; }
/// <summary>
/// The dispaly units from the event type definition
/// </summary>
public string ValueUnits { get; set; }
/// <summary>
/// The duration the event's condition was true.
/// </summary>
public int TotalTimeSeconds { get; set; }
/// <summary>
/// The number of occurances for the instance of the event. If the category is not Summary this will be 1.
/// </summary>
public int TotalOccurances { get; set; }
/// <summary>
/// URLs to media recorded with this event, if available.
/// </summary>
public IDictionary<string, string> MediaUrls { get; set; }
/// <summary>
/// The Location ID of a Location for this event, if available
/// </summary>
public long? LocationId { get; set; }
/// <summary>
/// The speed limit of the location event occured in
/// </summary>
public float? SpeedLimit { get; set; }
}
}
| mit | C# |
74d3703892141f79a367d81b43556f702f2617d6 | Disable line numbers by default | segrived/Msiler | Msiler/DialogPages/ExtensionDisplayOptions.cs | Msiler/DialogPages/ExtensionDisplayOptions.cs | using System.ComponentModel;
namespace Msiler.DialogPages
{
public class ExtensionDisplayOptions : MsilerDialogPage
{
[Category("Display")]
[DisplayName("Listing font name")]
[Description("")]
public string FontName { get; set; } = "Consolas";
[Category("Display")]
[DisplayName("Listing font size")]
[Description("")]
public int FontSize { get; set; } = 12;
[Category("Display")]
[DisplayName("Show line numbers")]
[Description("")]
public bool LineNumbers { get; set; } = false;
[Category("Display")]
[DisplayName("VS Color theme")]
[Description("Visual Studio color theme, Msiler highlighting will be adjusted based on this value")]
public MsilerColorTheme ColorTheme { get; set; } = MsilerColorTheme.Auto;
}
}
| using System.ComponentModel;
namespace Msiler.DialogPages
{
public class ExtensionDisplayOptions : MsilerDialogPage
{
[Category("Display")]
[DisplayName("Listing font name")]
[Description("")]
public string FontName { get; set; } = "Consolas";
[Category("Display")]
[DisplayName("Listing font size")]
[Description("")]
public int FontSize { get; set; } = 12;
[Category("Display")]
[DisplayName("Show line numbers")]
[Description("")]
public bool LineNumbers { get; set; } = true;
[Category("Display")]
[DisplayName("VS Color theme")]
[Description("Visual Studio color theme, Msiler highlighting will be adjusted based on this value")]
public MsilerColorTheme ColorTheme { get; set; } = MsilerColorTheme.Auto;
}
}
| mit | C# |
30e6bde4a79fcd797de571d2561211172f8f5788 | Test names changed to Should notation | msdeibel/opcmock | OpcMock/OpcMockTests/ProtocolComparerTests.cs | OpcMock/OpcMockTests/ProtocolComparerTests.cs | using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpcMock;
namespace OpcMockTests
{
[TestClass]
public class ProtocolComparerTests
{
private const int EQUALITY = 0;
[TestMethod]
public void ProtocolsWithTheSameNameShould_Be_Equal()
{
ProtocolComparer pc = new ProtocolComparer();
OpcMockProtocol omp1 = new OpcMockProtocol("omp1");
OpcMockProtocol compare1 = new OpcMockProtocol("omp1");
Assert.AreEqual(EQUALITY, pc.Compare(omp1, compare1));
}
}
}
| using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpcMock;
namespace OpcMockTests
{
[TestClass]
public class ProtocolComparerTests
{
private const int EQUALITY = 0;
[TestMethod]
public void Protocols_With_The_Same_Name_Are_Equal()
{
ProtocolComparer pc = new ProtocolComparer();
OpcMockProtocol omp1 = new OpcMockProtocol("omp1");
OpcMockProtocol compare1 = new OpcMockProtocol("omp1");
Assert.AreEqual(EQUALITY, pc.Compare(omp1, compare1));
}
}
}
| mit | C# |
9c62043294ab8de6f36fd02a04a7ad792917374b | Update version number | DaveSenn/Extend | PortableExtensions/Properties/AssemblyInfo.cs | PortableExtensions/Properties/AssemblyInfo.cs | #region Usings
using System.Reflection;
using System.Resources;
#endregion
[assembly: AssemblyTitle( "PortableExtensions" )]
[assembly:
AssemblyDescription(
"PortableExtensions is a set of .Net extension methods build as portable class library. " +
"PortableExtensions enhance the .Net framework by adding a bunch of methods to increase developer’s productivity." )]
#if DEBUG
[assembly: AssemblyConfiguration( "Debug" )]
#else
[assembly: AssemblyConfiguration( "Release" )]
#endif
[assembly: AssemblyCompany( "Dave Senn" )]
[assembly: AssemblyProduct( "PortableExtensions" )]
[assembly: AssemblyCopyright( "Copyright © Dave Senn 2015" )]
[assembly: AssemblyTrademark( "PortableExtensions" )]
[assembly: AssemblyCulture( "" )]
[assembly: NeutralResourcesLanguage( "en" )]
[assembly: AssemblyVersion( "1.1.2.0" )]
[assembly: AssemblyFileVersion( "1.1.2.0" )] | #region Usings
using System.Reflection;
using System.Resources;
#endregion
// General Information about an assembly is controlled through the following set of attributes. Change these attribute values to modify the information associated with an assembly.
[assembly: AssemblyTitle( "PortableExtensions" )]
[assembly:
AssemblyDescription(
"PortableExtensions is a set of .Net extension methods build as portable class library. " +
"PortableExtensions enhance the .Net framework by adding a bunch of methods to increase developer’s productivity." )]
#if DEBUG
[assembly: AssemblyConfiguration( "Debug" )]
#else
[assembly: AssemblyConfiguration ( "Release" )]
#endif
[assembly: AssemblyCompany( "Dave Senn" )]
[assembly: AssemblyProduct( "PortableExtensions" )]
[assembly: AssemblyCopyright( "Copyright © Dave Senn 2015" )]
[assembly: AssemblyTrademark( "PortableExtensions" )]
[assembly: AssemblyCulture( "" )]
[assembly: NeutralResourcesLanguage( "en" )]
// Version information for an assembly consists of the following four values:
//
// Major Version Minor Version Build Number Revision
//
// You can specify all the values or you can default the Build and Revision Numbers by using the '*' as shown below: [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.1.1.0" )]
[assembly: AssemblyFileVersion( "1.1.1.0" )] | mit | C# |
d8b3b20a395e02ad3533b2b5ca4c2eeb7ebdf6e2 | reduce the trigger time | smbc-digital/iag-webapp,smbc-digital/iag-webapp,smbc-digital/iag-webapp | src/StockportWebapp/Scheduler/QuartzScheduler.cs | src/StockportWebapp/Scheduler/QuartzScheduler.cs | using System;
using System.Threading.Tasks;
using Quartz;
using Quartz.Impl;
using StockportWebapp.FeatureToggling;
using StockportWebapp.Models;
using StockportWebapp.Repositories;
using StockportWebapp.Services;
using StockportWebapp.Utils;
using Microsoft.Extensions.Logging;
namespace StockportWebapp.Scheduler
{
public class QuartzScheduler
{
private readonly ShortUrlRedirects _shortShortUrlRedirects;
private readonly LegacyUrlRedirects _legacyUrlRedirects;
private readonly IRepository _repository;
private readonly ILogger<QuartzJob> _logger;
public QuartzScheduler(ShortUrlRedirects shortShortUrlRedirects, LegacyUrlRedirects legacyUrlRedirects, IRepository repository, ILogger<QuartzJob> logger)
{
_shortShortUrlRedirects = shortShortUrlRedirects;
_legacyUrlRedirects = legacyUrlRedirects;
_repository = repository;
_logger = logger;
}
public async Task Start()
{
var scheduler = await StdSchedulerFactory.GetDefaultScheduler();
await scheduler.Start();
scheduler.JobFactory = new QuartzJobFactory(_shortShortUrlRedirects, _legacyUrlRedirects, _repository, _logger);
var job = JobBuilder.Create<QuartzJob>().Build();
var immediateJob = JobBuilder.Create<QuartzJob>().Build();
var triggerTime = DateTime.Now.AddMinutes(8);
var immediateTrigger = TriggerBuilder.Create().StartAt(new DateTimeOffset(triggerTime)).Build();
var trigger = TriggerBuilder.Create()
.WithSimpleSchedule(x => x
.WithIntervalInSeconds(RedirectTimeout.RedirectsTimeout)
.RepeatForever())
.Build();
await scheduler.ScheduleJob(job, trigger);
await scheduler.ScheduleJob(immediateJob, immediateTrigger);
}
}
}
| using System;
using System.Threading.Tasks;
using Quartz;
using Quartz.Impl;
using StockportWebapp.FeatureToggling;
using StockportWebapp.Models;
using StockportWebapp.Repositories;
using StockportWebapp.Services;
using StockportWebapp.Utils;
using Microsoft.Extensions.Logging;
namespace StockportWebapp.Scheduler
{
public class QuartzScheduler
{
private readonly ShortUrlRedirects _shortShortUrlRedirects;
private readonly LegacyUrlRedirects _legacyUrlRedirects;
private readonly IRepository _repository;
private readonly ILogger<QuartzJob> _logger;
public QuartzScheduler(ShortUrlRedirects shortShortUrlRedirects, LegacyUrlRedirects legacyUrlRedirects, IRepository repository, ILogger<QuartzJob> logger)
{
_shortShortUrlRedirects = shortShortUrlRedirects;
_legacyUrlRedirects = legacyUrlRedirects;
_repository = repository;
_logger = logger;
}
public async Task Start()
{
var scheduler = await StdSchedulerFactory.GetDefaultScheduler();
await scheduler.Start();
scheduler.JobFactory = new QuartzJobFactory(_shortShortUrlRedirects, _legacyUrlRedirects, _repository, _logger);
var job = JobBuilder.Create<QuartzJob>().Build();
var immediateJob = JobBuilder.Create<QuartzJob>().Build();
var triggerTime = DateTime.Now.AddMinutes(10);
var immediateTrigger = TriggerBuilder.Create().StartAt(new DateTimeOffset(triggerTime)).Build();
var trigger = TriggerBuilder.Create()
.WithSimpleSchedule(x => x
.WithIntervalInSeconds(RedirectTimeout.RedirectsTimeout)
.RepeatForever())
.Build();
await scheduler.ScheduleJob(job, trigger);
await scheduler.ScheduleJob(immediateJob, immediateTrigger);
//await scheduler.AddJob(immediateJob, false);
//await scheduler.TriggerJob(immediateJob.Key);
}
}
}
| mit | C# |
f09fd206f17c9de6d65fbcb4693891e2cf4b8bfe | Update types on Message Bus definition | mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype | src/Glimpse.Common/Broker/IMessageBus.cs | src/Glimpse.Common/Broker/IMessageBus.cs | using System;
namespace Glimpse
{
public interface IMessageBus
{
IObservable<T> Listen<T>()
where T : IMessage;
IObservable<T> ListenIncludeLatest<T>()
where T : IMessage;
void SendMessage(IMessage message);
}
} | using System;
namespace Glimpse
{
public interface IMessageBus
{
IObservable<T> Listen<T>();
IObservable<T> ListenIncludeLatest<T>();
void SendMessage(object message);
}
} | mit | C# |
4a9077b3741e01a2a6a2593614954c48b8ebe296 | add all speech mods to modifiers enum | krille90/unitystation,krille90/unitystation,krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation | UnityProject/Assets/Scripts/Chat/ChatEvent.cs | UnityProject/Assets/Scripts/Chat/ChatEvent.cs | using System;
using System.ComponentModel;
using System.Text.RegularExpressions;
using UnityEngine;
using Random = UnityEngine.Random;
/// <summary>
/// A set of flags to show active chat channels. Be aware this can contain multiple active chat channels at a time!
/// </summary>
[Flags]
public enum ChatChannel
{
[Description("")] None = 0,
[Description("")] Examine = 1 << 0,
[Description("")] Local = 1 << 1,
[Description("")] OOC = 1 << 2,
[Description(";")] Common = 1 << 3,
[Description(":b")] Binary = 1 << 4,
[Description(":u")] Supply = 1 << 5,
[Description(":y")] CentComm = 1 << 6,
[Description(":c")] Command = 1 << 7,
[Description(":e")] Engineering = 1 << 8,
[Description(":m")] Medical = 1 << 9,
[Description(":n")] Science = 1 << 10,
[Description(":s")] Security = 1 << 11,
[Description(":v")] Service = 1 << 12,
[Description(":t")] Syndicate = 1 << 13,
[Description("")] System = 1 << 14,
[Description(":g")] Ghost = 1 << 15,
[Description("")] Combat = 1 << 16,
[Description("")] Warning = 1 << 17,
[Description("")] Action = 1 << 18,
[Description("")] Admin = 1 << 19
}
/// <summary>
/// A set of flags to show active chat modifiers. Be aware this can contain multiple active chat modifiers at once!
/// </summary>
[Flags]
public enum ChatModifier
{
// The following comments are for easy reference. They may be out of date.
// See Chat.cs to see how a message's ChatModifier is determined.
None = 0, // Default value
Drunk = 1 << 0,
Stutter = 1 << 1,
Mute = 1 << 2, // Dead, unconcious or naturally mute
Hiss = 1 << 3,
Clown = 1 << 4, // Having the clown occupation
Whisper = 1 << 5, // Message starts with "#" or "/w"
Yell = 1 << 6, // Message is in capital letters
Emote = 1 << 7, // Message starts with "/me" or "*"
Exclaim = 1 << 8, // Message ends with a "!"
Question= 1 << 9, // Message ends with a "?"
Sing = 1 << 10, // Message starts with "/s" or "%"
//Speech mutations, these should happen before drunk, stutter and that kind of thing!
Canadian = 1 << 11,
French = 1 << 12,
Italian = 1 << 13,
Swedish = 1 << 14,
Chav = 1 << 15,
Smile = 1 << 16,
Elvis = 1 << 17,
Spurdo = 1 << 18,
UwU = 1 << 19,
Unintelligible = 1 << 20
}
public class ChatEvent
{
public ChatChannel channels;
public string message;
public string messageOthers;
public ChatModifier modifiers = ChatModifier.None;
public string speaker;
public double timestamp;
public Vector3 position = TransformState.HiddenPos;
public GameObject originator;
/// <summary>
/// Send chat message only to those on this matrix
/// </summary>
public MatrixInfo matrix
{
get => _matrix;
set => _matrix = value;
}
private MatrixInfo _matrix = MatrixInfo.Invalid;
public ChatEvent() {
timestamp = (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds;
}
} | using System;
using System.ComponentModel;
using System.Text.RegularExpressions;
using UnityEngine;
using Random = UnityEngine.Random;
/// <summary>
/// A set of flags to show active chat channels. Be aware this can contain multiple active chat channels at a time!
/// </summary>
[Flags]
public enum ChatChannel
{
[Description("")] None = 0,
[Description("")] Examine = 1 << 0,
[Description("")] Local = 1 << 1,
[Description("")] OOC = 1 << 2,
[Description(";")] Common = 1 << 3,
[Description(":b")] Binary = 1 << 4,
[Description(":u")] Supply = 1 << 5,
[Description(":y")] CentComm = 1 << 6,
[Description(":c")] Command = 1 << 7,
[Description(":e")] Engineering = 1 << 8,
[Description(":m")] Medical = 1 << 9,
[Description(":n")] Science = 1 << 10,
[Description(":s")] Security = 1 << 11,
[Description(":v")] Service = 1 << 12,
[Description(":t")] Syndicate = 1 << 13,
[Description("")] System = 1 << 14,
[Description(":g")] Ghost = 1 << 15,
[Description("")] Combat = 1 << 16,
[Description("")] Warning = 1 << 17,
[Description("")] Action = 1 << 18,
[Description("")] Admin = 1 << 19
}
/// <summary>
/// A set of flags to show active chat modifiers. Be aware this can contain multiple active chat modifiers at once!
/// </summary>
[Flags]
public enum ChatModifier
{
// The following comments are for easy reference. They may be out of date.
// See Chat.cs to see how a message's ChatModifier is determined.
None = 0, // Default value
Drunk = 1 << 0,
Stutter = 1 << 1,
Mute = 1 << 2, // Dead, unconcious or naturally mute
Hiss = 1 << 3,
Clown = 1 << 4, // Having the clown occupation
Whisper = 1 << 5, // Message starts with "#" or "/w"
Yell = 1 << 6, // Message is in capital letters
Emote = 1 << 7, // Message starts with "/me" or "*"
Exclaim = 1 << 8, // Message ends with a "!"
Question= 1 << 9, // Message ends with a "?"
Sing = 1 << 10, // Message starts with "/s" or "%"
//Speech mutations
Canadian = 1 << 11,
French = 1 << 12,
Italian = 1 << 13,
Swedish = 1 << 14,
Chav = 1 << 15,
Smile = 1 << 16,
Elvis = 1 << 17,
Unintelligible = 1 << 18
}
public class ChatEvent
{
public ChatChannel channels;
public string message;
public string messageOthers;
public ChatModifier modifiers = ChatModifier.None;
public string speaker;
public double timestamp;
public Vector3 position = TransformState.HiddenPos;
public GameObject originator;
/// <summary>
/// Send chat message only to those on this matrix
/// </summary>
public MatrixInfo matrix
{
get => _matrix;
set => _matrix = value;
}
private MatrixInfo _matrix = MatrixInfo.Invalid;
public ChatEvent() {
timestamp = (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds;
}
} | agpl-3.0 | C# |
f941b24159d4436d67d2180dffdb6e77025b9fb1 | Increment Version | zamanak/Zamanak.WebService | Zamanak.WebService/Properties/AssemblyInfo.cs | Zamanak.WebService/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Zamanak.WebService")]
[assembly: AssemblyDescription("This is a client of Zamanak (www.zamanak.ir) web service")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Zamanak")]
[assembly: AssemblyProduct("Zamanak.WebService")]
[assembly: AssemblyCopyright("Copyright © Zamanak 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("483458e5-4d71-43a0-88c1-6cabe72154e3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Zamanak.WebService")]
[assembly: AssemblyDescription("This is a client of Zamanak (www.zamanak.ir) web service")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Zamanak")]
[assembly: AssemblyProduct("Zamanak.WebService")]
[assembly: AssemblyCopyright("Copyright © Zamanak 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("483458e5-4d71-43a0-88c1-6cabe72154e3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
6caf2ca58cbafcd1d83aac5804d17192380241b7 | Add FromHex Helper | matsprea/AspNetIdentity_U2F,matsprea/AspNetIdentity_U2F,matsprea/AspNetIdentity_U2F | U2F/Helper.cs | U2F/Helper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace U2F
{
public static class Helper
{
private static readonly string[] HexTbl = Enumerable.Range(0, 256).Select(v => v.ToString("X2")).ToArray();
public static string ToHex(this IEnumerable<byte> array)
{
var s = new StringBuilder();
foreach (var v in array)
s.Append(HexTbl[v]);
return s.ToString();
}
public static string ToHex(this byte[] array)
{
var s = new StringBuilder(array.Length*2);
foreach (var v in array)
s.Append(HexTbl[v]);
return s.ToString();
}
public static byte[] FromHex(this string hex)
{
return Enumerable.Range(0, hex.Length)
.Where(x => x%2 == 0)
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
.ToArray();
}
public static string Base64Urlencode(this byte[] arg)
{
var s = Convert.ToBase64String(arg); // Regular base64 encoder
s = s.TrimEnd('='); // Remove any trailing '='s
s = s.Replace('+', '-'); // 62nd char of encoding
s = s.Replace('/', '_'); // 63rd char of encoding
return s;
}
public static byte[] Base64Urldecode(this string arg)
{
var s = arg;
s = s.Replace('-', '+'); // 62nd char of encoding
s = s.Replace('_', '/'); // 63rd char of encoding
switch (s.Length%4) // Pad with trailing '='s
{
case 0:
break; // No pad chars in this case
case 2:
s += "==";
break; // Two pad chars
case 3:
s += "=";
break; // One pad char
default:
throw new Exception("Illegal base64url string!");
}
return Convert.FromBase64String(s); // Standard base64 decoder
}
public static byte[] GetBytes(this string str)
{
return Encoding.ASCII.GetBytes(str);
}
public static string GetString(this byte[] bytes)
{
return Encoding.ASCII.GetString(bytes);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace U2F
{
public static class Helper
{
private static readonly string[] HexTbl = Enumerable.Range(0, 256).Select(v => v.ToString("X2")).ToArray();
public static string ToHex(this IEnumerable<byte> array)
{
var s = new StringBuilder();
foreach (var v in array)
s.Append(HexTbl[v]);
return s.ToString();
}
public static string ToHex(this byte[] array)
{
var s = new StringBuilder(array.Length*2);
foreach (var v in array)
s.Append(HexTbl[v]);
return s.ToString();
}
public static string Base64Urlencode(this byte[] arg)
{
var s = Convert.ToBase64String(arg); // Regular base64 encoder
s = s.TrimEnd('='); // Remove any trailing '='s
s = s.Replace('+', '-'); // 62nd char of encoding
s = s.Replace('/', '_'); // 63rd char of encoding
return s;
}
public static byte[] Base64Urldecode(this string arg)
{
var s = arg;
s = s.Replace('-', '+'); // 62nd char of encoding
s = s.Replace('_', '/'); // 63rd char of encoding
switch (s.Length%4) // Pad with trailing '='s
{
case 0:
break; // No pad chars in this case
case 2:
s += "==";
break; // Two pad chars
case 3:
s += "=";
break; // One pad char
default:
throw new Exception("Illegal base64url string!");
}
return Convert.FromBase64String(s); // Standard base64 decoder
}
public static byte[] GetBytes(this string str)
{
return Encoding.ASCII.GetBytes(str);
}
public static string GetString(this byte[] bytes)
{
return Encoding.ASCII.GetString(bytes);
}
}
}
| apache-2.0 | C# |
bb360159f695b008be701d7bafd581e410781001 | disable fault injection tx test (#5066) | ibondy/orleans,sergeybykov/orleans,sergeybykov/orleans,galvesribeiro/orleans,ElanHasson/orleans,pherbel/orleans,waynemunro/orleans,Liversage/orleans,hoopsomuah/orleans,yevhen/orleans,yevhen/orleans,dotnet/orleans,Liversage/orleans,Liversage/orleans,veikkoeeva/orleans,amccool/orleans,ReubenBond/orleans,jthelin/orleans,amccool/orleans,amccool/orleans,ElanHasson/orleans,ibondy/orleans,hoopsomuah/orleans,jason-bragg/orleans,pherbel/orleans,galvesribeiro/orleans,benjaminpetit/orleans,dotnet/orleans,waynemunro/orleans | test/Transactions/Orleans.Transactions.Azure.Test/FaultInjection/ControlledInjection/TransactionFaultInjectionTests.cs | test/Transactions/Orleans.Transactions.Azure.Test/FaultInjection/ControlledInjection/TransactionFaultInjectionTests.cs | using Orleans.Transactions.AzureStorage.Tests;
using Orleans.Transactions.Tests;
using Xunit;
using Xunit.Abstractions;
namespace Orleans.Transactions.Azure.Tests
{
[TestCategory("Azure"), TestCategory("Transactions")]
public class TransactionFaultInjectionTests : ControlledFaultInjectionTransactionTestRunner, IClassFixture<ControlledFaultInjectionTestFixture>
{
public TransactionFaultInjectionTests(ControlledFaultInjectionTestFixture fixture, ITestOutputHelper output)
: base(fixture.GrainFactory, output)
{
fixture.EnsurePreconditionsMet();
}
}
}
| using Orleans.Transactions.AzureStorage.Tests;
using Orleans.Transactions.Tests;
using Xunit;
using Xunit.Abstractions;
namespace Orleans.Transactions.Azure.Tests
{
[TestCategory("Azure"), TestCategory("Transactions"), TestCategory("Functional")]
public class TransactionFaultInjectionTests : ControlledFaultInjectionTransactionTestRunner, IClassFixture<ControlledFaultInjectionTestFixture>
{
public TransactionFaultInjectionTests(ControlledFaultInjectionTestFixture fixture, ITestOutputHelper output)
: base(fixture.GrainFactory, output)
{
fixture.EnsurePreconditionsMet();
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.