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 |
|---|---|---|---|---|---|---|---|---|
74e8110a8e3dca02d901c79980072629b97dc819 | Set maximum parallel threads to 1 | ASP-NET-Core-Boilerplate/Templates,ASP-NET-Core-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates,ASP-NET-Core-Boilerplate/Templates,RehanSaeed/ASP.NET-MVC-Boilerplate,RehanSaeed/ASP.NET-MVC-Boilerplate,ASP-NET-MVC-Boilerplate/Templates,RehanSaeed/ASP.NET-MVC-Boilerplate | Tests/Boxed.Templates.Test/Properties/AssemblyInfo.cs | Tests/Boxed.Templates.Test/Properties/AssemblyInfo.cs | using Xunit;
[assembly: CollectionBehavior(DisableTestParallelization = true, MaxParallelThreads = 1)] | using Xunit;
[assembly: CollectionBehavior(DisableTestParallelization = true)] | mit | C# |
5c35053350ed370f129573f4ab47f3d7632aa7cd | Update test fix for test_FileSystemProvider.cs | PaulHigin/PowerShell,jsoref/PowerShell,KarolKaczmarek/PowerShell,JamesWTruher/PowerShell-1,TravisEz13/PowerShell,bingbing8/PowerShell,KarolKaczmarek/PowerShell,bmanikm/PowerShell,jsoref/PowerShell,jsoref/PowerShell,kmosher/PowerShell,daxian-dbw/PowerShell,KarolKaczmarek/PowerShell,TravisEz13/PowerShell,PaulHigin/PowerShell,TravisEz13/PowerShell,bingbing8/PowerShell,PaulHigin/PowerShell,jsoref/PowerShell,daxian-dbw/PowerShell,TravisEz13/PowerShell,bingbing8/PowerShell,kmosher/PowerShell,bmanikm/PowerShell,KarolKaczmarek/PowerShell,kmosher/PowerShell,jsoref/PowerShell,daxian-dbw/PowerShell,bingbing8/PowerShell,JamesWTruher/PowerShell-1,JamesWTruher/PowerShell-1,KarolKaczmarek/PowerShell,bmanikm/PowerShell,PaulHigin/PowerShell,daxian-dbw/PowerShell,kmosher/PowerShell,bmanikm/PowerShell,bmanikm/PowerShell,bingbing8/PowerShell,kmosher/PowerShell,JamesWTruher/PowerShell-1 | test/csharp/test_FileSystemProvider.cs | test/csharp/test_FileSystemProvider.cs | using Xunit;
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Management.Automation;
using System.Management.Automation.Provider;
using Microsoft.PowerShell.Commands;
namespace PSTests
{
[Collection("AssemblyLoadContext")]
public static class FileSystemProviderTests
{
[Fact]
public static void TestCreateJunctionFails()
{
Assert.False(InternalSymbolicLinkLinkCodeMethods.CreateJunction("",""));
}
[Fact]
public static void TestGetHelpMaml()
{
FileSystemProvider fileSystemProvider = new FileSystemProvider();
Assert.Equal(fileSystemProvider.GetHelpMaml(String.Empty,String.Empty),String.Empty);
Assert.Equal(fileSystemProvider.GetHelpMaml("helpItemName",String.Empty),String.Empty);
Assert.Equal(fileSystemProvider.GetHelpMaml(String.Empty,"path"),String.Empty);
}
[Fact]
public static void TestMode()
{
Assert.Equal(FileSystemProvider.Mode(null),String.Empty);
FileSystemInfo fileSystemObject = new DirectoryInfo(@"/");
Assert.NotEqual(FileSystemProvider.Mode(PSObject.AsPSObject(fileSystemObject)),String.Empty);
}
[Fact]
public static void TestGetProperty()
{
//FileSystemProvider fileSystemProvider = new FileSystemProvider();
//fileSystemProvider.GetProperty(@"/", new Collection<string>(){"Attributes"});
}
[Fact]
public static void TestSetProperty()
{
//FileSystemProvider fileSystemProvider = new FileSystemProvider();
//fileSystemProvider.SetProperty(@"/root", PSObject.AsPSObject(propertyToSet));
}
[Fact]
public static void TestClearProperty()
{
// FileSystemProvider fileSystemProvider = new FileSystemProvider();
// fileSystemProvider.ClearProperty(@"/test", new Collection<string>(){"Attributes"});
}
[Fact]
public static void TestGetContentReader()
{
// FileSystemProvider fileSystemProvider = new FileSystemProvider();
// IContentReader contentReader = fileSystemProvider.GetContentReader(@"/test");
// Assert.NotNull(contentReader);
}
[Fact]
public static void TestGetContentWriter()
{
// FileSystemProvider fileSystemProvider = new FileSystemProvider();
// IContentWriter contentWriter = fileSystemProvider.GetContentWriter(@"/test");
// Assert.NotNull(contentWriter);
}
[Fact]
public static void TestClearContent()
{
//FileSystemProvider fileSystemProvider = new FileSystemProvider();
//fileSystemProvider.ClearContent(@"/test");
}
}
}
| using Xunit;
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Management.Automation;
using System.Management.Automation.Provider;
using Microsoft.PowerShell.Commands;
namespace PSTests
{
[Collection("AssemblyLoadContext")]
public static class FileSystemProviderTests
{
[Fact]
public static void TestCreateJunctionFails()
{
Assert.False(InternalSymbolicLinkLinkCodeMethods.CreateJunction("",""));
}
[Fact]
public static void TestGetHelpMaml()
{
FileSystemProvider fileSystemProvider = new FileSystemProvider();
Assert.Equal(fileSystemProvider.GetHelpMaml(String.Empty,String.Empty),String.Empty);
Assert.Equal(fileSystemProvider.GetHelpMaml("helpItemName",String.Empty),String.Empty);
Assert.Equal(fileSystemProvider.GetHelpMaml(String.Empty,"path"),String.Empty);
}
[Fact]
public static void TestMode()
{
Assert.Equal(FileSystemProvider.Mode(null),String.Empty);
FileSystemInfo fileSystemObject = new DirectoryInfo(@"/");
Assert.NotEqual(FileSystemProvider.Mode(PSObject.AsPSObject(fileSystemObject)),String.Empty);
}
[Fact]
public static void TestGetProperty()
{
FileSystemProvider fileSystemProvider = new FileSystemProvider();
fileSystemProvider.GetProperty(@"/", new Collection<string>(){"Attributes"});
}
[Fact]
public static void TestSetProperty()
{
//FileSystemProvider fileSystemProvider = new FileSystemProvider();
//fileSystemProvider.SetProperty(@"/root", PSObject.AsPSObject(propertyToSet));
}
[Fact]
public static void TestClearProperty()
{
// FileSystemProvider fileSystemProvider = new FileSystemProvider();
// fileSystemProvider.ClearProperty(@"/test", new Collection<string>(){"Attributes"});
}
[Fact]
public static void TestGetContentReader()
{
// FileSystemProvider fileSystemProvider = new FileSystemProvider();
// IContentReader contentReader = fileSystemProvider.GetContentReader(@"/test");
// Assert.NotNull(contentReader);
}
[Fact]
public static void TestGetContentWriter()
{
// FileSystemProvider fileSystemProvider = new FileSystemProvider();
// IContentWriter contentWriter = fileSystemProvider.GetContentWriter(@"/test");
// Assert.NotNull(contentWriter);
}
[Fact]
public static void TestClearContent()
{
//FileSystemProvider fileSystemProvider = new FileSystemProvider();
//fileSystemProvider.ClearContent(@"/test");
}
}
}
| mit | C# |
bebba27f2620e16dadd2cccc01e57c8d4c125637 | Fix Dimension in integration tests | Cybermaxs/Toppler | tests/Toppler.Tests.Integration/TestHelpers/TestBase.cs | tests/Toppler.Tests.Integration/TestHelpers/TestBase.cs | using System;
using System.Diagnostics;
namespace Toppler.Tests.Integration.TestHelpers
{
public class TestBase
{
private static Random Generator = new Random();
protected string TestEventSource { get; private set; }
protected string TestDimension { get; private set; }
public TestBase()
{
this.TestEventSource = RandomEventSource();
this.TestDimension = RandomDimension();
}
protected bool Reset()
{
return RedisServer.Reset();
}
#region Monitor
private Process RedisCli;
protected void StartMonitor()
{
if (RedisCli == null)
{
RedisCli = RedisServer.StartNewMonitor();
RedisCli.BeginOutputReadLine();
RedisCli.OutputDataReceived += (e, s) =>
{
Trace.WriteLine(s.Data);
};
}
}
protected void StopMonitor()
{
if (RedisCli != null)
RedisCli.Kill();
}
#endregion"
public static int RandomHits()
{
return Generator.Next(1000);
}
public static string RandomEventSource()
{
return "es-" + Generator.Next(1000).ToString();
}
public static string RandomDimension()
{
return "dim-" + Generator.Next(1000).ToString();
}
}
}
| using System;
using System.Diagnostics;
namespace Toppler.Tests.Integration.TestHelpers
{
public class TestBase
{
private static Random Generator = new Random();
protected string TestEventSource { get; private set; }
protected string TestDimension { get; private set; }
public TestBase()
{
this.TestEventSource = RandomEventSource();
this.TestDimension = RandomDimension();
this.TestDimension = "mydimension";
}
protected bool Reset()
{
return RedisServer.Reset();
}
#region Monitor
private Process RedisCli;
protected void StartMonitor()
{
if (RedisCli == null)
{
RedisCli = RedisServer.StartNewMonitor();
RedisCli.BeginOutputReadLine();
RedisCli.OutputDataReceived += (e, s) =>
{
Trace.WriteLine(s.Data);
};
}
}
protected void StopMonitor()
{
if (RedisCli != null)
RedisCli.Kill();
}
#endregion"
public static int RandomHits()
{
return Generator.Next(1000);
}
public static string RandomEventSource()
{
return "es-" + Generator.Next(1000).ToString();
}
public static string RandomDimension()
{
return "dim-" + Generator.Next(1000).ToString();
}
}
}
| mit | C# |
1e5132a70f428fc7839eef9290d2838fe782c457 | Add a missed converter | amatukaze/HeavenlyWind | src/Game/Sakuno.ING.Game.Provider/Models/RawMap.cs | src/Game/Sakuno.ING.Game.Provider/Models/RawMap.cs | using Sakuno.ING.Game.Json.Converters;
using Sakuno.ING.Game.Models.MasterData;
using System.Text.Json.Serialization;
namespace Sakuno.ING.Game.Models
{
#nullable disable
public sealed class RawMap : IIdentifiable<MapId>
{
[JsonPropertyName("api_id")]
public MapId Id { get; set; }
[JsonPropertyName("api_cleared")]
[JsonConverter(typeof(IntToBooleanConverter))]
public bool IsCleared { get; set; }
[JsonPropertyName("api_air_base_decks")]
public int AvailableAirForceGroups { get; set; }
[JsonPropertyName("api_defeat_count")]
public int? DefeatedCount { get; set; }
[JsonPropertyName("api_required_defeat_count")]
public int? RequiredDefeatCount { get; set; }
}
#nullable enable
}
| using Sakuno.ING.Game.Models.MasterData;
using System.Text.Json.Serialization;
namespace Sakuno.ING.Game.Models
{
#nullable disable
public sealed class RawMap : IIdentifiable<MapId>
{
[JsonPropertyName("api_id")]
public MapId Id { get; set; }
[JsonPropertyName("api_cleared")]
public bool IsCleared { get; set; }
[JsonPropertyName("api_air_base_decks")]
public int AvailableAirForceGroups { get; set; }
[JsonPropertyName("api_defeat_count")]
public int? DefeatedCount { get; set; }
[JsonPropertyName("api_required_defeat_count")]
public int? RequiredDefeatCount { get; set; }
}
#nullable enable
}
| mit | C# |
6dc0999304de8fa67c4b3524215c8a67775dc98f | Add dusplay name for 'Perfil' | fmassaretto/formacao-talentos,fmassaretto/formacao-talentos,fmassaretto/formacao-talentos | Fatec.Treinamento.Web/Models/RegistroUsuarioViewModel.cs | Fatec.Treinamento.Web/Models/RegistroUsuarioViewModel.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Fatec.Treinamento.Model;
namespace Fatec.Treinamento.Web.Models
{
/// <summary>
/// Um viewmodel serve para trabalhar com os dados na view.
/// Esse viewmodel é usado para obter os dados de registro de usuario
/// </summary>
public class RegistroUsuarioViewModel
{
[Required(ErrorMessage = "O campo {0} é Obrigatório.")]
[Display(Name = "Nome")]
public string Nome { get; set; }
[Required(ErrorMessage = "O campo {0} é Obrigatório.")]
[EmailAddress(ErrorMessage = "O campo Email deve conter um endereço de email válido.")]
[Display(Name = "Email")]
public string Email { get; set; }
[Required(ErrorMessage = "O campo {0} é Obrigatório.")]
[StringLength(100, ErrorMessage = "A Senha deve ter ao menos 6 caracteres.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Senha")]
public string Senha { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirmar Senha")]
[System.ComponentModel.DataAnnotations.Compare("Senha", ErrorMessage = "A senha e confirmação não coincidem")]
public string ConfirmacaoSenha { get; set; }
public IEnumerable<SelectListItem> ListaPerfil { get; set; }
[Display(Name = "Perfil")]
public int IdPerfil { get; set; }
}
} | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Fatec.Treinamento.Model;
namespace Fatec.Treinamento.Web.Models
{
/// <summary>
/// Um viewmodel serve para trabalhar com os dados na view.
/// Esse viewmodel é usado para obter os dados de registro de usuario
/// </summary>
public class RegistroUsuarioViewModel
{
[Required(ErrorMessage = "O campo {0} é Obrigatório.")]
[Display(Name = "Nome")]
public string Nome { get; set; }
[Required(ErrorMessage = "O campo {0} é Obrigatório.")]
[EmailAddress(ErrorMessage = "O campo Email deve conter um endereço de email válido.")]
[Display(Name = "Email")]
public string Email { get; set; }
[Required(ErrorMessage = "O campo {0} é Obrigatório.")]
[StringLength(100, ErrorMessage = "A Senha deve ter ao menos 6 caracteres.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Senha")]
public string Senha { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirmar Senha")]
[System.ComponentModel.DataAnnotations.Compare("Senha", ErrorMessage = "A senha e confirmação não coincidem")]
public string ConfirmacaoSenha { get; set; }
public IEnumerable<SelectListItem> ListaPerfil { get; set; }
public int IdPerfil { get; set; }
}
} | apache-2.0 | C# |
7f6318c9f701058bc4043c9cd30cb13fa22a6f4c | Fix comment | DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer | LmpClient/Harmony/KerbalEVA_proceedAndBoard.cs | LmpClient/Harmony/KerbalEVA_proceedAndBoard.cs | using Harmony;
using LmpClient.Events;
using System;
// ReSharper disable All
namespace LmpClient.Harmony
{
/// <summary>
/// This harmony patch is intended to trigger an event when boarding a vessel
/// </summary>
[HarmonyPatch(typeof(KerbalEVA))]
[HarmonyPatch("proceedAndBoard")]
public class KerbalEVA_proceedAndBoard
{
private static Guid kerbalVesselId = Guid.Empty;
private static string kerbalName;
[HarmonyPrefix]
private static void PrefixProceedAndBoard(KerbalEVA __instance)
{
kerbalVesselId = __instance.vessel.id;
kerbalName = __instance.vessel.name;
}
[HarmonyPostfix]
private static void PostfixProceedAndBoard(Part p)
{
EvaEvent.onCrewEvaBoarded.Fire(kerbalVesselId, kerbalName, p.vessel);
}
}
}
| using Harmony;
using LmpClient.Events;
using System;
// ReSharper disable All
namespace LmpClient.Harmony
{
/// <summary>
/// This harmony patch is intended to trigger an event when a strategy has been activated
/// </summary>
[HarmonyPatch(typeof(KerbalEVA))]
[HarmonyPatch("proceedAndBoard")]
public class KerbalEVA_proceedAndBoard
{
private static Guid kerbalVesselId = Guid.Empty;
private static string kerbalName;
[HarmonyPrefix]
private static void PrefixProceedAndBoard(KerbalEVA __instance)
{
kerbalVesselId = __instance.vessel.id;
kerbalName = __instance.vessel.name;
}
[HarmonyPostfix]
private static void PostfixProceedAndBoard(Part p)
{
EvaEvent.onCrewEvaBoarded.Fire(kerbalVesselId, kerbalName, p.vessel);
}
}
}
| mit | C# |
076f1c83e3a3d131dffa0c0bc9bf76088e25f9b5 | Rollback const prefix since it breaks sharedlibrary build . Linker cannot seem to find "Boxed_System::__UniversalCanon::`vftable',DATA" | gregkalapos/corert,gregkalapos/corert,gregkalapos/corert,gregkalapos/corert | src/ILCompiler.Compiler/src/Compiler/WindowsNodeMangler.cs | src/ILCompiler.Compiler/src/Compiler/WindowsNodeMangler.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Internal.Text;
using Internal.TypeSystem;
using System.Diagnostics;
namespace ILCompiler
{
//
// The naming format of these names is known to the debugger
//
public class WindowsNodeMangler : NodeMangler
{
public const string NonGCStaticMemberName = "__NONGCSTATICS";
public const string GCStaticMemberName = "__GCSTATICS";
public const string ThreadStaticMemberName = "__THREADSTATICS";
// Mangled name of boxed version of a type
public sealed override string MangledBoxedTypeName(TypeDesc type)
{
Debug.Assert(type.IsValueType);
return "Boxed_" + NameMangler.GetMangledTypeName(type);
}
public sealed override string EEType(TypeDesc type)
{
string mangledJustTypeName;
if (type.IsValueType)
mangledJustTypeName = MangledBoxedTypeName(type);
else
mangledJustTypeName = NameMangler.GetMangledTypeName(type);
return mangledJustTypeName + "::`vftable'";
}
public sealed override string GCStatics(TypeDesc type)
{
return NameMangler.GetMangledTypeName(type) + "::" + GCStaticMemberName;
}
public sealed override string NonGCStatics(TypeDesc type)
{
return NameMangler.GetMangledTypeName(type) + "::" + NonGCStaticMemberName;
}
public sealed override string ThreadStatics(TypeDesc type)
{
return NameMangler.CompilationUnitPrefix + NameMangler.GetMangledTypeName(type) + "::" + ThreadStaticMemberName;
}
public sealed override string TypeGenericDictionary(TypeDesc type)
{
return GenericDictionaryNamePrefix + NameMangler.GetMangledTypeName(type);
}
public override string MethodGenericDictionary(MethodDesc method)
{
return GenericDictionaryNamePrefix + NameMangler.GetMangledMethodName(method);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Internal.Text;
using Internal.TypeSystem;
using System.Diagnostics;
namespace ILCompiler
{
//
// The naming format of these names is known to the debugger
//
public class WindowsNodeMangler : NodeMangler
{
public const string NonGCStaticMemberName = "__NONGCSTATICS";
public const string GCStaticMemberName = "__GCSTATICS";
public const string ThreadStaticMemberName = "__THREADSTATICS";
// Mangled name of boxed version of a type
public sealed override string MangledBoxedTypeName(TypeDesc type)
{
Debug.Assert(type.IsValueType);
return "Boxed_" + NameMangler.GetMangledTypeName(type);
}
public sealed override string EEType(TypeDesc type)
{
string mangledJustTypeName;
if (type.IsValueType)
mangledJustTypeName = MangledBoxedTypeName(type);
else
mangledJustTypeName = NameMangler.GetMangledTypeName(type);
return "const " + mangledJustTypeName + "::`vftable'";
}
public sealed override string GCStatics(TypeDesc type)
{
return NameMangler.GetMangledTypeName(type) + "::" + GCStaticMemberName;
}
public sealed override string NonGCStatics(TypeDesc type)
{
return NameMangler.GetMangledTypeName(type) + "::" + NonGCStaticMemberName;
}
public sealed override string ThreadStatics(TypeDesc type)
{
return NameMangler.CompilationUnitPrefix + NameMangler.GetMangledTypeName(type) + "::" + ThreadStaticMemberName;
}
public sealed override string TypeGenericDictionary(TypeDesc type)
{
return GenericDictionaryNamePrefix + NameMangler.GetMangledTypeName(type);
}
public override string MethodGenericDictionary(MethodDesc method)
{
return GenericDictionaryNamePrefix + NameMangler.GetMangledMethodName(method);
}
}
}
| mit | C# |
f1994df20dca37ea0ff1266cd4076b3c4b4d98ef | Revert incorrect async workaround | kendallb/PreMailer.Net,milkshakesoftware/PreMailer.Net | PreMailer.Net/PreMailer.Net/Downloaders/WebDownloader.cs | PreMailer.Net/PreMailer.Net/Downloaders/WebDownloader.cs | using System;
using System.IO;
using System.Net;
namespace PreMailer.Net.Downloaders
{
public class WebDownloader : IWebDownloader
{
private static IWebDownloader _sharedDownloader;
public static IWebDownloader SharedDownloader
{
get
{
if (_sharedDownloader == null)
{
_sharedDownloader = new WebDownloader();
}
return _sharedDownloader;
}
set
{
_sharedDownloader = value;
}
}
public string DownloadString(Uri uri)
{
var request = WebRequest.Create(uri);
using (var response = request.GetResponse())
using (var stream = response.GetResponseStream())
using (var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
}
} | using System;
using System.IO;
using System.Net;
namespace PreMailer.Net.Downloaders
{
public class WebDownloader : IWebDownloader
{
private static IWebDownloader _sharedDownloader;
public static IWebDownloader SharedDownloader
{
get
{
if (_sharedDownloader == null)
{
_sharedDownloader = new WebDownloader();
}
return _sharedDownloader;
}
set
{
_sharedDownloader = value;
}
}
public string DownloadString(Uri uri)
{
var request = WebRequest.Create(uri);
using (var response = request.GetResponseAsync().Result)
using (var stream = response.GetResponseStream())
using (var reader = new StreamReader(stream))
{
return reader.ReadToEnd();
}
}
}
} | mit | C# |
dd33ef966a8b4f0ffbeb4c78207b48c38857ae29 | Adjust SynchronizationContextTaskScheduler comments | David-Desmaisons/EasyActor | EasyActor/TaskHelper/SynchronizationContextTaskScheduler.cs | EasyActor/TaskHelper/SynchronizationContextTaskScheduler.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace EasyActor.TaskHelper
{
/// <summary>
/// Adapted from http://referencesource.microsoft.com/#mscorlib/system/threading/Tasks/TaskScheduler.cs,30e7d3d352bbb730
/// </summary>
internal class SynchronizationContextTaskScheduler : TaskScheduler
{
private SynchronizationContext m_synchronizationContext;
public SynchronizationContextTaskScheduler(SynchronizationContext synContext)
{
if (synContext == null)
{
throw new ArgumentNullException("synContext can not be null");
}
m_synchronizationContext = synContext;
}
[SecurityCritical]
protected override void QueueTask(Task task)
{
m_synchronizationContext.Post(PostCallback, task);
}
[SecurityCritical]
protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
{
return (SynchronizationContext.Current == m_synchronizationContext) ? TryExecuteTask(task) : false;
}
[SecurityCritical]
protected override IEnumerable<Task> GetScheduledTasks()
{
return null;
}
public override Int32 MaximumConcurrencyLevel
{
get { return 1; }
}
private void PostCallback(object obj)
{
base.TryExecuteTask((Task)obj);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace EasyActor.TaskHelper
{
internal class SynchronizationContextTaskScheduler : TaskScheduler
{
private SynchronizationContext m_synchronizationContext;
/// <summary>
/// Adapted from http://referencesource.microsoft.com/#mscorlib/system/threading/Tasks/TaskScheduler.cs,30e7d3d352bbb730
/// </summary>
public SynchronizationContextTaskScheduler(SynchronizationContext synContext)
{
if (synContext == null)
{
throw new ArgumentNullException("synContext can not be null");
}
m_synchronizationContext = synContext;
}
[SecurityCritical]
protected override void QueueTask(Task task)
{
m_synchronizationContext.Post(PostCallback, task);
}
[SecurityCritical]
protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
{
return (SynchronizationContext.Current == m_synchronizationContext) ? TryExecuteTask(task) : false;
}
[SecurityCritical]
protected override IEnumerable<Task> GetScheduledTasks()
{
return null;
}
public override Int32 MaximumConcurrencyLevel
{
get { return 1; }
}
private void PostCallback(object obj)
{
base.TryExecuteTask((Task)obj);
}
}
}
| mit | C# |
a85835b8c92a995e5703a82205693af64fc8e88c | Fix another ToMRect() | charlenni/Mapsui,charlenni/Mapsui,pauldendulk/Mapsui | Tests/Mapsui.Tests/Rendering/RenderFetchStrategyTests.cs | Tests/Mapsui.Tests/Rendering/RenderFetchStrategyTests.cs | using System.IO;
using BruTile.Cache;
using BruTile.Predefined;
using Mapsui.Extensions;
using Mapsui.Layers;
using Mapsui.Rendering;
using NUnit.Framework;
namespace Mapsui.Tests.Rendering
{
[TestFixture]
public class RenderFetchStrategyTests
{
[Test]
public void GetFeaturesWithPartOfOptimalResolutionTilesMissing()
{
// arrange
var schema = new GlobalSphericalMercator();
var box = schema.Extent.ToMRect();
const int level = 3;
var resolution = schema.Resolutions[level];
var memoryCache = PopulateMemoryCache(schema, new MemoryCache<RasterFeature>(), level);
var renderFetchStrategy = new RenderFetchStrategy();
// act
var tiles = renderFetchStrategy.Get(box, resolution.UnitsPerPixel, schema, memoryCache);
// assert
Assert.True(tiles.Count == 43);
}
private static ITileCache<RasterFeature> PopulateMemoryCache(GlobalSphericalMercator schema, MemoryCache<RasterFeature> cache, int levelId)
{
for (var i = levelId; i >= 0; i--)
{
var tiles = schema.GetTileInfos(schema.Extent, i);
foreach (var tile in tiles)
{
if ((tile.Index.Col + tile.Index.Row) % 2 == 0) // Add only 50% of the tiles with the arbitrary rule.
{
cache.Add(tile.Index, new RasterFeature { Raster = new MRaster(new MemoryStream(), new MRect(0, 0, 1, 1)) });
}
}
}
return cache;
}
}
}
| using System.IO;
using BruTile.Cache;
using BruTile.Predefined;
using Mapsui.Extensions;
using Mapsui.Layers;
using Mapsui.Rendering;
using NUnit.Framework;
namespace Mapsui.Tests.Rendering
{
[TestFixture]
public class RenderFetchStrategyTests
{
[Test]
public void GetFeaturesWithPartOfOptimalResolutionTilesMissing()
{
// arrange
var schema = new GlobalSphericalMercator();
var box = schema.Extent.ToBoundingBox();
const int level = 3;
var resolution = schema.Resolutions[level];
var memoryCache = PopulateMemoryCache(schema, new MemoryCache<RasterFeature>(), level);
var renderFetchStrategy = new RenderFetchStrategy();
// act
var tiles = renderFetchStrategy.Get(box, resolution.UnitsPerPixel, schema, memoryCache);
// assert
Assert.True(tiles.Count == 43);
}
private static ITileCache<RasterFeature> PopulateMemoryCache(GlobalSphericalMercator schema, MemoryCache<RasterFeature> cache, int levelId)
{
for (var i = levelId; i >= 0; i--)
{
var tiles = schema.GetTileInfos(schema.Extent, i);
foreach (var tile in tiles)
{
if ((tile.Index.Col + tile.Index.Row) % 2 == 0) // Add only 50% of the tiles with the arbitrary rule.
{
cache.Add(tile.Index, new RasterFeature { Raster = new MRaster(new MemoryStream(), new MRect(0, 0, 1, 1)) });
}
}
}
return cache;
}
}
}
| mit | C# |
3d1dd6f5a4f5f4524786f74a30820cec30de24cb | Update CopyingRows.cs | aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET | Examples/CSharp/Articles/CopyRowsColumns/CopyingRows.cs | Examples/CSharp/Articles/CopyRowsColumns/CopyingRows.cs | using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles.CopyRowsColumns
{
public class CopyingRows
{
public static void Main()
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiate a new workbook
//Open an existing excel file
Workbook workbook = new Workbook(dataDir+ "aspose-sample.xlsx");
//Get the first worksheet cells
Cells cells = workbook.Worksheets[0].Cells;
//Apply formulas to the cells
for (int i = 0; i < 5; i++)
{
cells[0, i].Formula = "=Input!" + cells[0, i].Name;
}
//Copy the first row to next 10 rows
cells.CopyRows(cells, 0, 1, 10);
//Save the excel file
workbook.Save(dataDir + "outaspose-sample.out.xlsx");
//ExEnd:1
}
}
}
| using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles.CopyRowsColumns
{
public class CopyingRows
{
public static void Main()
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiate a new workbook
//Open an existing excel file
Workbook workbook = new Workbook(dataDir+ "aspose-sample.xlsx");
//Get the first worksheet cells
Cells cells = workbook.Worksheets[0].Cells;
//Apply formulas to the cells
for (int i = 0; i < 5; i++)
{
cells[0, i].Formula = "=Input!" + cells[0, i].Name;
}
//Copy the first row to next 10 rows
cells.CopyRows(cells, 0, 1, 10);
//Save the excel file
workbook.Save(dataDir + "outaspose-sample.out.xlsx");
}
}
} | mit | C# |
7ed065126334a36ed976984cbaa6023889a28ef2 | Set the icon for the release notes dialog so it displays correctly on Linux | gmartin7/libpalaso,JohnThomson/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso,sillsdev/libpalaso,JohnThomson/libpalaso,ddaspit/libpalaso,hatton/libpalaso,ermshiperete/libpalaso,mccarthyrb/libpalaso,sillsdev/libpalaso,ddaspit/libpalaso,andrew-polk/libpalaso,gtryus/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,chrisvire/libpalaso,andrew-polk/libpalaso,mccarthyrb/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,gmartin7/libpalaso,ermshiperete/libpalaso,gtryus/libpalaso,chrisvire/libpalaso,hatton/libpalaso,andrew-polk/libpalaso,ddaspit/libpalaso,ermshiperete/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso,andrew-polk/libpalaso,tombogle/libpalaso,JohnThomson/libpalaso,gmartin7/libpalaso,hatton/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,gtryus/libpalaso,chrisvire/libpalaso,hatton/libpalaso,gmartin7/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,JohnThomson/libpalaso,ddaspit/libpalaso,chrisvire/libpalaso | PalasoUIWindowsForms/ReleaseNotes/ShowReleaseNotesDialog.cs | PalasoUIWindowsForms/ReleaseNotes/ShowReleaseNotesDialog.cs | using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Palaso.IO;
namespace Palaso.UI.WindowsForms.ReleaseNotes
{
/// <summary>
/// Shows a dialog for release notes; accepts html and markdown
/// </summary>
public partial class ShowReleaseNotesDialog : Form
{
private readonly string _path;
private TempFile _temp;
private readonly Icon _icon;
public ShowReleaseNotesDialog(Icon icon, string path)
{
_path = path;
_icon = icon;
InitializeComponent();
}
private void ShowReleaseNotesDialog_Load(object sender, EventArgs e)
{
string contents = File.ReadAllText(_path);
var md = new Markdown();
_temp = TempFile.WithExtension("htm"); //enhance: will leek a file to temp
File.WriteAllText(_temp.Path, md.Transform(contents));
_browser.Url = new Uri(_temp.Path);
}
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
// a bug in Mono requires us to wait to set Icon until handle created.
Icon = _icon;
}
}
}
| using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using Palaso.IO;
namespace Palaso.UI.WindowsForms.ReleaseNotes
{
/// <summary>
/// Shows a dialog for release notes; accepts html and markdown
/// </summary>
public partial class ShowReleaseNotesDialog : Form
{
private readonly string _path;
private TempFile _temp;
public ShowReleaseNotesDialog(System.Drawing.Icon icon, string path)
{
_path = path;
Icon = icon;
InitializeComponent();
}
private void ShowReleaseNotesDialog_Load(object sender, EventArgs e)
{
string contents = File.ReadAllText(_path);
var md = new Markdown();
_temp = TempFile.WithExtension("htm"); //enhance: will leek a file to temp
File.WriteAllText(_temp.Path, md.Transform(contents));
_browser.Url = new Uri(_temp.Path);
}
}
}
| mit | C# |
96e1c5bd4db069c68bcc8fb51256bd5857731300 | Make RouteSelectorTests an actual test | willb611/SlimeSimulation | SlimeSimulationTests/Model/Simulation/RouteSelectorTests.cs | SlimeSimulationTests/Model/Simulation/RouteSelectorTests.cs | using Microsoft.VisualStudio.TestTools.UnitTesting;
using SlimeSimulation.Model.Simulation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlimeSimulation.Model.Simulation.Tests
{
[TestClass()]
public class RouteSelectorTests
{
[TestMethod()]
public void SelectRouteTest()
{
var a = new FoodSourceNode(1, 1, 1);
var b = new FoodSourceNode(2, 2, 2);
var ab = new SlimeEdge(a, b, 1);
var slimeEdges = new HashSet<SlimeEdge>() {ab};
var slime = new SlimeNetwork(slimeEdges);
var routeSelector = new RouteSelector();
var actualRoute = routeSelector.SelectRoute(slime);
Assert.IsNotNull(actualRoute);
Assert.IsNotNull(actualRoute.Sink);
Assert.IsNotNull(actualRoute.Source);
var actualSink = actualRoute.Sink;
Assert.IsTrue(actualSink.Equals(a) || actualSink.Equals(b));
var actualSource = actualRoute.Source;
Assert.IsNotNull(actualSource);
Assert.AreEqual(ab.GetOtherNode(actualSink), actualSource);
}
}
}
| using Microsoft.VisualStudio.TestTools.UnitTesting;
using SlimeSimulation.Model.Simulation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlimeSimulation.Model.Simulation.Tests
{
[TestClass()]
public class RouteSelectorTests
{
[TestMethod()]
public void SelectRouteTest()
{
var a = new FoodSourceNode(1, 1, 1);
var b = new FoodSourceNode(2, 2, 2);
var ab = new SlimeEdge(a, b, 1);
var slimeEdges = new HashSet<SlimeEdge>() {ab};
var slime = new SlimeNetwork(slimeEdges);
var routeSelector = new RouteSelector();
}
}
}
| apache-2.0 | C# |
7ed978c2b60448afb0b2906a5ca1ac3eab50d90e | fix compile | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/resharper-unity/src/ShaderLab/Feature/Services/TypingAssist/ShaderLabIndentTypingHelper.cs | resharper/resharper-unity/src/ShaderLab/Feature/Services/TypingAssist/ShaderLabIndentTypingHelper.cs | using JetBrains.ReSharper.Feature.Services.TypingAssist;
using JetBrains.ReSharper.Plugins.Unity.ShaderLab.Psi;
using JetBrains.ReSharper.Psi.Cpp.Parsing;
using JetBrains.ReSharper.Psi.Parsing;
using JetBrains.TextControl;
namespace JetBrains.ReSharper.Plugins.Unity.ShaderLab.Feature.Services.TypingAssist
{
public class ShaderLabIndentTypingHelper : IndentTypingHelper<ShaderLabLanguage>
{
public ShaderLabIndentTypingHelper(TypingAssistLanguageBase<ShaderLabLanguage> assist)
: base(assist)
{
}
// smart backspaces expecteed that GetExtraStub return not null value, "foo " is typical value
protected override string GetExtraStub(CachingLexer lexer, int offset, ITextControl textControl)
{
using (LexerStateCookie.Create(lexer))
{
lexer.FindTokenAt(offset);
if (!(lexer.TokenType is CppTokenNodeType))
return "foo ";
}
return base.GetExtraStub(lexer, offset, textControl);
}
}
} | using JetBrains.ReSharper.Feature.Services.TypingAssist;
using JetBrains.ReSharper.Plugins.Unity.ShaderLab.Psi;
using JetBrains.ReSharper.Psi.Cpp.Parsing;
using JetBrains.ReSharper.Psi.Parsing;
namespace JetBrains.ReSharper.Plugins.Unity.ShaderLab.Feature.Services.TypingAssist
{
public class ShaderLabIndentTypingHelper : IndentTypingHelper<ShaderLabLanguage>
{
public ShaderLabIndentTypingHelper(TypingAssistLanguageBase<ShaderLabLanguage> assist)
: base(assist)
{
}
// smart backspaces expecteed that GetExtraStub return not null value, "foo " is typical value
protected override string GetExtraStub(CachingLexer lexer, int offset)
{
using (LexerStateCookie.Create(lexer))
{
lexer.FindTokenAt(offset);
if (!(lexer.TokenType is CppTokenNodeType))
return "foo ";
}
return base.GetExtraStub(lexer, offset);
}
}
} | apache-2.0 | C# |
dbdfe97315b2c00e322cc675cabf96d31ee5c2e7 | fix mapping | bellrichm/weather,bellrichm/weather,bellrichm/weather,bellrichm/weather,bellrichm/weather | api/src/BellRichM.Weather.Api/Mapping/ObservationProfile.cs | api/src/BellRichM.Weather.Api/Mapping/ObservationProfile.cs | using AutoMapper;
using BellRichM.Weather.Api.Data;
using BellRichM.Weather.Api.Models;
using System;
namespace BellRichM.Weather.Api.Mapping
{
/// <summary>
/// The observation mapping profile.
/// </summary>
/// <seealso cref="AutoMapper.Profile" />
public class ObservationProfile : Profile
{
/// <summary>
/// Initializes a new instance of the <see cref="ObservationProfile"/> class.
/// </summary>
public ObservationProfile()
{
CreateMap<Observation, ObservationModel>();
CreateMap<ObservationModel, Observation>()
.ForMember(dest => dest.Year, opt => opt.Ignore())
.ForMember(dest => dest.Month, opt => opt.Ignore())
.ForMember(dest => dest.Day, opt => opt.Ignore())
.ForMember(dest => dest.Hour, opt => opt.Ignore())
.ForMember(dest => dest.Minute, opt => opt.Ignore())
.AfterMap((src, dest) =>
{
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // UTC vs Eastern...???
var dateTime = epoch.AddSeconds(src.DateTime);
dest.Year = dateTime.Year;
dest.Month = dateTime.Month;
dest.Day = dateTime.Day;
dest.Hour = dateTime.Hour;
dest.Minute = dateTime.Minute;
});
}
}
} | using AutoMapper;
using BellRichM.Weather.Api.Data;
using BellRichM.Weather.Api.Models;
using System;
namespace BellRichM.Weather.Api.Mapping
{
/// <summary>
/// The observation mapping profile.
/// </summary>
/// <seealso cref="AutoMapper.Profile" />
public class ObservationProfile : Profile
{
/// <summary>
/// Initializes a new instance of the <see cref="ObservationProfile"/> class.
/// </summary>
public ObservationProfile()
{
CreateMap<ObservationModel, Observation>()
.ForMember(src => src.Year, opt => opt.Ignore())
.ForMember(src => src.Month, opt => opt.Ignore())
.ForMember(src => src.Day, opt => opt.Ignore())
.ForMember(src => src.Hour, opt => opt.Ignore())
.ForMember(src => src.Minute, opt => opt.Ignore());
}
}
} | mit | C# |
19a3a1a473c24834d05786d0a99e6f6f3d31d03e | copy and paste is a bitch | mzrimsek/resume-site-api | Core/Interfaces/RepositoryInterfaces/ISkillRepository.cs | Core/Interfaces/RepositoryInterfaces/ISkillRepository.cs | using System.Collections.Generic;
using System.Threading.Tasks;
using Core.Models;
namespace Core.Interfaces.RepositoryInterfaces
{
public interface ISkillRepository : IRepository<SkillDomainModel>
{
Task<IEnumerable<SkillDomainModel>> GetByLanguageId(int languageId);
}
} | using System.Collections.Generic;
using System.Threading.Tasks;
using Core.Models;
namespace Core.Interfaces.RepositoryInterfaces
{
public interface ISkillRepository : IRepository<SkillDomainModel>
{
Task<IEnumerable<LanguageDomainModel>> GetByLanguageId(int jobId);
}
} | mit | C# |
1937dd52182cd5c48a507a7bb6c9deda0b9b3462 | remove unused using | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/Behaviors/FocusBehavior.cs | WalletWasabi.Fluent/Behaviors/FocusBehavior.cs | using System;
using System.Reactive.Disposables;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
namespace WalletWasabi.Fluent.Behaviors
{
internal class FocusBehavior : DisposingBehavior<Control>
{
public static readonly StyledProperty<bool> IsFocusedProperty =
AvaloniaProperty.Register<FocusBehavior, bool>(nameof(IsFocused), defaultBindingMode: BindingMode.TwoWay);
public bool IsFocused
{
get => GetValue(IsFocusedProperty);
set => SetValue(IsFocusedProperty, value);
}
protected override void OnAttached(CompositeDisposable disposables)
{
base.OnAttached();
if (AssociatedObject != null)
{
AssociatedObject.AttachedToLogicalTree += (sender, e) =>
disposables.Add(this.GetObservable(IsFocusedProperty)
.Subscribe(focused =>
{
if (focused)
{
AssociatedObject.Focus();
}
}));
}
}
}
} | using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
namespace WalletWasabi.Fluent.Behaviors
{
internal class FocusBehavior : DisposingBehavior<Control>
{
public static readonly StyledProperty<bool> IsFocusedProperty =
AvaloniaProperty.Register<FocusBehavior, bool>(nameof(IsFocused), defaultBindingMode: BindingMode.TwoWay);
public bool IsFocused
{
get => GetValue(IsFocusedProperty);
set => SetValue(IsFocusedProperty, value);
}
protected override void OnAttached(CompositeDisposable disposables)
{
base.OnAttached();
if (AssociatedObject != null)
{
AssociatedObject.AttachedToLogicalTree += (sender, e) =>
disposables.Add(this.GetObservable(IsFocusedProperty)
.Subscribe(focused =>
{
if (focused)
{
AssociatedObject.Focus();
}
}));
}
}
}
} | mit | C# |
1b4c72d84335679d2fc3f4bf27ee8d55a25a7765 | fix codefactor | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/ViewModels/ClosedWalletViewModel.cs | WalletWasabi.Fluent/ViewModels/ClosedWalletViewModel.cs | using ReactiveUI;
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using System.Threading.Tasks;
using WalletWasabi.Gui.Helpers;
using WalletWasabi.Logging;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels
{
public class ClosedWalletViewModel : WalletViewModelBase
{
private ObservableCollection<NavBarItemViewModel> _items;
protected ClosedWalletViewModel(IScreen screen, WalletManager walletManager, Wallet wallet) : base(screen, wallet)
{
_items = new ObservableCollection<NavBarItemViewModel>
{
new HomePageViewModel(screen) { Parent = this }
};
OpenWalletCommand = ReactiveCommand.CreateFromTask(
async () =>
{
try
{
if (wallet.KeyManager.PasswordVerified is true)
{
// TODO ... new UX will test password earlier...
}
await Task.Run(async () => await walletManager.StartWalletAsync(Wallet));
}
catch (OperationCanceledException ex)
{
Logger.LogTrace(ex);
}
catch (Exception ex)
{
NotificationHelpers.Error($"Couldn't load wallet. Reason: {ex.ToUserFriendlyString()}", sender: wallet);
Logger.LogError(ex);
}
},
this.WhenAnyValue(x => x.WalletState).Select(x => x == WalletState.Uninitialized));
}
public ObservableCollection<NavBarItemViewModel> Items
{
get => _items;
set => this.RaiseAndSetIfChanged(ref _items, value);
}
public ReactiveCommand<Unit, Unit> OpenWalletCommand { get; }
public override string IconName => "web_asset_regular";
public static WalletViewModelBase Create(IScreen screen, WalletManager walletManager, Wallet wallet)
{
return wallet.KeyManager.IsHardwareWallet
? new ClosedHardwareWalletViewModel(screen, walletManager, wallet)
: wallet.KeyManager.IsWatchOnly
? new ClosedWatchOnlyWalletViewModel(screen, walletManager, wallet)
: new ClosedWalletViewModel(screen, walletManager, wallet);
}
}
}
| using ReactiveUI;
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using System.Threading.Tasks;
using WalletWasabi.Gui.Helpers;
using WalletWasabi.Logging;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels
{
public class ClosedWalletViewModel : WalletViewModelBase
{
private ObservableCollection<NavBarItemViewModel> _items;
protected ClosedWalletViewModel(IScreen screen, WalletManager walletManager, Wallet wallet) : base(screen, wallet)
{
_items = new ObservableCollection<NavBarItemViewModel>
{
new HomePageViewModel(screen){ Parent = this }
};
OpenWalletCommand = ReactiveCommand.CreateFromTask(
async () =>
{
try
{
if (wallet.KeyManager.PasswordVerified is true)
{
// TODO ... new UX will test password earlier...
}
await Task.Run(async () => await walletManager.StartWalletAsync(Wallet));
}
catch (OperationCanceledException ex)
{
Logger.LogTrace(ex);
}
catch (Exception ex)
{
NotificationHelpers.Error($"Couldn't load wallet. Reason: {ex.ToUserFriendlyString()}", sender: wallet);
Logger.LogError(ex);
}
},
this.WhenAnyValue(x => x.WalletState).Select(x => x == WalletState.Uninitialized));
}
public ObservableCollection<NavBarItemViewModel> Items
{
get => _items;
set => this.RaiseAndSetIfChanged(ref _items, value);
}
public ReactiveCommand<Unit, Unit> OpenWalletCommand { get; }
public override string IconName => "web_asset_regular";
public static WalletViewModelBase Create(IScreen screen, WalletManager walletManager, Wallet wallet)
{
return wallet.KeyManager.IsHardwareWallet
? new ClosedHardwareWalletViewModel(screen, walletManager, wallet)
: wallet.KeyManager.IsWatchOnly
? new ClosedWatchOnlyWalletViewModel(screen, walletManager, wallet)
: new ClosedWalletViewModel(screen, walletManager, wallet);
}
}
}
| mit | C# |
85dcb2d215fb7fd9108f97f4a85344bf18c81cb8 | Use coalesce expression | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Behaviors/GreyOutOnDisabledBehavior.cs | WalletWasabi.Gui/Behaviors/GreyOutOnDisabledBehavior.cs | using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Xaml.Interactivity;
using System;
using System.Reactive.Disposables;
namespace WalletWasabi.Gui.Behaviors
{
public class GreyOutOnDisabledBehavior : Behavior<Control>
{
private CompositeDisposable Disposables { get; set; }
private double? OriginalOpacity { get; set; }
protected override void OnAttached()
{
Disposables?.Dispose();
Disposables = new CompositeDisposable
{
AssociatedObject.GetObservable(InputElement.IsEnabledProperty).Subscribe(enabled =>
{
if (enabled)
{
AssociatedObject.Opacity = OriginalOpacity ?? 1;
}
else
{
OriginalOpacity = AssociatedObject.Opacity;
AssociatedObject.Opacity = 0.5;
}
})
};
}
protected override void OnDetaching()
{
base.OnDetaching();
Disposables?.Dispose();
Disposables = null;
}
}
}
| using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Xaml.Interactivity;
using System;
using System.Reactive.Disposables;
namespace WalletWasabi.Gui.Behaviors
{
public class GreyOutOnDisabledBehavior : Behavior<Control>
{
private CompositeDisposable Disposables { get; set; }
private double? OriginalOpacity { get; set; }
protected override void OnAttached()
{
Disposables?.Dispose();
Disposables = new CompositeDisposable
{
AssociatedObject.GetObservable(InputElement.IsEnabledProperty).Subscribe(enabled =>
{
if (enabled)
{
AssociatedObject.Opacity = OriginalOpacity.HasValue ? OriginalOpacity.Value : 1;
}
else
{
OriginalOpacity = AssociatedObject.Opacity;
AssociatedObject.Opacity = 0.5;
}
})
};
}
protected override void OnDetaching()
{
base.OnDetaching();
Disposables?.Dispose();
Disposables = null;
}
}
}
| mit | C# |
a14a833fc1d65656dcfdc5d7ef2e5b3f9a5d63f4 | add nested filter on sort expresion | UdiBen/elasticsearch-net,KodrAus/elasticsearch-net,tkirill/elasticsearch-net,junlapong/elasticsearch-net,starckgates/elasticsearch-net,junlapong/elasticsearch-net,KodrAus/elasticsearch-net,mac2000/elasticsearch-net,LeoYao/elasticsearch-net,UdiBen/elasticsearch-net,NickCraver/NEST,cstlaurent/elasticsearch-net,NickCraver/NEST,alanprot/elasticsearch-net,SeanKilleen/elasticsearch-net,robertlyson/elasticsearch-net,TheFireCookie/elasticsearch-net,wawrzyn/elasticsearch-net,jonyadamit/elasticsearch-net,abibell/elasticsearch-net,robertlyson/elasticsearch-net,adam-mccoy/elasticsearch-net,amyzheng424/elasticsearch-net,DavidSSL/elasticsearch-net,tkirill/elasticsearch-net,RossLieberman/NEST,gayancc/elasticsearch-net,Grastveit/NEST,robrich/elasticsearch-net,elastic/elasticsearch-net,jonyadamit/elasticsearch-net,robrich/elasticsearch-net,adam-mccoy/elasticsearch-net,TheFireCookie/elasticsearch-net,amyzheng424/elasticsearch-net,DavidSSL/elasticsearch-net,UdiBen/elasticsearch-net,abibell/elasticsearch-net,gayancc/elasticsearch-net,robertlyson/elasticsearch-net,ststeiger/elasticsearch-net,SeanKilleen/elasticsearch-net,amyzheng424/elasticsearch-net,starckgates/elasticsearch-net,faisal00813/elasticsearch-net,mac2000/elasticsearch-net,SeanKilleen/elasticsearch-net,junlapong/elasticsearch-net,tkirill/elasticsearch-net,CSGOpenSource/elasticsearch-net,ststeiger/elasticsearch-net,faisal00813/elasticsearch-net,LeoYao/elasticsearch-net,alanprot/elasticsearch-net,mac2000/elasticsearch-net,CSGOpenSource/elasticsearch-net,CSGOpenSource/elasticsearch-net,joehmchan/elasticsearch-net,cstlaurent/elasticsearch-net,geofeedia/elasticsearch-net,Grastveit/NEST,azubanov/elasticsearch-net,RossLieberman/NEST,NickCraver/NEST,elastic/elasticsearch-net,wawrzyn/elasticsearch-net,LeoYao/elasticsearch-net,adam-mccoy/elasticsearch-net,wawrzyn/elasticsearch-net,jonyadamit/elasticsearch-net,DavidSSL/elasticsearch-net,faisal00813/elasticsearch-net,ststeiger/elasticsearch-net,abibell/elasticsearch-net,KodrAus/elasticsearch-net,azubanov/elasticsearch-net,joehmchan/elasticsearch-net,cstlaurent/elasticsearch-net,alanprot/elasticsearch-net,joehmchan/elasticsearch-net,geofeedia/elasticsearch-net,azubanov/elasticsearch-net,Grastveit/NEST,TheFireCookie/elasticsearch-net,geofeedia/elasticsearch-net,gayancc/elasticsearch-net,robrich/elasticsearch-net,alanprot/elasticsearch-net,RossLieberman/NEST,starckgates/elasticsearch-net | src/Nest.Dsl.Factory/Factory/Sort/FieldSortBuilder.cs | src/Nest.Dsl.Factory/Factory/Sort/FieldSortBuilder.cs | using Newtonsoft.Json.Linq;
namespace Nest.Dsl.Factory
{
public class FieldSortBuilder : ISortBuilder
{
private readonly string _fieldName;
private object _missing;
private SortOrder _order;
private bool? _ignoreUnampped;
private TermFilterBuilder _nestedFilter;
public FieldSortBuilder(string fieldName)
{
_fieldName = fieldName;
}
/// <summary>
/// Sets if the field does not exists in the index, it should be ignored and not sorted by or not. Defaults
/// to <tt>false</tt> (not ignoring).
/// </summary>
/// <param name="ignoreUnmapped"></param>
/// <returns></returns>
public FieldSortBuilder IgnoreUnmapped(bool ignoreUnmapped)
{
_ignoreUnampped = ignoreUnmapped;
return this;
}
/// <summary>
/// Sets sort nested filter
/// </summary>
/// <param name="nestedFilter">nested filter</param>
/// <returns></returns>
public FieldSortBuilder NestedFilter(TermFilterBuilder nestedFilter)
{
_nestedFilter = nestedFilter;
return this;
}
#region ISortBuilder Members
public ISortBuilder Order(SortOrder order)
{
_order = order;
return this;
}
public ISortBuilder Missing(object missing)
{
_missing = missing;
return this;
}
public object ToJsonObject()
{
var content = new JObject();
content[_fieldName] = new JObject();
if (_order != SortOrder.ASC)
{
content[_fieldName]["order"] = "desc";
}
if (_missing != null)
{
content[_fieldName]["missing"] = new JValue(_missing);
}
if (_ignoreUnampped != null)
{
content[_fieldName]["ignore_unmapped"] = _ignoreUnampped;
}
if (_nestedFilter != null)
{
content[_fieldName]["nested_filter"] = _nestedFilter.ToJsonObject() as JObject;
}
return content;
}
public override string ToString()
{
return ToJsonObject().ToString();
}
#endregion
}
} | using Newtonsoft.Json.Linq;
namespace Nest.Dsl.Factory
{
public class FieldSortBuilder : ISortBuilder
{
private readonly string _fieldName;
private object _missing;
private SortOrder _order;
private bool? _ignoreUnampped;
public FieldSortBuilder(string fieldName)
{
_fieldName = fieldName;
}
/// <summary>
/// Sets if the field does not exists in the index, it should be ignored and not sorted by or not. Defaults
/// to <tt>false</tt> (not ignoring).
/// </summary>
/// <param name="ignoreUnmapped"></param>
/// <returns></returns>
public FieldSortBuilder IgnoreUnmapped(bool ignoreUnmapped)
{
_ignoreUnampped = ignoreUnmapped;
return this;
}
#region ISortBuilder Members
public ISortBuilder Order(SortOrder order)
{
_order = order;
return this;
}
public ISortBuilder Missing(object missing)
{
_missing = missing;
return this;
}
public object ToJsonObject()
{
var content = new JObject();
content[_fieldName] = new JObject();
if (_order != SortOrder.ASC)
{
content[_fieldName]["order"] = "desc";
}
if (_missing != null)
{
content[_fieldName]["missing"] = new JValue(_missing);
}
if (_ignoreUnampped != null)
{
content[_fieldName]["ignore_unmapped"] = _ignoreUnampped;
}
return content;
}
public override string ToString()
{
return ToJsonObject().ToString();
}
#endregion
}
} | apache-2.0 | C# |
16e6702f123daf0e5c615f4ed69909c81ae08b32 | Update Entity.cs | PowerMogli/Rabbit.Db | src/RabbitDB/Entity/Entity.cs | src/RabbitDB/Entity/Entity.cs | namespace RabbitDB.Entity
{
public abstract class Entity
{
internal bool MarkedForDeletion { get; set; }
internal bool ChangeTrackingEnabled { get; set; }
public Entity()
{
this.ChangeTrackingEnabled = true;
}
}
}
| namespace RabbitDB.Entity
{
public abstract class Entity
{
internal bool MarkedForDeletion { get; set; }
public Entity() { }
}
}
| apache-2.0 | C# |
fe85b7d482a0aabb076387f174fbbc9ab7835e77 | Remove unused import | peppy/osu,peppy/osu-new,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,ppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu | osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs | osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.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 osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public class DrawableSliderHead : DrawableHitCircle
{
private readonly IBindable<int> pathVersion = new Bindable<int>();
protected override OsuSkinComponents CirclePieceComponent => OsuSkinComponents.SliderHeadHitCircle;
private DrawableSlider drawableSlider;
private Slider slider => drawableSlider?.HitObject;
public DrawableSliderHead()
{
}
public DrawableSliderHead(SliderHeadCircle h)
: base(h)
{
}
[BackgroundDependencyLoader]
private void load()
{
PositionBindable.BindValueChanged(_ => updatePosition());
pathVersion.BindValueChanged(_ => updatePosition());
}
protected override void OnFree()
{
base.OnFree();
pathVersion.UnbindFrom(drawableSlider.PathVersion);
}
protected override void OnParentReceived(DrawableHitObject parent)
{
base.OnParentReceived(parent);
drawableSlider = (DrawableSlider)parent;
pathVersion.BindTo(drawableSlider.PathVersion);
OnShake = drawableSlider.Shake;
CheckHittable = (d, t) => drawableSlider.CheckHittable?.Invoke(d, t) ?? true;
}
protected override void Update()
{
base.Update();
double completionProgress = Math.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
if (!IsHit)
Position = slider.CurvePositionAt(completionProgress);
}
public Action<double> OnShake;
public override void Shake(double maximumLength) => OnShake?.Invoke(maximumLength);
private void updatePosition()
{
if (slider != null)
Position = HitObject.Position - slider.Position;
}
}
}
| // 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.Allocation;
using osu.Framework.Bindables;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public class DrawableSliderHead : DrawableHitCircle
{
private readonly IBindable<int> pathVersion = new Bindable<int>();
protected override OsuSkinComponents CirclePieceComponent => OsuSkinComponents.SliderHeadHitCircle;
private DrawableSlider drawableSlider;
private Slider slider => drawableSlider?.HitObject;
public DrawableSliderHead()
{
}
public DrawableSliderHead(SliderHeadCircle h)
: base(h)
{
}
[BackgroundDependencyLoader]
private void load()
{
PositionBindable.BindValueChanged(_ => updatePosition());
pathVersion.BindValueChanged(_ => updatePosition());
}
protected override void OnFree()
{
base.OnFree();
pathVersion.UnbindFrom(drawableSlider.PathVersion);
}
protected override void OnParentReceived(DrawableHitObject parent)
{
base.OnParentReceived(parent);
drawableSlider = (DrawableSlider)parent;
pathVersion.BindTo(drawableSlider.PathVersion);
OnShake = drawableSlider.Shake;
CheckHittable = (d, t) => drawableSlider.CheckHittable?.Invoke(d, t) ?? true;
}
protected override void Update()
{
base.Update();
double completionProgress = Math.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
if (!IsHit)
Position = slider.CurvePositionAt(completionProgress);
}
public Action<double> OnShake;
public override void Shake(double maximumLength) => OnShake?.Invoke(maximumLength);
private void updatePosition()
{
if (slider != null)
Position = HitObject.Position - slider.Position;
}
}
}
| mit | C# |
8196cd731c86875a51dae91acb67cc0fb474db98 | Add "OrchardCore.Email" as dependency in Users Manifest module | stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,xkproject/Orchard2 | src/OrchardCore.Modules/OrchardCore.Users/Manifest.cs | src/OrchardCore.Modules/OrchardCore.Users/Manifest.cs | using OrchardCore.Modules.Manifest;
[assembly: Module(
Name = "Users",
Author = "The Orchard Team",
Website = "http://orchardproject.net",
Version = "2.0.0",
Description = "The users module enables authentication UI and user management.",
Dependencies = new [] { "OrchardCore.Authentication", "OrchardCore.DataProtection", "OrchardCore.Email" },
Category = "Security"
)]
| using OrchardCore.Modules.Manifest;
[assembly: Module(
Name = "Users",
Author = "The Orchard Team",
Website = "http://orchardproject.net",
Version = "2.0.0",
Description = "The users module enables authentication UI and user management.",
Dependencies = new [] { "OrchardCore.Authentication", "OrchardCore.DataProtection" },
Category = "Security"
)]
| bsd-3-clause | C# |
2699225294f4874dadaedf53b662df346675092b | Add missing attributes on StripeThreeDSecure | richardlawley/stripe.net,stripe/stripe-dotnet | src/Stripe.net/Entities/Sources/StripeThreeDSecure.cs | src/Stripe.net/Entities/Sources/StripeThreeDSecure.cs | namespace Stripe
{
using Newtonsoft.Json;
public class StripeThreeDSecure : StripeEntity
{
/// <summary>
/// If `address_line1` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
/// </summary>
[JsonProperty("address_line1_check")]
public string AddressLine1Check { get; set; }
/// <summary>
/// If `address_zip` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
/// </summary>
[JsonProperty("address_zip_check")]
public string AddressZipCheck { get; set; }
/// <summary>
/// True if the cardholder went through the authentication flow and their bank indicated that authentication succeeded.
/// </summary>
[JsonProperty("authenticated")]
public bool Authenticated { get; set; }
/// <summary>
/// Card brand. Can be `American Express`, `Diners Club`, `Discover`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
/// </summary>
[JsonProperty("brand")]
public string Brand { get; set; }
/// <summary>
/// The card used to create this 3DS source.
/// </summary>
[JsonProperty("card")]
public string CardId { get; set; }
/// <summary>
/// Two-letter ISO code representing the country of the card.
/// </summary>
[JsonProperty("country")]
public string Country { get; set; }
/// <summary>
/// The ID of the customer to which the card belongs, if any.
/// </summary>
[JsonProperty("customer")]
public string CustomerId { get; set; }
/// <summary>
/// If a CVC was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
/// </summary>
[JsonProperty("cvc_check")]
public string CvcCheck { get; set; }
/// <summary>
/// This is an internal property that is not returned in standard API requests.
/// </summary>
[JsonProperty("description")]
public string Description { get; set; }
/// <summary>
/// (For tokenized numbers only.) The last four digits of the device account number.
/// </summary>
[JsonProperty("dynamic_last4")]
public string DynamicLast4 { get; set; }
/// <summary>
/// The expiration month of the card.
/// </summary>
[JsonProperty("exp_month")]
public int ExpMonth { get; set; }
/// <summary>
/// The expiration year of the card.
/// </summary>
[JsonProperty("exp_year")]
public int ExpYear { get; set; }
/// <summary>
/// Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example.
/// </summary>
[JsonProperty("fingerprint")]
public string Fingerprint { get; set; }
/// <summary>
/// Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`.
/// </summary>
[JsonProperty("funding")]
public string Funding { get; set; }
/// <summary>
/// This is an internal property that is not returned in standard API requests.
/// </summary>
[JsonProperty("iin")]
public string IIN { get; set; }
/// <summary>
/// This is an internal property that is not returned in standard API requests.
/// </summary>
[JsonProperty("issuer")]
public string Issuer { get; set; }
/// <summary>
/// The last 4 digits of the card number.
/// </summary>
[JsonProperty("last4")]
public string Last4 { get; set; }
/// <summary>
/// The card's 3D Secure support status. Can be one of `not_supported`, `required`, `recommended` or `optional`.
/// </summary>
[JsonProperty("three_d_secure")]
public string ThreeDSecure { get; set; }
/// <summary>
/// If the card number is tokenized, this is the method that was used. Can be `apple_pay` or `android_pay`.
/// </summary>
[JsonProperty("tokenization_method")]
public string TokenizationMethod { get; set; }
}
}
| namespace Stripe
{
using Newtonsoft.Json;
public class StripeThreeDSecure : StripeEntity
{
[JsonProperty("card")]
public string CardId { get; set; }
[JsonProperty("customer")]
public string CustomerId { get; set; }
[JsonProperty("authenticated")]
public bool Authenticated { get; set; }
}
}
| apache-2.0 | C# |
d5a680ca98d8fb6f55cd39e8aeb0166902b60102 | Rename test class, to avoid conflict in Mono when compiled with other System.IO tests (#33142) | ViktorHofer/corefx,shimingsg/corefx,ViktorHofer/corefx,wtgodbe/corefx,ericstj/corefx,ptoonen/corefx,ViktorHofer/corefx,ericstj/corefx,ptoonen/corefx,ViktorHofer/corefx,wtgodbe/corefx,shimingsg/corefx,shimingsg/corefx,mmitche/corefx,ptoonen/corefx,mmitche/corefx,wtgodbe/corefx,mmitche/corefx,mmitche/corefx,ptoonen/corefx,ericstj/corefx,ericstj/corefx,shimingsg/corefx,BrennanConroy/corefx,wtgodbe/corefx,shimingsg/corefx,ptoonen/corefx,ericstj/corefx,BrennanConroy/corefx,wtgodbe/corefx,wtgodbe/corefx,ptoonen/corefx,ptoonen/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ericstj/corefx,shimingsg/corefx,mmitche/corefx,wtgodbe/corefx,ericstj/corefx,mmitche/corefx,BrennanConroy/corefx,shimingsg/corefx,ViktorHofer/corefx,mmitche/corefx | src/System.IO.UnmanagedMemoryStream/tests/UmsFlush.cs | src/System.IO.UnmanagedMemoryStream/tests/UmsFlush.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks;
using Xunit;
namespace System.IO.Tests
{
public class UnmanagedMemoryStreamFlushTests
{
[Fact]
public static void Flush()
{
const int length = 1000;
using (var manager = new UmsManager(FileAccess.Write, length))
{
UnmanagedMemoryStream stream = manager.Stream;
stream.Flush();
Assert.True(stream.FlushAsync(new CancellationToken(true)).IsCanceled);
Assert.True(stream.FlushAsync().Status == TaskStatus.RanToCompletion);
}
using (var stream = new DerivedUnmanagedMemoryStream())
{
Assert.Throws<ObjectDisposedException>(() => stream.Flush());
Task t = stream.FlushAsync();
Assert.True(t.IsFaulted);
Assert.IsType<ObjectDisposedException>(t.Exception.InnerException);
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks;
using Xunit;
namespace System.IO.Tests
{
public class FlushTests
{
[Fact]
public static void Flush()
{
const int length = 1000;
using (var manager = new UmsManager(FileAccess.Write, length))
{
UnmanagedMemoryStream stream = manager.Stream;
stream.Flush();
Assert.True(stream.FlushAsync(new CancellationToken(true)).IsCanceled);
Assert.True(stream.FlushAsync().Status == TaskStatus.RanToCompletion);
}
using (var stream = new DerivedUnmanagedMemoryStream())
{
Assert.Throws<ObjectDisposedException>(() => stream.Flush());
Task t = stream.FlushAsync();
Assert.True(t.IsFaulted);
Assert.IsType<ObjectDisposedException>(t.Exception.InnerException);
}
}
}
}
| mit | C# |
b4190913f6db57c9023ed28291ad3b62f592563c | Add notes to Soldier about ETS, PEBD | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | Battery-Commander.Web/Models/Soldier.cs | Battery-Commander.Web/Models/Soldier.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BatteryCommander.Web.Models
{
public class Soldier
{
private const double DaysPerYear = 365.2425;
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required, StringLength(50)]
[Display(Name = "Last Name")]
public String LastName { get; set; }
[Required, StringLength(50)]
[Display(Name = "First Name")]
public String FirstName { get; set; }
[Required]
public Rank Rank { get; set; } = Rank.E1;
[StringLength(12)]
public String DoDId { get; set; }
[DataType(DataType.EmailAddress), StringLength(50)]
public String MilitaryEmail { get; set; }
[DataType(DataType.EmailAddress), StringLength(50)]
public String CivilianEmail { get; set; }
[DataType(DataType.Date), Column(TypeName = "date")]
public DateTime DateOfBirth { get; set; }
public int Age => AgeAsOf(DateTime.Today);
public int AgeAsOf(DateTime date)
{
// They may not have reached their birthday for this year
return (int)((date - DateOfBirth).TotalDays / DaysPerYear);
}
[Required]
public Gender Gender { get; set; } = Gender.Male;
// public MilitaryEducationLevel EducationLevel { get; set; } = MilitaryEducationLevel.None;
// Status - Active, Inactive
[Required]
public int UnitId { get; set; }
public virtual Unit Unit { get; set; }
// Position
// Security Clearance
// MOS - Duty MOSQ'd?
// ETS Date & Time till ETS
// PEBD
// Date of Rank
public virtual ICollection<APFT> APFTs { get; set; }
}
} | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BatteryCommander.Web.Models
{
public class Soldier
{
private const double DaysPerYear = 365.2425;
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required, StringLength(50)]
[Display(Name = "Last Name")]
public String LastName { get; set; }
[Required, StringLength(50)]
[Display(Name = "First Name")]
public String FirstName { get; set; }
[Required]
public Rank Rank { get; set; } = Rank.E1;
[StringLength(12)]
public String DoDId { get; set; }
[DataType(DataType.EmailAddress), StringLength(50)]
public String MilitaryEmail { get; set; }
[DataType(DataType.EmailAddress), StringLength(50)]
public String CivilianEmail { get; set; }
[DataType(DataType.Date), Column(TypeName = "date")]
public DateTime DateOfBirth { get; set; }
public int Age => AgeAsOf(DateTime.Today);
public int AgeAsOf(DateTime date)
{
// They may not have reached their birthday for this year
return (int)((date - DateOfBirth).TotalDays / DaysPerYear);
}
[Required]
public Gender Gender { get; set; } = Gender.Male;
// public MilitaryEducationLevel EducationLevel { get; set; } = MilitaryEducationLevel.None;
// Status - Active, Inactive
[Required]
public int UnitId { get; set; }
public virtual Unit Unit { get; set; }
// Position
// Security Clearance
// MOS - Duty MOSQ'd?
// ETS Date
public virtual ICollection<APFT> APFTs { get; set; }
}
} | mit | C# |
8323db13ff7d2897d9c36b619b375b27c727be1f | fix in distance calculator | SiiHackathon/BikeTracking,SiiHackathon/BikeTracking,SiiHackathon/BikeTracking | BikeTracker/Services/ActivityService.cs | BikeTracker/Services/ActivityService.cs | using System.Linq;
namespace BikeTracker.Services
{
public class ActivityService : IActivityService
{
public decimal GetUserTotalDistance(long userId)
{
return DependencyFactory.CreateActivityRepository.GetByUserId(userId)
.Sum(activity => (decimal)activity.Distance / 1000);
}
}
} | using System.Linq;
namespace BikeTracker.Services
{
public class ActivityService : IActivityService
{
public decimal GetUserTotalDistance(long userId)
{
return DependencyFactory.CreateActivityRepository.GetByUserId(userId)
.Sum(activity => activity.Distance);
}
}
} | mit | C# |
8f4dcdc0a99914e3be371b1311b92449f7a9ab5f | Fix build. Oops. | jskeet/nodatime,malcolmr/nodatime,BenJenkinson/nodatime,nodatime/nodatime,malcolmr/nodatime,malcolmr/nodatime,nodatime/nodatime,malcolmr/nodatime,BenJenkinson/nodatime,jskeet/nodatime | src/NodaTime.Benchmarks/NodaTimeTests/ZoneYearOffsetBenchmarks.cs | src/NodaTime.Benchmarks/NodaTimeTests/ZoneYearOffsetBenchmarks.cs | // Copyright 2017 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using BenchmarkDotNet.Attributes;
using NodaTime.TimeZones;
namespace NodaTime.Benchmarks.NodaTimeTests
{
public class ZoneYearOffsetBenchmarks
{
private static readonly ZoneYearOffset Sample =
new ZoneYearOffset(TransitionMode.Wall, 3, 15, (int)IsoDayOfWeek.Sunday, true, new LocalTime(1, 0, 0));
[Benchmark]
public LocalInstantWrapper GetOccurrenceForYear() => new LocalInstantWrapper(Sample.GetOccurrenceForYear(2010));
public struct LocalInstantWrapper
{
private readonly LocalInstant value;
internal LocalInstantWrapper(LocalInstant value) => this.value = value;
}
}
}
| // Copyright 2017 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using BenchmarkDotNet.Attributes;
using NodaTime.TimeZones;
namespace NodaTime.Benchmarks.NodaTimeTests
{
public class ZoneRecurrenceBenchmarks
{
private static readonly ZoneYearOffset Sample =
new ZoneYearOffset(TransitionMode.Wall, 3, 15, (int)IsoDayOfWeek.Sunday, true, new LocalTime(1, 0, 0));
[Benchmark]
public LocalInstantWrapper GetOccurrenceForYear() => new LocalInstantWrapper(Sample.GetOccurrenceForYear(2010));
public struct LocalInstantWrapper
{
private readonly LocalInstant value;
internal LocalInstantWrapper(LocalInstant value) => this.value = value;
}
}
}
| apache-2.0 | C# |
ba767df5dd51b50e3d41df8dcd5f77c345df7514 | Implement the in memory archive | i2e-haw-hamburg/stp-loader,i2e-haw-hamburg/cad-in-unity | CAD2Unity/3DXMLLoader/Implementation/Model/ThreeDRepFile.cs | CAD2Unity/3DXMLLoader/Implementation/Model/ThreeDRepFile.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using Ionic.Zip;
namespace ThreeDXMLLoader.Implementation.Model
{
/// <summary>
/// In memory archive implementation for the IThreeDArchive interface.
/// </summary>
class ThreeDRepFile : IThreeDArchive
{
private IDictionary<string, Stream> _files;
private const string ManifestName = "Manifest.xml";
private ThreeDRepFile(IDictionary<string, Stream> files)
{
_files = files;
}
/// <summary>
/// Creates a new in memory archive from a given stream of zipped data.
/// </summary>
/// <param name="data">the zip compressed 3dxml archive</param>
/// <returns>a new instance of a ThreeDRepFile</returns>
public static IThreeDArchive Create(Stream data)
{
var dict = new Dictionary<string, Stream>();
using (var zipArchive = ZipFile.Read(data))
{
foreach (var entry in zipArchive.Where(entry => !entry.IsDirectory))
{
var name = entry.FileName.ToLower();
var fileStream = new MemoryStream();
entry.Extract(fileStream);
dict.Add(name, fileStream);
}
}
var archive = new ThreeDRepFile(dict);
return archive;
}
public XDocument GetManifest()
{
return GetNextDocument(ManifestName);
}
public XDocument GetNextDocument(string name)
{
name = name.ToLower();
if (!_files.ContainsKey(name))
{
throw new Exception($"File {name} not found in archive.");
}
var fileStream = _files[name];
var reader = XmlReader.Create(fileStream);
reader.MoveToContent();
return XDocument.Load(reader);
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Xml.Linq;
using Ionic.Zip;
namespace ThreeDXMLLoader.Implementation.Model
{
/// <summary>
/// In memory archive implementation for the IThreeDArchive interface.
/// </summary>
class ThreeDRepFile : IThreeDArchive
{
private IDictionary<string, Stream> _files;
private ThreeDRepFile()
{
}
public static IThreeDArchive Create(Stream data)
{
var archive = new ThreeDRepFile();
using (var zipArchive = ZipFile.Read(data))
{
foreach (var entry in zipArchive)
{
}
}
return archive;
}
public XDocument GetManifest()
{
throw new System.NotImplementedException();
}
public XDocument GetNextDocument(string name)
{
throw new System.NotImplementedException();
}
}
}
| apache-2.0 | C# |
16c1f3bc37ce3b1b97fdcea9d7f4dc26fc7fbabc | Remove unused queries | jnwatts/cs320_project2_group11,jnwatts/cs320_project2_group11 | Model/query.cs | Model/query.cs | using System;
using System.Data;
using System.Collections.Generic;
public class Query
{
public String query{ get; set; }
public String name { get; set; }
public Query(String name, String query)
{
this.name = name;
this.query = query;
}
public override String ToString()
{
return name;
}
public static List<Query> CreateQueries()
{
List<Query> QueryList = new List<Query>();
QueryList.Add(new Query("Select a query...",
""));
return QueryList;
}
}
| using System;
using System.Data;
using System.Collections.Generic;
public class Query
{
public String query{ get; set; }
public String name { get; set; }
public Query(String name, String query)
{
this.name = name;
this.query = query;
}
public override String ToString()
{
return name;
}
public static List<Query> CreateQueries()
{
List<Query> QueryList = new List<Query>();
QueryList.Add(new Query("Select a query...",
""));
QueryList.Add(new Query("Vendor parts w/ mfg and vendor",
"SELECT * FROM Vendor_parts AS VP INNER JOIN Manufacturers AS M ON VP.Manufacturer_id = M.Manufacturer_id INNER JOIN Vendors AS V ON VP.Vendor_id = V.Vendor_id;"));
QueryList.Add(new Query("Manufacturers and parts",
"SELECT * FROM Vendor_parts AS VP RIGHT OUTER JOIN Manufacturers AS M ON VP.Manufacturer_id = M.Manufacturer_id;"));
QueryList.Add(new Query("Parts w/ type attributes",
"SELECT * FROM Parts AS P NATURAL LEFT JOIN Capacitor_attributes AS A NATURAL LEFT JOIN Part_types AS T WHERE T.Type = 'Capacitor'"));
QueryList.Add(new Query("Number of each type of part",
"SELECT Type, COUNT(Part_num) FROM Parts NATURAL JOIN Part_types GROUP BY Part_type_id"));
QueryList.Add(new Query("A list of all Manufacturers",
"SELECT Name FROM Manufacturers"));
QueryList.Add(new Query("A list of all Vendors",
"SELECT Name FROM Vendors"));
QueryList.Add(new Query("A list of what Vendors a single Manufacturer",
"SELECT DISTINCT M.Name as Manufacturer, V.Name as Vendor FROM Manufacturers as M JOIN Vendor_parts JOIN Vendors as V Where M.Name = 'AVX'"));
QueryList.Add(new Query("Find parts with no vendor supplier",
"SELECT Part_num, Type, Description FROM Parts AS P NATURAL JOIN Part_types WHERE P.Part_num NOT IN (SELECT Part_num FROM Vendor_parts) ORDER BY Part_num, Part_type_id"));
QueryList.Add(new Query("Find parts with no pricing information",
"SELECT Part_num, Type, Description FROM Parts AS P NATURAL JOIN Part_types WHERE P.Part_num NOT IN (SELECT Part_num FROM Vendor_price_breaks) ORDER BY Part_num, Part_type_id"));
QueryList.Add(new Query("Find parts with no matching tuple in extended attributes",
" SELECT Part_num, Type, Description FROM Parts AS P NATURAL JOIN Part_types WHERE P.Part_num NOT IN ( SELECT Part_num FROM Capacitor_attributes UNION SELECT Part_num FROM Connector_attributes UNION SELECT Part_num FROM Memory_attributes ) ORDER BY Part_num, Part_type_id; "));
return QueryList;
}
}
| apache-2.0 | C# |
b961de10e33f9eb58b1c72424dfec896ffaed2d3 | Update BatchOperationHelper.cs | tiksn/TIKSN-Framework | TIKSN.Core/Data/BatchOperationHelper.cs | TIKSN.Core/Data/BatchOperationHelper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data
{
public static class BatchOperationHelper
{
public static Task BatchOperationAsync<T>(IEnumerable<T> entities, CancellationToken cancellationToken,
Func<T, CancellationToken, Task> singleOperation)
{
if (entities == null)
{
throw new ArgumentNullException(nameof(entities));
}
if (singleOperation == null)
{
throw new ArgumentNullException(nameof(singleOperation));
}
var tasks = entities.Select(entity => singleOperation?.Invoke(entity, cancellationToken));
return Task.WhenAll(tasks);
}
public static Task<TResult[]> BatchOperationAsync<T, TResult>(IEnumerable<T> entities,
CancellationToken cancellationToken, Func<T, CancellationToken, Task<TResult>> singleOperation)
{
if (entities == null)
{
throw new ArgumentNullException(nameof(entities));
}
if (singleOperation == null)
{
throw new ArgumentNullException(nameof(singleOperation));
}
var tasks = entities.Select(entity => singleOperation?.Invoke(entity, cancellationToken));
return Task.WhenAll(tasks);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data
{
public static class BatchOperationHelper
{
public static Task BatchOperationAsync<T>(IEnumerable<T> entities, CancellationToken cancellationToken, Func<T, CancellationToken, Task> singleOperation)
{
if (entities == null)
{
throw new ArgumentNullException(nameof(entities));
}
if (singleOperation == null)
{
throw new ArgumentNullException(nameof(singleOperation));
}
var tasks = entities.Select(entity => singleOperation?.Invoke(entity, cancellationToken));
return Task.WhenAll(tasks);
}
public static Task<TResult[]> BatchOperationAsync<T, TResult>(IEnumerable<T> entities, CancellationToken cancellationToken, Func<T, CancellationToken, Task<TResult>> singleOperation)
{
if (entities == null)
{
throw new ArgumentNullException(nameof(entities));
}
if (singleOperation == null)
{
throw new ArgumentNullException(nameof(singleOperation));
}
var tasks = entities.Select(entity => singleOperation?.Invoke(entity, cancellationToken));
return Task.WhenAll(tasks);
}
}
} | mit | C# |
e3387e94092fe976f7be8f9ac5aa54c4ef81ee06 | bump to version 1.3.22 | Terradue/DotNetTep,Terradue/DotNetTep | Terradue.Tep/Properties/AssemblyInfo.cs | Terradue.Tep/Properties/AssemblyInfo.cs | /*!
\namespace Terradue.Tep
@{
Terradue.Tep Software Package provides with all the functionalities specific to the TEP.
\xrefitem sw_version "Versions" "Software Package Version" 1.3.22
\xrefitem sw_link "Links" "Software Package List" [Terradue.Tep](https://git.terradue.com/sugar/Terradue.Tep)
\xrefitem sw_license "License" "Software License" [AGPL](https://git.terradue.com/sugar/Terradue.Tep/LICENSE)
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch
\xrefitem sw_req "Require" "Software Dependencies" \ref ServiceStack
\xrefitem sw_req "Require" "Software Dependencies" \ref log4net
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Portal
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Authentication.Umsso
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Cloud
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Github
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Metadata.EarthObservation
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.News
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenNebula
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.GeoJson
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.RdfEO
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Tumblr
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Twitter
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Ogc.OwsContext
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.WebService.Model
\ingroup Tep
@}
*/
/*!
\defgroup Tep Tep Modules
@{
This is a super component that encloses all Thematic Exploitation Platform related functional components.
Their main functionnalities are targeted to enhance the basic \ref Core functionalities for the thematic usage of the plaform.
@}
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using NuGet4Mono.Extensions;
[assembly: AssemblyTitle("Terradue.Tep")]
[assembly: AssemblyDescription("Terradue Tep .Net library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Terradue")]
[assembly: AssemblyProduct("Terradue.Tep")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyAuthors("Enguerran Boissier")]
[assembly: AssemblyProjectUrl("https://git.terradue.com/sugar/Terradue.Tep")]
[assembly: AssemblyLicenseUrl("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.3.22")]
[assembly: AssemblyInformationalVersion("1.3.22")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)] | /*!
\namespace Terradue.Tep
@{
Terradue.Tep Software Package provides with all the functionalities specific to the TEP.
\xrefitem sw_version "Versions" "Software Package Version" 1.3.21
\xrefitem sw_link "Links" "Software Package List" [Terradue.Tep](https://git.terradue.com/sugar/Terradue.Tep)
\xrefitem sw_license "License" "Software License" [AGPL](https://git.terradue.com/sugar/Terradue.Tep/LICENSE)
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch
\xrefitem sw_req "Require" "Software Dependencies" \ref ServiceStack
\xrefitem sw_req "Require" "Software Dependencies" \ref log4net
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Portal
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Authentication.Umsso
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Cloud
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Github
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Metadata.EarthObservation
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.News
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenNebula
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.GeoJson
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.RdfEO
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Tumblr
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Twitter
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Ogc.OwsContext
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.WebService.Model
\ingroup Tep
@}
*/
/*!
\defgroup Tep Tep Modules
@{
This is a super component that encloses all Thematic Exploitation Platform related functional components.
Their main functionnalities are targeted to enhance the basic \ref Core functionalities for the thematic usage of the plaform.
@}
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using NuGet4Mono.Extensions;
[assembly: AssemblyTitle("Terradue.Tep")]
[assembly: AssemblyDescription("Terradue Tep .Net library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Terradue")]
[assembly: AssemblyProduct("Terradue.Tep")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyAuthors("Enguerran Boissier")]
[assembly: AssemblyProjectUrl("https://git.terradue.com/sugar/Terradue.Tep")]
[assembly: AssemblyLicenseUrl("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.3.21")]
[assembly: AssemblyInformationalVersion("1.3.21")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)] | agpl-3.0 | C# |
d432254bb4ab6ee14a7f4c02f55b22bb60215239 | Fix API .onion redirect | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Backend/WebsiteTorifier.cs | WalletWasabi.Backend/WebsiteTorifier.cs | using NBitcoin;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace WalletWasabi.Backend
{
public class WebsiteTorifier
{
public string RootFolder { get; }
public string UnversionedFolder { get; }
public WebsiteTorifier(string rootFolder)
{
RootFolder = rootFolder;
UnversionedFolder = Path.GetFullPath(Path.Combine(RootFolder, "unversioned"));
}
public async Task CloneAndUpdateOnionIndexHtmlAsync()
{
var path = Path.Combine(RootFolder, "index.html");
var onionPath = Path.Combine(RootFolder, "onion-index.html");
var content = await File.ReadAllTextAsync(path);
content = content.Replace("http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion", "https://wasabiwallet.io", StringComparison.Ordinal);
content = content.Replace("https://blockstream.info", "http://explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion", StringComparison.Ordinal);
content = content.Replace("https://wasabiwallet.io/swagger/", "http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion/swagger/", StringComparison.Ordinal);
await File.WriteAllTextAsync(onionPath, content);
}
}
}
| using NBitcoin;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace WalletWasabi.Backend
{
public class WebsiteTorifier
{
public string RootFolder { get; }
public string UnversionedFolder { get; }
public WebsiteTorifier(string rootFolder)
{
RootFolder = rootFolder;
UnversionedFolder = Path.GetFullPath(Path.Combine(RootFolder, "unversioned"));
}
public async Task CloneAndUpdateOnionIndexHtmlAsync()
{
var path = Path.Combine(RootFolder, "index.html");
var onionPath = Path.Combine(RootFolder, "onion-index.html");
var content = await File.ReadAllTextAsync(path);
content = content.Replace("http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion", "https://wasabiwallet.io", StringComparison.Ordinal);
content = content.Replace("https://blockstream.info", "http://explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion", StringComparison.Ordinal);
await File.WriteAllTextAsync(onionPath, content);
}
}
}
| mit | C# |
c8cd4aaa9a8e4a054501ab01c48b705188239f39 | Switch back to file config | visualeyes/cabinet,visualeyes/cabinet,visualeyes/cabinet | src/Cabinet.Web.SelfHostTest/App_Start/Startup.IOC.cs | src/Cabinet.Web.SelfHostTest/App_Start/Startup.IOC.cs | using Amazon;
using Amazon.Runtime;
using Amazon.S3;
using Autofac;
using Autofac.Integration.WebApi;
using Cabinet.Core;
using Cabinet.FileSystem;
using Cabinet.S3;
using Cabinet.Web.SelfHostTest.Framework;
using Microsoft.Owin;
using Microsoft.Owin.FileSystems;
using Microsoft.Owin.Hosting;
using Microsoft.Owin.StaticFiles;
using Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
namespace Cabinet.Web.SelfHostTest {
public partial class Startup {
private const string BucketName = "test-bucket";
public ContainerBuilder ConfigureAutoFac(FileCabinetFactory cabinetFactory) {
var builder = new ContainerBuilder();
builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
builder.RegisterInstance<IPathMapper>(new PathMapper(AppDomain.CurrentDomain.SetupInformation.ApplicationBase));
builder.RegisterType<UploadKeyProvider>().As<IKeyProvider>();
builder.RegisterInstance<IFileCabinetFactory>(cabinetFactory);
builder.Register((c) => {
var mapper = c.Resolve<IPathMapper>();
string uploadDir = mapper.MapPath("~/App_Data/Uploads");
var fileConfig = new FileSystemCabinetConfig(uploadDir, true);
return cabinetFactory.GetCabinet(fileConfig);
});
//builder.Register((c) => {
// var s3Config = new AmazonS3CabinetConfig(BucketName, RegionEndpoint.APSoutheast2, new StoredProfileAWSCredentials());
// return cabinetFactory.GetCabinet(s3Config);
//});
return builder;
}
}
}
| using Amazon;
using Amazon.Runtime;
using Amazon.S3;
using Autofac;
using Autofac.Integration.WebApi;
using Cabinet.Core;
using Cabinet.FileSystem;
using Cabinet.S3;
using Cabinet.Web.SelfHostTest.Framework;
using Microsoft.Owin;
using Microsoft.Owin.FileSystems;
using Microsoft.Owin.Hosting;
using Microsoft.Owin.StaticFiles;
using Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
namespace Cabinet.Web.SelfHostTest {
public partial class Startup {
private const string BucketName = "test-bucket";
public ContainerBuilder ConfigureAutoFac(FileCabinetFactory cabinetFactory) {
var builder = new ContainerBuilder();
builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
builder.RegisterInstance<IPathMapper>(new PathMapper(AppDomain.CurrentDomain.SetupInformation.ApplicationBase));
builder.RegisterType<UploadKeyProvider>().As<IKeyProvider>();
builder.RegisterInstance<IFileCabinetFactory>(cabinetFactory);
//builder.Register((c) => {
// var mapper = c.Resolve<IPathMapper>();
// string uploadDir = mapper.MapPath("~/App_Data/Uploads");
// var fileConfig = new FileSystemCabinetConfig(uploadDir, true);
// return cabinetFactory.GetCabinet(fileConfig);
//});
builder.Register((c) => {
var s3Config = new AmazonS3CabinetConfig(BucketName, RegionEndpoint.APSoutheast2, new StoredProfileAWSCredentials());
return cabinetFactory.GetCabinet(s3Config);
});
return builder;
}
}
}
| mit | C# |
d7f5ffb1908ef6b9df68b7c396ef9e589ac00c60 | Change when FEZMod.Exit gets called. Either LiveSplit doesn't crash on my PC or it's fixed now. | AngelDE98/FEZMod,AngelDE98/FEZMod | FEZ.Mod.mm/FezGame/patch_Fez.cs | FEZ.Mod.mm/FezGame/patch_Fez.cs | using System;
using FezGame.Mod;
namespace FezGame {
public class patch_Fez {
public void OnExiting(Object sender, EventArgs args) {
//It's possible that FEZ doesn't contain this method and thus orig_OnExiting won't exist.
FEZMod.Exit();
}
}
}
| using System;
using FezGame.Mod;
namespace FezGame {
public class patch_Fez {
public void orig_Exit() {
}
public void Exit() {
orig_Exit();
FEZMod.Exit();
}
}
}
| mit | C# |
5e089114005c25362b5f40573ecd8ec627409e6e | set svn:eol-style | ft-/opensim-optimizations-wip-tests,BogusCurry/arribasim-dev,OpenSimian/opensimulator,ft-/arribasim-dev-tests,allquixotic/opensim-autobackup,OpenSimian/opensimulator,N3X15/VoxelSim,allquixotic/opensim-autobackup,allquixotic/opensim-autobackup,N3X15/VoxelSim,ft-/arribasim-dev-extras,AlexRa/opensim-mods-Alex,justinccdev/opensim,N3X15/VoxelSim,ft-/opensim-optimizations-wip-tests,AlphaStaxLLC/taiga,bravelittlescientist/opensim-performance,Michelle-Argus/ArribasimExtract,cdbean/CySim,bravelittlescientist/opensim-performance,TechplexEngineer/Aurora-Sim,AlphaStaxLLC/taiga,ft-/arribasim-dev-tests,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,zekizeki/agentservice,zekizeki/agentservice,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,cdbean/CySim,rryk/omp-server,intari/OpenSimMirror,rryk/omp-server,QuillLittlefeather/opensim-1,ft-/arribasim-dev-extras,OpenSimian/opensimulator,M-O-S-E-S/opensim,TomDataworks/opensim,ft-/opensim-optimizations-wip,ft-/arribasim-dev-tests,AlexRa/opensim-mods-Alex,rryk/omp-server,ft-/arribasim-dev-extras,AlphaStaxLLC/taiga,RavenB/opensim,bravelittlescientist/opensim-performance,OpenSimian/opensimulator,justinccdev/opensim,M-O-S-E-S/opensim,M-O-S-E-S/opensim,zekizeki/agentservice,intari/OpenSimMirror,Michelle-Argus/ArribasimExtract,QuillLittlefeather/opensim-1,ft-/opensim-optimizations-wip-extras,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-extras,BogusCurry/arribasim-dev,cdbean/CySim,RavenB/opensim,justinccdev/opensim,AlexRa/opensim-mods-Alex,M-O-S-E-S/opensim,rryk/omp-server,QuillLittlefeather/opensim-1,AlphaStaxLLC/taiga,bravelittlescientist/opensim-performance,QuillLittlefeather/opensim-1,M-O-S-E-S/opensim,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-extras,AlphaStaxLLC/taiga,ft-/opensim-optimizations-wip,BogusCurry/arribasim-dev,QuillLittlefeather/opensim-1,ft-/arribasim-dev-tests,intari/OpenSimMirror,TomDataworks/opensim,TechplexEngineer/Aurora-Sim,RavenB/opensim,OpenSimian/opensimulator,ft-/arribasim-dev-extras,zekizeki/agentservice,AlphaStaxLLC/taiga,AlexRa/opensim-mods-Alex,BogusCurry/arribasim-dev,RavenB/opensim,TomDataworks/opensim,OpenSimian/opensimulator,rryk/omp-server,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,Michelle-Argus/ArribasimExtract,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,allquixotic/opensim-autobackup,ft-/opensim-optimizations-wip,intari/OpenSimMirror,justinccdev/opensim,AlexRa/opensim-mods-Alex,bravelittlescientist/opensim-performance,N3X15/VoxelSim,allquixotic/opensim-autobackup,ft-/opensim-optimizations-wip-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,rryk/omp-server,ft-/arribasim-dev-extras,Michelle-Argus/ArribasimExtract,zekizeki/agentservice,AlphaStaxLLC/taiga,N3X15/VoxelSim,RavenB/opensim,cdbean/CySim,QuillLittlefeather/opensim-1,N3X15/VoxelSim,TomDataworks/opensim,justinccdev/opensim,TechplexEngineer/Aurora-Sim,ft-/opensim-optimizations-wip-tests,Michelle-Argus/ArribasimExtract,ft-/opensim-optimizations-wip-tests,N3X15/VoxelSim,BogusCurry/arribasim-dev,M-O-S-E-S/opensim,TomDataworks/opensim,zekizeki/agentservice,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,intari/OpenSimMirror,TomDataworks/opensim,OpenSimian/opensimulator,AlphaStaxLLC/taiga,cdbean/CySim,QuillLittlefeather/opensim-1,allquixotic/opensim-autobackup,BogusCurry/arribasim-dev,AlexRa/opensim-mods-Alex,justinccdev/opensim,bravelittlescientist/opensim-performance,RavenB/opensim,Michelle-Argus/ArribasimExtract,N3X15/VoxelSim,ft-/arribasim-dev-tests,TechplexEngineer/Aurora-Sim,ft-/opensim-optimizations-wip-tests,TomDataworks/opensim,ft-/opensim-optimizations-wip,cdbean/CySim,ft-/opensim-optimizations-wip-extras,intari/OpenSimMirror,RavenB/opensim,M-O-S-E-S/opensim | OpenSim/Framework/sLLVector3.cs | OpenSim/Framework/sLLVector3.cs | using System;
using libsecondlife;
namespace OpenSim.Framework
{
[Serializable]
public class sLLVector3
{
public sLLVector3()
{
}
public sLLVector3(LLVector3 v)
{
x = v.X;
y = v.Y;
z = v.Z;
}
public float x;
public float y;
public float z;
}
}
| using System;
using libsecondlife;
namespace OpenSim.Framework
{
[Serializable]
public class sLLVector3
{
public sLLVector3()
{
}
public sLLVector3(LLVector3 v)
{
x = v.X;
y = v.Y;
z = v.Z;
}
public float x;
public float y;
public float z;
}
}
| bsd-3-clause | C# |
ecdaa3ad40ae53f5b5405645e7c3652d35030d3c | Refactor LocalDateTimeInputTests by removing unused ControlValueFormat field | YevgeniyShunevych/Atata,YevgeniyShunevych/Atata,atata-framework/atata,atata-framework/atata | src/Atata.Tests/LocalDateTimeInputTests.cs | src/Atata.Tests/LocalDateTimeInputTests.cs | using System;
using NUnit.Framework;
namespace Atata.Tests
{
public class LocalDateTimeInputTests : UITestFixture
{
private LocalDateTimeInputPage page;
protected override void OnSetUp()
{
page = Go.To<LocalDateTimeInputPage>();
}
[Test]
public void LocalDateTimeInput()
{
var control = page.Regular;
var outputControl = page.RegularOutput;
control.Should.BeNull();
var testValue = new DateTime(2019, 11, 27, 20, 45, 0);
control.Set(testValue);
control.Should.Equal(testValue);
outputControl.Should.Equal(testValue);
control.Clear();
control.Should.BeNull();
outputControl.Should.BeNull();
control.Append("invalid");
control.Should.BeNull();
outputControl.Should.BeNull();
testValue = new DateTime(2011, 1, 2, 8, 00, 0);
control.Set(testValue);
control.Should.Equal(testValue);
outputControl.Should.Equal(testValue);
}
}
}
| using System;
using NUnit.Framework;
namespace Atata.Tests
{
public class LocalDateTimeInputTests : UITestFixture
{
private const string ControlValueFormat = "yyyy-MM-ddTHH:mm";
private LocalDateTimeInputPage page;
protected override void OnSetUp()
{
page = Go.To<LocalDateTimeInputPage>();
}
[Test]
public void LocalDateTimeInput()
{
var control = page.Regular;
var outputControl = page.RegularOutput;
control.Should.BeNull();
var testValue = new DateTime(2019, 11, 27, 20, 45, 0);
control.Set(testValue);
control.Should.Equal(testValue);
outputControl.Should.Equal(testValue);
control.Clear();
control.Should.BeNull();
outputControl.Should.BeNull();
control.Append("invalid");
control.Should.BeNull();
outputControl.Should.BeNull();
testValue = new DateTime(2011, 1, 2, 8, 00, 0);
control.Set(testValue);
control.Should.Equal(testValue);
outputControl.Should.Equal(testValue);
}
}
}
| apache-2.0 | C# |
bea54eb9127e3efbf39645c66b102c847d417ee3 | Expand CssValue test coverage | Carbon/Css | src/Carbon.Css.Tests/CssValueTests.cs | src/Carbon.Css.Tests/CssValueTests.cs | using Xunit;
namespace Carbon.Css.Tests
{
public class CssValueTests
{
[Fact]
public void NumbersAreStoredAtDoublePrecision()
{
var value = CssValue.Parse("97.916666666666666666666666666667%") as CssUnitValue;
Assert.Equal(97.916666666666666666666666666667d, value.Value);
}
[Fact]
public void ParseValues()
{
var (value, unit) = CssValue.Parse("14px") as CssUnitValue;
Assert.Equal(14f, value);
Assert.Equal("px", unit.Name);
}
[Fact]
public void ParsePx()
{
var value = CssValue.Parse("14px");
Assert.Equal("14px", value.ToString());
}
[Fact]
public void A()
{
Assert.Equal("left", CssValue.Parse("left").ToString());
}
[Fact]
public void Px()
{
Assert.Equal("50px", CssValue.Parse("50px").ToString());
}
[Fact]
public void Percent()
{
Assert.Equal("50%", CssValue.Parse("50%").ToString());
}
[Fact]
public void ValueList()
{
var value = CssValue.Parse("100px 100px 100px 100px") as CssValueList;
Assert.Equal(4, value.Count);
Assert.Equal("100px 100px 100px 100px", value.ToString());
}
[Fact]
public void Url()
{
Assert.Equal("hi.jpeg", CssUrlValue.Parse("url(hi.jpeg)").Value);
Assert.Equal("hi.jpeg", CssUrlValue.Parse("url('hi.jpeg')").Value);
}
}
} | using Xunit;
namespace Carbon.Css.Tests
{
public class CssValueTests
{
[Fact]
public void A()
{
Assert.Equal("left", CssValue.Parse("left").ToString());
}
[Fact]
public void Px()
{
Assert.Equal("50px", CssValue.Parse("50px").ToString());
}
[Fact]
public void Percent()
{
Assert.Equal("50%", CssValue.Parse("50%").ToString());
}
[Fact]
public void ValueList()
{
var value = CssValue.Parse("100px 100px 100px 100px") as CssValueList;
Assert.Equal(4, value.Count);
Assert.Equal("100px 100px 100px 100px", value.ToString());
}
[Fact]
public void ParseValues()
{
var (value, unit) = CssValue.Parse("14px") as CssUnitValue;
Assert.Equal(14f, value);
Assert.Equal("px", unit.Name);
}
[Fact]
public void Url()
{
Assert.Equal("hi.jpeg", CssUrlValue.Parse("url(hi.jpeg)").Value);
Assert.Equal("hi.jpeg", CssUrlValue.Parse("url('hi.jpeg')").Value);
}
}
}
| mit | C# |
8b334c8b964aa7e043370938b8556b76481d7d6e | Update ConnectStateChangedEventArgs constructor. | CountrySideEngineer/Ev3Controller | dev/src/Ev3Controller/Model/ConnectStateChangedEventArgs.cs | dev/src/Ev3Controller/Model/ConnectStateChangedEventArgs.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ev3Controller.Model
{
public class ConnectStateChangedEventArgs : EventArgs
{
#region Constructors and the Finalizer
/// <summary>
/// Constructor
/// </summary>
/// <param name="OldValue">Old value of connection state with device.</param>
/// <param name="NewValue">New value of connection state with device.</param>
public ConnectStateChangedEventArgs(ConnectState OldValue,
ConnectState NewValue,
bool Result = true)
{
this.OldValue = OldValue;
this.NewValue = NewValue;
this.ChangedResult = Result;
}
/// <summary>
/// Constructor with one argument, represents new connection state, NewValue
/// </summary>
/// <param name="NewValue">Connection state after event fired.</param>
public ConnectStateChangedEventArgs(ConnectState NewValue, bool Result = true)
{
this.OldValue = new ConnectState(ConnectionState.Unknown);
this.NewValue = NewValue;
this.ChangedResult = Result;
}
#endregion
#region Public properties
/// <summary>
/// Represent state of connection with device BEFORE the connection state changed.
/// </summary>
public ConnectState OldValue { get; protected set; }
/// <summary>
/// Represent state of connection with device AFTER the connection state changed.
/// </summary>
public ConnectState NewValue { get; protected set; }
/// <summary>
/// Result of sequence to change connect state.
/// </summary>
public bool ChangedResult { get; protected set; }
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ev3Controller.Model
{
public class ConnectStateChangedEventArgs : EventArgs
{
#region Constructors and the Finalizer
/// <summary>
/// Constructor
/// </summary>
/// <param name="OldValue">Old value of connection state with device.</param>
/// <param name="NewValue">New value of connection state with device.</param>
public ConnectStateChangedEventArgs(ConnectState OldValue, ConnectState NewValue)
{
this.OldValue = OldValue;
this.NewValue = NewValue;
}
/// <summary>
/// Constructor with one argument, represents new connection state, NewValue
/// </summary>
/// <param name="NewValue">Connection state after event fired.</param>
public ConnectStateChangedEventArgs(ConnectState NewValue, bool Result = true)
{
this.OldValue = new ConnectState(ConnectionState.Unknown);
this.NewValue = NewValue;
}
#endregion
#region Public properties
/// <summary>
/// Represent state of connection with device BEFORE the connection state changed.
/// </summary>
public ConnectState OldValue { get; protected set; }
/// <summary>
/// Represent state of connection with device AFTER the connection state changed.
/// </summary>
public ConnectState NewValue { get; protected set; }
/// <summary>
/// Result of sequence to change connect state.
/// </summary>
public bool ChangedResult { get; protected set; }
#endregion
}
}
| mit | C# |
53cbff3eb0ad5b82f95b74acc82508cb59137a03 | Change ShouldEndSession to nullable | stoiveyp/alexa-skills-dotnet,timheuer/alexa-skills-dotnet | Alexa.NET/Response/Response.cs | Alexa.NET/Response/Response.cs | using Newtonsoft.Json;
using System.Collections.Generic;
namespace Alexa.NET.Response
{
public class ResponseBody
{
[JsonProperty("outputSpeech", NullValueHandling = NullValueHandling.Ignore)]
public IOutputSpeech OutputSpeech { get; set; }
[JsonProperty("card", NullValueHandling = NullValueHandling.Ignore)]
public ICard Card { get; set; }
[JsonProperty("reprompt", NullValueHandling = NullValueHandling.Ignore)]
public Reprompt Reprompt { get; set; }
[JsonProperty("shouldEndSession", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShouldEndSession { get; set; } = false;
[JsonProperty("directives", NullValueHandling = NullValueHandling.Ignore)]
public IList<IDirective> Directives { get; set; } = new List<IDirective>();
public bool ShouldSerializeDirectives()
{
return Directives.Count > 0;
}
}
}
| using Newtonsoft.Json;
using System.Collections.Generic;
namespace Alexa.NET.Response
{
public class ResponseBody
{
[JsonProperty("outputSpeech", NullValueHandling = NullValueHandling.Ignore)]
public IOutputSpeech OutputSpeech { get; set; }
[JsonProperty("card", NullValueHandling = NullValueHandling.Ignore)]
public ICard Card { get; set; }
[JsonProperty("reprompt", NullValueHandling = NullValueHandling.Ignore)]
public Reprompt Reprompt { get; set; }
[JsonProperty("shouldEndSession")]
[JsonRequired]
public bool ShouldEndSession { get; set; }
[JsonProperty("directives", NullValueHandling = NullValueHandling.Ignore)]
public IList<IDirective> Directives { get; set; } = new List<IDirective>();
public bool ShouldSerializeDirectives()
{
return Directives.Count > 0;
}
}
} | mit | C# |
2528a166fa34dfad2621e96990081e259e44c46e | Update version to 1.4.1 | Aaron-Liu/equeue,geffzhang/equeue,tangxuehua/equeue,geffzhang/equeue,tangxuehua/equeue,tangxuehua/equeue,Aaron-Liu/equeue | src/EQueue/Properties/AssemblyInfo.cs | src/EQueue/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.2")]
[assembly: AssemblyFileVersion("1.4.2")]
| mit | C# |
4032d669596a2031eca223c37bc2cddb9a102725 | Apply same legacy scale adjust logic to TaikoLegacyHitTarget | peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,peppy/osu,ppy/osu,smoogipooo/osu | osu.Game.Rulesets.Taiko/Skinning/TaikoLegacyHitTarget.cs | osu.Game.Rulesets.Taiko/Skinning/TaikoLegacyHitTarget.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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Taiko.Skinning
{
public class TaikoLegacyHitTarget : CompositeDrawable
{
private Container content;
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
RelativeSizeAxes = Axes.Both;
InternalChild = content = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new Sprite
{
Texture = skin.GetTexture("approachcircle"),
Scale = new Vector2(0.73f),
Alpha = 0.7f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
new Sprite
{
Texture = skin.GetTexture("taikobigcircle"),
Scale = new Vector2(0.7f),
Alpha = 0.5f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
}
};
}
protected override void Update()
{
base.Update();
// Relying on RelativeSizeAxes.Both + FillMode.Fit doesn't work due to the precise pixel layout requirements.
// This is a bit ugly but makes the non-legacy implementations a lot cleaner to implement.
content.Scale = new Vector2(DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT);
}
}
}
| // 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Taiko.Skinning
{
public class TaikoLegacyHitTarget : CompositeDrawable
{
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new Sprite
{
Texture = skin.GetTexture("approachcircle"),
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.73f) * 0.625f,
Alpha = 0.7f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
new Sprite
{
Texture = skin.GetTexture("taikobigcircle"),
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.7f) * 0.625f,
Alpha = 0.5f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
};
}
}
}
| mit | C# |
9efb0a40b05bd0e1513a6e1619430079db5b1354 | Set assembly properties | peterlanoie/aspnet-mvc-slack | src/Pelasoft.AspNet.Mvc.Slack/Properties/AssemblyInfo.cs | src/Pelasoft.AspNet.Mvc.Slack/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("Pelasoft.AspNet.Mvc.Slack")]
[assembly: AssemblyDescription("ASP.NET MVC Utilities for Slack integration")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Peter Lanoie")]
[assembly: AssemblyProduct("Pelasoft.AspNet.Mvc.Slack")]
[assembly: AssemblyCopyright("Copyright Pelasoft © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("86e42b00-af09-4384-b749-7a69105e22b9")]
// 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.*")]
| 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("Pelasoft.AspNet.Mvc.Slack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pelasoft.AspNet.Mvc.Slack")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("86e42b00-af09-4384-b749-7a69105e22b9")]
// 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# |
dd8b417040bfc56ff0a5ae8d0a6e1cb5eeec010a | Add ListItem.Tag to store extra object info if needed | PowerOfCode/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,bbqchickenrobot/Eto-1,l8s/Eto,l8s/Eto | Source/Eto/Forms/ListItem.cs | Source/Eto/Forms/ListItem.cs | using System;
using Eto.Drawing;
#if DESKTOP
using System.Windows.Markup;
#endif
namespace Eto.Forms
{
public interface IListItem
{
string Text { get; }
string Key { get; }
}
#if DESKTOP
[ContentProperty("Text")]
#endif
public class ListItem : IListItem
{
string key;
public string Text { get; set; }
public string Key {
get { return key ?? Text; }
set { key = value; }
}
public object Tag { get; set; }
}
public class ImageListItem : ListItem, IImageListItem
{
public Image Image { get; set; }
}
#if DESKTOP
[ContentProperty("Item")]
#endif
public class ObjectListItem : IListItem
{
public object Item { get; set; }
public virtual string Text {
get { return Convert.ToString (Item); }
}
public virtual string Key {
get { return Text; }
}
public ObjectListItem ()
{
}
public ObjectListItem (object item)
{
this.Item = item;
}
}
}
| using System;
using Eto.Drawing;
#if DESKTOP
using System.Windows.Markup;
#endif
namespace Eto.Forms
{
public interface IListItem
{
string Text { get; }
string Key { get; }
}
#if DESKTOP
[ContentProperty("Text")]
#endif
public class ListItem : IListItem
{
string key;
public string Text { get; set; }
public string Key {
get { return key ?? Text; }
set { key = value; }
}
}
public class ImageListItem : ListItem, IImageListItem
{
public Image Image { get; set; }
}
#if DESKTOP
[ContentProperty("Item")]
#endif
public class ObjectListItem : IListItem
{
public object Item { get; set; }
public virtual string Text {
get { return Convert.ToString (Item); }
}
public virtual string Key {
get { return Text; }
}
public ObjectListItem ()
{
}
public ObjectListItem (object item)
{
this.Item = item;
}
}
}
| bsd-3-clause | C# |
4bb23f62dc3b3bd01a36f5a8634c899ef0e1df03 | Fix crash in Spotfire 7.0, remove pre-invoke at binding beginning. | Jarrey/spotfire_dom_viewer | SpotfireDomViewer/MethodNode.cs | SpotfireDomViewer/MethodNode.cs | namespace SpotfireDomViewer
{
using System.Reflection;
public class MethodNode : DomNode
{
private object parentObject;
private MethodInfo method;
public MethodNode(object parentObj, MethodInfo m)
: base(null, NodeTypes.Method, m.ToString())
{
parentObject = parentObj;
method = m;
CanInvoke = true;
}
public string Value
{
get
{
// var v = this.Invoke();
// return v == null ? string.Empty : v.ToString();
return "Please invoke this method in right panel...";
}
}
public object Invoke()
{
if (method != null)
{
return method.Invoke(parentObject, null);
}
return null;
}
}
}
| namespace SpotfireDomViewer
{
using System.Reflection;
public class MethodNode : DomNode
{
private object parentObject;
private MethodInfo method;
public MethodNode(object parentObj, MethodInfo m)
: base(null, NodeTypes.Method, m.ToString())
{
parentObject = parentObj;
method = m;
CanInvoke = true;
}
public string Value
{
get
{
var v = this.Invoke();
return v == null ? string.Empty : v.ToString();
}
}
public object Invoke()
{
if (method != null)
{
return method.Invoke(parentObject, null);
}
return null;
}
}
}
| mit | C# |
b998f6cd984af96012c6c614541de6a6a4e160cc | Refactor Only load the profiles with JSON when requested | jazd/Business,jazd/Business,jazd/Business | CSharp/Core/Profile/Profile.cs | CSharp/Core/Profile/Profile.cs | using System;
using System.IO;
namespace Business.Core.Profile
{
public class Profile
{
public ILog Log { get; set; }
public string SQLiteDatabasePath {
get {
string path;
if (string.IsNullOrEmpty(SQLiteProfile.Path))
path = "sandbox/Business/business.sqlite3";
else
path = SQLiteProfile.Path;
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), path);
}
}
public SQLite SQLiteProfile {
get {
if (sqliteprofile == null) {
var tokens = JSON["SQLite"];
if (tokens != null) {
sqliteprofile = tokens.ToObject<SQLite>();
sqliteprofile.Active = true;
} else {
sqliteprofile = new SQLite();
}
}
return sqliteprofile;
}
}
SQLite sqliteprofile;
public PostgreSQL PostgreSQLProfile {
get {
if(postgresqlprofile == null) {
var tokens = JSON["PostgreSQL"];
if(tokens != null) {
postgresqlprofile = tokens.ToObject<PostgreSQL>();
postgresqlprofile.Active = true;
}
}
return postgresqlprofile;
}
}
PostgreSQL postgresqlprofile;
public NuoDB NuoDBProfile {
get {
if(nuodbprofile == null) {
var tokens = JSON["NuoDb"];
if (tokens != null) {
nuodbprofile = tokens.ToObject<NuoDB>();
nuodbprofile.Active = true;
}
}
return nuodbprofile;
}
}
NuoDB nuodbprofile;
public string ProfilePath {
get {
return GetBasePath() + "profile.json";
}
}
public Newtonsoft.Json.Linq.JObject JSON {
get {
if(json == null)
json = Newtonsoft.Json.Linq.JObject.Parse(File.ReadAllText(ProfilePath));
return json;
}
set {
json = value;
}
}
Newtonsoft.Json.Linq.JObject json;
public Profile() {
}
public virtual string GetBasePath() {
return AppDomain.CurrentDomain.RelativeSearchPath ?? AppDomain.CurrentDomain.BaseDirectory;
}
}
public class SQLite
{
public Boolean Active { get; set; } = true;
public string Path { get; set; }
}
public class NuoDB
{
public Boolean Active { get; set; } = false;
public string Server { get; set; } = "nuodb";
public string Database { get; set; } = "MyCo";
public string User { get; set; } = "test";
public string Password { get; set; } = "secret";
}
public class PostgreSQL
{
public Boolean Active { get; set; } = false;
public string Host { get; set; } = "postgresql";
public string Database { get; set; } = "MyCo";
public string User { get; set; } = "test";
}
}
| using System;
using System.IO;
namespace Business.Core.Profile
{
public class Profile
{
public ILog Log { get; set; }
public string SQLiteDatabasePath {
get {
String path;
if (String.IsNullOrEmpty(SQLiteProfile.Path))
path = "sandbox/Business/business.sqlite3";
else
path = SQLiteProfile.Path;
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), path);
}
}
public SQLite SQLiteProfile { get; set; }
public NuoDB NuoDBProfile { get; set; }
public PostgreSQL PostgreSQLProfile { get; set; }
public string ProfilePath {
get {
return GetBasePath() + "profile.json";
}
}
public Newtonsoft.Json.Linq.JObject JSON {
get {
if(json == null)
json = Newtonsoft.Json.Linq.JObject.Parse(File.ReadAllText(ProfilePath));
return json;
}
set {
json = value;
}
}
Newtonsoft.Json.Linq.JObject json;
public Profile() {
SQLiteProfile = new SQLite();
NuoDBProfile = new NuoDB();
PostgreSQLProfile = new PostgreSQL();
try {
var sqlite = JSON["SQLite"];
if(sqlite != null) {
SQLiteProfile = sqlite.ToObject<SQLite>();
SQLiteProfile.Active = true;
}
var nuoDb = JSON["NuoDb"];
if (nuoDb != null) {
NuoDBProfile = nuoDb.ToObject<NuoDB>();
NuoDBProfile.Active = true;
}
var postgreSQL = JSON["PostgreSQL"];
if (postgreSQL != null) {
PostgreSQLProfile = postgreSQL.ToObject<PostgreSQL>();
PostgreSQLProfile.Active = true;
}
} catch (Exception e) {
throw e;
// Use the profile object defaults
}
}
public virtual string GetBasePath() {
return AppDomain.CurrentDomain.RelativeSearchPath ?? AppDomain.CurrentDomain.BaseDirectory;
}
}
public class SQLite
{
public Boolean Active { get; set; } = true;
public string Path { get; set; }
}
public class NuoDB
{
public Boolean Active { get; set; } = false;
public string Server { get; set; } = "nuodb";
public string Database { get; set; } = "MyCo";
public string User { get; set; } = "test";
public string Password { get; set; } = "secret";
}
public class PostgreSQL
{
public Boolean Active { get; set; } = false;
public string Host { get; set; } = "postgresql";
public string Database { get; set; } = "MyCo";
public string User { get; set; } = "test";
}
}
| mit | C# |
d0d15cb0030f3a1132fc26b4cf4f83f25eecc048 | Fix errors in docstrings. | JustinRChou/nunit,NikolayPianikov/nunit,jadarnel27/nunit,mjedrzejek/nunit,mikkelbu/nunit,agray/nunit,agray/nunit,appel1/nunit,agray/nunit,ggeurts/nunit,NikolayPianikov/nunit,OmicronPersei/nunit,JustinRChou/nunit,nunit/nunit,OmicronPersei/nunit,mjedrzejek/nunit,mikkelbu/nunit,appel1/nunit,nunit/nunit,ggeurts/nunit,jadarnel27/nunit | src/NUnitFramework/framework/Internal/ConstraintUtil.cs | src/NUnitFramework/framework/Internal/ConstraintUtil.cs | // ***********************************************************************
// Copyright (c) 2015 Charlie Poole, Rob Prouse
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Globalization;
namespace NUnit.Framework.Internal
{
/// <summary>
/// Provides methods to support consistent checking for constaints methods.
/// </summary>
internal class ConstraintUtil
{
/// <summary>
/// Require that the provided object is actually of the type required,
/// and that it is not null.
/// <param name="actual">The object to verify</param>
/// <param name="paramName">Name of the parameter as passed into the checking method.</param>
/// <typeparam name="T">The type to require</typeparam>
/// <returns>A properly typed object, or throws. Never null.</returns>
/// </summary>
public static T RequireActual<T>(object actual, string paramName)
{
if (actual is T) return (T)actual;
var actualDisplay = actual == null ? "null" : actual.GetType().Name;
throw new ArgumentException($"Expected: {typeof(T).Name} But was: {actualDisplay}", paramName);
}
}
}
| // ***********************************************************************
// Copyright (c) 2015 Charlie Poole, Rob Prouse
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Globalization;
namespace NUnit.Framework.Internal
{
/// <summary>
/// Provides methods to support consistent checking for constaints methods.
/// </summary>
internal class ConstraintUtil
{
/// <summary>
/// Require that the provided object is actually of the type required,
/// and that it is not null.
/// <param name="object">The object to verify</param>
/// <param name="paramName">Name of the parameter as passed into the checking method.</param>
/// <returns>A properly typed object, or throws. Never null.</returns>
/// </summary>
public static T RequireActual<T>(object actual, string paramName)
{
if (actual is T) return (T)actual;
var actualDisplay = actual == null ? "null" : actual.GetType().Name;
throw new ArgumentException($"Expected: {typeof(T).Name} But was: {actualDisplay}", paramName);
}
}
}
| mit | C# |
467f9bf5b92eae6bce049966d67c39ae2a0a25e5 | Rearrange properties to be standards compliant | tgstation/tgstation-server-tools,tgstation/tgstation-server,Cyberboss/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server | src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs | src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs | using System;
using System.DirectoryServices.AccountManagement;
using System.Security.Principal;
using System.Threading;
using System.Threading.Tasks;
namespace Tgstation.Server.Host.Security
{
/// <summary>
/// <see cref="ISystemIdentity"/> for windows systems
/// </summary>
sealed class WindowsSystemIdentity : ISystemIdentity
{
/// <inheritdoc />
public string Uid => (userPrincipal?.Sid ?? identity.User).ToString();
/// <inheritdoc />
public string Username => userPrincipal?.Name ?? identity.Name;
/// <summary>
/// The <see cref="WindowsIdentity"/> for the <see cref="WindowsSystemIdentity"/>
/// </summary>
readonly WindowsIdentity identity;
/// <summary>
/// The <see cref="UserPrincipal"/> for the <see cref="WindowsSystemIdentity"/>
/// </summary>
readonly UserPrincipal userPrincipal;
/// <summary>
/// Construct a <see cref="WindowsSystemIdentity"/> using a <see cref="WindowsIdentity"/>
/// </summary>
/// <param name="identity">The value of <see cref="identity"/></param>
public WindowsSystemIdentity(WindowsIdentity identity)
{
this.identity = identity ?? throw new ArgumentNullException(nameof(identity));
}
/// <summary>
/// Construct a <see cref="WindowsSystemIdentity"/> using a <see cref="UserPrincipal"/>
/// </summary>
/// <param name="userPrincipal">The value of <see cref="userPrincipal"/></param>
public WindowsSystemIdentity(UserPrincipal userPrincipal)
{
this.userPrincipal = userPrincipal ?? throw new ArgumentNullException(nameof(userPrincipal));
}
/// <inheritdoc />
public void Dispose()
{
if (identity != null)
identity.Dispose();
else
{
var context = userPrincipal.Context;
userPrincipal.Dispose();
context.Dispose();
}
}
/// <inheritdoc />
public ISystemIdentity Clone()
{
if (identity != null)
{
//var newIdentity = (WindowsIdentity)identity.Clone(); //doesn't work because of https://github.com/dotnet/corefx/issues/31841
var newIdentity = new WindowsIdentity(identity.Token); //the handle is cloned internally
return new WindowsSystemIdentity(newIdentity);
}
//can't clone a UP, shouldn't be trying to anyway, cloning is for impersonation
throw new InvalidOperationException("Cannot clone a UserPrincipal based WindowsSystemIdentity!");
}
/// <inheritdoc />
public Task RunImpersonated(Action action, CancellationToken cancellationToken) => Task.Factory.StartNew(() =>
{
if (action == null)
throw new ArgumentNullException(nameof(action));
if (identity == null)
throw new InvalidOperationException("Impersonate using a UserPrincipal based WindowsSystemIdentity!");
WindowsIdentity.RunImpersonated(identity.AccessToken, action);
}, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current);
}
} | using System;
using System.DirectoryServices.AccountManagement;
using System.Security.Principal;
using System.Threading;
using System.Threading.Tasks;
namespace Tgstation.Server.Host.Security
{
/// <summary>
/// <see cref="ISystemIdentity"/> for windows systems
/// </summary>
sealed class WindowsSystemIdentity : ISystemIdentity
{
/// <summary>
/// The <see cref="WindowsIdentity"/> for the <see cref="WindowsSystemIdentity"/>
/// </summary>
readonly WindowsIdentity identity;
/// <summary>
/// The <see cref="UserPrincipal"/> for the <see cref="WindowsSystemIdentity"/>
/// </summary>
readonly UserPrincipal userPrincipal;
/// <summary>
/// Construct a <see cref="WindowsSystemIdentity"/> using a <see cref="WindowsIdentity"/>
/// </summary>
/// <param name="identity">The value of <see cref="identity"/></param>
public WindowsSystemIdentity(WindowsIdentity identity)
{
this.identity = identity ?? throw new ArgumentNullException(nameof(identity));
}
/// <summary>
/// Construct a <see cref="WindowsSystemIdentity"/> using a <see cref="UserPrincipal"/>
/// </summary>
/// <param name="userPrincipal">The value of <see cref="userPrincipal"/></param>
public WindowsSystemIdentity(UserPrincipal userPrincipal)
{
this.userPrincipal = userPrincipal ?? throw new ArgumentNullException(nameof(userPrincipal));
}
/// <inheritdoc />
public void Dispose()
{
if (identity != null)
identity.Dispose();
else
{
var context = userPrincipal.Context;
userPrincipal.Dispose();
context.Dispose();
}
}
/// <inheritdoc />
public string Uid => (userPrincipal?.Sid ?? identity.User).ToString();
/// <inheritdoc />
public string Username => userPrincipal?.Name ?? identity.Name;
/// <inheritdoc />
public ISystemIdentity Clone()
{
if (identity != null)
{
//var newIdentity = (WindowsIdentity)identity.Clone(); //doesn't work because of https://github.com/dotnet/corefx/issues/31841
var newIdentity = new WindowsIdentity(identity.Token); //the handle is cloned internally
return new WindowsSystemIdentity(newIdentity);
}
//can't clone a UP, shouldn't be trying to anyway, cloning is for impersonation
throw new InvalidOperationException("Cannot clone a UserPrincipal based WindowsSystemIdentity!");
}
/// <inheritdoc />
public Task RunImpersonated(Action action, CancellationToken cancellationToken) => Task.Factory.StartNew(() =>
{
if (action == null)
throw new ArgumentNullException(nameof(action));
if (identity == null)
throw new InvalidOperationException("Impersonate using a UserPrincipal based WindowsSystemIdentity!");
WindowsIdentity.RunImpersonated(identity.AccessToken, action);
}, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current);
}
} | agpl-3.0 | C# |
982f6b1a68d096da61e5b140a6d5c4af3ddbc208 | Add basic constructor to AutocompleteResponse. | jcheng31/WundergroundAutocomplete.NET | WundergroundClient/Autocomplete/AutocompleteResponse.cs | WundergroundClient/Autocomplete/AutocompleteResponse.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WundergroundClient.Autocomplete
{
class AutocompleteResponse
{
public Boolean IsSuccessful { get; private set; }
public IList<AutocompleteResponseObject> Results;
public AutocompleteResponse(bool isSuccessful)
{
IsSuccessful = isSuccessful;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WundergroundClient.Autocomplete
{
class AutocompleteResponse
{
public Boolean IsSuccessful { get; private set; }
public IList<AutocompleteResponseObject> Results;
}
}
| mit | C# |
abefdc7949b1bcbdb69b8e3d70fb94254ae6f7b2 | Add ClientId to PasswordChangeTicketRequest (#464) | auth0/auth0.net,auth0/auth0.net | src/Auth0.ManagementApi/Models/PasswordChangeTicketRequest.cs | src/Auth0.ManagementApi/Models/PasswordChangeTicketRequest.cs | using Newtonsoft.Json;
namespace Auth0.ManagementApi.Models
{
/// <summary>
///
/// </summary>
public class PasswordChangeTicketRequest
{
/// <summary>
/// The user will be redirected to this endpoint once the ticket is used.
/// </summary>
[JsonProperty("result_url")]
public string ResultUrl { get; set; }
/// <summary>
/// The user ID for which the ticket is to be created.
/// </summary>
[JsonProperty("user_id")]
public string UserId { get; set; }
/// <summary>
/// The connection that provides the identity for which the password is to be changed. If sending this parameter, the <see cref="Email"/> is also required and the <see cref="UserId"/> is invalid.
/// </summary>
[JsonProperty("connection_id")]
public string ConnectionId { get; set; }
/// <summary>
/// The user's email.
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }
/// <summary>
/// The ticket's lifetime in seconds starting from the moment of creation.
/// After expiration the ticket can not be used to change the users's password.
/// If not specified or if you send 0 the Auth0 default lifetime will be applied
/// </summary>
[JsonProperty("ttl_sec")]
public int? Ttl { get; set; }
/// <summary>
/// Whether the email_verified attribute will be set once the password is changed.
/// </summary>
[JsonProperty("mark_email_as_verified")]
public bool? MarkEmailAsVerified { get; set; }
/// <summary>
/// Whether the reset_email will include the email as part of the returnUrl.
/// </summary>
[JsonProperty("includeEmailInRedirect")]
public bool? IncludeEmailInRedirect { get; set; }
/// <summary>
/// ID of the client.
/// If provided for tenants using the New Universal Login experience,
/// the user will be prompted to redirect to the default login route of the corresponding application once the ticket is used.
/// See <see href="https://auth0.com/docs/universal-login/configure-default-login-routes">Configuring Default Login Routes</see> for more details.
/// </summary>
[JsonProperty("client_id")]
public string ClientId { get; set; }
}
} | using Newtonsoft.Json;
namespace Auth0.ManagementApi.Models
{
/// <summary>
///
/// </summary>
public class PasswordChangeTicketRequest
{
/// <summary>
/// The user will be redirected to this endpoint once the ticket is used.
/// </summary>
[JsonProperty("result_url")]
public string ResultUrl { get; set; }
/// <summary>
/// The user ID for which the ticket is to be created.
/// </summary>
[JsonProperty("user_id")]
public string UserId { get; set; }
/// <summary>
/// The connection that provides the identity for which the password is to be changed. If sending this parameter, the <see cref="Email"/> is also required and the <see cref="UserId"/> is invalid.
/// </summary>
[JsonProperty("connection_id")]
public string ConnectionId { get; set; }
/// <summary>
/// The user's email.
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }
/// <summary>
/// The ticket's lifetime in seconds starting from the moment of creation.
/// After expiration the ticket can not be used to change the users's password.
/// If not specified or if you send 0 the Auth0 default lifetime will be applied
/// </summary>
[JsonProperty("ttl_sec")]
public int? Ttl { get; set; }
/// <summary>
/// Whether the email_verified attribute will be set once the password is changed.
/// </summary>
[JsonProperty("mark_email_as_verified")]
public bool? MarkEmailAsVerified { get; set; }
/// <summary>
/// Whether the reset_email will include the email as part of the returnUrl.
/// </summary>
[JsonProperty("includeEmailInRedirect")]
public bool? IncludeEmailInRedirect { get; set; }
}
} | mit | C# |
b4d6495f99a60194a8609cf3d35d048166001b03 | Fix editor skin providing container not providing playable beatmap | ppy/osu,ppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,smoogipoo/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipooo/osu | osu.Game/Screens/Edit/EditorSkinProvidingContainer.cs | osu.Game/Screens/Edit/EditorSkinProvidingContainer.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.Game.Skinning;
#nullable enable
namespace osu.Game.Screens.Edit
{
/// <summary>
/// A <see cref="SkinProvidingContainer"/> that fires <see cref="ISkinSource.SourceChanged"/> when users have made a change to the beatmap skin
/// of the map being edited.
/// </summary>
public class EditorSkinProvidingContainer : RulesetSkinProvidingContainer
{
private readonly EditorBeatmapSkin? beatmapSkin;
public EditorSkinProvidingContainer(EditorBeatmap editorBeatmap)
: base(editorBeatmap.PlayableBeatmap.BeatmapInfo.Ruleset.CreateInstance(), editorBeatmap.PlayableBeatmap, editorBeatmap.BeatmapSkin)
{
beatmapSkin = editorBeatmap.BeatmapSkin;
}
protected override void LoadComplete()
{
base.LoadComplete();
if (beatmapSkin != null)
beatmapSkin.BeatmapSkinChanged += TriggerSourceChanged;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (beatmapSkin != null)
beatmapSkin.BeatmapSkinChanged -= TriggerSourceChanged;
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Skinning;
#nullable enable
namespace osu.Game.Screens.Edit
{
/// <summary>
/// A <see cref="SkinProvidingContainer"/> that fires <see cref="ISkinSource.SourceChanged"/> when users have made a change to the beatmap skin
/// of the map being edited.
/// </summary>
public class EditorSkinProvidingContainer : RulesetSkinProvidingContainer
{
private readonly EditorBeatmapSkin? beatmapSkin;
public EditorSkinProvidingContainer(EditorBeatmap editorBeatmap)
: base(editorBeatmap.PlayableBeatmap.BeatmapInfo.Ruleset.CreateInstance(), editorBeatmap, editorBeatmap.BeatmapSkin)
{
beatmapSkin = editorBeatmap.BeatmapSkin;
}
protected override void LoadComplete()
{
base.LoadComplete();
if (beatmapSkin != null)
beatmapSkin.BeatmapSkinChanged += TriggerSourceChanged;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (beatmapSkin != null)
beatmapSkin.BeatmapSkinChanged -= TriggerSourceChanged;
}
}
}
| mit | C# |
79fc8cd4c6a03da01cb78f02eb456edf4f3c8069 | Revert "Enum - Add methods to verify against the user's role if the user can add, delete, or find users" | penblade/Training.CSharpWorkshop | Training.CSharpWorkshop/User.cs | Training.CSharpWorkshop/User.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Training.CSharpWorkshop
{
public class User
{
public int Id { get; set; }
public string Name { get; set; }
public RoleEnum Role { get; set; }
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Training.CSharpWorkshop
{
public class User
{
public int Id { get; set; }
public string Name { get; set; }
public RoleEnum Role { get; set; }
}
namespace Training.CSharpWorkshop
{
public class User
{
public int Id { get; set; }
public string Name { get; set; }
public RoleEnum Role { get; set; }
public virtual bool CanInsert()
{
return Role == RoleEnum.Admin;
}
public bool CanDelete()
{
return Role == RoleEnum.Admin;
}
public bool CanFind()
{
return Role != RoleEnum.None;
}
}
}
} | mit | C# |
40aab9865d24ed8da252f1647a898704f29d8439 | Add override for AddSerializerDelegates (#5010) | ElanHasson/orleans,waynemunro/orleans,pherbel/orleans,yevhen/orleans,ibondy/orleans,yevhen/orleans,galvesribeiro/orleans,ibondy/orleans,veikkoeeva/orleans,dotnet/orleans,galvesribeiro/orleans,hoopsomuah/orleans,ElanHasson/orleans,jthelin/orleans,waynemunro/orleans,sergeybykov/orleans,sergeybykov/orleans,amccool/orleans,benjaminpetit/orleans,pherbel/orleans,Liversage/orleans,jason-bragg/orleans,Liversage/orleans,Liversage/orleans,amccool/orleans,amccool/orleans,ReubenBond/orleans,dotnet/orleans,hoopsomuah/orleans | src/Orleans.Core/Serialization/SerializerFeatureExtensions.cs | src/Orleans.Core/Serialization/SerializerFeatureExtensions.cs | using System;
using Orleans.Utilities;
namespace Orleans.Serialization
{
internal static class SerializerFeatureExtensions
{
/// <summary>
/// Adds <paramref name="type"/> as a known type.
/// </summary>
/// <param name="serializerFeature">The serializer feature.</param>
/// <param name="type">The type.</param>
public static void AddKnownType(this SerializerFeature serializerFeature, Type type)
{
serializerFeature.KnownTypes.Add(new SerializerKnownTypeMetadata(RuntimeTypeNameFormatter.Format(type), type.OrleansTypeKeyString()));
}
/// <summary>
/// Adds serialization delegates for <paramref name="type"/>.
/// </summary>
/// <param name="serializerFeature">The serializer feature.</param>
/// <param name="type">The type.</param>
/// <param name="copier">The copy delegate.</param>
/// <param name="serializer">The serializer delegate.</param>
/// <param name="deserializer">The deserializer delegate.</param>
public static void AddSerializerDelegates(this SerializerFeature serializerFeature, Type type, DeepCopier copier, Serializer serializer, Deserializer deserializer)
{
serializerFeature.SerializerDelegates.Add(new SerializerDelegateMetadata(type, copier, serializer, deserializer, overrideExisting: true));
}
/// <summary>
/// Adds serialization delegates for <paramref name="type"/>.
/// </summary>
/// <param name="serializerFeature">The serializer feature.</param>
/// <param name="type">The type.</param>
/// <param name="copier">The copy delegate.</param>
/// <param name="serializer">The serializer delegate.</param>
/// <param name="deserializer">The deserializer delegate.</param>
/// <param name="overrideExisting">Whether or not to override existing registrations.</param>
public static void AddSerializerDelegates(this SerializerFeature serializerFeature, Type type, DeepCopier copier, Serializer serializer, Deserializer deserializer, bool overrideExisting)
{
serializerFeature.SerializerDelegates.Add(new SerializerDelegateMetadata(type, copier, serializer, deserializer, overrideExisting));
}
}
} | using System;
using Orleans.Utilities;
namespace Orleans.Serialization
{
internal static class SerializerFeatureExtensions
{
/// <summary>
/// Adds <paramref name="type"/> as a known type.
/// </summary>
/// <param name="serializerFeature">The serializer feature.</param>
/// <param name="type">The type.</param>
public static void AddKnownType(this SerializerFeature serializerFeature, Type type)
{
serializerFeature.KnownTypes.Add(new SerializerKnownTypeMetadata(RuntimeTypeNameFormatter.Format(type), type.OrleansTypeKeyString()));
}
/// <summary>
/// Adds serialization delegates for <paramref name="type"/>.
/// </summary>
/// <param name="serializerFeature">The serializer feature.</param>
/// <param name="type">The type.</param>
/// <param name="copier">The copy delegate.</param>
/// <param name="serializer">The serializer delegate.</param>
/// <param name="deserializer">The deserializer delegate.</param>
/// <param name="overrideExisting">Whether or not to override other registrations.</param>
public static void AddSerializerDelegates(this SerializerFeature serializerFeature, Type type, DeepCopier copier, Serializer serializer, Deserializer deserializer, bool overrideExisting = true)
{
serializerFeature.SerializerDelegates.Add(new SerializerDelegateMetadata(type, copier, serializer, deserializer, overrideExisting));
}
}
} | mit | C# |
6366a245036952b0b1d0287b2b58f1b13a41f8bb | Add demo | TrekBikes/Trek.BalihooApiClient | ConsoleApplication1/Program.cs | ConsoleApplication1/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace Trek.BalihooApiClient.Sample
{
class Program
{
static void Main()
{
// https://github.com/balihoo/local-connect-client
var client = new BalihooApiClient();
//client.GenerateClientApiKey("", "");
// Not sure where this list of location Ids are supposed to come from
var list = new List<int> { 85104, 1103020 };
var result = client.GetCampaigns(list);
var tactics = (from location in result
from campaign in location.Value
from tactic in campaign.Tactics
select tactic.Id).Distinct().ToList();
foreach (var tacticId in tactics)
{
var tacticMetrics = client.GetTacticMetrics(list, tacticId);
}
// Get Location Email Report
var reportResults = client.GetEmailReportData(list);
Console.ReadLine();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace Trek.BalihooApiClient.Sample
{
class Program
{
static void Main()
{
// https://github.com/balihoo/local-connect-client
var client = new BalihooApiClient();
//client.GenerateClientApiKey("", "");
// Not sure where this list of location Ids are supposed to come from
var list = new List<int> { 85104, 1103020 };
var result = client.GetCampaigns(list);
var tactics = (from location in result
from campaign in location.Value
from tactic in campaign.Tactics
select tactic.Id).Distinct().ToList();
foreach (var tacticId in tactics)
{
var tacticMetrics = client.GetTacticMetrics(list, tacticId);
}
Console.ReadLine();
}
}
}
| mit | C# |
cc0661019d76f48d41a874d2d2b703c56c0131af | 解决 #95 | Sandwych/slipstream,Sandwych/slipstream,Sandwych/slipstream,Sandwych/slipstream | src/ObjectServer.Core/Data/Postgresql/PgSqlTypeConverter.cs | src/ObjectServer.Core/Data/Postgresql/PgSqlTypeConverter.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using ObjectServer.Model;
namespace ObjectServer.Data
{
internal sealed class PgSqlTypeConverter
{
private PgSqlTypeConverter()
{
}
private static readonly Dictionary<FieldType, Func<IFieldDescriptor, string>> mapping =
new Dictionary<FieldType, Func<IFieldDescriptor, string>>()
{
{ FieldType.ID, f => "bigserial not null primary key" },
{ FieldType.Boolean, f => "boolean" },
{ FieldType.Integer, f => "int4" },
{ FieldType.BigInteger, f => "int8" },
{ FieldType.DateTime, f => "timestamp" },
{ FieldType.Date, f => "date" },
{ FieldType.Time, f => "time" },
{ FieldType.Float, f => "float8" },
{ FieldType.Decimal, f => "decimal" },
{ FieldType.Text, f => "text" },
{ FieldType.Binary, f => "bytea" },
{ FieldType.ManyToOne, f => "int8" },
{ FieldType.Chars, f => f.Size > 0 ? string.Format("varchar({0})", f.Size) : "varchar" },
{ FieldType.Enumeration, f => string.Format("varchar({0})", f.Size) },
{ FieldType.Reference, f => "varchar(128)" },
};
public static string GetSqlType(IFieldDescriptor field)
{
if (field == null)
{
throw new ArgumentNullException("field");
}
var func = mapping[field.Type];
var sb = new StringBuilder();
sb.Append(func(field));
if (field.IsRequired)
{
sb.Append(' ');
sb.Append("not null");
}
if (field.IsUnique)
{
sb.Append(' ');
sb.Append("unique");
}
return sb.ToString();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using ObjectServer.Model;
namespace ObjectServer.Data
{
internal sealed class PgSqlTypeConverter
{
private PgSqlTypeConverter()
{
}
private static readonly Dictionary<FieldType, Func<IFieldDescriptor, string>> mapping =
new Dictionary<FieldType, Func<IFieldDescriptor, string>>()
{
{ FieldType.ID, f => "bigserial not null primary key" },
{ FieldType.Boolean, f => "boolean" },
{ FieldType.Integer, f => "int4" },
{ FieldType.BigInteger, f => "int8" },
{ FieldType.DateTime, f => "timestamp" },
{ FieldType.Date, f => "date" },
{ FieldType.Time, f => "time" },
{ FieldType.Float, f => "float8" },
{ FieldType.Decimal, f => "decimal" },
{ FieldType.Text, f => "text" },
{ FieldType.Binary, f => "bytea" },
{ FieldType.ManyToOne, f => "int8" },
{ FieldType.Chars, f => f.Size > 0 ? string.Format("varchar({0})", f.Size) : "varchar" },
{ FieldType.Enumeration, f => string.Format("varchar({0})", f.Size) },
{ FieldType.Reference, f => "varchar(128)" },
};
public static string GetSqlType(IFieldDescriptor field)
{
if (field == null)
{
throw new ArgumentNullException("field");
}
var func = mapping[field.Type];
var sqlTypeStr = func(field);
if (field.IsRequired)
{
sqlTypeStr = sqlTypeStr + ' ' + "not null";
}
return sqlTypeStr;
}
}
}
| agpl-3.0 | C# |
604535b58a9eebe103a4ab55d5e95d29357173c4 | Fix new lines for SourceBuild (#39130) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Security/Authentication/Certificate/src/AssemblyInfo.cs | src/Security/Authentication/Certificate/src/AssemblyInfo.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Authentication.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Authentication.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
| apache-2.0 | C# |
d415af6a06fdf460c479cd5404b2720b130c3920 | Delete initialization of the IProjectTypeLookupService | orthoxerox/roslyn,bbarry/roslyn,KevinRansom/roslyn,gafter/roslyn,AnthonyDGreen/roslyn,gafter/roslyn,pdelvo/roslyn,brettfo/roslyn,tmat/roslyn,ErikSchierboom/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,pdelvo/roslyn,wvdd007/roslyn,jeffanders/roslyn,CaptainHayashi/roslyn,AlekseyTs/roslyn,tmeschter/roslyn,Giftednewt/roslyn,tannergooding/roslyn,amcasey/roslyn,DustinCampbell/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,nguerrera/roslyn,srivatsn/roslyn,CyrusNajmabadi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mmitche/roslyn,paulvanbrenk/roslyn,genlu/roslyn,orthoxerox/roslyn,cston/roslyn,tmat/roslyn,yeaicc/roslyn,reaction1989/roslyn,physhi/roslyn,tannergooding/roslyn,MichalStrehovsky/roslyn,AnthonyDGreen/roslyn,AArnott/roslyn,swaroop-sridhar/roslyn,paulvanbrenk/roslyn,nguerrera/roslyn,physhi/roslyn,drognanar/roslyn,KirillOsenkov/roslyn,dpoeschl/roslyn,xoofx/roslyn,agocke/roslyn,brettfo/roslyn,xasx/roslyn,AmadeusW/roslyn,reaction1989/roslyn,swaroop-sridhar/roslyn,aelij/roslyn,swaroop-sridhar/roslyn,KevinH-MS/roslyn,OmarTawfik/roslyn,lorcanmooney/roslyn,stephentoub/roslyn,VSadov/roslyn,xoofx/roslyn,CyrusNajmabadi/roslyn,agocke/roslyn,jkotas/roslyn,sharwell/roslyn,abock/roslyn,orthoxerox/roslyn,diryboy/roslyn,abock/roslyn,xasx/roslyn,dpoeschl/roslyn,tvand7093/roslyn,MattWindsor91/roslyn,jamesqo/roslyn,jkotas/roslyn,jcouv/roslyn,TyOverby/roslyn,heejaechang/roslyn,khyperia/roslyn,weltkante/roslyn,Hosch250/roslyn,bkoelman/roslyn,sharwell/roslyn,akrisiun/roslyn,Hosch250/roslyn,eriawan/roslyn,mavasani/roslyn,lorcanmooney/roslyn,KevinH-MS/roslyn,KirillOsenkov/roslyn,mattwar/roslyn,jeffanders/roslyn,jmarolf/roslyn,bartdesmet/roslyn,zooba/roslyn,jasonmalinowski/roslyn,davkean/roslyn,pdelvo/roslyn,jmarolf/roslyn,yeaicc/roslyn,sharwell/roslyn,mmitche/roslyn,jamesqo/roslyn,KirillOsenkov/roslyn,AArnott/roslyn,xoofx/roslyn,mgoertz-msft/roslyn,nguerrera/roslyn,dotnet/roslyn,diryboy/roslyn,drognanar/roslyn,mmitche/roslyn,DustinCampbell/roslyn,davkean/roslyn,robinsedlaczek/roslyn,srivatsn/roslyn,mgoertz-msft/roslyn,panopticoncentral/roslyn,tvand7093/roslyn,bbarry/roslyn,CaptainHayashi/roslyn,shyamnamboodiripad/roslyn,robinsedlaczek/roslyn,diryboy/roslyn,khyperia/roslyn,Giftednewt/roslyn,tvand7093/roslyn,jcouv/roslyn,tmeschter/roslyn,bbarry/roslyn,OmarTawfik/roslyn,genlu/roslyn,tmat/roslyn,srivatsn/roslyn,AArnott/roslyn,bartdesmet/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,akrisiun/roslyn,heejaechang/roslyn,eriawan/roslyn,tmeschter/roslyn,VSadov/roslyn,MattWindsor91/roslyn,weltkante/roslyn,amcasey/roslyn,MichalStrehovsky/roslyn,physhi/roslyn,bkoelman/roslyn,panopticoncentral/roslyn,panopticoncentral/roslyn,a-ctor/roslyn,stephentoub/roslyn,vslsnap/roslyn,dotnet/roslyn,VSadov/roslyn,vslsnap/roslyn,mattwar/roslyn,akrisiun/roslyn,jasonmalinowski/roslyn,dpoeschl/roslyn,genlu/roslyn,MichalStrehovsky/roslyn,MattWindsor91/roslyn,amcasey/roslyn,AmadeusW/roslyn,TyOverby/roslyn,ErikSchierboom/roslyn,abock/roslyn,paulvanbrenk/roslyn,davkean/roslyn,bkoelman/roslyn,TyOverby/roslyn,heejaechang/roslyn,brettfo/roslyn,vslsnap/roslyn,kelltrick/roslyn,zooba/roslyn,jkotas/roslyn,stephentoub/roslyn,agocke/roslyn,AnthonyDGreen/roslyn,robinsedlaczek/roslyn,kelltrick/roslyn,jasonmalinowski/roslyn,a-ctor/roslyn,AmadeusW/roslyn,mattscheffer/roslyn,Hosch250/roslyn,mattscheffer/roslyn,jcouv/roslyn,drognanar/roslyn,mattscheffer/roslyn,reaction1989/roslyn,zooba/roslyn,CaptainHayashi/roslyn,lorcanmooney/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,MattWindsor91/roslyn,dotnet/roslyn,AlekseyTs/roslyn,mavasani/roslyn,jmarolf/roslyn,kelltrick/roslyn,tannergooding/roslyn,a-ctor/roslyn,khyperia/roslyn,KevinRansom/roslyn,cston/roslyn,mgoertz-msft/roslyn,aelij/roslyn,Giftednewt/roslyn,AlekseyTs/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,aelij/roslyn,KevinH-MS/roslyn,mattwar/roslyn,cston/roslyn,weltkante/roslyn,wvdd007/roslyn,jamesqo/roslyn,yeaicc/roslyn,mavasani/roslyn,DustinCampbell/roslyn,gafter/roslyn,jeffanders/roslyn,ErikSchierboom/roslyn,xasx/roslyn,eriawan/roslyn,OmarTawfik/roslyn | src/VisualStudio/Core/Def/Telemetry/RoslynTelemetrySetup.cs | src/VisualStudio/Core/Def/Telemetry/RoslynTelemetrySetup.cs | using System;
using System.ComponentModel.Composition;
using System.Diagnostics;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Options;
using Microsoft.Internal.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.LanguageServices;
using Microsoft.VisualStudio.LanguageServices.Setup;
namespace Microsoft.VisualStudio.LanguageServices.Telemetry
{
[Export(typeof(IRoslynTelemetrySetup))]
internal class RoslynTelemetrySetup : IRoslynTelemetrySetup
{
public void Initialize(IServiceProvider serviceProvider)
{
var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
var workspace = componentModel.GetService<VisualStudioWorkspace>();
// set initial logger
var optionService = workspace.Services.GetService<IOptionService>();
var loggingChecker = Logger.GetLoggingChecker(optionService);
var telemetryService = serviceProvider.GetService(typeof(SVsTelemetryService)) as IVsTelemetryService;
Logger.SetLogger(
AggregateLogger.Create(
CodeMarkerLogger.Instance,
new EtwLogger(loggingChecker),
new VSTelemetryLogger(telemetryService),
new VSTelemetryActivityLogger(telemetryService),
Logger.GetLogger()));
Logger.Log(FunctionId.Run_Environment, KeyValueLogMessage.Create(m => m["Version"] = FileVersionInfo.GetVersionInfo(typeof(VisualStudioWorkspace).Assembly.Location).FileVersion));
}
}
}
| using System;
using System.ComponentModel.Composition;
using System.Diagnostics;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Options;
using Microsoft.Internal.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.LanguageServices;
using Microsoft.VisualStudio.LanguageServices.Setup;
namespace Microsoft.VisualStudio.LanguageServices.Telemetry
{
[Export(typeof(IRoslynTelemetrySetup))]
internal class RoslynTelemetrySetup : IRoslynTelemetrySetup
{
public void Initialize(IServiceProvider serviceProvider)
{
var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
var workspace = componentModel.GetService<VisualStudioWorkspace>();
// initialize host context on UI thread.
var projectTypeLookup = workspace.Services.GetService<IProjectTypeLookupService>();
// set initial logger
var optionService = workspace.Services.GetService<IOptionService>();
var loggingChecker = Logger.GetLoggingChecker(optionService);
var telemetryService = serviceProvider.GetService(typeof(SVsTelemetryService)) as IVsTelemetryService;
Logger.SetLogger(
AggregateLogger.Create(
CodeMarkerLogger.Instance,
new EtwLogger(loggingChecker),
new VSTelemetryLogger(telemetryService),
new VSTelemetryActivityLogger(telemetryService),
Logger.GetLogger()));
Logger.Log(FunctionId.Run_Environment, KeyValueLogMessage.Create(m => m["Version"] = FileVersionInfo.GetVersionInfo(typeof(VisualStudioWorkspace).Assembly.Location).FileVersion));
}
}
}
| mit | C# |
c248d3be1b0809e69c610fd0d8b5320a2e5eb19b | Update of BookDefaultDetails to accomodate new default types (e.g. agency) | RWE-Nexus/EnergyTrading-MDM-Contracts | Code/EnergyTrading.MDM.Contracts/BookDefaultDetails.cs | Code/EnergyTrading.MDM.Contracts/BookDefaultDetails.cs | namespace RWEST.Nexus.MDM.Contracts
{
using System.Runtime.Serialization;
using System.Xml.Serialization;
[DataContract(Namespace = "http://schemas.rwe.com/nexus")]
[XmlType(Namespace = "http://schemas.rwe.com/nexus")]
public class BookDefaultDetails
{
[DataMember(Order = 1)]
[XmlElement]
public string Name { get; set; }
[DataMember(Order = 2)]
[XmlElement]
public virtual EntityId Trader { get; set; }
[DataMember(Order = 3)]
[XmlElement]
public virtual EntityId Desk { get; set; }
[DataMember(Order = 4)]
[XmlElement]
public virtual string GfProductMapping { get; set; }
[DataMember(Order = 5)]
[XmlElement]
public virtual EntityId Book { get; set; }
[DataMember(Order = 6)]
[XmlElement]
public virtual string DefaultType { get; set; }
[DataMember(Order = 7)]
[XmlElement]
public virtual EntityId PartyRole { get; set; }
}
} | namespace RWEST.Nexus.MDM.Contracts
{
using System.Runtime.Serialization;
using System.Xml.Serialization;
[DataContract(Namespace = "http://schemas.rwe.com/nexus")]
[XmlType(Namespace = "http://schemas.rwe.com/nexus")]
public class BookDefaultDetails
{
[DataMember(Order = 1)]
[XmlElement]
public string Name { get; set; }
[DataMember(Order = 2)]
[XmlElement]
public virtual EntityId Trader { get; set; }
[DataMember(Order = 3)]
[XmlElement]
public virtual EntityId Desk { get; set; }
[DataMember(Order = 4)]
[XmlElement]
public virtual string GfProductMapping { get; set; }
[DataMember(Order = 5)]
[XmlElement]
public virtual EntityId Book { get; set; }
}
} | mit | C# |
7afcf0fdb6447979d72ccb39301e908049efef84 | Refactor test to use modern assertions | Lc5/CurrencyRates,Lc5/CurrencyRates,Lc5/CurrencyRates | CurrencyRates.Tests/Base/Extensions/StringUtilsTest.cs | CurrencyRates.Tests/Base/Extensions/StringUtilsTest.cs | namespace CurrencyRates.Tests.Base.Extensions
{
using System;
using CurrencyRates.Base.Extensions;
using NUnit.Framework;
[TestFixture]
public class StringUtilsTest
{
private static readonly object[] TruncateTestCases =
{
new object[] { string.Empty, 1, string.Empty },
new object[] { "Example", 4, "E..." },
new object[] { "Example", 6, "Exa..." },
new object[] { "Example", 7, "Example" },
new object[] { "Example", 8, "Example" }
};
[TestCaseSource(nameof(TruncateTestCases))]
public void TestTruncate(string value, int maxLength, string truncated)
{
Assert.That(StringUtils.Truncate(value, maxLength), Is.EqualTo(truncated));
}
[Test]
public void TestTruncateThrowsException()
{
Assert.That(
() => StringUtils.Truncate("Example", 3),
Throws
.TypeOf<ArgumentOutOfRangeException>()
.With.Property("ParamName").EqualTo("maxLength")
.With.Property("Message").Contain("maxLength must be at least 4")
);
}
}
}
| namespace CurrencyRates.Tests.Base.Extensions
{
using System;
using CurrencyRates.Base.Extensions;
using NUnit.Framework;
[TestFixture]
public class StringUtilsTest
{
private static readonly object[] TruncateTestCases =
{
new object[] { string.Empty, 1, string.Empty },
new object[] { "Example", 4, "E..." },
new object[] { "Example", 6, "Exa..." },
new object[] { "Example", 7, "Example" },
new object[] { "Example", 8, "Example" }
};
[TestCaseSource(nameof(TruncateTestCases))]
public void TestTruncate(string value, int maxLength, string truncated)
{
Assert.That(StringUtils.Truncate(value, maxLength), Is.EqualTo(truncated));
}
[Test]
public void TestTruncateThrowsException()
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() => StringUtils.Truncate("Example", 3));
Assert.That(exception.ParamName, Is.EqualTo("maxLength"));
Assert.That(exception.Message, Does.Contain("maxLength must be at least 4"));
}
}
}
| mit | C# |
dc7f6261ee821027276de37bfd123d7263cec8ff | Update SystemConvars.cs | TheBerkin/Devcom | Devcom/System/SystemConvars.cs | Devcom/System/SystemConvars.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeveloperCommands
{
/// <summary>
/// Contains the default convars used by the Devcom engine.
/// </summary>
[DevcomCategory]
public static class SystemConvars
{
private static bool _echoInput = false;
/// <summary>
/// Determines if input sent to the Devcom engine should be echoed in the output before execution.
/// Alias: echo_input
/// </summary>
[Convar("echo_input", "Determines if input sent to the Devcom engine should be echoed in the output before execution.")]
public static bool EchoInput
{
get { return _echoInput; }
set { _echoInput = value; }
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeveloperCommands
{
/// <summary>
/// Contains the default convars used by the Devcom engine.
/// </summary>
[DevcomCategory]
public static class SystemConvars
{
private static bool _echoInput = false;
/// <summary>
/// Determines if input sent to the Devcom engine should be echoed in the output before execution.
/// Alias: echo_input
/// </summary>
[Convar("echo_input", "A test boolean.")]
public static bool EchoInput
{
get { return _echoInput; }
set { _echoInput = value; }
}
}
}
| mit | C# |
b6242021ed91dbb1085eb023869e3f6d5f8fdab9 | Set override Umbraco Vault context in app startup | wkallhof/UmbracoVault.Lite,thenerdery/UmbracoVault,thenerdery/UmbracoVault,thenerdery/UmbracoVault | ReferenceApiWeblessUmbraco/App_Start/OwinStartup.cs | ReferenceApiWeblessUmbraco/App_Start/OwinStartup.cs | using System;
using Microsoft.Owin;
using Owin;
using ReferenceApiWeblessUmbraco.Application;
using ReferenceApiWeblessUmbraco.App_Start;
using UmbracoVault;
[assembly: OwinStartup(typeof(OwinStartup))]
namespace ReferenceApiWeblessUmbraco.App_Start
{
public class OwinStartup
{
public void Configuration(IAppBuilder app)
{
StartUmbracoContext();
}
private void StartUmbracoContext()
{
var application = new ReferenceApiApplicationBase();
application.Start(application, new EventArgs());
Vault.SetOverrideContext(new UmbracoWeblessContext());
}
}
} | using System;
using Microsoft.Owin;
using Owin;
using ReferenceApiWeblessUmbraco.Application;
using ReferenceApiWeblessUmbraco.App_Start;
[assembly: OwinStartup(typeof(OwinStartup))]
namespace ReferenceApiWeblessUmbraco.App_Start
{
public class OwinStartup
{
public void Configuration(IAppBuilder app)
{
StartUmbracoContext();
}
private void StartUmbracoContext()
{
var application = new ReferenceApiApplicationBase();
application.Start(application, new EventArgs());
}
}
} | apache-2.0 | C# |
847cfdba46d651e0f607b2f3a59dcce74ec2fff5 | Add update product | phongtlse61770/TakeCoffee_ASS_SE1065,phongtlse61770/TakeCoffee_ASS_SE1065,phongtlse61770/TakeCoffee_ASS_SE1065 | Entity/Helper/ProductHelper.cs | Entity/Helper/ProductHelper.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entity.JsonModel;
using Newtonsoft.Json.Linq;
namespace Entity.Helper
{
public class ProductHelper : BaseEntityHelper
{
public ICollection<Product> GetAllProduct()
{
return db.Products.ToList();
}
public ICollection<Product> GetProductByCaterory(int categoryId)
{
return db.Products
.Where(product => product.categoryID == categoryId)
.ToList();
}
public Product CreateProduct(string name, int categoryId, Decimal unitPrice, Uri image)
{
try
{
Product product = new Product
{
name = name,
categoryID = categoryId,
unitPrice = unitPrice,
image = Path.GetFileName(image.AbsoluteUri)
};
db.Products.Add(product);
db.SaveChanges();
return product;
}
catch (Exception)
{
return null;
}
}
public bool UpdateProduct(int id, string name, int? categoryId, decimal? unitPrice, Uri image)
{
try
{
int affectedRecord = 0;
Product product = db.Products.Find(id);
if (product != null)
{
if (name != null)
{
product.name = name;
}
if (categoryId != null)
{
product.categoryID = categoryId;
}
if (unitPrice != null)
{
product.unitPrice = unitPrice.Value;
}
if (image != null)
{
product.image = Path.GetFileName(image.AbsoluteUri);
}
affectedRecord = db.SaveChanges();
}
return affectedRecord == 1;
}
catch (Exception)
{
return false;
}
}
public bool RemoveProduct(int id)
{
throw new NotImplementedException();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entity.JsonModel;
using Newtonsoft.Json.Linq;
namespace Entity.Helper
{
public class ProductHelper : BaseEntityHelper
{
public ICollection<Product> GetAllProduct()
{
return db.Products.ToList<Product>();
}
public ICollection<Product> GetProductByCaterory(int categoryId)
{
return db.Products
.Where(product => product.categoryID == categoryId)
.ToList<Product>();
}
public bool CreateProduct(string name,int categoryID, Decimal unitPrice, Uri image)
{
// Product product = new Product
// {
//// name =
// };
throw new NotImplementedException();
}
}
} | mit | C# |
35cf4972f215a48becf8d8a316011b264202d77c | Bump version. | mios-fi/mios.payment | core/Properties/AssemblyInfo.cs | 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("Mios.Payment")]
[assembly: AssemblyDescription("A library for generating and verifying payment details for various online payment providers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mios Ltd")]
[assembly: AssemblyProduct("Mios.Payment")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("90888035-e560-4ab7-bcc5-c88aee09f29b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.17.0")]
[assembly: AssemblyFileVersion("2.0.17.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("Mios.Payment")]
[assembly: AssemblyDescription("A library for generating and verifying payment details for various online payment providers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mios Ltd")]
[assembly: AssemblyProduct("Mios.Payment")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("90888035-e560-4ab7-bcc5-c88aee09f29b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.10.0")]
[assembly: AssemblyFileVersion("2.0.10.0")]
| bsd-2-clause | C# |
a2cc5e8c153a813ab3413e4585652087a8994928 | Add logging for Forget(this Task task) | github/VisualStudio,github/VisualStudio,github/VisualStudio | src/GitHub.Extensions/TaskExtensions.cs | src/GitHub.Extensions/TaskExtensions.cs | using System;
using System.Threading.Tasks;
using GitHub.Logging;
using Serilog;
namespace GitHub.Extensions
{
public static class TaskExtensions
{
static readonly ILogger log = LogManager.ForContext(typeof(TaskExtensions));
public static async Task<T> Catch<T>(this Task<T> source, Func<Exception, T> handler = null)
{
Guard.ArgumentNotNull(source, nameof(source));
try
{
return await source;
}
catch (Exception ex)
{
if (handler != null)
return handler(ex);
return default(T);
}
}
public static async Task Catch(this Task source, Action<Exception> handler = null)
{
Guard.ArgumentNotNull(source, nameof(source));
try
{
await source;
}
catch (Exception ex)
{
if (handler != null)
handler(ex);
}
}
/// <summary>
/// Allow task to run and log any exceptions.
/// </summary>
/// <param name="task">The <see cref="Task"/> to log exceptions from.</param>
/// <param name="errorMessage">An error message to log if the task throws.</param>
public static void Forget(this Task task, string errorMessage = "")
{
task.ContinueWith(t =>
{
if (t.IsFaulted)
{
log.Error(t.Exception, errorMessage);
}
});
}
/// <summary>
/// Allow task to run and log any exceptions.
/// </summary>
/// <param name="task">The task to log exceptions from.</param>
/// <param name="log">The logger to use.</param>
/// <param name="errorMessage">The error message to log if the task throws.</param>
public static void Forget(this Task task, ILogger log, string errorMessage = "")
{
task.ContinueWith(t =>
{
if (t.IsFaulted)
{
log.Error(t.Exception, errorMessage);
}
});
}
}
}
| using System;
using System.Threading.Tasks;
using Serilog;
namespace GitHub.Extensions
{
public static class TaskExtensions
{
public static async Task<T> Catch<T>(this Task<T> source, Func<Exception, T> handler = null)
{
Guard.ArgumentNotNull(source, nameof(source));
try
{
return await source;
}
catch (Exception ex)
{
if (handler != null)
return handler(ex);
return default(T);
}
}
public static async Task Catch(this Task source, Action<Exception> handler = null)
{
Guard.ArgumentNotNull(source, nameof(source));
try
{
await source;
}
catch (Exception ex)
{
if (handler != null)
handler(ex);
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "task")]
public static void Forget(this Task task)
{
}
/// <summary>
/// Log any exceptions when a task throws.
/// </summary>
/// <param name="task">The <see cref="Task"/> to log exceptions from.</param>
/// <param name="log">The <see cref="ILogger"/> to use.</param>
public static void Forget(this Task task, ILogger log)
{
task.ContinueWith(t =>
{
if (t.IsFaulted)
{
log.Error(t.Exception, nameof(Forget));
}
});
}
}
}
| mit | C# |
93fa3a899568695063332734f1fc9367af250bfb | Update Version to 1.9.42 | vancem/perfview,vancem/perfview,vancem/perfview,vancem/perfview,vancem/perfview | src/PerfView/Properties/AssemblyInfo.cs | src/PerfView/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PerfView")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("PerfView")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[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 nodeId in this assembly from
// COM, set the ComVisible attribute to true on that nodeId.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US English
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. SignalPropertyChange the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
//[assembly: ThemeInfo(
// ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
// (used if a resource is not found in the page,
// or application resource dictionaries)
// ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
// (used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.9.42.0")]
[assembly: InternalsVisibleTo("PerfViewTests")] | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PerfView")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("PerfView")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[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 nodeId in this assembly from
// COM, set the ComVisible attribute to true on that nodeId.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US English
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. SignalPropertyChange the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
//[assembly: ThemeInfo(
// ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
// (used if a resource is not found in the page,
// or application resource dictionaries)
// ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
// (used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
//)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.9.41.0")]
[assembly: InternalsVisibleTo("PerfViewTests")] | mit | C# |
91e190a2f796d7818fe2e6417c4050712032ede0 | Update AssemblyInfo | idiotandrobot/petzold-code | source/Code/Properties/AssemblyInfo.cs | source/Code/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("Petzold Code Encoder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Petzold Code Encoder")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a8fe1699-acef-408f-ab78-7a92983fbf15")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WindowsFormsApplication1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WindowsFormsApplication1")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a8fe1699-acef-408f-ab78-7a92983fbf15")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| apache-2.0 | C# |
6075db61e57f77872d66019f5d975bf1258d3539 | Remove data arguments | wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D | src/Core2D.Model/IDrawable.cs | src/Core2D.Model/IDrawable.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Core2D.Renderer;
using Core2D.Style;
namespace Core2D
{
/// <summary>
/// Defines drawable shape contract.
/// </summary>
public interface IDrawable
{
/// <summary>
/// Get or sets shape drawing style.
/// </summary>
IShapeStyle Style { get; set; }
/// <summary>
/// Gets or sets flag indicating whether shape is stroked.
/// </summary>
bool IsStroked { get; set; }
/// <summary>
/// Gets or sets flag indicating whether shape is filled.
/// </summary>
bool IsFilled { get; set; }
/// <summary>
/// Get or sets shape matrix transform.
/// </summary>
IMatrixObject Transform { get; set; }
/// <summary>
/// Begins matrix transform.
/// </summary>
/// <param name="dc">The generic drawing context object.</param>
/// <param name="renderer">The generic renderer object used to draw shape.</param>
/// <returns>The previous transform state.</returns>
object BeginTransform(object dc, IShapeRenderer renderer);
/// <summary>
/// Ends matrix transform.
/// </summary>
/// <param name="dc">The generic drawing context object.</param>
/// <param name="renderer">The generic renderer object used to draw shape.</param>
/// <param name="state">The previous transform state.</param>
void EndTransform(object dc, IShapeRenderer renderer, object state);
/// <summary>
/// Draws shape using current <see cref="IShapeRenderer"/>.
/// </summary>
/// <param name="dc">The generic drawing context object.</param>
/// <param name="renderer">The generic renderer object used to draw shape.</param>
/// <param name="dx">The X axis draw position offset.</param>
/// <param name="dy">The Y axis draw position offset.</param>
void Draw(object dc, IShapeRenderer renderer, double dx, double dy);
/// <summary>
/// Invalidates shape renderer cache.
/// </summary>
/// <param name="renderer">The generic renderer object used to draw shape.</param>
/// <param name="dx">The X axis draw position offset.</param>
/// <param name="dy">The Y axis draw position offset.</param>
/// <returns>Returns true if shape was invalidated; otherwise, returns false.</returns>
bool Invalidate(IShapeRenderer renderer, double dx, double dy);
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Core2D.Renderer;
using Core2D.Style;
namespace Core2D
{
/// <summary>
/// Defines drawable shape contract.
/// </summary>
public interface IDrawable
{
/// <summary>
/// Get or sets shape drawing style.
/// </summary>
IShapeStyle Style { get; set; }
/// <summary>
/// Gets or sets flag indicating whether shape is stroked.
/// </summary>
bool IsStroked { get; set; }
/// <summary>
/// Gets or sets flag indicating whether shape is filled.
/// </summary>
bool IsFilled { get; set; }
/// <summary>
/// Get or sets shape matrix transform.
/// </summary>
IMatrixObject Transform { get; set; }
/// <summary>
/// Begins matrix transform.
/// </summary>
/// <param name="dc">The generic drawing context object.</param>
/// <param name="renderer">The generic renderer object used to draw shape.</param>
/// <returns>The previous transform state.</returns>
object BeginTransform(object dc, IShapeRenderer renderer);
/// <summary>
/// Ends matrix transform.
/// </summary>
/// <param name="dc">The generic drawing context object.</param>
/// <param name="renderer">The generic renderer object used to draw shape.</param>
/// <param name="state">The previous transform state.</param>
void EndTransform(object dc, IShapeRenderer renderer, object state);
/// <summary>
/// Draws shape using current <see cref="IShapeRenderer"/>.
/// </summary>
/// <param name="dc">The generic drawing context object.</param>
/// <param name="renderer">The generic renderer object used to draw shape.</param>
/// <param name="dx">The X axis draw position offset.</param>
/// <param name="dy">The Y axis draw position offset.</param>
/// <param name="db">The properties database.</param>
/// <param name="r">The database record.</param>
void Draw(object dc, IShapeRenderer renderer, double dx, double dy, object db, object r);
/// <summary>
/// Invalidates shape renderer cache.
/// </summary>
/// <param name="renderer">The generic renderer object used to draw shape.</param>
/// <param name="dx">The X axis draw position offset.</param>
/// <param name="dy">The Y axis draw position offset.</param>
/// <returns>Returns true if shape was invalidated; otherwise, returns false.</returns>
bool Invalidate(IShapeRenderer renderer, double dx, double dy);
}
}
| mit | C# |
e20b5a8a19d8b5480d129fe03f213c2042c202b7 | Rename ErrorCode TooShort to PacketTooShort | henrik1235/Kugelmatik,henrik1235/Kugelmatik,henrik1235/Kugelmatik | KugelmatikLibrary/ErrorCode.cs | KugelmatikLibrary/ErrorCode.cs | namespace KugelmatikLibrary
{
public enum ErrorCode
{
None = 0,
PacketTooShort = 1,
InvalidX = 2,
InvalidY = 3,
InvalidMagic = 4,
BufferOverflow = 5,
UnknownPacket = 6,
NotRunningBusy = 7,
InvalidConfigValue = 8,
InvalidHeight = 9,
InvalidValue = 10,
NotAllowedToRead = 11,
PacketSizeBufferOverflow = 12,
McpFault1 = 13,
McpFault2 = 14,
McpFault3 = 15,
McpFault4 = 16,
McpFault5 = 17,
McpFault6 = 18,
McpFault7 = 19,
McpFault8 = 20,
InternalWrongParameter = 251,
InternalWrongLoopValues = 252,
InternalInvalidTimerIndex = 253,
InternalDefaultConfigFault = 254,
Internal = 255,
UnknownError
}
}
| namespace KugelmatikLibrary
{
public enum ErrorCode
{
None = 0,
TooShort = 1,
InvalidX = 2,
InvalidY = 3,
InvalidMagic = 4,
BufferOverflow = 5,
UnknownPacket = 6,
NotRunningBusy = 7,
InvalidConfigValue = 8,
InvalidHeight = 9,
InvalidValue = 10,
NotAllowedToRead = 11,
PacketSizeBufferOverflow = 12,
McpFault1 = 13,
McpFault2 = 14,
McpFault3 = 15,
McpFault4 = 16,
McpFault5 = 17,
McpFault6 = 18,
McpFault7 = 19,
McpFault8 = 20,
InternalWrongParameter = 251,
InternalWrongLoopValues = 252,
InternalInvalidTimerIndex = 253,
InternalDefaultConfigFault = 254,
Internal = 255,
UnknownError
}
}
| mit | C# |
4b6e207892310258547cdd54691c9f3a18184344 | Add toJSON method to SenderDetails | CurrencyCloud/currencycloud-net | Source/CurrencyCloud/Entity/SenderDetails.cs | Source/CurrencyCloud/Entity/SenderDetails.cs | using System;
using Newtonsoft.Json;
namespace CurrencyCloud.Entity
{
public class SenderDetails : Entity
{
[JsonConstructor]
public SenderDetails() { }
public string Id { get; set; }
public decimal? Amount { get; set; }
public string Currency { get; set; }
public string AdditionalInformation { get; set; }
public DateTime? ValueDate { get; set; }
public string Sender { get; set; }
public string ReceivingAccountNumber { get; set; }
public string ReceivingAccountIban { get; set; }
public DateTime? CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
public string ToJSON()
{
var obj = new[]
{
new
{
Id,
Amount,
Currency,
AdditionalInformation,
ValueDate,
Sender,
ReceivingAccountNumber,
ReceivingAccountIban,
CreatedAt,
UpdatedAt
}
};
return JsonConvert.SerializeObject(obj);
}
public override bool Equals(object obj)
{
if (!(obj is SenderDetails))
{
return false;
}
var senderDetails = obj as SenderDetails;
return Id == senderDetails.Id &&
Amount == senderDetails.Amount &&
Currency == senderDetails.Currency &&
AdditionalInformation == senderDetails.AdditionalInformation &&
ValueDate == senderDetails.ValueDate &&
Sender == senderDetails.Sender &&
ReceivingAccountNumber == senderDetails.ReceivingAccountNumber &&
ReceivingAccountIban == senderDetails.ReceivingAccountIban &&
CreatedAt == senderDetails.CreatedAt &&
UpdatedAt == senderDetails.UpdatedAt;
}
public override int GetHashCode()
{
return Id.GetHashCode();
}
}
} | using System;
using Newtonsoft.Json;
namespace CurrencyCloud.Entity
{
public class SenderDetails : Entity
{
[JsonConstructor]
public SenderDetails() { }
public string Id { get; set; }
public decimal? Amount { get; set; }
public string Currency { get; set; }
public string AdditionalInformation { get; set; }
public DateTime? ValueDate { get; set; }
public string Sender { get; set; }
public string ReceivingAccountNumber { get; set; }
public string ReceivingAccountIban { get; set; }
public DateTime? CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
public override bool Equals(object obj)
{
if (!(obj is SenderDetails))
{
return false;
}
var senderDetails = obj as SenderDetails;
return Id == senderDetails.Id &&
Amount == senderDetails.Amount &&
Currency == senderDetails.Currency &&
AdditionalInformation == senderDetails.AdditionalInformation &&
ValueDate == senderDetails.ValueDate &&
Sender == senderDetails.Sender &&
ReceivingAccountNumber == senderDetails.ReceivingAccountNumber &&
ReceivingAccountIban == senderDetails.ReceivingAccountIban &&
CreatedAt == senderDetails.CreatedAt &&
UpdatedAt == senderDetails.UpdatedAt;
}
public override int GetHashCode()
{
return Id.GetHashCode();
}
}
} | mit | C# |
17ea1b72fe1ace68c6bee834de7175d987d07481 | Disable async query execution temporarily based on Microsoft's ef core https://github.com/aspnet/EntityFramework/issues/6534 issue. | bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework | Foundation/Server/Foundation.DataAccess/Implementations/EntityFrameworkCore/EfCoreAsyncQueryableExecuter.cs | Foundation/Server/Foundation.DataAccess/Implementations/EntityFrameworkCore/EfCoreAsyncQueryableExecuter.cs | using Foundation.DataAccess.Contracts;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Threading;
using Microsoft.EntityFrameworkCore;
using System;
using Microsoft.EntityFrameworkCore.Query.Internal;
namespace Foundation.DataAccess.Implementations.EntityFrameworkCore
{
public class EfCoreAsyncQueryableExecuter : IAsyncQueryableExecuter
{
public Task<T> FirstOrDefaultAsync<T>(IQueryable<T> source, CancellationToken cancellationToken)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
return source.FirstOrDefaultAsync(cancellationToken);
}
public virtual Task<long> LongCountAsync<T>(IQueryable<T> source, CancellationToken cancellationToken)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
return source
.LongCountAsync(cancellationToken);
}
public bool SupportsAsyncExecution<T>(IQueryable source)
{
// https://github.com/aspnet/EntityFramework/issues/6534
return false;
if (source == null)
throw new ArgumentNullException(nameof(source));
return source is EntityQueryable<T>;
}
public virtual Task<List<T>> ToListAsync<T>(IQueryable<T> source, CancellationToken cancellationToken)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
return source
.ToListAsync(cancellationToken);
}
}
}
| using Foundation.DataAccess.Contracts;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Threading;
using Microsoft.EntityFrameworkCore;
using System;
using Microsoft.EntityFrameworkCore.Query.Internal;
namespace Foundation.DataAccess.Implementations.EntityFrameworkCore
{
public class EfCoreAsyncQueryableExecuter : IAsyncQueryableExecuter
{
public Task<T> FirstOrDefaultAsync<T>(IQueryable<T> source, CancellationToken cancellationToken)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
return source.FirstOrDefaultAsync(cancellationToken);
}
public virtual Task<long> LongCountAsync<T>(IQueryable<T> source, CancellationToken cancellationToken)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
return source
.LongCountAsync(cancellationToken);
}
public bool SupportsAsyncExecution<T>(IQueryable source)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
return source is EntityQueryable<T>;
}
public virtual Task<List<T>> ToListAsync<T>(IQueryable<T> source, CancellationToken cancellationToken)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
return source
.ToListAsync(cancellationToken);
}
}
}
| mit | C# |
0722ca8155ffb5538c275c9fc672a6423252dea0 | Make PSAliasProperty.Is Get/Setable throw an expection instead of return a default value | sburnicki/Pash,sburnicki/Pash,Jaykul/Pash,Jaykul/Pash,ForNeVeR/Pash,sillvan/Pash,mrward/Pash,sillvan/Pash,sburnicki/Pash,sburnicki/Pash,WimObiwan/Pash,mrward/Pash,JayBazuzi/Pash,ForNeVeR/Pash,mrward/Pash,Jaykul/Pash,Jaykul/Pash,sillvan/Pash,JayBazuzi/Pash,sillvan/Pash,ForNeVeR/Pash,WimObiwan/Pash,ForNeVeR/Pash,mrward/Pash,JayBazuzi/Pash,WimObiwan/Pash,WimObiwan/Pash,JayBazuzi/Pash | Source/System.Management/Automation/PSAliasProperty.cs | Source/System.Management/Automation/PSAliasProperty.cs | // Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/
//classtodo: Needs full implementation (consistuant on runtime advances)
using System;
namespace System.Management.Automation
{
/// <summary>
/// Represents an alias to a property.
/// </summary>
public class PSAliasProperty : PSPropertyInfo
{
public PSAliasProperty(string name, string referencedMemberName)
{
base.Name = name;
ReferencedMemberName = referencedMemberName;
}
public PSAliasProperty(string name, string referencedMemberName, Type conversionType)
{
base.Name = name;
ReferencedMemberName = referencedMemberName;
ConversionType = conversionType;
}
//todo: implement
public override PSMemberInfo Copy()
{
return null;
}
public override string ToString()
{
if (ConversionType != null)
return (base.Name + " (" + ConversionType + ") = " + ReferencedMemberName);
return (base.Name + " = " + ReferencedMemberName);
}
public Type ConversionType { get; private set; }
public override bool IsGettable
{
get
{
throw new NotImplementedException();
}
}
public override bool IsSettable
{
get
{
throw new NotImplementedException();
}
}
public override PSMemberTypes MemberType
{
get
{
return PSMemberTypes.AliasProperty;
}
}
public string ReferencedMemberName { get; private set; }
public override string TypeNameOfValue
{
get
{
return ConversionType.FullName ?? "Null";
}
}
public override object Value { get; set; }
}
}
| // Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/
//classtodo: Needs full implementation (consistuant on runtime advances)
using System;
namespace System.Management.Automation
{
/// <summary>
/// Represents an alias to a property.
/// </summary>
public class PSAliasProperty : PSPropertyInfo
{
public PSAliasProperty(string name, string referencedMemberName)
{
base.Name = name;
ReferencedMemberName = referencedMemberName;
}
public PSAliasProperty(string name, string referencedMemberName, Type conversionType)
{
base.Name = name;
ReferencedMemberName = referencedMemberName;
ConversionType = conversionType;
}
//todo: implement
public override PSMemberInfo Copy()
{
return null;
}
public override string ToString()
{
if (ConversionType != null)
return (base.Name + " (" + ConversionType + ") = " + ReferencedMemberName);
return (base.Name + " = " + ReferencedMemberName);
}
public Type ConversionType { get; private set; }
private bool isgettable;
public override bool IsGettable
{
get
{
return isgettable;
}
}
private bool issettable;
public override bool IsSettable
{
get
{
return issettable;
}
}
public override PSMemberTypes MemberType
{
get
{
return PSMemberTypes.AliasProperty;
}
}
public string ReferencedMemberName { get; private set; }
public override string TypeNameOfValue
{
get
{
return ConversionType.FullName ?? "Null";
}
}
public override object Value { get; set; }
}
}
| bsd-3-clause | C# |
7f71912a680ef3aaeffd5cfb170d71e30761736c | Make ChildValidatorAdaptor.GetValidator public | robv8r/FluentValidation,GDoronin/FluentValidation | src/FluentValidation/Validators/ChildValidatorAdaptor.cs | src/FluentValidation/Validators/ChildValidatorAdaptor.cs | namespace FluentValidation.Validators {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Internal;
using Results;
public class ChildValidatorAdaptor : NoopPropertyValidator {
static readonly IEnumerable<ValidationFailure> EmptyResult = Enumerable.Empty<ValidationFailure>();
static readonly Task<IEnumerable<ValidationFailure>> AsyncEmptyResult = TaskHelpers.FromResult(Enumerable.Empty<ValidationFailure>());
readonly Func<object, IValidator> validatorProvider;
readonly Type validatorType;
public Type ValidatorType {
get { return validatorType; }
}
public override bool IsAsync {
get { return true; }
}
public ChildValidatorAdaptor(IValidator validator) : this(_ => validator, validator.GetType()) {
}
public ChildValidatorAdaptor(Func<object, IValidator> validatorProvider, Type validatorType) {
this.validatorProvider = validatorProvider;
this.validatorType = validatorType;
}
public override IEnumerable<ValidationFailure> Validate(PropertyValidatorContext context) {
return ValidateInternal(
context,
(ctx, v) => v.Validate(ctx).Errors,
EmptyResult
);
}
public override Task<IEnumerable<ValidationFailure>> ValidateAsync(PropertyValidatorContext context, CancellationToken cancellation) {
return ValidateInternal(
context,
(ctx, v) => v.ValidateAsync(ctx).Then(r => r.Errors.AsEnumerable(), runSynchronously:true),
AsyncEmptyResult
);
}
private TResult ValidateInternal<TResult>(PropertyValidatorContext context, Func<ValidationContext, IValidator, TResult> validationApplicator, TResult emptyResult) {
var instanceToValidate = context.PropertyValue;
if (instanceToValidate == null) {
return emptyResult;
}
var validator = GetValidator(context);
if (validator == null) {
return emptyResult;
}
var newContext = CreateNewValidationContextForChildValidator(instanceToValidate, context);
return validationApplicator(newContext, validator);
}
public virtual IValidator GetValidator(PropertyValidatorContext context) {
context.Guard("Cannot pass a null context to GetValidator");
return validatorProvider(context.Instance);
}
protected ValidationContext CreateNewValidationContextForChildValidator(object instanceToValidate, PropertyValidatorContext context) {
var newContext = context.ParentContext.CloneForChildValidator(instanceToValidate);
newContext.PropertyChain.Add(context.Rule.PropertyName);
return newContext;
}
}
} | namespace FluentValidation.Validators {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Results;
public class ChildValidatorAdaptor : NoopPropertyValidator {
static readonly IEnumerable<ValidationFailure> EmptyResult = Enumerable.Empty<ValidationFailure>();
static readonly Task<IEnumerable<ValidationFailure>> AsyncEmptyResult = TaskHelpers.FromResult(Enumerable.Empty<ValidationFailure>());
readonly Func<object, IValidator> validatorProvider;
readonly Type validatorType;
public Type ValidatorType {
get { return validatorType; }
}
public override bool IsAsync {
get { return true; }
}
public RuleSetMode RulesetMode { get; set; }
public ChildValidatorAdaptor(IValidator validator) : this(_ => validator, validator.GetType()) {
}
public ChildValidatorAdaptor(Func<object, IValidator> validatorProvider, Type validatorType) {
this.validatorProvider = validatorProvider;
this.validatorType = validatorType;
}
public override IEnumerable<ValidationFailure> Validate(PropertyValidatorContext context) {
return ValidateInternal(
context,
(ctx, v) => v.Validate(ctx).Errors,
EmptyResult
);
}
public override Task<IEnumerable<ValidationFailure>> ValidateAsync(PropertyValidatorContext context, CancellationToken cancellation) {
return ValidateInternal(
context,
(ctx, v) => v.ValidateAsync(ctx).Then(r => r.Errors.AsEnumerable(), runSynchronously:true),
AsyncEmptyResult
);
}
private TResult ValidateInternal<TResult>(PropertyValidatorContext context, Func<ValidationContext, IValidator, TResult> validationApplicator, TResult emptyResult) {
var instanceToValidate = context.PropertyValue;
if (instanceToValidate == null) {
return emptyResult;
}
var validator = GetValidator(context);
if (validator == null) {
return emptyResult;
}
var newContext = CreateNewValidationContextForChildValidator(instanceToValidate, context);
return validationApplicator(newContext, validator);
}
protected virtual IValidator GetValidator(PropertyValidatorContext context) {
return validatorProvider(context.Instance);
}
protected ValidationContext CreateNewValidationContextForChildValidator(object instanceToValidate, PropertyValidatorContext context) {
var newContext = context.ParentContext.CloneForChildValidator(instanceToValidate);
newContext.PropertyChain.Add(context.Rule.PropertyName);
return newContext;
}
public enum RuleSetMode {
PropertyValidator,
Include
}
}
} | apache-2.0 | C# |
b01c8da1d87003400ccc849faac4e758751f8cb0 | Fix typo (#59) | yangyuan/hearthrock | src/Hearthrock.Contracts/RockAction.cs | src/Hearthrock.Contracts/RockAction.cs | // <copyright file="RockAction.cs" company="https://github.com/yangyuan">
// Copyright (c) The Hearthrock Project. All rights reserved.
// </copyright>
namespace Hearthrock.Contracts
{
using System.Collections.Generic;
/// <summary>
/// The action of the bot.
/// </summary>
public class RockAction
{
/// <summary>
/// Gets or sets the version of the action
/// </summary>
public int Version { get; set; }
/// <summary>
/// Gets or sets the sequence of the objects.
/// </summary>
public List<int> Objects { get; set; }
/// <summary>
/// Gets or sets the slot, slot is used when to place a minion.
/// Index starts from zero.
/// </summary>
public int Slot { get; set; }
/// <summary>
/// The factory method of RockAction
/// </summary>
/// <returns>The RockAction.</returns>
public static RockAction Create()
{
return Create(new List<int>(), -1);
}
/// <summary>
/// The factory method of RockAction
/// </summary>
/// <param name="objects">The RockObject IDs of the action.</param>
/// <returns>The RockAction.</returns>
public static RockAction Create(List<int> objects)
{
return Create(objects, -1);
}
/// <summary>
/// The factory method of RockAction
/// </summary>
/// <param name="objects">The RockObject IDs of the action.</param>
/// <param name="slot">The slot when apply the action.</param>
/// <returns>The RockAction.</returns>
public static RockAction Create(List<int> objects, int slot)
{
var result = new RockAction();
result.Version = 1;
result.Objects = objects;
result.Slot = slot;
return result;
}
}
}
| // <copyright file="RockAction.cs" company="https://github.com/yangyuan">
// Copyright (c) The Hearthrock Project. All rights reserved.
// </copyright>
namespace Hearthrock.Contracts
{
using System.Collections.Generic;
/// <summary>
/// The action of the bot.
/// </summary>
public class RockAction
{
/// <summary>
/// Gets or sets the version of the action
/// </summary>
public int Version { get; set; }
/// <summary>
/// Gets or sets the sequence of the objects.
/// </summary>
public List<int> Objects { get; set; }
/// <summary>
/// Gets or sets the slot, slot is used when to place a minion.
/// Index starts from zero.
/// </summary>
public int Slot { get; set; }
/// <summary>
/// The factory method of RockAction
/// </summary>
/// <returns>The RockAction.</returns>
public static RockAction Create()
{
return Create(new List<int>(), -1);
}
/// <summary>
/// The factory method of RockAction
/// </summary>
/// <param name="objects">The RockObject IDs of the action.</param>
/// <returns>The RockAction.</returns>
public static RockAction Create(List<int> objects)
{
return Create(objects, -1);
}
/// <summary>
/// The factory method of RockAction
/// </summary>
/// <param name="objects">The RockObject IDs of the action.</param>
/// <param name="solt">The solt when apply the action.</param>
/// <returns>The RockAction.</returns>
public static RockAction Create(List<int> objects, int solt)
{
var result = new RockAction();
result.Version = 1;
result.Objects = objects;
result.Slot = solt;
return result;
}
}
}
| mit | C# |
b5b878ce5a41fb7d144ea054348702b9f113c002 | Rename Char to CharField | laicasaane/VFW | Assets/Plugins/Editor/Vexe/GUIs/BaseGUI/Controls/Chars.cs | Assets/Plugins/Editor/Vexe/GUIs/BaseGUI/Controls/Chars.cs | using UnityEngine;
namespace Vexe.Editor.GUIs
{
public abstract partial class BaseGUI
{
public char CharField(char value)
{
return CharField(string.Empty, value);
}
public char CharField(string label, char value)
{
return CharField(label, value, null);
}
public char CharField(string label, string tooltip, char value)
{
return CharField(label, tooltip, value, null);
}
public char CharField(string label, char value, Layout option)
{
return CharField(label, string.Empty, value, option);
}
public char CharField(string label, string tooltip, char value, Layout option)
{
return CharField(GetContent(label, tooltip), value, option);
}
public abstract char CharField(GUIContent content, char value, Layout option);
}
}
| using UnityEngine;
namespace Vexe.Editor.GUIs
{
public abstract partial class BaseGUI
{
public char Char(char value)
{
return Char(string.Empty, value);
}
public char Char(string label, char value)
{
return Char(label, value, null);
}
public char Char(string label, string tooltip, char value)
{
return Char(label, tooltip, value, null);
}
public char Char(string label, char value, Layout option)
{
return Char(label, string.Empty, value, option);
}
public char Char(string label, string tooltip, char value, Layout option)
{
return Char(GetContent(label, tooltip), value, option);
}
public abstract char Char(GUIContent content, char value, Layout option);
}
}
| mit | C# |
8eb0934649409db066dcb1a6e391adaa1f77c6ff | fix up recent activity ajax | ucdavis/Purchasing,ucdavis/Purchasing,ucdavis/Purchasing | Purchasing.Mvc/Views/HistoryAjax/RecentActivity.cshtml | Purchasing.Mvc/Views/HistoryAjax/RecentActivity.cshtml | @using Purchasing.Mvc.Helpers
@model Purchasing.Core.Queries.OrderTrackingHistory
@if (Model == null)
{
<p>No recent activity here!</p>
<p>@Html.ActionLink("Request a new order >", "SelectWorkgroup", "Order")</p>
}
else {
<p><span class="time-ago">@string.Format("{0} ago,", (DateTime.Now - Model.TrackingDate).ToLongString())</span> you worked on</p>
<p class="order-details">@Html.ActionLink(Model.RequestNumber, "Review", "Order", new { id = Model.OrderId }, new { })
<span class="requester">@Model.CreatedBy</span> requested: <span class="order-summary">@Model.DisplaySummary()</span></p>
<p>@Html.ActionLink("View the order >", "Review", "Order", new { id = Model.OrderId }, new { })</p>
} | @using Purchasing.Web.Helpers
@model Purchasing.Core.Queries.OrderTrackingHistory
@if (Model == null)
{
<p>No recent activity here!</p>
<p>@Html.ActionLink("Request a new order >", "SelectWorkgroup", "Order")</p>
}
else {
<p><span class="time-ago">@string.Format("{0} ago,", (DateTime.Now - Model.TrackingDate).ToLongString())</span> you worked on</p>
<p class="order-details">@Html.ActionLink(Model.RequestNumber, "Review", "Order", new { id = Model.OrderId }, new { })
<span class="requester">@Model.CreatedBy</span> requested: <span class="order-summary">@Model.DisplaySummary()</span></p>
<p>@Html.ActionLink("View the order >", "Review", "Order", new { id = Model.OrderId }, new { })</p>
} | mit | C# |
a9f7c451970388746fa1735d43ccad4d06eb1951 | Update XGroups.cs | wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Core2D/Collections/XGroups.cs | src/Core2D/Collections/XGroups.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Immutable;
using Core2D.Attributes;
using Core2D.Shapes;
namespace Core2D.Collections
{
/// <summary>
/// Observable <see cref="XGroup"/> collection.
/// </summary>
public class XGroups : ObservableResource
{
/// <summary>
/// Gets or sets resource name.
/// </summary>
[Name]
public string Name { get; set; }
/// <summary>
/// Gets or sets children collection.
/// </summary>
[Content]
public ImmutableArray<XGroup> Children { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="XGroups"/> class.
/// </summary>
public XGroups()
{
Children = ImmutableArray.Create<XGroup>();
}
/// <summary>
/// Check whether the <see cref="Name"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public bool ShouldSerializeName() => !String.IsNullOrWhiteSpace(Name);
/// <summary>
/// Check whether the <see cref="Children"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public bool ShouldSerializeChildren() => Children.IsEmpty == false;
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using Core2D.Attributes;
using Core2D.Shapes;
namespace Core2D.Collections
{
/// <summary>
/// Observable <see cref="XGroup"/> collection.
/// </summary>
public class XGroups : ObservableResource
{
/// <summary>
/// Gets or sets resource name.
/// </summary>
[Name]
public string Name { get; set; }
/// <summary>
/// Gets or sets children collection.
/// </summary>
[Content]
public ImmutableArray<XGroup> Children { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="XGroups"/> class.
/// </summary>
public XGroups()
{
Children = ImmutableArray.Create<XGroup>();
}
}
}
| mit | C# |
3f0807b543de873f69818f7e0a3321b232a24d69 | fix conditional compile misstype | Toxu4/RDS.CaraBus | src/RDS.CaraBus/TypeExtensions.cs | src/RDS.CaraBus/TypeExtensions.cs | using System;
using System.Collections.Generic;
using System.Reflection;
namespace RDS.CaraBus
{
internal static class TypeExtensions
{
public static List<Type> GetInheritanceChainAndInterfaces(this Type type)
{
var chain = new List<Type>();
#if NETSTANDARD1_5
chain.AddRange(type.GetTypeInfo().GetInterfaces());
#else
chain.AddRange(type.GetInterfaces());
#endif
while (true)
{
if (type == null)
{
break;
}
chain.Insert(0, type);
#if NETSTANDARD1_5
type = type.GetTypeInfo().BaseType;
#else
type = type.BaseType;
#endif
}
return chain;
}
}
} | using System;
using System.Collections.Generic;
using System.Reflection;
namespace RDS.CaraBus
{
internal static class TypeExtensions
{
public static List<Type> GetInheritanceChainAndInterfaces(this Type type)
{
var chain = new List<Type>();
#if NET451
chain.AddRange(type.GetInterfaces());
#endif
#if NETSTANDARD1_5
chain.AddRange(type.GetTypeInfo().GetInterfaces());
#endif
while (true)
{
if (type == null)
{
break;
}
chain.Insert(0, type);
#if NET451
type = type.BaseType;
#endif
#if NETSTANDARD1_5
type = type.GetTypeInfo().BaseType;
#endif
}
return chain;
}
}
} | mit | C# |
9c8232994f22ea348342933672bf9cd9ae0e064e | Update 0040_DragonBreathScript.cs | Albeoris/Memoria,Albeoris/Memoria,Albeoris/Memoria,Albeoris/Memoria | Memoria.Scripts/Sources/Battle/0040_DragonBreathScript.cs | Memoria.Scripts/Sources/Battle/0040_DragonBreathScript.cs | using System;
namespace Memoria.Scripts.Battle
{
/// <summary>
/// Dragon Breath
/// </summary>
[BattleScript(Id)]
public sealed class DragonBreathScript : IBattleScript
{
public const Int32 Id = 0040;
private readonly BattleCalculator _v;
public DragonBreathScript(BattleCalculator v)
{
_v = v;
}
public void Perform()
{
_v.Target.Flags |= CalcFlag.HpAlteration;
_v.Target.HpDamage = (Int32)_v.Target.MaximumHp - (Int32)_v.Target.CurrentHp;
foreach (BattleUnit unit in BattleState.EnumerateUnits())
{
_v.Target.Change(unit);
if (!_v.Target.IsPlayer && _v.Target.IsSelected)
{
SBattleCalculator.CalcResult(_v);
BattleState.Unit2DReq(unit);
}
}
_v.Target.Flags = 0;
_v.Target.MpDamage = 0;
}
}
}
| using System;
namespace Memoria.Scripts.Battle
{
/// <summary>
/// Dragon Breath
/// </summary>
[BattleScript(Id)]
public sealed class DragonBreathScript : IBattleScript
{
public const Int32 Id = 0040;
private readonly BattleCalculator _v;
public DragonBreathScript(BattleCalculator v)
{
_v = v;
}
public void Perform()
{
_v.Target.Flags |= CalcFlag.HpAlteration;
_v.Target.HpDamage = (Int32)_v.Target.MaximumHp - (Int32)_v.Target.CurrentHp;
foreach (BattleUnit unit in BattleState.EnumerateUnits())
{
_v.Target.Change(unit);
if (!_v.Target.IsPlayer && _v.Target.IsSelected)
{
SBattleCalculator.CalcResult(_v);
BattleState.Unit2DReq(unit);
}
}
}
}
} | mit | C# |
004dc1865a31902e61ffb125b0d7a4af8b46c4a0 | Implement constructor and dispose method to open/close device | vejuhust/msft-scooter | ScooterController/ScooterController/HardwareController.cs | ScooterController/ScooterController/HardwareController.cs |
using System;
namespace ScooterController
{
class HardwareController
{
private readonly int deviceHandle;
public static void LogError(string message)
{
throw new Exception(message);
}
public HardwareController(string serialNumber = "FDP2R")
{
if (UsbRelayDevice.Init() != 0)
{
LogError("Couldn't initialize!");
}
this.deviceHandle = UsbRelayDevice.OpenWithSerialNumber(serialNumber, serialNumber.Length);
}
~HardwareController()
{
UsbRelayDevice.Close(this.deviceHandle);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScooterController
{
class HardwareController
{
public HardwareController()
{
if (UsbRelayDevice.Init() != 0)
{
Console.WriteLine("Couldn't initialize!");
return;
}
string serial = "FDP2R";
int deviceHandle = UsbRelayDevice.OpenWithSerialNumber(serial, serial.Length);
int openResult = UsbRelayDevice.OpenOneRelayChannel(deviceHandle, 1);
if (openResult == 1)
{
Console.WriteLine("Got error from OpenOneRelayChannel!");
return;
}
else if (openResult == 2)
{
Console.WriteLine("Index is out of range on the usb relay device");
return;
}
int closeResult = UsbRelayDevice.CloseOneRelayChannel(deviceHandle, 1);
var x = UsbRelayDevice.Enumerate();
if (x == null)
{
}
}
}
}
| mit | C# |
2344a1a411cf1778ffd21635e2167f13e0039f89 | use image block in markdown container | NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu,peppy/osu-new,NeoAdonis/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu | osu.Game/Overlays/Wiki/Markdown/WikiMarkdownContainer.cs | osu.Game/Overlays/Wiki/Markdown/WikiMarkdownContainer.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.Linq;
using Markdig.Extensions.Yaml;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Game.Graphics.Containers.Markdown;
namespace osu.Game.Overlays.Wiki.Markdown
{
public class WikiMarkdownContainer : OsuMarkdownContainer
{
public string CurrentPath
{
set => DocumentUrl = $"{DocumentUrl}wiki/{value}";
}
protected override void AddMarkdownComponent(IMarkdownObject markdownObject, FillFlowContainer container, int level)
{
switch (markdownObject)
{
case YamlFrontMatterBlock yamlFrontMatterBlock:
container.Add(new WikiNoticeContainer(yamlFrontMatterBlock));
break;
case ParagraphBlock paragraphBlock:
// Check if paragraph only contains an image
if (paragraphBlock.Inline.Count() == 1 && paragraphBlock.Inline.FirstChild is LinkInline { IsImage: true } linkInline)
{
container.Add(new WikiMarkdownImageBlock(linkInline));
return;
}
break;
}
base.AddMarkdownComponent(markdownObject, container, level);
}
public override MarkdownTextFlowContainer CreateTextFlow() => new WikiMarkdownTextFlowContainer();
private class WikiMarkdownTextFlowContainer : OsuMarkdownTextFlowContainer
{
protected override void AddImage(LinkInline linkInline) => AddDrawable(new WikiMarkdownImage(linkInline));
}
}
}
| // 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 Markdig.Extensions.Yaml;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Game.Graphics.Containers.Markdown;
namespace osu.Game.Overlays.Wiki.Markdown
{
public class WikiMarkdownContainer : OsuMarkdownContainer
{
public string CurrentPath
{
set => DocumentUrl = $"{DocumentUrl}wiki/{value}";
}
protected override void AddMarkdownComponent(IMarkdownObject markdownObject, FillFlowContainer container, int level)
{
switch (markdownObject)
{
case YamlFrontMatterBlock yamlFrontMatterBlock:
container.Add(new WikiNoticeContainer(yamlFrontMatterBlock));
return;
}
base.AddMarkdownComponent(markdownObject, container, level);
}
public override MarkdownTextFlowContainer CreateTextFlow() => new WikiMarkdownTextFlowContainer();
protected override MarkdownParagraph CreateParagraph(ParagraphBlock paragraphBlock, int level) => new WikiMarkdownParagraph(paragraphBlock);
private class WikiMarkdownTextFlowContainer : OsuMarkdownTextFlowContainer
{
protected override void AddImage(LinkInline linkInline) => AddDrawable(new WikiMarkdownImage(linkInline));
}
}
}
| mit | C# |
59030dd594e0aef9692ec928ad6d9db91497f28a | Fix to test project with additiional IPlugin member | ADAPT/ADAPT | source/TestPlugin/TestPlugin.cs | source/TestPlugin/TestPlugin.cs | /*******************************************************************************
* Copyright (C) 2015 AgGateway and ADAPT Contributors
* Copyright (C) 2015 Deere and Company
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contributors:
* Tarak Reddy, Tim Shearouse - initial API and implementation
* Kelly Nelson - Added Errors collection
*******************************************************************************/
using System.Collections.Generic;
using AgGateway.ADAPT.ApplicationDataModel.ADM;
namespace AgGateway.ADAPT.TestPlugin
{
public class TestPlugin : IPlugin
{
public string Name
{
get
{
return "TestPlugin";
}
}
public string Version { get; private set; }
public string Owner { get; private set; }
public void Initialize(string args = null)
{
}
public bool IsDataCardSupported(string dataPath, Properties properties = null)
{
return true;
}
public IList<IError> ValidateDataOnCard(string dataPath, Properties properties = null)
{
return new List<IError>();
}
public IList<ApplicationDataModel.ADM.ApplicationDataModel> Import(string dataPath, Properties properties = null)
{
return new[] {new ApplicationDataModel.ADM.ApplicationDataModel()};
}
public void Export(ApplicationDataModel.ADM.ApplicationDataModel dataModel, string exportPath, Properties properties = null)
{
}
public Properties GetProperties(string dataPath)
{
return new Properties();
}
public IList<IError> Errors { get { return new List<IError>(); } }
}
}
| /*******************************************************************************
* Copyright (C) 2015 AgGateway and ADAPT Contributors
* Copyright (C) 2015 Deere and Company
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contributors:
* Tarak Reddy, Tim Shearouse - initial API and implementation
*******************************************************************************/
using System.Collections.Generic;
using AgGateway.ADAPT.ApplicationDataModel.ADM;
namespace AgGateway.ADAPT.TestPlugin
{
public class TestPlugin : IPlugin
{
public string Name
{
get
{
return "TestPlugin";
}
}
public string Version { get; private set; }
public string Owner { get; private set; }
public void Initialize(string args = null)
{
}
public bool IsDataCardSupported(string dataPath, Properties properties = null)
{
return true;
}
public IList<IError> ValidateDataOnCard(string dataPath, Properties properties = null)
{
return new List<IError>();
}
public IList<ApplicationDataModel.ADM.ApplicationDataModel> Import(string dataPath, Properties properties = null)
{
return new[] {new ApplicationDataModel.ADM.ApplicationDataModel()};
}
public void Export(ApplicationDataModel.ADM.ApplicationDataModel dataModel, string exportPath, Properties properties = null)
{
}
public Properties GetProperties(string dataPath)
{
return new Properties();
}
}
}
| epl-1.0 | C# |
8e895784dceca135712d8f545c06491c542e8c7e | fix DEXP-563765 (#1944) | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/resharper-unity/src/CSharp/Feature/Services/LiveTemplates/Scope/UnityProjectVersionScopeProvider.cs | resharper/resharper-unity/src/CSharp/Feature/Services/LiveTemplates/Scope/UnityProjectVersionScopeProvider.cs | using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Application;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.LiveTemplates.Context;
using JetBrains.ReSharper.Feature.Services.LiveTemplates.Scope;
using JetBrains.ReSharper.Plugins.Unity.ProjectModel;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.LiveTemplates.Scope
{
[ShellComponent]
public class UnityProjectVersionScopeProvider : IScopeProvider
{
public IEnumerable<ITemplateScopePoint> ProvideScopePoints(TemplateAcceptanceContext context)
{
if (!context.Solution.HasUnityReference())
yield break;
var project = context.GetProject();
var version = project != null
? context.Solution.GetComponent<UnityVersion>().GetActualVersion(project)
: context.Solution.GetComponent<UnityVersion>().ActualVersionForSolution.Maybe.ValueOrDefault;
if (version != null && version.Major != 0)
yield return new MustBeInProjectWithUnityVersion(version);
}
public ITemplateScopePoint CreateScope(Guid scopeGuid, string typeName,
IEnumerable<Pair<string, string>> customProperties)
{
if (typeName != MustBeInProjectWithUnityVersion.TypeName)
return null;
var versionString = customProperties.Where(p => p.First == MustBeInProjectWithUnityVersion.VersionProperty)
.Select(p => p.Second)
.FirstOrDefault();
if (versionString == null)
return null;
var version = Version.Parse(versionString);
return new MustBeInProjectWithUnityVersion(version) {UID = scopeGuid};
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Application;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.LiveTemplates.Context;
using JetBrains.ReSharper.Feature.Services.LiveTemplates.Scope;
using JetBrains.ReSharper.Plugins.Unity.ProjectModel;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.LiveTemplates.Scope
{
[ShellComponent]
public class UnityProjectVersionScopeProvider : IScopeProvider
{
public IEnumerable<ITemplateScopePoint> ProvideScopePoints(TemplateAcceptanceContext context)
{
if (!context.Solution.HasUnityReference())
yield break;
var project = context.GetProject();
var version = project != null
? context.Solution.GetComponent<UnityVersion>().GetActualVersion(project)
: context.Solution.GetComponent<UnityVersion>().ActualVersionForSolution.Value;
if (version.Major != 0)
yield return new MustBeInProjectWithUnityVersion(version);
}
public ITemplateScopePoint CreateScope(Guid scopeGuid, string typeName,
IEnumerable<Pair<string, string>> customProperties)
{
if (typeName != MustBeInProjectWithUnityVersion.TypeName)
return null;
var versionString = customProperties.Where(p => p.First == MustBeInProjectWithUnityVersion.VersionProperty)
.Select(p => p.Second)
.FirstOrDefault();
if (versionString == null)
return null;
var version = Version.Parse(versionString);
return new MustBeInProjectWithUnityVersion(version) {UID = scopeGuid};
}
}
} | apache-2.0 | C# |
ab95ced41da08f22c77c426ae730403602027228 | Use default TypeReader if not overriden | RogueException/Discord.Net,AntiTcb/Discord.Net,LassieME/Discord.Net,Confruggy/Discord.Net | src/Discord.Net.Commands/Builders/ParameterBuilder.cs | src/Discord.Net.Commands/Builders/ParameterBuilder.cs | using System;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Discord.Commands.Builders
{
public class ParameterBuilder
{
public ParameterBuilder()
{ }
public ParameterBuilder(string name)
{
Name = name;
}
public string Name { get; set; }
public string Summary { get; set; }
public object DefaultValue { get; set; }
public Type ParameterType { get; set; }
public TypeReader TypeReader { get; set; }
public bool Optional { get; set; }
public bool Remainder { get; set; }
public bool Multiple { get; set; }
public ParameterBuilder SetName(string name)
{
Name = name;
return this;
}
public ParameterBuilder SetSummary(string summary)
{
Summary = summary;
return this;
}
public ParameterBuilder SetDefault<T>(T defaultValue)
{
DefaultValue = defaultValue;
ParameterType = typeof(T);
if (ParameterType.IsArray)
ParameterType = ParameterType.GetElementType();
return this;
}
public ParameterBuilder SetType(Type parameterType)
{
ParameterType = parameterType;
return this;
}
public ParameterBuilder SetTypeReader(TypeReader reader)
{
TypeReader = reader;
return this;
}
public ParameterBuilder SetOptional(bool isOptional)
{
Optional = isOptional;
return this;
}
public ParameterBuilder SetRemainder(bool isRemainder)
{
Remainder = isRemainder;
return this;
}
public ParameterBuilder SetMultiple(bool isMultiple)
{
Multiple = isMultiple;
return this;
}
internal ParameterInfo Build(CommandInfo info, CommandService service)
{
if (TypeReader == null)
TypeReader = service.GetTypeReader(ParameterType);
return new ParameterInfo(this, info, service);
}
}
} | using System;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Discord.Commands.Builders
{
public class ParameterBuilder
{
public ParameterBuilder()
{ }
public ParameterBuilder(string name)
{
Name = name;
}
public string Name { get; set; }
public string Summary { get; set; }
public object DefaultValue { get; set; }
public Type ParameterType { get; set; }
public TypeReader TypeReader { get; set; }
public bool Optional { get; set; }
public bool Remainder { get; set; }
public bool Multiple { get; set; }
public ParameterBuilder SetName(string name)
{
Name = name;
return this;
}
public ParameterBuilder SetSummary(string summary)
{
Summary = summary;
return this;
}
public ParameterBuilder SetDefault<T>(T defaultValue)
{
DefaultValue = defaultValue;
ParameterType = typeof(T);
if (ParameterType.IsArray)
ParameterType = ParameterType.GetElementType();
return this;
}
public ParameterBuilder SetType(Type parameterType)
{
ParameterType = parameterType;
return this;
}
public ParameterBuilder SetTypeReader(TypeReader reader)
{
TypeReader = reader;
return this;
}
public ParameterBuilder SetOptional(bool isOptional)
{
Optional = isOptional;
return this;
}
public ParameterBuilder SetRemainder(bool isRemainder)
{
Remainder = isRemainder;
return this;
}
public ParameterBuilder SetMultiple(bool isMultiple)
{
Multiple = isMultiple;
return this;
}
internal ParameterInfo Build(CommandInfo info, CommandService service)
{
return new ParameterInfo(this, info, service);
}
}
} | mit | C# |
42010fa4ef4e3a025dc11a566a024534ba007b53 | add BigmodsTriggerManualMirrorSyncPHP to PrivateStuff | Willster419/RelhaxModpack,Willster419/RelhaxModpack,Willster419/RelicModManager | RelhaxModpack/RelhaxModpack/PrivateStuff/PrivateStuff.cs | RelhaxModpack/RelhaxModpack/PrivateStuff/PrivateStuff.cs | using System.Net;
namespace RelhaxModpack
{
#pragma warning disable CS1591
public static class PrivateStuff
{
#region discord stuff
public const string DiscordBotClientID = null;
public const ulong DiscordModChannelID = 0;
public const ulong DiscordAnnouncementsChannelID = 0;
#endregion
//https://stackoverflow.com/questions/9418404/cant-connect-to-ftp-553-file-name-not-allowed
#region bigmods FTP modpack addresses
//path of modpack acct is <REDACTED>
public const string BigmodsFTPModpackRoot = null;
public const string BigmodsFTPModpackInstallStats = null;
public const string BigmodsFTPModpackMedias = null;
public const string BigmodsFTPModpackRelhaxModpack = null;
public const string BigmodsFTPRootWoT = null;
public const string BigmodsFTPModpackResources = null;
public const string BigmodsFTPModpackManager = null;
public const string BigmodsFTPModpackDatabase = null;
#endregion
#region bigmods FTP user addresses
//path of users acct is <REDACTED>
public const string BigmodsFTPUsersRoot = null;
public const string BigmodsFTPUsersMedias = null;
#endregion
#region bigmods HTTP all addresses
public const string BigmodsEnterDownloadStatPHP = null;
public const string BigmodsCreateDatabasePHP = null;
public const string BigmodsCreateManagerInfoPHP = null;
public const string BigmodsCreateUpdatePackagesPHP = null;
public const string BigmodsCreateModInfoPHP = null;
public const string BigmodsTriggerManualMirrorSyncPHP = null;
public const string BigmodsModpackUpdaterKey = null;
#endregion
#region server credentials
public static NetworkCredential BigmodsNetworkCredentialScripts = null;
public static NetworkCredential BigmodsNetworkCredentialPrivate = null;
public static NetworkCredential BigmodsNetworkCredential = null;
#endregion
}
#pragma warning restore CS1591
} | using System.Net;
namespace RelhaxModpack
{
#pragma warning disable CS1591
public static class PrivateStuff
{
#region discord stuff
public const string DiscordBotClientID = null;
public const ulong DiscordModChannelID = 0;
public const ulong DiscordAnnouncementsChannelID = 0;
#endregion
//https://stackoverflow.com/questions/9418404/cant-connect-to-ftp-553-file-name-not-allowed
#region bigmods FTP modpack addresses
//path of modpack acct is <REDACTED>
public const string BigmodsFTPModpackRoot = null;
public const string BigmodsFTPModpackInstallStats = null;
public const string BigmodsFTPModpackMedias = null;
public const string BigmodsFTPModpackRelhaxModpack = null;
public const string BigmodsFTPRootWoT = null;
public const string BigmodsFTPModpackResources = null;
public const string BigmodsFTPModpackManager = null;
public const string BigmodsFTPModpackDatabase = null;
#endregion
#region bigmods FTP user addresses
//path of users acct is <REDACTED>
public const string BigmodsFTPUsersRoot = null;
public const string BigmodsFTPUsersMedias = null;
#endregion
#region bigmods HTTP all addresses
public const string BigmodsEnterDownloadStatPHP = null;
public const string BigmodsCreateDatabasePHP = null;
public const string BigmodsCreateManagerInfoPHP = null;
public const string BigmodsCreateUpdatePackagesPHP = null;
public const string BigmodsCreateModInfoPHP = null;
public const string BigmodsModpackUpdaterKey = null;
#endregion
#region server credentials
public static NetworkCredential BigmodsNetworkCredentialScripts = null;
public static NetworkCredential BigmodsNetworkCredentialPrivate = null;
public static NetworkCredential BigmodsNetworkCredential = null;
#endregion
}
#pragma warning restore CS1591
} | apache-2.0 | C# |
5edcf4ece10d1fe26177c0dafe492c0b65e82f28 | Write lines | spinesheath/HanaMahjong,spinesheath/HanaMahjong,spinesheath/HanaMahjong,spinesheath/TenView | Spines.Tools/Spines.Tools.AnalzyerBuilder/MainWindow.xaml.cs | Spines.Tools/Spines.Tools.AnalzyerBuilder/MainWindow.xaml.cs | // Spines.Tools.AnalyzerBuilder.MainWindow.xaml.cs
//
// Copyright (C) 2016 Johannes Heckl
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Microsoft.WindowsAPICodePack.Dialogs;
using Spines.Mahjong.Analysis.Combinations;
namespace Spines.Tools.AnalyzerBuilder
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
/// <summary>
/// Constructor.
/// </summary>
public MainWindow()
{
InitializeComponent();
}
private void CreateCombinations(object sender, RoutedEventArgs e)
{
ProgressBar.Minimum = 0;
ProgressBar.Maximum = 15;
ProgressBar.Value = 0;
using (var dialog = new CommonOpenFileDialog())
{
dialog.IsFolderPicker = true;
dialog.EnsurePathExists = true;
var result = dialog.ShowDialog(this);
if (result != CommonFileDialogResult.Ok)
{
return;
}
var workingDirectory = dialog.FileNames.Single();
CreateCombinationsAsync(workingDirectory);
}
}
private async void CreateCombinationsAsync(string workingDirectory)
{
var counts = Enumerable.Range(0, 15);
await Task.Run(() => Parallel.ForEach(counts, c => CreateCombinationFile(c, workingDirectory)));
}
private void CreateCombinationFile(int count, string workingDirectory)
{
var creator = new ConcealedSuitCombinationCreator();
var combinations = creator.Create(count);
var lines = combinations.Select(c => string.Join(string.Empty, c.Counts));
var fileName = $"ConcealedSuitCombinations_{count}.txt";
var path = Path.Combine(workingDirectory, fileName);
File.WriteAllLines(path, lines);
IncrementProgressBar();
}
private void IncrementProgressBar()
{
Dispatcher.Invoke(() => ProgressBar.Value += 1);
}
}
} | // Spines.Tools.AnalyzerBuilder.MainWindow.xaml.cs
//
// Copyright (C) 2016 Johannes Heckl
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Microsoft.WindowsAPICodePack.Dialogs;
using Spines.Mahjong.Analysis.Combinations;
namespace Spines.Tools.AnalyzerBuilder
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
/// <summary>
/// Constructor.
/// </summary>
public MainWindow()
{
InitializeComponent();
}
private void CreateCombinations(object sender, RoutedEventArgs e)
{
ProgressBar.Minimum = 0;
ProgressBar.Maximum = 15;
ProgressBar.Value = 0;
using (var dialog = new CommonOpenFileDialog())
{
dialog.IsFolderPicker = true;
dialog.EnsurePathExists = true;
var result = dialog.ShowDialog(this);
if (result != CommonFileDialogResult.Ok)
{
return;
}
var workingDirectory = dialog.FileNames.Single();
CreateCombinationsAsync(workingDirectory);
}
}
private async void CreateCombinationsAsync(string workingDirectory)
{
var counts = Enumerable.Range(0, 15);
await Task.Run(() => Parallel.ForEach(counts, c => CreateCombinationFile(c, workingDirectory)));
}
private void CreateCombinationFile(int count, string workingDirectory)
{
var creator = new ConcealedSuitCombinationCreator();
var combinations = creator.Create(count);
var text = string.Join(string.Empty, combinations.SelectMany(c => c.Counts));
var fileName = $"ConcealedSuitCombinations_{count}.txt";
var path = Path.Combine(workingDirectory, fileName);
File.WriteAllText(path, text);
IncrementProgressBar();
}
private void IncrementProgressBar()
{
Dispatcher.Invoke(() => ProgressBar.Value += 1);
}
}
} | mit | C# |
01a35eca066b97763a4888060cd148e8f6361d0a | Update LocatorModule.cs | wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D | apps/Core2D.Avalonia/Modules/LocatorModule.cs | apps/Core2D.Avalonia/Modules/LocatorModule.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Autofac;
using ServiceProvider.Autofac;
namespace Core2D.Avalonia.Modules
{
/// <summary>
/// Locator components module.
/// </summary>
public class LocatorModule : Module
{
/// <inheritdoc/>
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<AutofacServiceProvider>().As<IServiceProvider>().InstancePerLifetimeScope();
}
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Autofac;
using Core2D.Avalonia.Locator;
namespace Core2D.Avalonia.Modules
{
/// <summary>
/// Locator components module.
/// </summary>
public class LocatorModule : Module
{
/// <inheritdoc/>
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<ServiceProvider>().As<IServiceProvider>().InstancePerLifetimeScope();
}
}
}
| mit | C# |
e3fd4113d41329eea28cdac45651159af654175f | Change EntityPermission Id type | tidm/TAuthorization | src/TAuthorization/TAuthorization/EntityPermission.cs | src/TAuthorization/TAuthorization/EntityPermission.cs | using System;
using System.Collections.Generic;
namespace TAuthorization
{
public class EntityPermission
{
private Dictionary<string, string> _rawActionParams = new Dictionary<string, string>();
public virtual string Id { get; set; }
public virtual string EntityId { get; set; }
public virtual string Action { get; set; }
public virtual string RoleName { get; set; }
public virtual Permission Permission { get; set; }
public virtual Dictionary<string, string> RawActionParams
{
get { return _rawActionParams; }
set { _rawActionParams = value; }
}
}
public class EntityPermission<TActionParamsType> : EntityPermission
{
public TActionParamsType ActionParameters { get; set; }
}
}
| using System;
using System.Collections.Generic;
namespace TAuthorization
{
public class EntityPermission
{
private Dictionary<string, string> _rawActionParams = new Dictionary<string, string>();
public virtual Guid Id { get; set; }
public virtual string EntityId { get; set; }
public virtual string Action { get; set; }
public virtual string RoleName { get; set; }
public virtual Permission Permission { get; set; }
public virtual Dictionary<string, string> RawActionParams
{
get { return _rawActionParams; }
set { _rawActionParams = value; }
}
}
public class EntityPermission<TActionParamsType> : EntityPermission
{
public TActionParamsType ActionParameters { get; set; }
}
}
| mit | C# |
6c3a5361d4a27fac2b57ab7b25f6a21923ea1230 | Make sure backend can be reached outside of local network. | BibleBot/BibleBot,BibleBot/BibleBot,BibleBot/BibleBot | src/BibleBot.Backend/Program.cs | src/BibleBot.Backend/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
using BibleBot.Backend.Services;
namespace BibleBot.Backend
{
public static class Program
{
public static void Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Console(outputTemplate: "[{Level:w4}] {Message:lj}{NewLine}{Exception}", theme: AnsiConsoleTheme.Code)
.CreateBootstrapLogger();
Log.Information("BibleBot v9.1-beta (Backend) by Kerygma Digital");
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog((context, services, configuration) => configuration
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.ReadFrom.Configuration(context.Configuration)
.ReadFrom.Services(services)
.Enrich.FromLogContext()
.WriteTo.Console(outputTemplate: "[{Level:w4}] {Message:lj}{NewLine}{Exception}", theme: AnsiConsoleTheme.Code))
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.UseKestrel();
webBuilder.UseUrls(new string[]{"http://0.0.0.0:5000", "https://0.0.0.0:5001"});
});
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
using BibleBot.Backend.Services;
namespace BibleBot.Backend
{
public static class Program
{
public static void Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Console(outputTemplate: "[{Level:w4}] {Message:lj}{NewLine}{Exception}", theme: AnsiConsoleTheme.Code)
.CreateBootstrapLogger();
Log.Information("BibleBot v9.1-beta (Backend) by Kerygma Digital");
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog((context, services, configuration) => configuration
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.ReadFrom.Configuration(context.Configuration)
.ReadFrom.Services(services)
.Enrich.FromLogContext()
.WriteTo.Console(outputTemplate: "[{Level:w4}] {Message:lj}{NewLine}{Exception}", theme: AnsiConsoleTheme.Code))
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
| mpl-2.0 | C# |
313d19eb5785a3e017663cfefe81ebff0717c307 | Update XDocument.cs | wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D | src/Core2D/Project/XDocument.cs | src/Core2D/Project/XDocument.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Immutable;
using Core2D.Attributes;
namespace Core2D.Project
{
/// <summary>
/// Document model.
/// </summary>
public class XDocument : XSelectable
{
private bool _isExpanded = true;
private ImmutableArray<XContainer> _pages;
/// <summary>
/// Gets or sets flag indicating whether document is expanded.
/// </summary>
public bool IsExpanded
{
get => _isExpanded;
set => Update(ref _isExpanded, value);
}
/// <summary>
/// Gets or sets document pages.
/// </summary>
[Content]
public ImmutableArray<XContainer> Pages
{
get => _pages;
set => Update(ref _pages, value);
}
/// <summary>
/// Initializes a new instance of the <see cref="XDocument"/> class.
/// </summary>
public XDocument() : base() => _pages = ImmutableArray.Create<XContainer>();
/// <summary>
/// Creates a new <see cref="XDocument"/> instance.
/// </summary>
/// <param name="name">The document name.</param>
/// <returns>The new instance of the <see cref="XDocument"/> class.</returns>
public static XDocument Create(string name = "Document") => new XDocument() { Name = name };
/// <summary>
/// Check whether the <see cref="IsExpanded"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public bool ShouldSerializeIsExpanded() => _isExpanded != default(bool);
/// <summary>
/// Check whether the <see cref="Pages"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public bool ShouldSerializePages() => _pages.IsEmpty == false;
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Immutable;
using Core2D.Attributes;
namespace Core2D.Project
{
/// <summary>
/// Document model.
/// </summary>
public class XDocument : XSelectable
{
private string _name;
private bool _isExpanded = true;
private ImmutableArray<XContainer> _pages;
/// <summary>
/// Gets or sets document name.
/// </summary>
[Name]
public string Name
{
get => _name;
set => Update(ref _name, value);
}
/// <summary>
/// Gets or sets flag indicating whether document is expanded.
/// </summary>
public bool IsExpanded
{
get => _isExpanded;
set => Update(ref _isExpanded, value);
}
/// <summary>
/// Gets or sets document pages.
/// </summary>
[Content]
public ImmutableArray<XContainer> Pages
{
get => _pages;
set => Update(ref _pages, value);
}
/// <summary>
/// Initializes a new instance of the <see cref="XDocument"/> class.
/// </summary>
public XDocument() : base() => _pages = ImmutableArray.Create<XContainer>();
/// <summary>
/// Creates a new <see cref="XDocument"/> instance.
/// </summary>
/// <param name="name">The document name.</param>
/// <returns>The new instance of the <see cref="XDocument"/> class.</returns>
public static XDocument Create(string name = "Document") => new XDocument() { Name = name };
/// <summary>
/// Check whether the <see cref="Name"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public bool ShouldSerializeName() => !String.IsNullOrWhiteSpace(_name);
/// <summary>
/// Check whether the <see cref="IsExpanded"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public bool ShouldSerializeIsExpanded() => _isExpanded != default(bool);
/// <summary>
/// Check whether the <see cref="Pages"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public bool ShouldSerializePages() => _pages.IsEmpty == false;
}
}
| mit | C# |
c53779654ed0c38b86b9b1286403b921bd469dc0 | Remove unnecessary instantiation | vedi/unity3d-levelup,vedi/unity3d-levelup,vedi/unity3d-levelup,vedi/unity3d-levelup,vedi/unity3d-levelup | Soomla/Assets/Plugins/Soomla/Levelup/Config/LevelUpSettings.cs | Soomla/Assets/Plugins/Soomla/Levelup/Config/LevelUpSettings.cs | /// Copyright (C) 2012-2014 Soomla Inc.
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
using UnityEngine;
using System.IO;
using System;
using System.Collections.Generic;
using System.Linq;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Soomla.Levelup
{
#if UNITY_EDITOR
[InitializeOnLoad]
#endif
/// <summary>
/// This class holds the levelup's configurations.
/// </summary>
public class LevelUpSettings : ISoomlaSettings
{
#if UNITY_EDITOR
static LevelUpSettings instance = new LevelUpSettings();
static string currentModuleVersion = "1.0.18";
static LevelUpSettings()
{
SoomlaEditorScript.addSettings(instance);
SoomlaEditorScript.addFileList("LevelUp", "Assets/Soomla/levelup_file_list", new string[] {});
}
// BuildTargetGroup[] supportedPlatforms = { BuildTargetGroup.Android, BuildTargetGroup.iPhone,
// BuildTargetGroup.WebPlayer, BuildTargetGroup.Standalone};
GUIContent levelUpVersion = new GUIContent("LevelUp Version [?]", "The SOOMLA LevelUp version. ");
private LevelUpSettings()
{
}
public void OnEnable() {
// Generating AndroidManifest.xml
// ManifestTools.GenerateManifest();
}
public void OnModuleGUI() {
// AndroidGUI();
// EditorGUILayout.Space();
// IOSGUI();
}
public void OnInfoGUI() {
SoomlaEditorScript.RemoveSoomlaModuleButton(levelUpVersion, currentModuleVersion, "LevelUp");
SoomlaEditorScript.LatestVersionField ("unity3d-levelup", currentModuleVersion, "New LevelUp version available!", "http://library.soom.la/fetch/unity3d-levelup/latest?cf=unity");
EditorGUILayout.Space();
}
public void OnSoomlaGUI() {
}
#endif
/** LevelUp Specific Variables **/
}
}
| /// Copyright (C) 2012-2014 Soomla Inc.
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
using UnityEngine;
using System.IO;
using System;
using System.Collections.Generic;
using System.Linq;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Soomla.Levelup
{
#if UNITY_EDITOR
[InitializeOnLoad]
#endif
/// <summary>
/// This class holds the levelup's configurations.
/// </summary>
public class LevelUpSettings : ISoomlaSettings
{
#if UNITY_EDITOR
static LevelUpSettings instance = new LevelUpSettings();
static string currentModuleVersion = "1.0.18";
static LevelUpSettings()
{
SoomlaEditorScript.addSettings(instance);
List<string> additionalDependFiles = new List<string>(); //Add files that not tracked in file_list
SoomlaEditorScript.addFileList("LevelUp", "Assets/Soomla/levelup_file_list", additionalDependFiles.ToArray());
}
// BuildTargetGroup[] supportedPlatforms = { BuildTargetGroup.Android, BuildTargetGroup.iPhone,
// BuildTargetGroup.WebPlayer, BuildTargetGroup.Standalone};
GUIContent levelUpVersion = new GUIContent("LevelUp Version [?]", "The SOOMLA LevelUp version. ");
private LevelUpSettings()
{
}
public void OnEnable() {
// Generating AndroidManifest.xml
// ManifestTools.GenerateManifest();
}
public void OnModuleGUI() {
// AndroidGUI();
// EditorGUILayout.Space();
// IOSGUI();
}
public void OnInfoGUI() {
SoomlaEditorScript.RemoveSoomlaModuleButton(levelUpVersion, currentModuleVersion, "LevelUp");
SoomlaEditorScript.LatestVersionField ("unity3d-levelup", currentModuleVersion, "New LevelUp version available!", "http://library.soom.la/fetch/unity3d-levelup/latest?cf=unity");
EditorGUILayout.Space();
}
public void OnSoomlaGUI() {
}
#endif
/** LevelUp Specific Variables **/
}
}
| apache-2.0 | C# |
2dc0f61a42e9e19c9b7f1c4ac59dad131c87b4c3 | Fix unit test | MetSystem/Orchard,JRKelso/Orchard,marcoaoteixeira/Orchard,LaserSrl/Orchard,ericschultz/outercurve-orchard,Ermesx/Orchard,bigfont/orchard-cms-modules-and-themes,caoxk/orchard,alejandroaldana/Orchard,jagraz/Orchard,NIKASoftwareDevs/Orchard,luchaoshuai/Orchard,escofieldnaxos/Orchard,Sylapse/Orchard.HttpAuthSample,AEdmunds/beautiful-springtime,mvarblow/Orchard,andyshao/Orchard,austinsc/Orchard,KeithRaven/Orchard,fortunearterial/Orchard,Praggie/Orchard,enspiral-dev-academy/Orchard,DonnotRain/Orchard,rtpHarry/Orchard,angelapper/Orchard,Cphusion/Orchard,patricmutwiri/Orchard,openbizgit/Orchard,andyshao/Orchard,Praggie/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,AndreVolksdorf/Orchard,vard0/orchard.tan,escofieldnaxos/Orchard,dozoft/Orchard,tobydodds/folklife,alejandroaldana/Orchard,infofromca/Orchard,geertdoornbos/Orchard,ericschultz/outercurve-orchard,sebastienros/msc,neTp9c/Orchard,Morgma/valleyviewknolls,Inner89/Orchard,Morgma/valleyviewknolls,Anton-Am/Orchard,fortunearterial/Orchard,qt1/orchard4ibn,LaserSrl/Orchard,hbulzy/Orchard,jerryshi2007/Orchard,angelapper/Orchard,m2cms/Orchard,qt1/orchard4ibn,asabbott/chicagodevnet-website,sfmskywalker/Orchard,vard0/orchard.tan,Lombiq/Orchard,arminkarimi/Orchard,MpDzik/Orchard,xkproject/Orchard,marcoaoteixeira/Orchard,xiaobudian/Orchard,jerryshi2007/Orchard,abhishekluv/Orchard,SouleDesigns/SouleDesigns.Orchard,ehe888/Orchard,Fogolan/OrchardForWork,omidnasri/Orchard,Dolphinsimon/Orchard,patricmutwiri/Orchard,yonglehou/Orchard,vard0/orchard.tan,dburriss/Orchard,oxwanawxo/Orchard,dcinzona/Orchard-Harvest-Website,SeyDutch/Airbrush,MpDzik/Orchard,mgrowan/Orchard,luchaoshuai/Orchard,sebastienros/msc,abhishekluv/Orchard,dozoft/Orchard,dcinzona/Orchard,mgrowan/Orchard,Fogolan/OrchardForWork,SzymonSel/Orchard,mvarblow/Orchard,ehe888/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,jagraz/Orchard,NIKASoftwareDevs/Orchard,jagraz/Orchard,huoxudong125/Orchard,xiaobudian/Orchard,AndreVolksdorf/Orchard,AEdmunds/beautiful-springtime,Inner89/Orchard,jtkech/Orchard,Praggie/Orchard,m2cms/Orchard,AEdmunds/beautiful-springtime,armanforghani/Orchard,TalaveraTechnologySolutions/Orchard,tobydodds/folklife,yersans/Orchard,rtpHarry/Orchard,marcoaoteixeira/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,DonnotRain/Orchard,spraiin/Orchard,jimasp/Orchard,stormleoxia/Orchard,sfmskywalker/Orchard,Lombiq/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,grapto/Orchard.CloudBust,jaraco/orchard,armanforghani/Orchard,mgrowan/Orchard,TaiAivaras/Orchard,omidnasri/Orchard,emretiryaki/Orchard,fassetar/Orchard,li0803/Orchard,patricmutwiri/Orchard,oxwanawxo/Orchard,bigfont/orchard-cms-modules-and-themes,johnnyqian/Orchard,m2cms/Orchard,TaiAivaras/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,vairam-svs/Orchard,austinsc/Orchard,sebastienros/msc,geertdoornbos/Orchard,jchenga/Orchard,bedegaming-aleksej/Orchard,enspiral-dev-academy/Orchard,Anton-Am/Orchard,hhland/Orchard,qt1/Orchard,infofromca/Orchard,openbizgit/Orchard,omidnasri/Orchard,sfmskywalker/Orchard,OrchardCMS/Orchard,RoyalVeterinaryCollege/Orchard,oxwanawxo/Orchard,SeyDutch/Airbrush,fassetar/Orchard,aaronamm/Orchard,LaserSrl/Orchard,abhishekluv/Orchard,hhland/Orchard,TalaveraTechnologySolutions/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,yersans/Orchard,arminkarimi/Orchard,qt1/Orchard,qt1/Orchard,mvarblow/Orchard,asabbott/chicagodevnet-website,NIKASoftwareDevs/Orchard,xkproject/Orchard,sfmskywalker/Orchard,bigfont/orchard-continuous-integration-demo,stormleoxia/Orchard,AdvantageCS/Orchard,dcinzona/Orchard-Harvest-Website,phillipsj/Orchard,gcsuk/Orchard,caoxk/orchard,spraiin/Orchard,armanforghani/Orchard,fassetar/Orchard,enspiral-dev-academy/Orchard,Fogolan/OrchardForWork,fassetar/Orchard,tobydodds/folklife,johnnyqian/Orchard,OrchardCMS/Orchard-Harvest-Website,arminkarimi/Orchard,omidnasri/Orchard,Codinlab/Orchard,dcinzona/Orchard-Harvest-Website,yonglehou/Orchard,emretiryaki/Orchard,jtkech/Orchard,hannan-azam/Orchard,kgacova/Orchard,SeyDutch/Airbrush,m2cms/Orchard,andyshao/Orchard,Inner89/Orchard,smartnet-developers/Orchard,Dolphinsimon/Orchard,dcinzona/Orchard-Harvest-Website,xkproject/Orchard,sfmskywalker/Orchard,LaserSrl/Orchard,TalaveraTechnologySolutions/Orchard,TaiAivaras/Orchard,yersans/Orchard,ehe888/Orchard,neTp9c/Orchard,Codinlab/Orchard,salarvand/orchard,jchenga/Orchard,dozoft/Orchard,mvarblow/Orchard,Sylapse/Orchard.HttpAuthSample,Sylapse/Orchard.HttpAuthSample,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,vairam-svs/Orchard,hbulzy/Orchard,RoyalVeterinaryCollege/Orchard,fortunearterial/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,rtpHarry/Orchard,patricmutwiri/Orchard,caoxk/orchard,JRKelso/Orchard,luchaoshuai/Orchard,xiaobudian/Orchard,salarvand/Portal,planetClaire/Orchard-LETS,huoxudong125/Orchard,enspiral-dev-academy/Orchard,stormleoxia/Orchard,openbizgit/Orchard,cooclsee/Orchard,dburriss/Orchard,SeyDutch/Airbrush,jersiovic/Orchard,AndreVolksdorf/Orchard,Anton-Am/Orchard,xiaobudian/Orchard,TaiAivaras/Orchard,neTp9c/Orchard,sebastienros/msc,andyshao/Orchard,planetClaire/Orchard-LETS,Lombiq/Orchard,aaronamm/Orchard,MetSystem/Orchard,stormleoxia/Orchard,marcoaoteixeira/Orchard,geertdoornbos/Orchard,tobydodds/folklife,Sylapse/Orchard.HttpAuthSample,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,Inner89/Orchard,li0803/Orchard,jtkech/Orchard,openbizgit/Orchard,omidnasri/Orchard,abhishekluv/Orchard,jerryshi2007/Orchard,jchenga/Orchard,SzymonSel/Orchard,jimasp/Orchard,OrchardCMS/Orchard-Harvest-Website,KeithRaven/Orchard,Ermesx/Orchard,JRKelso/Orchard,escofieldnaxos/Orchard,salarvand/orchard,sebastienros/msc,TalaveraTechnologySolutions/Orchard,TaiAivaras/Orchard,dcinzona/Orchard,LaserSrl/Orchard,Anton-Am/Orchard,gcsuk/Orchard,jersiovic/Orchard,abhishekluv/Orchard,kgacova/Orchard,phillipsj/Orchard,xkproject/Orchard,enspiral-dev-academy/Orchard,smartnet-developers/Orchard,mvarblow/Orchard,TalaveraTechnologySolutions/Orchard,infofromca/Orchard,AndreVolksdorf/Orchard,dburriss/Orchard,jtkech/Orchard,MpDzik/Orchard,yonglehou/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,jersiovic/Orchard,dburriss/Orchard,escofieldnaxos/Orchard,grapto/Orchard.CloudBust,li0803/Orchard,aaronamm/Orchard,salarvand/orchard,Praggie/Orchard,salarvand/Portal,dozoft/Orchard,Serlead/Orchard,vairam-svs/Orchard,luchaoshuai/Orchard,jimasp/Orchard,SzymonSel/Orchard,bigfont/orchard-continuous-integration-demo,brownjordaninternational/OrchardCMS,SouleDesigns/SouleDesigns.Orchard,jimasp/Orchard,austinsc/Orchard,AEdmunds/beautiful-springtime,emretiryaki/Orchard,patricmutwiri/Orchard,Dolphinsimon/Orchard,rtpHarry/Orchard,hhland/Orchard,qt1/orchard4ibn,Anton-Am/Orchard,cryogen/orchard,phillipsj/Orchard,bigfont/orchard-cms-modules-and-themes,alejandroaldana/Orchard,cryogen/orchard,brownjordaninternational/OrchardCMS,OrchardCMS/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,smartnet-developers/Orchard,hannan-azam/Orchard,huoxudong125/Orchard,kouweizhong/Orchard,omidnasri/Orchard,SzymonSel/Orchard,SouleDesigns/SouleDesigns.Orchard,Lombiq/Orchard,Dolphinsimon/Orchard,brownjordaninternational/OrchardCMS,escofieldnaxos/Orchard,qt1/Orchard,qt1/orchard4ibn,asabbott/chicagodevnet-website,KeithRaven/Orchard,harmony7/Orchard,li0803/Orchard,MpDzik/Orchard,ehe888/Orchard,kouweizhong/Orchard,huoxudong125/Orchard,jerryshi2007/Orchard,marcoaoteixeira/Orchard,grapto/Orchard.CloudBust,MetSystem/Orchard,gcsuk/Orchard,Fogolan/OrchardForWork,austinsc/Orchard,kouweizhong/Orchard,Serlead/Orchard,dcinzona/Orchard-Harvest-Website,AdvantageCS/Orchard,Cphusion/Orchard,Serlead/Orchard,TalaveraTechnologySolutions/Orchard,hhland/Orchard,luchaoshuai/Orchard,hhland/Orchard,xkproject/Orchard,infofromca/Orchard,omidnasri/Orchard,SouleDesigns/SouleDesigns.Orchard,johnnyqian/Orchard,rtpHarry/Orchard,armanforghani/Orchard,openbizgit/Orchard,TalaveraTechnologySolutions/Orchard,qt1/orchard4ibn,emretiryaki/Orchard,jchenga/Orchard,OrchardCMS/Orchard-Harvest-Website,OrchardCMS/Orchard-Harvest-Website,IDeliverable/Orchard,spraiin/Orchard,Codinlab/Orchard,cooclsee/Orchard,andyshao/Orchard,SouleDesigns/SouleDesigns.Orchard,RoyalVeterinaryCollege/Orchard,Codinlab/Orchard,Praggie/Orchard,stormleoxia/Orchard,grapto/Orchard.CloudBust,Ermesx/Orchard,Cphusion/Orchard,brownjordaninternational/OrchardCMS,jchenga/Orchard,bedegaming-aleksej/Orchard,phillipsj/Orchard,OrchardCMS/Orchard,arminkarimi/Orchard,salarvand/orchard,OrchardCMS/Orchard,aaronamm/Orchard,AdvantageCS/Orchard,harmony7/Orchard,OrchardCMS/Orchard-Harvest-Website,omidnasri/Orchard,ehe888/Orchard,sfmskywalker/Orchard,huoxudong125/Orchard,dcinzona/Orchard-Harvest-Website,jaraco/orchard,neTp9c/Orchard,Ermesx/Orchard,kouweizhong/Orchard,IDeliverable/Orchard,KeithRaven/Orchard,grapto/Orchard.CloudBust,mgrowan/Orchard,planetClaire/Orchard-LETS,Cphusion/Orchard,qt1/Orchard,KeithRaven/Orchard,fortunearterial/Orchard,oxwanawxo/Orchard,jaraco/orchard,jersiovic/Orchard,angelapper/Orchard,fortunearterial/Orchard,vard0/orchard.tan,sfmskywalker/Orchard,caoxk/orchard,IDeliverable/Orchard,MpDzik/Orchard,salarvand/Portal,vairam-svs/Orchard,spraiin/Orchard,OrchardCMS/Orchard-Harvest-Website,phillipsj/Orchard,JRKelso/Orchard,DonnotRain/Orchard,cooclsee/Orchard,bedegaming-aleksej/Orchard,ericschultz/outercurve-orchard,infofromca/Orchard,jagraz/Orchard,Morgma/valleyviewknolls,hbulzy/Orchard,jtkech/Orchard,cryogen/orchard,MetSystem/Orchard,OrchardCMS/Orchard,asabbott/chicagodevnet-website,alejandroaldana/Orchard,alejandroaldana/Orchard,RoyalVeterinaryCollege/Orchard,geertdoornbos/Orchard,salarvand/Portal,cryogen/orchard,kouweizhong/Orchard,MpDzik/Orchard,emretiryaki/Orchard,fassetar/Orchard,AdvantageCS/Orchard,spraiin/Orchard,RoyalVeterinaryCollege/Orchard,bigfont/orchard-cms-modules-and-themes,hannan-azam/Orchard,DonnotRain/Orchard,dozoft/Orchard,johnnyqian/Orchard,jersiovic/Orchard,xiaobudian/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,m2cms/Orchard,sfmskywalker/Orchard,Ermesx/Orchard,SzymonSel/Orchard,armanforghani/Orchard,Dolphinsimon/Orchard,jaraco/orchard,IDeliverable/Orchard,gcsuk/Orchard,arminkarimi/Orchard,vard0/orchard.tan,bigfont/orchard-continuous-integration-demo,Serlead/Orchard,qt1/orchard4ibn,Sylapse/Orchard.HttpAuthSample,DonnotRain/Orchard,kgacova/Orchard,JRKelso/Orchard,NIKASoftwareDevs/Orchard,Cphusion/Orchard,dburriss/Orchard,Lombiq/Orchard,li0803/Orchard,Morgma/valleyviewknolls,SeyDutch/Airbrush,bedegaming-aleksej/Orchard,planetClaire/Orchard-LETS,dcinzona/Orchard,salarvand/orchard,cooclsee/Orchard,geertdoornbos/Orchard,jerryshi2007/Orchard,yersans/Orchard,johnnyqian/Orchard,abhishekluv/Orchard,vard0/orchard.tan,brownjordaninternational/OrchardCMS,hbulzy/Orchard,gcsuk/Orchard,salarvand/Portal,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,bedegaming-aleksej/Orchard,angelapper/Orchard,bigfont/orchard-continuous-integration-demo,angelapper/Orchard,hbulzy/Orchard,hannan-azam/Orchard,ericschultz/outercurve-orchard,Morgma/valleyviewknolls,Inner89/Orchard,TalaveraTechnologySolutions/Orchard,planetClaire/Orchard-LETS,hannan-azam/Orchard,harmony7/Orchard,cooclsee/Orchard,bigfont/orchard-cms-modules-and-themes,oxwanawxo/Orchard,grapto/Orchard.CloudBust,AndreVolksdorf/Orchard,yonglehou/Orchard,Codinlab/Orchard,dcinzona/Orchard,Serlead/Orchard,tobydodds/folklife,IDeliverable/Orchard,jagraz/Orchard,yonglehou/Orchard,NIKASoftwareDevs/Orchard,aaronamm/Orchard,MetSystem/Orchard,dcinzona/Orchard,smartnet-developers/Orchard,omidnasri/Orchard,AdvantageCS/Orchard,mgrowan/Orchard,Fogolan/OrchardForWork,harmony7/Orchard,smartnet-developers/Orchard,vairam-svs/Orchard,harmony7/Orchard,austinsc/Orchard,kgacova/Orchard,yersans/Orchard,jimasp/Orchard,neTp9c/Orchard,tobydodds/folklife,dmitry-urenev/extended-orchard-cms-v10.1,kgacova/Orchard | src/Orchard/FileSystems/Dependencies/IDependenciesFolder.cs | src/Orchard/FileSystems/Dependencies/IDependenciesFolder.cs | using System.Collections.Generic;
using System.Linq;
using Orchard.Caching;
namespace Orchard.FileSystems.Dependencies {
public class DependencyDescriptor {
public DependencyDescriptor() {
References = Enumerable.Empty<ReferenceDescriptor>();
}
public string Name { get; set; }
public string LoaderName { get; set; }
public string VirtualPath { get; set; }
public IEnumerable<ReferenceDescriptor> References { get; set; }
}
public class ReferenceDescriptor {
public string Name { get; set; }
public string LoaderName { get; set; }
public string VirtualPath { get; set; }
}
public interface IDependenciesFolder : IVolatileProvider {
DependencyDescriptor GetDescriptor(string moduleName);
IEnumerable<DependencyDescriptor> LoadDescriptors();
void StoreDescriptors(IEnumerable<DependencyDescriptor> dependencyDescriptors);
}
}
| using System.Collections.Generic;
using Orchard.Caching;
namespace Orchard.FileSystems.Dependencies {
public class DependencyDescriptor {
public string Name { get; set; }
public string LoaderName { get; set; }
public string VirtualPath { get; set; }
public IEnumerable<ReferenceDescriptor> References { get; set; }
}
public class ReferenceDescriptor {
public string Name { get; set; }
public string LoaderName { get; set; }
public string VirtualPath { get; set; }
}
public interface IDependenciesFolder : IVolatileProvider {
DependencyDescriptor GetDescriptor(string moduleName);
IEnumerable<DependencyDescriptor> LoadDescriptors();
void StoreDescriptors(IEnumerable<DependencyDescriptor> dependencyDescriptors);
}
}
| bsd-3-clause | C# |
8c01ea24d1b4dee689c4bf2610c95b022ee8c621 | remove old codes | Mooophy/Sports-Store,Mooophy/Sports-Store,Mooophy/Sports-Store | SportsStore/SportsStore.WebUI/Controllers/ProductController.cs | SportsStore/SportsStore.WebUI/Controllers/ProductController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SportsStore.Domain.Abstract;
using SportsStore.Domain.Entities;
using SportsStore.WebUI.Models;
namespace SportsStore.WebUI.Controllers
{
public class ProductController : Controller
{
private IProductsRepository repository;
public int PageSize = 2;
public ProductController(IProductsRepository productRepository)
{
repository = productRepository;
}
public ViewResult List(int page = 1)
{
var model = new ProductsListViewModel
{
Products = repository.Products.OrderBy(p => p.ProductID).Skip((page - 1) * PageSize).Take(PageSize),
PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = PageSize, TotalItems = repository.Products.Count() }
};
return View(model);
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SportsStore.Domain.Abstract;
using SportsStore.Domain.Entities;
using SportsStore.WebUI.Models;
namespace SportsStore.WebUI.Controllers
{
public class ProductController : Controller
{
private IProductsRepository repository;
public int PageSize = 2;
public ProductController(IProductsRepository productRepository)
{
repository = productRepository;
}
public ViewResult List(int page = 1)
{
var model = new ProductsListViewModel
{
Products = repository.Products.OrderBy(p => p.ProductID).Skip((page - 1) * PageSize).Take(PageSize),
PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = PageSize, TotalItems = repository.Products.Count() }
};
return View(model);
//var products_of_one_page = repository
// .Products
// .OrderBy(p => p.ProductID)
// .Skip((page - 1) * PageSize)
// .Take(PageSize);
//return View(products_of_one_page);
}
}
} | mit | C# |
0c50931d2f072b36a1b0e4e4ff292e493dc549cd | change method of finding `incompatibleMod` | peppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu | osu.Game.Tests/Visual/Gameplay/TestSceneModValidity.cs | osu.Game.Tests/Visual/Gameplay/TestSceneModValidity.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 disable
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Tests.Visual.Gameplay
{
[HeadlessTest]
public class TestSceneModValidity : TestSceneAllRulesetPlayers
{
protected override void AddCheckSteps()
{
AddStep("Check all mod acronyms are unique", () =>
{
var mods = Ruleset.Value.CreateInstance().AllMods;
IEnumerable<string> acronyms = mods.Select(m => m.Acronym);
Assert.That(acronyms, Is.Unique);
});
AddStep("Check all mods are two-way incompatible", () =>
{
var mods = Ruleset.Value.CreateInstance().AllMods;
IEnumerable<Mod> modInstances = mods.Select(mod => mod.CreateInstance());
foreach (var mod in modInstances)
{
var modIncompatibilities = mod.IncompatibleMods;
foreach (var incompatibleModType in modIncompatibilities)
{
var incompatibleMod = modInstances.First(m => m.GetType().IsInstanceOfType(incompatibleModType));
Assert.That(incompatibleMod.IncompatibleMods.Contains(mod.GetType()));
}
}
});
}
}
}
| // 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 disable
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Tests.Visual.Gameplay
{
[HeadlessTest]
public class TestSceneModValidity : TestSceneAllRulesetPlayers
{
protected override void AddCheckSteps()
{
AddStep("Check all mod acronyms are unique", () =>
{
var mods = Ruleset.Value.CreateInstance().AllMods;
IEnumerable<string> acronyms = mods.Select(m => m.Acronym);
Assert.That(acronyms, Is.Unique);
});
AddStep("Check all mods are two-way incompatible", () =>
{
var mods = Ruleset.Value.CreateInstance().AllMods;
IEnumerable<Mod> modInstances = mods.Select(mod => mod.CreateInstance());
foreach (var mod in modInstances)
{
var modIncompatibilities = mod.IncompatibleMods;
foreach (var incompatibleModType in modIncompatibilities)
{
var incompatibleMod = (Mod)Activator.CreateInstance(incompatibleModType);
Assert.That(incompatibleMod?.IncompatibleMods.Contains(mod.GetType()) ?? false);
}
}
});
}
}
}
| mit | C# |
0435201ba3d2e31ef52f767f542d17e5a8f5ccfa | Update SimpleXmlBondSerializer.cs | tiksn/TIKSN-Framework | TIKSN.Core/Serialization/Bond/SimpleXmlBondSerializer.cs | TIKSN.Core/Serialization/Bond/SimpleXmlBondSerializer.cs | using Bond.Protocols;
using System.IO;
using System.Xml;
namespace TIKSN.Serialization.Bond
{
public class SimpleXmlBondSerializer : SerializerBase<string>
{
protected override string SerializeInternal<T>(T obj)
{
using (var output = new StringWriter())
{
var writer = new SimpleXmlWriter(XmlWriter.Create(output));
global::Bond.Serialize.To(writer, obj);
writer.Flush();
return output.GetStringBuilder().ToString();
}
}
}
} | using Bond.Protocols;
using System.IO;
using System.Xml;
namespace TIKSN.Serialization.Bond
{
public class SimpleXmlBondSerializer : SerializerBase<string>
{
protected override string SerializeInternal(object obj)
{
using (var output = new StringWriter())
{
var writer = new SimpleXmlWriter(XmlWriter.Create(output));
global::Bond.Serialize.To(writer, obj);
writer.Flush();
return output.GetStringBuilder().ToString();
}
}
}
} | mit | C# |
55e6d63fd51306e7376b94e837face6630e4e11d | Fix iOS strings processor loading | LorenzCK/Pseudo-i18n | src/ProcessorFactory.cs | src/ProcessorFactory.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PseudoInternationalization {
class ProcessorFactory {
private static readonly Dictionary<string, Type> _extensionMap = new Dictionary<string, Type> {
{ ".resx", typeof(ResxProcessor) },
{ ".xml", typeof(AndroidProcessor) },
{ ".strings", typeof(StringsProcessor) }
};
public bool IsSupported(string path) => _extensionMap.ContainsKey(Path.GetExtension(path));
public IProcessor GetProcessor(string path) {
var extension = Path.GetExtension(path);
if (_extensionMap.ContainsKey(extension)) {
return (IProcessor)Activator.CreateInstance(_extensionMap[extension]);
}
else {
throw new ArgumentException("File type not supported");
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PseudoInternationalization {
class ProcessorFactory {
private static readonly Dictionary<string, Type> _extensionMap = new Dictionary<string, Type> {
{ ".resx", typeof(ResxProcessor) },
{ ".xml", typeof(AndroidProcessor) },
{ ".strings", typeof(StringSplitOptions) }
};
public bool IsSupported(string path) => _extensionMap.ContainsKey(Path.GetExtension(path));
public IProcessor GetProcessor(string path) {
var extension = Path.GetExtension(path);
if (_extensionMap.ContainsKey(extension)) {
return (IProcessor)Activator.CreateInstance(_extensionMap[extension]);
}
else {
throw new ArgumentException("File type not supported");
}
}
}
}
| mit | C# |
1265194cf38d553942817a943ba9c7c14aded385 | Update AppBuilderExtensionsTests.cs | ipjohnson/EasyRpc,ipjohnson/EasyRpc | tests/EasyRpc.Tests/Middleware/AppBuilderExtensionsTests.cs | tests/EasyRpc.Tests/Middleware/AppBuilderExtensionsTests.cs | using System;
using System.Collections.Generic;
using System.Text;
using EasyRpc.AspNetCore;
using Microsoft.Extensions.DependencyInjection;
using SimpleFixture;
using SimpleFixture.Attributes;
using SimpleFixture.xUnit;
using Xunit;
namespace EasyRpc.Tests.Middleware
{
public class AppBuilderExtensionsTests
{
[Theory]
[AutoData]
public void AppBuilderExtensions_AddJsonRpc(ServiceCollection serviceCollection)
{
serviceCollection.AddJsonRpc();
Assert.Equal(9, serviceCollection.Count);
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using EasyRpc.AspNetCore;
using Microsoft.Extensions.DependencyInjection;
using SimpleFixture;
using SimpleFixture.Attributes;
using SimpleFixture.xUnit;
using Xunit;
namespace EasyRpc.Tests.Middleware
{
public class AppBuilderExtensionsTests
{
[Theory]
[AutoData]
public void AppBuilderExtensions_AddJsonRpc(ServiceCollection serviceCollection)
{
serviceCollection.AddJsonRpc();
Assert.Equal(8, serviceCollection.Count);
}
}
}
| mit | C# |
e123db183b6ec975fd2624f8824a5f3a4c79a153 | Remove redundant buffer free check. | DrabWeb/osu-framework,naoey/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,Tom94/osu-framework,default0/osu-framework,DrabWeb/osu-framework,naoey/osu-framework,default0/osu-framework,paparony03/osu-framework,ZLima12/osu-framework,paparony03/osu-framework,ppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,NeoAdonis/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework,NeoAdonis/osu-framework,Tom94/osu-framework,RedNesto/osu-framework,Nabile-Rahmani/osu-framework | osu.Framework/Graphics/OpenGL/Textures/TextureUpload.cs | osu.Framework/Graphics/OpenGL/Textures/TextureUpload.cs | //Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Drawing;
using OpenTK.Graphics.ES20;
namespace osu.Framework.Graphics.OpenGL.Textures
{
public class TextureUpload : IDisposable
{
private static TextureBufferStack bufferStack = new TextureBufferStack(10);
public int Level;
public PixelFormat Format = PixelFormat.Rgba;
public Rectangle Bounds;
public readonly byte[] Data;
public TextureUpload(int size)
{
Data = bufferStack.ReserveBuffer(size);
}
public TextureUpload(byte[] data)
{
Data = data;
}
#region IDisposable Support
private bool disposedValue = false;
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
bufferStack.FreeBuffer(Data);
disposedValue = true;
}
}
~TextureUpload()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
}
} | //Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Drawing;
using OpenTK.Graphics.ES20;
namespace osu.Framework.Graphics.OpenGL.Textures
{
public class TextureUpload : IDisposable
{
private static TextureBufferStack TextureBufferStack = new TextureBufferStack(10);
public int Level;
public PixelFormat Format = PixelFormat.Rgba;
public Rectangle Bounds;
public readonly byte[] Data;
private bool shouldFreeBuffer;
public TextureUpload(int size)
{
Data = TextureBufferStack.ReserveBuffer(size);
shouldFreeBuffer = true;
}
public TextureUpload(byte[] data)
{
Data = data;
}
#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (shouldFreeBuffer)
{
TextureBufferStack.FreeBuffer(Data);
}
disposedValue = true;
}
}
~TextureUpload()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
}
} | mit | C# |
75b26d0cdecd5335c4009009036e0b2c160bde63 | Add failing test cases | ppy/osu,smoogipooo/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,peppy/osu-new,UselessToucan/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu | osu.Game.Tests/Beatmaps/BeatmapDifficultyManagerTest.cs | osu.Game.Tests/Beatmaps/BeatmapDifficultyManagerTest.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
namespace osu.Game.Tests.Beatmaps
{
[TestFixture]
public class BeatmapDifficultyManagerTest
{
[Test]
public void TestKeyEqualsWithDifferentModInstances()
{
var key1 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
var key2 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
Assert.That(key1, Is.EqualTo(key2));
}
[Test]
public void TestKeyEqualsWithDifferentModOrder()
{
var key1 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
var key2 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHidden(), new OsuModHardRock() });
Assert.That(key1, Is.EqualTo(key2));
}
[TestCase(1.3, DifficultyRating.Easy)]
[TestCase(1.993, DifficultyRating.Easy)]
[TestCase(1.998, DifficultyRating.Normal)]
[TestCase(2.4, DifficultyRating.Normal)]
[TestCase(2.693, DifficultyRating.Normal)]
[TestCase(2.698, DifficultyRating.Hard)]
[TestCase(3.5, DifficultyRating.Hard)]
[TestCase(3.993, DifficultyRating.Hard)]
[TestCase(3.997, DifficultyRating.Insane)]
[TestCase(5.0, DifficultyRating.Insane)]
[TestCase(5.292, DifficultyRating.Insane)]
[TestCase(5.297, DifficultyRating.Expert)]
[TestCase(6.2, DifficultyRating.Expert)]
[TestCase(6.493, DifficultyRating.Expert)]
[TestCase(6.498, DifficultyRating.ExpertPlus)]
[TestCase(8.3, DifficultyRating.ExpertPlus)]
public void TestDifficultyRatingMapping(double starRating, DifficultyRating expectedBracket)
{
var actualBracket = BeatmapDifficultyManager.GetDifficultyRating(starRating);
Assert.AreEqual(expectedBracket, actualBracket);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
namespace osu.Game.Tests.Beatmaps
{
[TestFixture]
public class BeatmapDifficultyManagerTest
{
[Test]
public void TestKeyEqualsWithDifferentModInstances()
{
var key1 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
var key2 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
Assert.That(key1, Is.EqualTo(key2));
}
[Test]
public void TestKeyEqualsWithDifferentModOrder()
{
var key1 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHardRock(), new OsuModHidden() });
var key2 = new BeatmapDifficultyManager.DifficultyCacheLookup(1234, 0, new Mod[] { new OsuModHidden(), new OsuModHardRock() });
Assert.That(key1, Is.EqualTo(key2));
}
}
}
| mit | C# |
8200028b3e02dffcfc6229efcfad512605b9e999 | Put class in a namespace | nunit/nunit-console,nunit/nunit-console,nunit/nunit-console | NUnitFramework/src/framework/Constraints/ToleranceMode.cs | NUnitFramework/src/framework/Constraints/ToleranceMode.cs | // ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework.Constraints
{
/// <summary>
/// Modes in which the tolerance value for a comparison can be interpreted.
/// </summary>
public enum ToleranceMode
{
/// <summary>
/// The tolerance was created with a value, without specifying
/// how the value would be used. This is used to prevent setting
/// the mode more than once and is generally changed to Linear
/// upon execution of the test.
/// </summary>
None,
/// <summary>
/// The tolerance is used as a numeric range within which
/// two compared values are considered to be equal.
/// </summary>
Linear,
/// <summary>
/// Interprets the tolerance as the percentage by which
/// the two compared values my deviate from each other.
/// </summary>
Percent,
/// <summary>
/// Compares two values based in their distance in
/// representable numbers.
/// </summary>
Ulps
}
} | // ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
/// <summary>
/// Modes in which the tolerance value for a comparison can be interpreted.
/// </summary>
public enum ToleranceMode
{
/// <summary>
/// The tolerance was created with a value, without specifying
/// how the value would be used. This is used to prevent setting
/// the mode more than once and is generally changed to Linear
/// upon execution of the test.
/// </summary>
None,
/// <summary>
/// The tolerance is used as a numeric range within which
/// two compared values are considered to be equal.
/// </summary>
Linear,
/// <summary>
/// Interprets the tolerance as the percentage by which
/// the two compared values my deviate from each other.
/// </summary>
Percent,
/// <summary>
/// Compares two values based in their distance in
/// representable numbers.
/// </summary>
Ulps
} | mit | C# |
513f7a7574fe4d15a5e026606845fdee20ca7065 | Fix issues in SDK | dhawalharsora/connectedcare-sdk,SnapMD/connectedcare-sdk | SnapMD.ConnectedCare.Sdk/Models/OnDemandRequest.cs | SnapMD.ConnectedCare.Sdk/Models/OnDemandRequest.cs | // Copyright 2015 SnapMD, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections.Generic;
using SnapMD.Sdk.Models;
namespace SnapMD.ConnectedCare.Sdk.Models
{
public class OnDemandRequest
{
public OnDemandRequest()
{
Concerns = new List<IntakeConcern>();
}
public List<IntakeConcern> Concerns { get; set; }
public string Phone { get; set; }
public int PatientId { get; set; }
}
} | // Copyright 2015 SnapMD, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using SnapMD.ConnectedCare.ApiModels;
using SnapMD.Sdk.Models;
namespace SnapMD.ConnectedCare.Sdk.Models
{
public class OnDemandRequest
{
public IntakeConcern[] Concerns { get; set; }
public string Phone { get; set; }
public int PatientId { get; set; }
}
} | apache-2.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.