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 |
|---|---|---|---|---|---|---|---|---|
8bd26d687ab061756c500c0f35641cea970b422d
|
Add informational version attribute
|
TheAlmightyBob/oxyplot,svendu/oxyplot,BRER-TECH/oxyplot,GeertvanHorrik/oxyplot,lynxkor/oxyplot,as-zhuravlev/oxyplot_wpf_fork,lynxkor/oxyplot,Jofta/oxyplot,jeremyiverson/oxyplot,Mitch-Connor/oxyplot,HermanEldering/oxyplot,shoelzer/oxyplot,freudenthal/oxyplot,jeremyiverson/oxyplot,shoelzer/oxyplot,GeertvanHorrik/oxyplot,objorke/oxyplot,mattleibow/oxyplot,svendu/oxyplot,DotNetDoctor/oxyplot,svendu/oxyplot,objorke/oxyplot,olegtarasov/oxyplot,br111an/oxyplot,zur003/oxyplot,Jonarw/oxyplot,Isolocis/oxyplot,br111an/oxyplot,Rustemt/oxyplot,br111an/oxyplot,Rustemt/oxyplot,olegtarasov/oxyplot,freudenthal/oxyplot,NilesDavis/oxyplot,HermanEldering/oxyplot,lynxkor/oxyplot,H2ONaCl/oxyplot,BRER-TECH/oxyplot,bbqchickenrobot/oxyplot,Rustemt/oxyplot,bbqchickenrobot/oxyplot,objorke/oxyplot,sevoku/oxyplot,Sbosanquet/oxyplot,oxyplot/oxyplot,DotNetDoctor/oxyplot,TheAlmightyBob/oxyplot,as-zhuravlev/oxyplot_wpf_fork,Kaplas80/oxyplot,as-zhuravlev/oxyplot_wpf_fork,GeertvanHorrik/oxyplot,Mitch-Connor/oxyplot,jeremyiverson/oxyplot,TheAlmightyBob/oxyplot,Sbosanquet/oxyplot,bbqchickenrobot/oxyplot,H2ONaCl/oxyplot,Sbosanquet/oxyplot,shoelzer/oxyplot,ze-pequeno/oxyplot,mattleibow/oxyplot,Mitch-Connor/oxyplot,Kaplas80/oxyplot,H2ONaCl/oxyplot,sevoku/oxyplot,freudenthal/oxyplot
|
Source/GlobalAssemblyInfo.cs
|
Source/GlobalAssemblyInfo.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GlobalAssemblyInfo.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("OxyPlot")]
[assembly: AssemblyCompany("OxyPlot")]
[assembly: AssemblyCopyright("Copyright (C) OxyPlot 2012.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2014.1.1.1")]
[assembly: AssemblyInformationalVersion("2014.1.1.1-alpha")]
[assembly: AssemblyFileVersion("2014.1.1.1")]
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GlobalAssemblyInfo.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("OxyPlot")]
[assembly: AssemblyCompany("OxyPlot")]
[assembly: AssemblyCopyright("Copyright (C) OxyPlot 2012.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2014.1.1.1")]
[assembly: AssemblyFileVersion("2014.1.1.1")]
|
mit
|
C#
|
10712d1a01aabd3d3636f3f9f3fef6f22b6c34ae
|
Move SharpDX to next minor verison 2.5.1
|
sharpdx/Toolkit,sharpdx/Toolkit,tomba/Toolkit
|
Source/SharedAssemblyInfo.cs
|
Source/SharedAssemblyInfo.cs
|
// Copyright (c) 2010-2013 SharpDX - Alexandre Mutel
//
// 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.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly:AssemblyCompany("Alexandre Mutel")]
[assembly:AssemblyCopyright("Copyright © 2010-2013 Alexandre Mutel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyVersion("2.5.1")]
[assembly:AssemblyFileVersion("2.5.1")]
[assembly: NeutralResourcesLanguage("en-us")]
#if DEBUG
[assembly:AssemblyConfiguration("Debug")]
#else
[assembly:AssemblyConfiguration("Release")]
#endif
[assembly:ComVisible(false)]
|
// Copyright (c) 2010-2013 SharpDX - Alexandre Mutel
//
// 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.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly:AssemblyCompany("Alexandre Mutel")]
[assembly:AssemblyCopyright("Copyright © 2010-2013 Alexandre Mutel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyVersion("2.5.0")]
[assembly:AssemblyFileVersion("2.5.0")]
[assembly: NeutralResourcesLanguage("en-us")]
#if DEBUG
[assembly:AssemblyConfiguration("Debug")]
#else
[assembly:AssemblyConfiguration("Release")]
#endif
[assembly:ComVisible(false)]
|
mit
|
C#
|
11eb0156ea2fb54909ca65a8182b5dadc2d748e7
|
Create subclass for Servicelevel for mapping JSON
|
goshippo/shippo-csharp-client
|
Shippo/Rate.cs
|
Shippo/Rate.cs
|
using System;
using Newtonsoft.Json;
namespace Shippo {
[JsonObject(MemberSerialization.OptIn)]
public class Rate : ShippoId {
[JsonProperty(PropertyName = "object_created")]
public object ObjectCreated { get; set; }
[JsonProperty(PropertyName = "object_owner")]
public object ObjectOwner { get; set; }
[JsonProperty(PropertyName = "attributes")]
public object Attributes { get; set; }
[JsonProperty(PropertyName = "amount_local")]
public object AmountLocal { get; set; }
[JsonProperty(PropertyName = "currency_local")]
public object CurrencyLocal { get; set; }
[JsonProperty(PropertyName = "amount")]
public object Amount { get; set; }
[JsonProperty(PropertyName = "currency")]
public object Currency { get; set; }
[JsonProperty(PropertyName = "provider")]
public object Provider { get; set; }
[JsonProperty(PropertyName = "provider_image_75")]
public object ProviderImage75 { get; set; }
[JsonProperty(PropertyName = "provider_image_200")]
public object ProviderImage200 { get; set; }
[JsonProperty(PropertyName = "servicelevel")]
public ServiceLevel Servicelevel { get; set; }
[JsonProperty(PropertyName = "estimated_days")]
public object EstimatedDays { get; set; }
[JsonProperty(PropertyName = "duration_terms")]
public object DurationTerms { get; set; }
[JsonProperty(PropertyName = "messages")]
public object Messages { get; set; }
[JsonProperty(PropertyName = "zone")]
public object Zone { get; set; }
public class ServiceLevel {
[JsonProperty (PropertyName = "name")]
public object Name { get; set; }
[JsonProperty (PropertyName = "token")]
public object Token { get; set; }
[JsonProperty (PropertyName = "terms")]
public object Terms { get; set; }
}
}
}
|
using System;
using Newtonsoft.Json;
namespace Shippo {
[JsonObject(MemberSerialization.OptIn)]
public class Rate : ShippoId {
[JsonProperty(PropertyName = "object_created")]
public object ObjectCreated { get; set; }
[JsonProperty(PropertyName = "object_owner")]
public object ObjectOwner { get; set; }
[JsonProperty(PropertyName = "attributes")]
public object Attributes { get; set; }
[JsonProperty(PropertyName = "amount_local")]
public object AmountLocal { get; set; }
[JsonProperty(PropertyName = "currency_local")]
public object CurrencyLocal { get; set; }
[JsonProperty(PropertyName = "amount")]
public object Amount { get; set; }
[JsonProperty(PropertyName = "currency")]
public object Currency { get; set; }
[JsonProperty(PropertyName = "provider")]
public object Provider { get; set; }
[JsonProperty(PropertyName = "provider_image_75")]
public object ProviderImage75 { get; set; }
[JsonProperty(PropertyName = "provider_image_200")]
public object ProviderImage200 { get; set; }
[JsonProperty(PropertyName = "servicelevel")]
public object Servicelevel { get; set; }
[JsonProperty(PropertyName = "estimated_days")]
public object EstimatedDays { get; set; }
[JsonProperty(PropertyName = "duration_terms")]
public object DurationTerms { get; set; }
[JsonProperty(PropertyName = "messages")]
public object Messages { get; set; }
[JsonProperty(PropertyName = "zone")]
public object Zone { get; set; }
}
}
|
apache-2.0
|
C#
|
f345ede698fb8ac51480ff30f7b5a9ecb73eaddf
|
Remove reference to statistic manager from timerdecorator.
|
Hammerstad/Moya
|
Moya.Runner/Runners/TimerDecorator.cs
|
Moya.Runner/Runners/TimerDecorator.cs
|
namespace Moya.Runner.Runners
{
using System.Diagnostics;
using System.Reflection;
using Models;
public class TimerDecorator : ITestRunner
{
public ITestRunner DecoratedTestRunner { get; set; }
public TimerDecorator(ITestRunner testRunner)
{
DecoratedTestRunner = testRunner;
}
public ITestResult Execute(MethodInfo methodInfo)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
var result = DecoratedTestRunner.Execute(methodInfo);
stopwatch.Stop();
result.Duration = stopwatch.ElapsedMilliseconds;
return result;
}
}
}
|
namespace Moya.Runner.Runners
{
using System.Diagnostics;
using System.Reflection;
using Models;
using Statistics;
public class TimerDecorator : ITestRunner
{
private readonly IDurationManager duration;
public ITestRunner DecoratedTestRunner { get; set; }
public TimerDecorator(ITestRunner testRunner)
{
DecoratedTestRunner = testRunner;
duration = DurationManager.DefaultInstance;
}
public ITestResult Execute(MethodInfo methodInfo)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
var result = DecoratedTestRunner.Execute(methodInfo);
stopwatch.Stop();
duration.AddOrUpdateDuration(methodInfo.GetHashCode(), stopwatch.ElapsedMilliseconds);
result.Duration = stopwatch.ElapsedMilliseconds;
return result;
}
}
}
|
mit
|
C#
|
5106d46206e937157bdaef95cc39c04f686cfea6
|
Remove index page content.
|
razsilev/Sv_Naum,razsilev/Sv_Naum,razsilev/Sv_Naum
|
Source/SvNaum.Web/Views/Home/Index.cshtml
|
Source/SvNaum.Web/Views/Home/Index.cshtml
|
@{
ViewBag.Title = "Начало";
}
|
@{
ViewBag.Title = "Начало";
}
<img src="../../Images/XristosVoskreseGoldModifikated.png" alt="Христос Воскресе!" class="image" />
<img src="../../Images/xvoskrese.png" alt="червено яйце" class="image" />
<div class="text">Някакъв текст.</div>
|
mit
|
C#
|
1c560e3c6aa4298dccbc80dcba3264095de781f0
|
Update UsTrafficWithSensorWorker.cs
|
bitsecondal/raspitraffic-stem,bitsecondal/raspitraffic-stem,bitsecondal/raspitraffic-stem
|
Almostengr.TrafficPi.LampControl/Workers/UsTrafficWithSensorWorker.cs
|
Almostengr.TrafficPi.LampControl/Workers/UsTrafficWithSensorWorker.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Almostengr.TrafficPi.LampControl.Common;
using Almostengr.TrafficPi.LampControl.Services;
using Microsoft.Extensions.Logging;
namespace Almostengr.TrafficPi.LampControl.Workers
{
public class UsTrafficWithSensorWorker : BaseWorker
{
private readonly ISensorService _carWaitingSensor;
public UsTrafficWithSensorWorker(ILogger<BaseWorker> logger, ISignalIndicationService signalIndication,
ISensorService carWaitingSensor) :
base(logger, signalIndication)
{
_carWaitingSensor = carWaitingSensor;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
int wait;
while (!stoppingToken.IsCancellationRequested)
{
_signalIndication.GreenLight();
wait = RedGreenDelay();
await Task.Delay(TimeSpan.FromSeconds(wait), stoppingToken);
_signalIndication.YellowLight();
wait = YellowDelay();
await Task.Delay(TimeSpan.FromSeconds(wait), stoppingToken);
_signalIndication.RedLight();
await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken); // all red and cross green phase
for(int i = 0; i < 180; i++)
{
bool buttonPressed = _carWaitingSensor.IsButtonPressed(InputPin.CarSensor);
await Task.Delay(TimeSpan.FromSeconds(1), stoppingToken);
if (buttonPressed)
{
_logger.LogInformation($"Car is waiting");
break;
}
} // end for
await Task.Delay(TimeSpan.FromSeconds(YellowDelay()), stoppingToken); // cross light yellow
await Task.Delay(TimeSpan.FromSeconds(1), stoppingToken); // all red phase
} // end while
}
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Almostengr.TrafficPi.LampControl.Common;
using Almostengr.TrafficPi.LampControl.Services;
using Microsoft.Extensions.Logging;
namespace Almostengr.TrafficPi.LampControl.Workers
{
public class UsTrafficWithSensorWorker : BaseWorker
{
private readonly ISensorService _carWaitingSensor;
public UsTrafficWithSensorWorker(ILogger<BaseWorker> logger, ISignalIndicationService signalIndication,
ISensorService carWaitingSensor) :
base(logger, signalIndication)
{
_carWaitingSensor = carWaitingSensor;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
int wait;
while (!stoppingToken.IsCancellationRequested)
{
_signalIndication.GreenLight();
wait = RedGreenDelay();
await Task.Delay(TimeSpan.FromSeconds(wait), stoppingToken);
_signalIndication.YellowLight();
wait = YellowDelay();
await Task.Delay(TimeSpan.FromSeconds(wait), stoppingToken);
_signalIndication.RedLight();
await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken);
for(int i = 0; i < 180; i++)
{
bool buttonPressed = _carWaitingSensor.IsButtonPressed(InputPin.CarSensor);
await Task.Delay(TimeSpan.FromSeconds(1), stoppingToken);
if (buttonPressed)
{
_logger.LogInformation($"Car is waiting");
await Task.Delay(TimeSpan.FromSeconds(YellowDelay() + 1), stoppingToken);
break;
}
} // end for
} // end while
}
}
}
|
mit
|
C#
|
3954345be5c785cf6237096a40b067d1c7e1774b
|
Use owinContext.Request.CallCancelled in default page middleware
|
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
|
Foundation/Server/Foundation.Api/Middlewares/DefaultPageMiddleware.cs
|
Foundation/Server/Foundation.Api/Middlewares/DefaultPageMiddleware.cs
|
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Owin;
using Foundation.Api.Contracts;
using Foundation.Core.Contracts;
namespace Foundation.Api.Middlewares
{
public class DefaultPageMiddleware : OwinMiddleware
{
public DefaultPageMiddleware(OwinMiddleware next)
: base(next)
{
}
public override async Task Invoke(IOwinContext context)
{
IDependencyResolver dependencyResolver = context.GetDependencyResolver();
string defaultPage = await dependencyResolver.Resolve<IDefaultHtmlPageProvider>().GetDefaultPageAsync(context.Request.CallCancelled);
context.Response.ContentType = "text/html; charset=utf-8";
await context.Response.WriteAsync(defaultPage);
}
}
}
|
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Owin;
using Foundation.Api.Contracts;
using Foundation.Core.Contracts;
namespace Foundation.Api.Middlewares
{
public class DefaultPageMiddleware : OwinMiddleware
{
public DefaultPageMiddleware(OwinMiddleware next)
: base(next)
{
}
public override async Task Invoke(IOwinContext context)
{
IDependencyResolver dependencyResolver = context.GetDependencyResolver();
string defaultPage = await dependencyResolver.Resolve<IDefaultHtmlPageProvider>().GetDefaultPageAsync(CancellationToken.None);
context.Response.ContentType = "text/html; charset=utf-8";
await context.Response.WriteAsync(defaultPage);
}
}
}
|
mit
|
C#
|
81a5849c338e1be6ea909b439bbaca5e92785d1a
|
Add Content-Type when sending a batch.
|
smartystreets/smartystreets-dotnet-sdk
|
src/sdk/USZipCodeApi/Client.cs
|
src/sdk/USZipCodeApi/Client.cs
|
namespace SmartyStreets.USZipCodeApi
{
using System;
using System.Collections.Generic;
using System.IO;
public class Client : IUSZipCodeClient
{
private readonly ISender sender;
private readonly ISerializer serializer;
public Client(ISender sender, ISerializer serializer)
{
this.sender = sender;
this.serializer = serializer;
}
public void Send(Lookup lookup)
{
if (lookup == null)
throw new ArgumentNullException("lookup");
this.Send(new Batch {lookup});
}
/// <summary>
/// Sends a batch of up to 100 lookups for verification
/// </summary>
public void Send(Batch batch)
{
if (batch == null)
throw new ArgumentNullException("batch");
var request = new Request();
if (batch.Count == 0)
return;
if (batch.Count == 1)
PopulateQueryString(batch[0], request);
else
{
request.Headers.Add("Content-Type", "application/json");
request.Payload = batch.Serialize(this.serializer);
}
var response = this.sender.Send(request);
var payloadStream = new MemoryStream(response.Payload);
var results = this.serializer.Deserialize<Result[]>(payloadStream) ?? new Result[0];
AssignResultsToLookups(batch, results);
}
private static void PopulateQueryString(Lookup lookup, Request request)
{
request.SetParameter("input_id", lookup.InputId);
request.SetParameter("city", lookup.City);
request.SetParameter("state", lookup.State);
request.SetParameter("zipcode", lookup.ZipCode);
}
private static void AssignResultsToLookups(Batch batch, IList<Result> results)
{
for (var i = 0; i < results.Count; i++)
batch[i].Result = results[i];
}
}
}
|
namespace SmartyStreets.USZipCodeApi
{
using System;
using System.Collections.Generic;
using System.IO;
public class Client : IUSZipCodeClient
{
private readonly ISender sender;
private readonly ISerializer serializer;
public Client(ISender sender, ISerializer serializer)
{
this.sender = sender;
this.serializer = serializer;
}
public void Send(Lookup lookup)
{
if (lookup == null)
throw new ArgumentNullException("lookup");
this.Send(new Batch {lookup});
}
/// <summary>
/// Sends a batch of up to 100 lookups for verification
/// </summary>
public void Send(Batch batch)
{
if (batch == null)
throw new ArgumentNullException("batch");
var request = new Request();
if (batch.Count == 0)
return;
if (batch.Count == 1)
PopulateQueryString(batch[0], request);
else
request.Payload = batch.Serialize(this.serializer);
var response = this.sender.Send(request);
var payloadStream = new MemoryStream(response.Payload);
var results = this.serializer.Deserialize<Result[]>(payloadStream) ?? new Result[0];
AssignResultsToLookups(batch, results);
}
private static void PopulateQueryString(Lookup lookup, Request request)
{
request.SetParameter("input_id", lookup.InputId);
request.SetParameter("city", lookup.City);
request.SetParameter("state", lookup.State);
request.SetParameter("zipcode", lookup.ZipCode);
}
private static void AssignResultsToLookups(Batch batch, IList<Result> results)
{
for (var i = 0; i < results.Count; i++)
batch[i].Result = results[i];
}
}
}
|
apache-2.0
|
C#
|
19ebf5ad7d8356b9f88716223d1c37759fcb41d6
|
Bring back blob disposal checks
|
SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia
|
src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs
|
src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs
|
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
namespace Avalonia.Platform.Internal;
internal class UnmanagedBlob : IUnmanagedBlob
{
private IntPtr _address;
private readonly object _lock = new object();
#if DEBUG
private static readonly List<string> Backtraces = new List<string>();
private static Thread? GCThread;
private readonly string _backtrace;
private static readonly object _btlock = new object();
class GCThreadDetector
{
~GCThreadDetector()
{
GCThread = Thread.CurrentThread;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Spawn() => new GCThreadDetector();
static UnmanagedBlob()
{
Spawn();
GC.WaitForPendingFinalizers();
}
#endif
public UnmanagedBlob(int size)
{
try
{
if (size <= 0)
throw new ArgumentException("Positive number required", nameof(size));
_address = Marshal.AllocHGlobal(size);
GC.AddMemoryPressure(size);
Size = size;
}
catch
{
GC.SuppressFinalize(this);
throw;
}
#if DEBUG
_backtrace = Environment.StackTrace;
lock (_btlock)
Backtraces.Add(_backtrace);
#endif
}
void DoDispose()
{
lock (_lock)
{
if (!IsDisposed)
{
#if DEBUG
lock (_btlock)
Backtraces.Remove(_backtrace);
#endif
Marshal.FreeHGlobal(_address);
GC.RemoveMemoryPressure(Size);
IsDisposed = true;
_address = IntPtr.Zero;
Size = 0;
}
}
}
public void Dispose()
{
#if DEBUG
if (Thread.CurrentThread.ManagedThreadId == GCThread?.ManagedThreadId)
{
lock (_lock)
{
if (!IsDisposed)
{
Console.Error.WriteLine("Native blob disposal from finalizer thread\nBacktrace: "
+ Environment.StackTrace
+ "\n\nBlob created by " + _backtrace);
}
}
}
#endif
DoDispose();
GC.SuppressFinalize(this);
}
~UnmanagedBlob()
{
#if DEBUG
Console.Error.WriteLine("Undisposed native blob created by " + _backtrace);
#endif
DoDispose();
}
public IntPtr Address => IsDisposed ? throw new ObjectDisposedException("UnmanagedBlob") : _address;
public int Size { get; private set; }
public bool IsDisposed { get; private set; }
}
|
using System;
using System.Runtime.InteropServices;
namespace Avalonia.Platform.Internal;
internal class UnmanagedBlob : IUnmanagedBlob
{
private IntPtr _address;
private readonly object _lock = new object();
public UnmanagedBlob(int size)
{
try
{
if (size <= 0)
throw new ArgumentException("Positive number required", nameof(size));
_address = Marshal.AllocHGlobal(size);
GC.AddMemoryPressure(size);
Size = size;
}
catch
{
GC.SuppressFinalize(this);
throw;
}
}
private void DoDispose()
{
lock (_lock)
{
if (!IsDisposed)
{
Marshal.FreeHGlobal(_address);
GC.RemoveMemoryPressure(Size);
IsDisposed = true;
_address = IntPtr.Zero;
Size = 0;
}
}
}
public void Dispose()
{
DoDispose();
GC.SuppressFinalize(this);
}
~UnmanagedBlob()
{
DoDispose();
}
public IntPtr Address => IsDisposed ? throw new ObjectDisposedException("UnmanagedBlob") : _address;
public int Size { get; private set; }
public bool IsDisposed { get; private set; }
}
|
mit
|
C#
|
116a85639b11b25f899952f7c7532ae0de1c8904
|
add expired helper for datetime
|
chrisowhite/IdentityServer4,jbijlsma/IdentityServer4,siyo-wang/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,chrisowhite/IdentityServer4,MienDev/IdentityServer4,jbijlsma/IdentityServer4,siyo-wang/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,jbijlsma/IdentityServer4,jbijlsma/IdentityServer4,chrisowhite/IdentityServer4,IdentityServer/IdentityServer4,IdentityServer/IdentityServer4,siyo-wang/IdentityServer4,IdentityServer/IdentityServer4
|
src/IdentityServer4/Extensions/DateTimeExtensions.cs
|
src/IdentityServer4/Extensions/DateTimeExtensions.cs
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System;
using System.Diagnostics;
namespace IdentityServer4.Extensions
{
internal static class DateTimeExtensions
{
[DebuggerStepThrough]
public static bool HasExceeded(this DateTime creationTime, int seconds)
{
return (DateTimeHelper.UtcNow > creationTime.AddSeconds(seconds));
}
[DebuggerStepThrough]
public static int GetLifetimeInSeconds(this DateTime creationTime)
{
return ((int)(DateTimeHelper.UtcNow - creationTime).TotalSeconds);
}
[DebuggerStepThrough]
public static bool HasExpired(this DateTime? expirationTime)
{
if (expirationTime.HasValue &&
expirationTime.Value.HasExpired())
{
return true;
}
return false;
}
[DebuggerStepThrough]
public static bool HasExpired(this DateTime expirationTime)
{
if (expirationTime < DateTimeHelper.UtcNow)
{
return true;
}
return false;
}
}
}
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System;
using System.Diagnostics;
namespace IdentityServer4.Extensions
{
internal static class DateTimeExtensions
{
[DebuggerStepThrough]
public static bool HasExceeded(this DateTime creationTime, int seconds)
{
return (DateTimeHelper.UtcNow > creationTime.AddSeconds(seconds));
}
[DebuggerStepThrough]
public static int GetLifetimeInSeconds(this DateTime creationTime)
{
return ((int)(DateTimeHelper.UtcNow - creationTime).TotalSeconds);
}
[DebuggerStepThrough]
public static bool HasExpired(this DateTime? expirationTime)
{
if (expirationTime.HasValue &&
expirationTime < DateTimeHelper.UtcNow)
{
return true;
}
return false;
}
}
}
|
apache-2.0
|
C#
|
6be9403268fa273c8819401a96d88a19413a6bdd
|
add Resolve method to StaticResolver
|
coolkev/LewisTech.Utils
|
src/LewisTech.Utils/Infrastructure/StaticResolver.cs
|
src/LewisTech.Utils/Infrastructure/StaticResolver.cs
|
using System;
namespace LewisTech.Utils.Infrastructure
{
public static class StaticResolver
{
public static IServiceProvider Current { get; set; }
public static T Resolve<T>() where T : class
{
return Current.GetService<T>();
}
}
}
|
using System;
namespace LewisTech.Utils.Infrastructure
{
public static class StaticResolver
{
public static IServiceProvider Current { get; set; }
}
}
|
mit
|
C#
|
44838de9da50e69143df8b280d3c877611a31409
|
use OnStart/OnStop for setting up/tearing down view model bindings
|
bordoley/RxApp
|
RxApp.Example.Android/MainActivity.cs
|
RxApp.Example.Android/MainActivity.cs
|
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Android.App;
using Android.OS;
using Android.Widget;
using Toolbar = Android.Support.V7.Widget.Toolbar;
using RxApp;
using RxApp.Android;
namespace RxApp.Example
{
[Activity(Label = "MainActivity")]
public sealed class MainActivity : RxActionBarActivity<IMainViewModel>
{
private IDisposable subscription = null;
private Button button;
protected override void OnCreate(Bundle bundle)
{
// Update the activity theme. Must be the first thing done in OnCreate();
this.SetTheme(Resource.Style.RxAppTheme);
base.OnCreate(bundle);
this.SetContentView(Resource.Layout.Main);
button = this.FindViewById<Button>(Resource.Id.myButton);
var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
SetSupportActionBar (toolbar);
SupportActionBar.SetDisplayHomeAsUpEnabled (true);
SupportActionBar.SetHomeButtonEnabled (true);
}
protected override void OnStart()
{
base.OnStart();
var subscription = new CompositeDisposable();
subscription.Add(this.ViewModel.OpenPage.Bind(button));
this.subscription = subscription;
}
protected override void OnStop()
{
subscription.Dispose();
base.OnStop();
}
}
}
|
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Android.App;
using Android.OS;
using Android.Widget;
using Toolbar = Android.Support.V7.Widget.Toolbar;
using RxApp;
using RxApp.Android;
namespace RxApp.Example
{
[Activity(Label = "MainActivity")]
public sealed class MainActivity : RxActionBarActivity<IMainViewModel>
{
private IDisposable subscription = null;
private Button button;
protected override void OnCreate(Bundle bundle)
{
// Update the activity theme. Must be the first thing done in OnCreate();
this.SetTheme(Resource.Style.RxAppTheme);
base.OnCreate(bundle);
this.SetContentView(Resource.Layout.Main);
button = this.FindViewById<Button>(Resource.Id.myButton);
var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
SetSupportActionBar (toolbar);
SupportActionBar.SetDisplayHomeAsUpEnabled (true);
SupportActionBar.SetHomeButtonEnabled (true);
}
protected override void OnResume()
{
base.OnResume();
var subscription = new CompositeDisposable();
subscription.Add(this.ViewModel.OpenPage.Bind(button));
this.subscription = subscription;
}
protected override void OnPause()
{
subscription.Dispose();
base.OnPause();
}
}
}
|
apache-2.0
|
C#
|
7aeb6536ff7e29b3bccd9161d23f0c288a45c711
|
Fix Test
|
sboulema/CodeNav,sboulema/CodeNav
|
CodeNav.Tests/HelperTests/VisibilityHelperTests.cs
|
CodeNav.Tests/HelperTests/VisibilityHelperTests.cs
|
using CodeNav.Helpers;
using CodeNav.Mappers;
using CodeNav.Models;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
namespace CodeNav.Tests.HelperTests
{
[TestFixture]
public class VisibilityHelperTests
{
[TestCase(false, Visibility.Visible)]
[TestCase(true, Visibility.Collapsed)]
public void EmptyItemsShouldRespectSetting(bool hideItemsWithoutChildren, Visibility expectedVisibility)
{
var document = new CodeDocumentViewModel
{
CodeDocument = SyntaxMapper.MapDocument(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\TestVisibility.cs"))
};
SettingsHelper.FilterRules = new List<FilterRule>
{
new FilterRule
{
Access = CodeItemAccessEnum.All,
Kind = CodeItemKindEnum.Class,
Visible = true,
HideIfEmpty = hideItemsWithoutChildren
}
};
VisibilityHelper.SetCodeItemVisibility(document.CodeDocument);
var firstClass = (document.CodeDocument.First() as IMembers).Members.First() as CodeClassItem;
Assert.AreEqual(expectedVisibility, firstClass.IsVisible);
}
}
}
|
using CodeNav.Helpers;
using CodeNav.Mappers;
using CodeNav.Models;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
namespace CodeNav.Tests.HelperTests
{
[TestFixture]
public class VisibilityHelperTests
{
[TestCase(false, Visibility.Visible)]
[TestCase(true, Visibility.Collapsed)]
public void EmptyItemsShouldRespectSetting(bool hideItemsWithoutChildren, Visibility expectedVisibility)
{
var document = new CodeDocumentViewModel
{
CodeDocument = SyntaxMapper.MapDocument(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\TestVisibility.cs"))
};
SettingsHelper.FilterRules = new List<FilterRule>
{
new FilterRule
{
Access = CodeItemAccessEnum.All,
Kind = CodeItemKindEnum.Class,
HideIfEmpty = hideItemsWithoutChildren
}
};
VisibilityHelper.SetCodeItemVisibility(document.CodeDocument);
var firstClass = (document.CodeDocument.First() as IMembers).Members.First() as CodeClassItem;
Assert.AreEqual(expectedVisibility, firstClass.IsVisible);
}
}
}
|
mit
|
C#
|
e8c98bdc41a03ae22e3a7107f14d01eee8b29919
|
Add MLC and SMC to education levels
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
Battery-Commander.Web/Models/MilitaryEducationLevel.cs
|
Battery-Commander.Web/Models/MilitaryEducationLevel.cs
|
using System.ComponentModel.DataAnnotations;
namespace BatteryCommander.Web.Models
{
public enum MilitaryEducationLevel : byte
{
Unknown,
[Display(Name = "(AIT) Advanced Individual Training", ShortName = "AIT")]
AIT = 1,
[Display(Name = "(BLC) Basic Leader Course", ShortName = "BLC")]
BLC = 2,
[Display(Name = "(ALC) Advanced Leader Course", ShortName = "ALC")]
ALC = 3,
[Display(Name = "(SLC) Senior Leader Course", ShortName = "SLC")]
SLC = 4,
[Display(Name = "(MLC) Master Leader Course", ShortName = "MLC")]
MLC = 5,
[Display(Name = "(SMC) Sergeants Major Course", ShortName = "SMC")]
SMC = 6,
[Display(Name = "(BOLC) Basic Officer Leaders Course", ShortName = "BOLC")]
BOLC = 10,
[Display(Name = "(CCC) Captains Career Course", ShortName = "CCC")]
CCC = 11
}
}
|
using System.ComponentModel.DataAnnotations;
namespace BatteryCommander.Web.Models
{
public enum MilitaryEducationLevel : byte
{
Unknown,
[Display(Name = "(AIT) Advanced Individual Training", ShortName = "AIT")]
AIT = 1,
[Display(Name = "(BLC) Basic Leader Course", ShortName = "BLC")]
BLC = 2,
[Display(Name = "(ALC) Advanced Leader Course", ShortName = "ALC")]
ALC = 3,
[Display(Name = "(SLC) Senior Leader Course", ShortName = "SLC")]
SLC = 4,
[Display(Name = "(BOLC) Basic Officer Leaders Course", ShortName = "BOLC")]
BOLC = 10,
[Display(Name = "(CCC) Captains Career Course", ShortName = "CCC")]
CCC = 11
}
}
|
mit
|
C#
|
996c15610668fedb30df9dd4d885b648a6fb82dc
|
apply suggestions
|
UselessToucan/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,smoogipooo/osu,ppy/osu
|
osu.Game/Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.cs
|
osu.Game/Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.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.Timing;
using osu.Game.Beatmaps;
using osu.Game.Storyboards.Drawables;
namespace osu.Game.Graphics.Backgrounds
{
public class BeatmapBackgroundWithStoryboard : BeatmapBackground
{
public BeatmapBackgroundWithStoryboard(WorkingBeatmap beatmap, string fallbackTextureName = "Backgrounds/bg1")
: base(beatmap, fallbackTextureName)
{
}
[BackgroundDependencyLoader]
private void load()
{
if (!Beatmap.Storyboard.HasDrawable)
return;
if (Beatmap.Storyboard.ReplacesBackground)
Sprite.Alpha = 0;
var audio = new AudioContainer { RelativeSizeAxes = Axes.Both };
audio.Volume.Value = 0;
AddInternal(audio);
LoadComponentAsync(new DrawableStoryboard(Beatmap.Storyboard) { Clock = new InterpolatingFramedClock(Beatmap.Track) }, audio.Add);
}
}
}
|
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Storyboards;
using osu.Game.Storyboards.Drawables;
namespace osu.Game.Graphics.Backgrounds
{
public class BeatmapBackgroundWithStoryboard : BeatmapBackground
{
public BeatmapBackgroundWithStoryboard(WorkingBeatmap beatmap, string fallbackTextureName = "Backgrounds/bg1")
: base(beatmap, fallbackTextureName)
{
}
[BackgroundDependencyLoader]
private void load()
{
var storyboard = new Storyboard { BeatmapInfo = Beatmap.BeatmapInfo };
foreach (var layer in storyboard.Layers)
{
if (layer.Name != "Fail")
layer.Elements = Beatmap.Storyboard.GetLayer(layer.Name).Elements.Where(e => !(e is StoryboardSampleInfo)).ToList();
}
if (!storyboard.HasDrawable)
return;
if (storyboard.ReplacesBackground)
{
Sprite.Texture = Texture.WhitePixel;
Sprite.Colour = Colour4.Black;
}
LoadComponentAsync(new DrawableStoryboard(storyboard) { Clock = new InterpolatingFramedClock(Beatmap.Track) }, AddInternal);
}
}
}
|
mit
|
C#
|
33aaa2c5bdb1ce6d6788b7958961eea5bc9498bc
|
clean up
|
icarus-consulting/Yaapii.Atoms
|
src/Yaapii.Atoms/IO/Sha256DigestOf.cs
|
src/Yaapii.Atoms/IO/Sha256DigestOf.cs
|
// MIT License
//
// Copyright(c) 2017 ICARUS Consulting GmbH
//
// 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.Security.Cryptography;
using Yaapii.Atoms.Scalar;
namespace Yaapii.Atoms.IO
{
/// <summary>
/// SHA-256 checksum calculation
/// </summary>
public sealed class Sha256DigestOf : DigestEnvelope
{
/// <summary>
/// SHA-256 checksum calculation of IInput.
/// </summary>
/// <param name="source">Input</param>
public Sha256DigestOf(IInput source) :
base(source, new ScalarOf<HashAlgorithm>(() => new SHA256CryptoServiceProvider()))
{ }
}
}
|
// MIT License
//
// Copyright(c) 2017 ICARUS Consulting GmbH
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using Yaapii.Atoms.Func;
using Yaapii.Atoms.Scalar;
namespace Yaapii.Atoms.IO
{
/// <summary>
/// SHA-256 checksum calculation
/// </summary>
public sealed class Sha256DigestOf : DigestEnvelope
{
private readonly IInput _source;
/// <summary>
/// SHA-256 checksum calculation of IInput.
/// </summary>
/// <param name="source">Input</param>
public Sha256DigestOf(IInput source) :
base(source, new ScalarOf<HashAlgorithm>(() => new SHA256CryptoServiceProvider()))
{ }
}
}
|
mit
|
C#
|
705978afaa24db4bc6c6b95393c45fd04fc95a57
|
fix typo and spacing issue
|
danbarua/EasyNetQ,Ascendon/EasyNetQ,EIrwin/EasyNetQ,mleenhardt/EasyNetQ,lukasz-lysik/EasyNetQ,fpommerening/EasyNetQ,scratch-net/EasyNetQ,ar7z1/EasyNetQ,nicklv/EasyNetQ,fpommerening/EasyNetQ,maverix/EasyNetQ,zidad/EasyNetQ,scratch-net/EasyNetQ,Pliner/EasyNetQ,zidad/EasyNetQ,alexwiese/EasyNetQ,lukasz-lysik/EasyNetQ,chinaboard/EasyNetQ,mleenhardt/EasyNetQ,blackcow02/EasyNetQ,sanjaysingh/EasyNetQ,blackcow02/EasyNetQ,ar7z1/EasyNetQ,reisenberger/EasyNetQ,reisenberger/EasyNetQ,GeckoInformasjonssystemerAS/EasyNetQ,EIrwin/EasyNetQ,alexwiese/EasyNetQ,EasyNetQ/EasyNetQ,maverix/EasyNetQ,micdenny/EasyNetQ,Ascendon/EasyNetQ,danbarua/EasyNetQ,alexwiese/EasyNetQ,sanjaysingh/EasyNetQ,tkirill/EasyNetQ,tkirill/EasyNetQ,chinaboard/EasyNetQ,GeckoInformasjonssystemerAS/EasyNetQ,Pliner/EasyNetQ,nicklv/EasyNetQ
|
Source/EasyNetQ/TypeNameSerializer.cs
|
Source/EasyNetQ/TypeNameSerializer.cs
|
using System;
namespace EasyNetQ
{
public interface ITypeNameSerializer
{
string Serialize(Type type);
Type DeSerialize(string typeName);
}
public class TypeNameSerializer : ITypeNameSerializer
{
public Type DeSerialize(string typeName)
{
var nameParts = typeName.Split(':');
if (nameParts.Length != 2)
{
throw new EasyNetQException(
"type name {0}, is not a valid EasyNetQ type name. Expected Type:Assembly",
typeName);
}
var type = Type.GetType(nameParts[0] + ", " + nameParts[1]);
if (type == null)
{
throw new EasyNetQException(
"Cannot find type {0}",
typeName);
}
return type;
}
public string Serialize(Type type)
{
Preconditions.CheckNotNull(type, "type");
var typeName = type.FullName + ":" + type.Assembly.GetName().Name;
if (typeName.Length > 255)
{
throw new EasyNetQException("The serialized name of type '{0}' exceeds the AMQP " +
"maximum short string length of 255 characters.",
type.Name);
}
return typeName;
}
}
}
|
using System;
namespace EasyNetQ
{
public interface ITypeNameSerializer
{
string Serialize(Type type);
Type DeSerialize(string typeName);
}
public class TypeNameSerializer : ITypeNameSerializer
{
public Type DeSerialize(string typeName)
{
var nameParts = typeName.Split(':');
if (nameParts.Length != 2)
{
throw new EasyNetQException(
"type name {0}, is not a valid EasyNetQ type name. Expected Type:Assembly",
typeName);
}
var type = Type.GetType(nameParts[0] + ", " + nameParts[1]);
if (type == null)
{
throw new EasyNetQException(
"Cannot find type {0}",
typeName);
}
return type;
}
public string Serialize(Type type)
{
Preconditions.CheckNotNull(type, "type");
var typeName = type.FullName + ":" + type.Assembly.GetName().Name;
if (typeName.Length > 255)
{
throw new EasyNetQException("The serialized name of type '{0}' exceeds the AMQP" +
"maximum short string lengh of 255 characters.",
type.Name);
}
return typeName;
}
}
}
|
mit
|
C#
|
22afa542a053b6780b555090362a614a2ce37808
|
Add comment that `IModelViewManager::RemoveSectionView` doesn't work and link a forum question
|
Weingartner/SolidworksAddinFramework
|
SolidworksAddinFramework/ModelViewManagerExtensions.cs
|
SolidworksAddinFramework/ModelViewManagerExtensions.cs
|
using System;
using System.Reactive.Disposables;
using SolidWorks.Interop.sldworks;
namespace SolidworksAddinFramework
{
public static class ModelViewManagerExtensions
{
public static IDisposable CreateSectionView(this IModelViewManager modelViewManager, Action<SectionViewData> config)
{
var data = modelViewManager.CreateSectionViewData();
config(data);
if (!modelViewManager.CreateSectionView(data))
{
throw new Exception("Error while creating section view.");
}
// TODO `modelViewManager.RemoveSectionView` always returns `false` and doesn't remove the section view
// In 2011 this seems to have worked (see https://forum.solidworks.com/thread/47641)
return Disposable.Create(() => modelViewManager.RemoveSectionView());
}
}
}
|
using System;
using System.Reactive.Disposables;
using SolidWorks.Interop.sldworks;
namespace SolidworksAddinFramework
{
public static class ModelViewManagerExtensions
{
public static IDisposable CreateSectionView(this IModelViewManager modelViewManager, Action<SectionViewData> config)
{
var data = modelViewManager.CreateSectionViewData();
config(data);
if (!modelViewManager.CreateSectionView(data))
{
throw new Exception("Error while creating section view.");
}
return Disposable.Create(() => modelViewManager.RemoveSectionView());
}
}
}
|
mit
|
C#
|
e500d7fe77f04ab60255cef407829db2c8efdcd9
|
Update hospital API tests
|
dhawalharsora/connectedcare-sdk,SnapMD/connectedcare-sdk
|
SnapMD.ConnectedCare.Sdk.Tests/HospitalApiTests.cs
|
SnapMD.ConnectedCare.Sdk.Tests/HospitalApiTests.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;
using Moq;
using NUnit.Framework;
using SnapMD.ConnectedCare.Sdk.Interfaces;
using SnapMD.ConnectedCare.Sdk.Tests.Properties;
namespace SnapMD.ConnectedCare.Sdk.Tests
{
[TestFixture]
public class HospitalApiTests : TestBase
{
[Test]
public void TestGetAddress()
{
string token;
Mock<IWebClient> mockWebClient = TokenandWebClientSetup(out token);
mockWebClient.Setup(x => x.DownloadString(
new Uri(BaseUri, @"hospitaladdress/1")))
.Returns("{\"$id\": \"1\",\"success\": true,\"data\": {\"$id\": \"2\",\"addressText\": \"1000 wilshire blvd, los angeles, ca 90017\"},\"message\": \"Success\"}");
//IWebClient webClient = TokenandWebClientSetupRemoteCall(out url, out token);
var api = new HospitalApi(Settings.Default.BaseUrl, null, Settings.Default.ApiDeveloperId, Settings.Default.ApiKey, mockWebClient.Object);
Assert.AreEqual("1000 wilshire blvd, los angeles, ca 90017", api.GetAddress(1));
}
[Test]
public void TestGetHospital()
{
string token;
HospitalApi api = null;
Mock<IWebClient> mockWebClient = TokenandWebClientSetup(out token);
mockWebClient.Setup(x => x.DownloadString(new Uri(BaseUri, @"hospital"))).Returns("{\"hospitalId\":1}");
api = new HospitalApi(Settings.Default.BaseUrl, token, Settings.Default.ApiDeveloperId, Settings.Default.ApiKey, mockWebClient.Object);
var result = api.GetHospital();
Assert.AreEqual(result.Value<int>("hospitalId"), 1);
}
}
}
|
// 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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Moq;
using NUnit.Framework;
using SnapMD.ConnectedCare.Sdk;
using SnapMD.ConnectedCare.Sdk.Interfaces;
using System.Net;
using SnapMD.ConnectedCare.Sdk.Tests.Properties;
namespace SnapMD.ConnectedCare.Sdk.Tests
{
[TestFixture]
public class HospitalApiTests : TestBase
{
[Test]
public void TestGetAddress()
{
string token;
Mock<IWebClient> mockWebClient = TokenandWebClientSetup(out token);
mockWebClient.Setup(x => x.DownloadString(
new Uri(BaseUri, @"hospitaladdress/1")))
.Returns("{\"$id\": \"1\",\"success\": true,\"data\": {\"$id\": \"2\",\"addressText\": \"1000 wilshire blvd, los angeles, ca 90017\"},\"message\": \"Success\"}");
//IWebClient webClient = TokenandWebClientSetupRemoteCall(out url, out token);
var api = new HospitalApi(Settings.Default.BaseUrl, null, Settings.Default.ApiDeveloperId, Settings.Default.ApiKey, mockWebClient.Object);
Assert.AreEqual("1000 wilshire blvd, los angeles, ca 90017", api.GetAddress(1));
}
[Test]
public void TestGetHospital()
{
string token;
HospitalApi api = null;
Mock<IWebClient> mockWebClient = TokenandWebClientSetup(out token);
mockWebClient.Setup(x => x.DownloadString(new Uri(BaseUri, @"hospital"))).Returns("{\"hospitalId\":1}");
api = new HospitalApi(Settings.Default.BaseUrl, token, Settings.Default.ApiDeveloperId, Settings.Default.ApiKey, mockWebClient.Object);
var result = api.GetHospital();
Assert.AreEqual(result.Value<int>("hospitalId"), 1);
}
}
}
|
apache-2.0
|
C#
|
3735b759e5d58a11d02c772ea672352f12a5ee11
|
Rename assembly to proper name
|
intercom/intercom-dotnet
|
src/Intercom/Properties/AssemblyInfo.cs
|
src/Intercom/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("Intercom.Dotnet.Client")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("khalil")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("Library")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("khalil")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
apache-2.0
|
C#
|
f34bee3e2721b716d287ec922a354439b6792e7a
|
Fix Firebird bool type
|
MetSystem/fluentmigrator,alphamc/fluentmigrator,drmohundro/fluentmigrator,itn3000/fluentmigrator,fluentmigrator/fluentmigrator,swalters/fluentmigrator,dealproc/fluentmigrator,tohagan/fluentmigrator,mstancombe/fluentmig,tommarien/fluentmigrator,daniellee/fluentmigrator,wolfascu/fluentmigrator,drmohundro/fluentmigrator,mstancombe/fluentmig,MetSystem/fluentmigrator,modulexcite/fluentmigrator,jogibear9988/fluentmigrator,wolfascu/fluentmigrator,DefiSolutions/fluentmigrator,mstancombe/fluentmig,stsrki/fluentmigrator,akema-fr/fluentmigrator,alphamc/fluentmigrator,istaheev/fluentmigrator,vgrigoriu/fluentmigrator,mstancombe/fluentmigrator,lcharlebois/fluentmigrator,FabioNascimento/fluentmigrator,amroel/fluentmigrator,bluefalcon/fluentmigrator,stsrki/fluentmigrator,KaraokeStu/fluentmigrator,lahma/fluentmigrator,vgrigoriu/fluentmigrator,eloekset/fluentmigrator,akema-fr/fluentmigrator,lahma/fluentmigrator,igitur/fluentmigrator,daniellee/fluentmigrator,lcharlebois/fluentmigrator,IRlyDontKnow/fluentmigrator,barser/fluentmigrator,schambers/fluentmigrator,FabioNascimento/fluentmigrator,igitur/fluentmigrator,istaheev/fluentmigrator,tohagan/fluentmigrator,istaheev/fluentmigrator,fluentmigrator/fluentmigrator,schambers/fluentmigrator,jogibear9988/fluentmigrator,daniellee/fluentmigrator,IRlyDontKnow/fluentmigrator,mstancombe/fluentmigrator,dealproc/fluentmigrator,spaccabit/fluentmigrator,amroel/fluentmigrator,eloekset/fluentmigrator,modulexcite/fluentmigrator,bluefalcon/fluentmigrator,itn3000/fluentmigrator,tommarien/fluentmigrator,swalters/fluentmigrator,KaraokeStu/fluentmigrator,barser/fluentmigrator,lahma/fluentmigrator,DefiSolutions/fluentmigrator,tohagan/fluentmigrator,DefiSolutions/fluentmigrator,spaccabit/fluentmigrator
|
src/FluentMigrator.Runner/Generators/Firebird/FirebirdTypeMap.cs
|
src/FluentMigrator.Runner/Generators/Firebird/FirebirdTypeMap.cs
|
using System.Data;
using FluentMigrator.Runner.Generators.Base;
namespace FluentMigrator.Runner.Generators.Firebird
{
internal class FirebirdTypeMap : TypeMapBase
{
private const int DecimalCapacity = 19;
private const int FirebirdMaxVarcharSize = 32765;
private const int FirebirdMaxCharSize = 32767;
protected override void SetupTypeMaps()
{
/*
* Values were taken from the Interbase 6 Data Definition Guide
*
* */
SetTypeMap(DbType.AnsiStringFixedLength, "CHAR(255)");
SetTypeMap(DbType.AnsiStringFixedLength, "CHAR($size)", FirebirdMaxCharSize);
SetTypeMap(DbType.AnsiString, "BLOB SUB_TYPE TEXT");
SetTypeMap(DbType.AnsiString, "VARCHAR($size)", FirebirdMaxVarcharSize);
SetTypeMap(DbType.Binary, "BLOB SUB_TYPE BINARY");
SetTypeMap(DbType.Boolean, "VARCHAR(10)"); //no direct boolean support
SetTypeMap(DbType.Byte, "SMALLINT");
SetTypeMap(DbType.Currency, "BIGINT");
SetTypeMap(DbType.Date, "DATE");
SetTypeMap(DbType.DateTime, "TIMESTAMP");
SetTypeMap(DbType.Decimal, "DECIMAL(14,5)");
SetTypeMap(DbType.Decimal, "DECIMAL($precision,$size)", DecimalCapacity);
SetTypeMap(DbType.Double, "DOUBLE PRECISION"); //64 bit double precision
SetTypeMap(DbType.Guid, "CHAR(16)"); //no guid support, "only" uuid is supported(via gen_uuid() built-in function)
SetTypeMap(DbType.Int16, "SMALLINT");
SetTypeMap(DbType.Int32, "INTEGER");
SetTypeMap(DbType.Int64, "BIGINT");
SetTypeMap(DbType.Single, "FLOAT");
SetTypeMap(DbType.StringFixedLength, "CHAR(255)");
SetTypeMap(DbType.StringFixedLength, "CHAR($size)", FirebirdMaxCharSize);
SetTypeMap(DbType.String, "BLOB SUB_TYPE TEXT");
SetTypeMap(DbType.String, "VARCHAR($size)", FirebirdMaxVarcharSize);
SetTypeMap(DbType.Time, "TIME");
}
}
}
|
using System.Data;
using FluentMigrator.Runner.Generators.Base;
namespace FluentMigrator.Runner.Generators.Firebird
{
internal class FirebirdTypeMap : TypeMapBase
{
private const int DecimalCapacity = 19;
private const int FirebirdMaxVarcharSize = 32765;
private const int FirebirdMaxCharSize = 32767;
protected override void SetupTypeMaps()
{
/*
* Values were taken from the Interbase 6 Data Definition Guide
*
* */
SetTypeMap(DbType.AnsiStringFixedLength, "CHAR(255)");
SetTypeMap(DbType.AnsiStringFixedLength, "CHAR($size)", FirebirdMaxCharSize);
SetTypeMap(DbType.AnsiString, "BLOB SUB_TYPE TEXT");
SetTypeMap(DbType.AnsiString, "VARCHAR($size)", FirebirdMaxVarcharSize);
SetTypeMap(DbType.Binary, "BLOB SUB_TYPE BINARY");
SetTypeMap(DbType.Boolean, "CHAR(1)"); //no direct boolean support
SetTypeMap(DbType.Byte, "SMALLINT");
SetTypeMap(DbType.Currency, "BIGINT");
SetTypeMap(DbType.Date, "DATE");
SetTypeMap(DbType.DateTime, "TIMESTAMP");
SetTypeMap(DbType.Decimal, "DECIMAL(14,5)");
SetTypeMap(DbType.Decimal, "DECIMAL($precision,$size)", DecimalCapacity);
SetTypeMap(DbType.Double, "DOUBLE PRECISION"); //64 bit double precision
SetTypeMap(DbType.Guid, "CHAR(16)"); //no guid support, "only" uuid is supported(via gen_uuid() built-in function)
SetTypeMap(DbType.Int16, "SMALLINT");
SetTypeMap(DbType.Int32, "INTEGER");
SetTypeMap(DbType.Int64, "BIGINT");
SetTypeMap(DbType.Single, "FLOAT");
SetTypeMap(DbType.StringFixedLength, "CHAR(255)");
SetTypeMap(DbType.StringFixedLength, "CHAR($size)", FirebirdMaxCharSize);
SetTypeMap(DbType.String, "BLOB SUB_TYPE TEXT");
SetTypeMap(DbType.String, "VARCHAR($size)", FirebirdMaxVarcharSize);
SetTypeMap(DbType.Time, "TIME");
}
}
}
|
apache-2.0
|
C#
|
ebe84bf3bae7d602f79cb28a45112d40d8115405
|
fix second test
|
DamianStanger/codingInterview,version99/codingInterview-1,DamianStanger/codingInterview
|
fizzBuzzInterview/ConsoleApp/Program.cs
|
fizzBuzzInterview/ConsoleApp/Program.cs
|
using System;
namespace ConsoleApp
{
public class Program
{
public static void Main(string[] args)
{
var target = int.Parse(args[0]);
var output = "";
for (int i = 1; i <= target; i++)
{
if (i%3==0)
{
output += string.Format("{0} ", "Fizz");
continue;
}
output += string.Format("{0} ", i);
}
Console.Write(output.Trim());
}
}
}
|
using System;
namespace ConsoleApp
{
public class Program
{
public static void Main(string[] args)
{
var target = int.Parse(args[0]);
var output = "";
for (int i = 1; i <= target; i++)
{
output += string.Format("{0} ", i);
}
Console.Write(output.Trim());
}
}
}
|
mit
|
C#
|
f76e29bd06432bd3fb336fed572e434a6965620d
|
Fix logic.
|
github/VisualStudio,github/VisualStudio,github/VisualStudio
|
src/GitHub.Exports.Reactive/Extensions/ConnectionManagerExtensions.cs
|
src/GitHub.Exports.Reactive/Extensions/ConnectionManagerExtensions.cs
|
using System;
using System.Threading.Tasks;
using GitHub.Factories;
using GitHub.Models;
using GitHub.Services;
namespace GitHub.Extensions
{
public static class ConnectionManagerExtensions
{
public static async Task<IModelService> GetModelService(
this IConnectionManager cm,
ILocalRepositoryModel repository,
IModelServiceFactory factory)
{
var connection = await cm.GetConnection(repository);
return connection?.IsLoggedIn == true ? await factory.CreateAsync(connection) : null;
}
}
}
|
using System;
using System.Threading.Tasks;
using GitHub.Factories;
using GitHub.Models;
using GitHub.Services;
namespace GitHub.Extensions
{
public static class ConnectionManagerExtensions
{
public static async Task<IModelService> GetModelService(
this IConnectionManager cm,
ILocalRepositoryModel repository,
IModelServiceFactory factory)
{
var connection = await cm.GetConnection(repository);
return connection != null ? await factory.CreateAsync(connection) : null;
}
}
}
|
mit
|
C#
|
6126415bdfe0b71a1903e552e0a04e8d980be00c
|
Update DockerfileTemplate.cs
|
brthor/Dockerize.NET,brthor/Dockerize.NET
|
DockerfileTemplate.cs
|
DockerfileTemplate.cs
|
namespace Brthor.Dockerize
{
public static class DockerfileTemplate
{
public static string Generate(DockerizeConfiguration config, string outputBinaryName)
{
var addUser = config.Username == null
? ""
: $@"RUN groupadd -r {config.Username} && useradd --no-log-init -u 1000 -m -r -g {config.Username} {config.Username}
RUN chown {config.Username}:{config.Username} /projectBinaries
USER {config.Username}:{config.Username}";
var chownOnAdd = config.Username == null
? ""
: $"--chown={config.Username}:{config.Username} ";
var dockerfileContent = $@"
FROM {config.BaseImage}
RUN mkdir /projectBinaries
{addUser}
ADD {chownOnAdd}./publish/ /projectBinaries/
WORKDIR /projectBinaries/
CMD /projectBinaries/{outputBinaryName}
";
return dockerfileContent;
}
}
}
|
namespace Brthor.Dockerize
{
public static class DockerfileTemplate
{
public static string Generate(DockerizeConfiguration config, string outputBinaryName)
{
var addUser = config.Username == null
? ""
: $@"RUN groupadd -r {config.Username} && useradd --no-log-init -m -r -g {config.Username} {config.Username}
RUN chown {config.Username}:{config.Username} /projectBinaries
USER {config.Username}:{config.Username}";
var chownOnAdd = config.Username == null
? ""
: $"--chown={config.Username}:{config.Username} ";
var dockerfileContent = $@"
FROM {config.BaseImage}
RUN mkdir /projectBinaries
{addUser}
ADD {chownOnAdd}./publish/ /projectBinaries/
WORKDIR /projectBinaries/
CMD /projectBinaries/{outputBinaryName}
";
return dockerfileContent;
}
}
}
|
mit
|
C#
|
9fdaf39272b228dc6333acb8e863bc8b72591cb4
|
Drop internet explorer test
|
2sky/Vidyano,2sky/Vidyano,2sky/Vidyano,2sky/Vidyano,2sky/Vidyano
|
test/GlobalSearch.cs
|
test/GlobalSearch.cs
|
using NUnit.Framework;
using OpenQA.Selenium;
using System.Linq;
using Vidyano.Test.Helpers;
namespace Vidyano.Test
{
[TestFixture("chrome")]
[TestFixture("safari")]
[TestFixture("firefox")]
[TestFixture("edge")]
[Parallelizable(ParallelScope.Fixtures)]
public class GlobalSearch: BrowserStackTestBase
{
public GlobalSearch(string profile): base(profile) {}
[Test]
public void Search()
{
var search = "pei";
var input = driver.FindElement(By.CssSelector("vi-menu vi-input-search > form > input"));
input.SendKeys(search);
input.SendKeys(Keys.Enter);
var grid = driver.FindGridByQueryName("Customers");
Assert.That(grid, Is.Not.Null, "Customers grid not found.");
var firstRow = grid.FindElement(By.CssSelector("vi-query-grid tr[is='vi-query-grid-table-data-row']:first-of-type"));
Assert.That(firstRow, Is.Not.Null, "Unable to find first data row.");
var cells = firstRow.FindElements(By.TagName("vi-query-grid-cell-default"));
Assert.That(cells.FirstOrDefault(c => c.Text.Contains(search)), Is.Not.Null, "No match found.");
Assert.That(driver.Title.StartsWith(search), Is.True, "Invalid title after search.");
}
}
}
|
using NUnit.Framework;
using OpenQA.Selenium;
using System.Linq;
using Vidyano.Test.Helpers;
namespace Vidyano.Test
{
[TestFixture("chrome")]
[TestFixture("safari")]
[TestFixture("firefox")]
[TestFixture("edge")]
[TestFixture("ie")]
[Parallelizable(ParallelScope.Fixtures)]
public class GlobalSearch: BrowserStackTestBase
{
public GlobalSearch(string profile): base(profile) {}
[Test]
public void Search()
{
var search = "pei";
var input = driver.FindElement(By.CssSelector("vi-menu vi-input-search > form > input"));
input.SendKeys(search);
input.SendKeys(Keys.Enter);
var grid = driver.FindGridByQueryName("Customers");
Assert.That(grid, Is.Not.Null, "Customers grid not found.");
var firstRow = grid.FindElement(By.CssSelector("vi-query-grid tr[is='vi-query-grid-table-data-row']:first-of-type"));
Assert.That(firstRow, Is.Not.Null, "Unable to find first data row.");
var cells = firstRow.FindElements(By.TagName("vi-query-grid-cell-default"));
Assert.That(cells.FirstOrDefault(c => c.Text.Contains(search)), Is.Not.Null, "No match found.");
Assert.That(driver.Title.StartsWith(search), Is.True, "Invalid title after search.");
}
}
}
|
mit
|
C#
|
8f27eb3e1eede75591829b422df84f9dc8aa14f0
|
Update Column.cs
|
accessrichard/sqleditor.net
|
SqlEditor/Models/Dojo/Dgrid/Column.cs
|
SqlEditor/Models/Dojo/Dgrid/Column.cs
|
namespace SqlEditor.Models.Dojo.Dgrid
{
/// <summary>
/// Represents a column in the client side dojo grid.
/// </summary>
public class Column
{
/// <summary>
/// Backing field for label property.
/// </summary>
private string label;
/// <summary>
/// Gets or sets the dojo grid field name.
/// </summary>
public string Field { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the field is displayed in the grid.
/// </summary>
public string Hidden { get; set; }
/// <summary>
/// Gets or sets a JS formatter name to use in order to
/// format the column in the grid using JS.
/// </summary>
public string Formatter { get; set; }
/// <summary>
/// Gets a value indicating whether the field is sortable in the client.
/// </summary>
public bool Sortable
{
get
{
return true;
}
}
/// <summary>
/// Gets or sets the data grid column header label.
/// </summary>
public string Label
{
get
{
return string.IsNullOrWhiteSpace(this.label) ? this.Field : this.label;
}
set
{
this.label = value;
}
}
}
}
|
namespace SqlEditor.Models.Dojo.Dgrid
{
/// <summary>
/// Represents a column in the client side dojo grid.
/// </summary>
public class Column
{
/// <summary>
/// Backing field for label property.
/// </summary>
private string label;
/// <summary>
/// Gets or sets the dojo grid field name.
/// </summary>
public string Field { get; set; }
/// <summary>
/// Gets or sets a JS formatter name to use in order to
/// format the column in the grid using JS.
/// </summary>
public string Formatter { get; set; }
/// <summary>
/// Gets a value indicating whether the field is sortable in the client.
/// </summary>
public bool Sortable
{
get
{
return true;
}
}
/// <summary>
/// Gets or sets the data grid column header label.
/// </summary>
public string Label
{
get
{
return string.IsNullOrWhiteSpace(this.label) ? this.Field : this.label;
}
set
{
this.label = value;
}
}
}
}
|
mit
|
C#
|
27321e57de3c2f54cadfa3488685ad47a70393b4
|
Update AndConstraint.cs (#742)
|
jnyrup/fluentassertions,fluentassertions/fluentassertions,jnyrup/fluentassertions,dennisdoomen/fluentassertions,dennisdoomen/fluentassertions,fluentassertions/fluentassertions
|
Src/FluentAssertions/AndConstraint.cs
|
Src/FluentAssertions/AndConstraint.cs
|
using System.Diagnostics;
namespace FluentAssertions
{
[DebuggerNonUserCode]
public class AndConstraint<T>
{
public T And { get; }
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Object"/> class.
/// </summary>
public AndConstraint(T parentConstraint)
{
And = parentConstraint;
}
}
}
|
using System.Diagnostics;
namespace FluentAssertions
{
[DebuggerNonUserCode]
public class AndConstraint<T>
{
private readonly T parentConstraint;
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Object"/> class.
/// </summary>
public AndConstraint(T parentConstraint)
{
this.parentConstraint = parentConstraint;
}
public T And
{
get { return parentConstraint; }
}
}
}
|
apache-2.0
|
C#
|
02f33d06ec80536618e7c92a01f16cf90e985fc4
|
Update ExchangeRate.cs
|
coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk,coinapi/coinapi-sdk
|
csharp-ws/CoinAPI.WebSocket.V1/DataModels/ExchangeRate.cs
|
csharp-ws/CoinAPI.WebSocket.V1/DataModels/ExchangeRate.cs
|
using System;
namespace CoinAPI.WebSocket.V1.DataModels
{
public struct ExchangeRate
{
public DateTime time { get; set; }
public string asset_id_base { get; set; }
public string asset_id_quote { get; set; }
public decimal rate { get; set; }
}
}
|
using System;
namespace CoinAPI.WebSocket.V1.DataModels
{
public struct ExchangeRate
{
public decimal? rate { get; set; }
public decimal? crossing_cost { get; set; }
public DateTime time { get; set; }
public string asset_id_base { get; set; }
public string asset_id_quote { get; set; }
}
}
|
mit
|
C#
|
069ffde59d7a9e4d060a0c97075a4e0481553992
|
Update AssemblyVersion
|
mono/dbus-sharp-glib,mono/dbus-sharp-glib
|
glib/AssemblyInfo.cs
|
glib/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("0.3.0")]
[assembly: AssemblyTitle ("NDesk.DBus.GLib")]
[assembly: AssemblyDescription ("GLib integration for NDesk.DBus, the D-Bus IPC library")]
[assembly: AssemblyCopyright ("Copyright (C) Alp Toker")]
[assembly: AssemblyCompany ("NDesk")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
//[assembly: AssemblyVersion("0.0.0.*")]
[assembly: AssemblyTitle ("NDesk.DBus.GLib")]
[assembly: AssemblyDescription ("GLib integration for NDesk.DBus, the D-Bus IPC library")]
[assembly: AssemblyCopyright ("Copyright (C) Alp Toker")]
[assembly: AssemblyCompany ("NDesk")]
|
mit
|
C#
|
217d49f3fecd205818fea6ca299f761a3c31d522
|
Add a Counter prop and make max recursion count const public
|
ilkerhalil/dnlib,kiootic/dnlib,jorik041/dnlib,ZixiangBoy/dnlib,Arthur2e5/dnlib,yck1509/dnlib,0xd4d/dnlib,picrap/dnlib,modulexcite/dnlib
|
src/DotNet/RecursionCounter.cs
|
src/DotNet/RecursionCounter.cs
|
using System;
namespace dot10.DotNet {
struct RecursionCounter {
/// <summary>
/// Max recursion count. If this is reached, we won't continue, and will use a default value.
/// </summary>
public const int MAX_RECURSION_COUNT = 100;
int counter;
/// <summary>
/// Gets the recursion counter
/// </summary>
public int Counter {
get { return counter; }
}
/// <summary>
/// Increments <see cref="counter"/> if it's not too high. <c>ALL</c> instance methods
/// that can be called recursively must call this method and <see cref="DecrementRecursionCounter"/>
/// (if this method returns <c>true</c>)
/// </summary>
/// <returns><c>true</c> if it was incremented and caller can continue, <c>false</c> if
/// it was <c>not</c> incremented and the caller must return to its caller.</returns>
public bool IncrementRecursionCounter() {
if (counter >= MAX_RECURSION_COUNT)
return false;
counter++;
return true;
}
/// <summary>
/// Must be called before returning to caller if <see cref="IncrementRecursionCounter"/>
/// returned <c>true</c>
/// </summary>
public void DecrementRecursionCounter() {
#if DEBUG
if (counter <= 0)
throw new InvalidOperationException("recursionCounter <= 0");
#endif
counter--;
}
/// <inheritdoc/>
public override string ToString() {
return counter.ToString();
}
}
}
|
using System;
namespace dot10.DotNet {
struct RecursionCounter {
/// <summary>
/// Max recursion count. If this is reached, we won't continue, and will use a default value.
/// </summary>
const int MAX_RECURSION_COUNT = 100;
int counter;
/// <summary>
/// Increments <see cref="counter"/> if it's not too high. <c>ALL</c> instance methods
/// that can be called recursively must call this method and <see cref="DecrementRecursionCounter"/>
/// (if this method returns <c>true</c>)
/// </summary>
/// <returns><c>true</c> if it was incremented and caller can continue, <c>false</c> if
/// it was <c>not</c> incremented and the caller must return to its caller.</returns>
public bool IncrementRecursionCounter() {
if (counter >= MAX_RECURSION_COUNT)
return false;
counter++;
return true;
}
/// <summary>
/// Must be called before returning to caller if <see cref="IncrementRecursionCounter"/>
/// returned <c>true</c>
/// </summary>
public void DecrementRecursionCounter() {
#if DEBUG
if (counter <= 0)
throw new InvalidOperationException("recursionCounter <= 0");
#endif
counter--;
}
/// <inheritdoc/>
public override string ToString() {
return counter.ToString();
}
}
}
|
mit
|
C#
|
5355cf9b0c44e788d5f6f26536dfb8b8cf0c0722
|
Remove console warning for editor
|
suppayami/unity2d-tmx
|
src/Editor/TilemapInspector.cs
|
src/Editor/TilemapInspector.cs
|
using UnityEngine;
using UnityEditor;
using System.Collections;
namespace Symphony {
[CustomEditor (typeof(TileMap))]
public class TilemapInspector : Editor {
TileMap tilemap;
GUIStyle style;
public void OnEnable() {
tilemap = (TileMap) target;
}
public override void OnInspectorGUI() {
EditorGUILayout.HelpBox("Only use this script for TMX Map Format", MessageType.Info);
EditorGUILayout.HelpBox("Only use TMX file with CSV data, also change the extension .tmx to .xml. " +
"You can drop XML file from Asset Explorer.", MessageType.Warning);
EditorGUILayout.HelpBox("Create a folder inside folder Resources (create folder Resources inside " +
"Asset directory if you do not have one) and put all using tilesets there. " +
"Write created folder name inside this field.", MessageType.Warning);
EditorGUILayout.Space();
GUILayout.BeginHorizontal();
GUILayout.Label("Pixels to Units");
tilemap.unit = EditorGUILayout.FloatField(tilemap.unit, GUILayout.Width(160));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Tilesets Folder");
tilemap.tileFolder = EditorGUILayout.TextField(tilemap.tileFolder, GUILayout.Width(160));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Tilemap XML");
tilemap.tileXml = (TextAsset) EditorGUILayout.ObjectField(tilemap.tileXml, typeof(TextAsset), false, GUILayout.Width(160));
GUILayout.EndHorizontal();
EditorGUILayout.Space();
GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
buttonStyle.stretchWidth = true;
if (GUILayout.Button("Render/Reload Tilemap", buttonStyle)) {
tilemap.RenderMap();
}
if (GUILayout.Button("Clear Tilemap", buttonStyle)) {
tilemap.ClearMap();
}
}
}
}
|
using UnityEngine;
using UnityEditor;
using System.Collections;
namespace Symphony {
[CustomEditor (typeof(TileMap))]
public class TilemapInspector : Editor {
TileMap tilemap;
GUIStyle style;
public void OnEnable() {
tilemap = (TileMap) target;
}
public override void OnInspectorGUI() {
EditorGUILayout.HelpBox("Only use this script for TMX Map Format", MessageType.Info);
EditorGUILayout.HelpBox("Only use TMX file with CSV data, also change the extension .tmx to .xml. " +
"You can drop XML file from Asset Explorer.", MessageType.Warning);
EditorGUILayout.HelpBox("Create a folder inside folder Resources (create folder Resources inside " +
"Asset directory if you do not have one) and put all using tilesets there. " +
"Write created folder name inside this field.", MessageType.Warning);
EditorGUILayout.Space();
GUILayout.BeginHorizontal();
GUILayout.Label("Pixels to Units");
tilemap.unit = EditorGUILayout.FloatField(tilemap.unit, GUILayout.Width(160));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Tilesets Folder");
tilemap.tileFolder = EditorGUILayout.TextField(tilemap.tileFolder, GUILayout.Width(160));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Tilemap XML");
tilemap.tileXml = (TextAsset) EditorGUILayout.ObjectField(tilemap.tileXml, typeof(TextAsset), GUILayout.Width(160));
GUILayout.EndHorizontal();
EditorGUILayout.Space();
GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
buttonStyle.stretchWidth = true;
if (GUILayout.Button("Render/Reload Tilemap", buttonStyle)) {
tilemap.RenderMap();
}
if (GUILayout.Button("Clear Tilemap", buttonStyle)) {
tilemap.ClearMap();
}
}
}
}
|
mit
|
C#
|
2b6167641a831d224f54fe085cdb2d72cdf39967
|
fix smoke target param
|
Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek
|
Tweek.ApiService.SmokeTests/TweekApiServiceFactory.cs
|
Tweek.ApiService.SmokeTests/TweekApiServiceFactory.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RestEase;
namespace Tweek.ApiService.SmokeTests
{
public static class TweekApiServiceFactory
{
public static ITweekApi GetTweekApiClient()
{
var targetBaseUrl = Environment.GetEnvironmentVariable("TWEEK_SMOKE_TARGET");
if (string.IsNullOrEmpty(targetBaseUrl))
{
throw new ArgumentException("Missing smoke tests target environment variable, make sure you set up 'TWEEK_SMOKE_TARGET' to the target hostname.");
}
return RestClient.For<ITweekApi>(targetBaseUrl);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RestEase;
namespace Tweek.ApiService.SmokeTests
{
public static class TweekApiServiceFactory
{
public static ITweekApi GetTweekApiClient()
{
var targetBaseUrl = "http://localhost:54069";
if (string.IsNullOrEmpty(targetBaseUrl))
{
throw new ArgumentException("Missing smoke tests target environment variable, make sure you set up 'TWEEK_SMOKE_TARGET' to the target hostname.");
}
return RestClient.For<ITweekApi>(targetBaseUrl);
}
}
}
|
mit
|
C#
|
072adaee53e4de23bd53f23b09be783d82705fd9
|
Fix converter
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Fluent/Converters/SearchIconConverter.cs
|
WalletWasabi.Fluent/Converters/SearchIconConverter.cs
|
using Avalonia;
using Avalonia.Data.Converters;
using System;
using System.Globalization;
using WalletWasabi.Fluent.ViewModels.Search;
namespace WalletWasabi.Fluent.Converters
{
public class SearchIconConverter : IValueConverter
{
public static readonly SearchIconConverter Instance = new SearchIconConverter();
private SearchIconConverter()
{
}
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is SearchItemViewModel sivm)
{
if (Application.Current.Styles.TryGetResource(sivm.IconName, out object resource))
{
return resource;
}
}
return null;
}
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
using Avalonia;
using Avalonia.Data.Converters;
using System;
using System.Globalization;
using WalletWasabi.Fluent.ViewModels.NavBar;
namespace WalletWasabi.Fluent.Converters
{
public class SearchIconConverter : IValueConverter
{
public static readonly SearchIconConverter Instance = new SearchIconConverter();
private SearchIconConverter()
{
}
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is SearchItemViewModel sivm)
{
if (Application.Current.Styles.TryGetResource(sivm.IconName, out object resource))
{
return resource;
}
}
return null;
}
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
3a8bcc77c6c98e1ad359c26ff08276ce168a5b62
|
Update DispatcherCountdownTimer
|
Kingloo/GB-Live
|
src/Common/DispatcherCountdownTimer.cs
|
src/Common/DispatcherCountdownTimer.cs
|
using System;
using System.Globalization;
using System.Text;
using System.Windows.Threading;
namespace GBLive.Common
{
public class DispatcherCountdownTimer
{
private readonly TimeSpan span;
private readonly Action tick;
private readonly DateTime created = DateTime.Now;
private DispatcherTimer? timer = null;
public bool IsRunning => timer?.IsEnabled ?? false;
public TimeSpan TimeLeft => IsRunning
? ((created + (timer?.Interval ?? TimeSpan.Zero)) - DateTime.Now)
: TimeSpan.Zero;
public DispatcherCountdownTimer(TimeSpan span, Action tick)
{
if (span.Ticks < (10_000 * 1000))
{
// there are 10_000 ticks in 1 millisecond
// therefore there are 10_000 * 1000 ticks in 1 second
// 10_000 * 1000 = 10_000_000
throw new ArgumentOutOfRangeException(nameof(span), "span.Ticks cannot be less than 1 second");
}
if (tick is null)
{
throw new ArgumentNullException(nameof(tick));
}
this.tick = tick;
this.span = span;
}
public void Start()
{
timer = new DispatcherTimer(DispatcherPriority.Background);
timer.Interval = span;
timer.Tick += Timer_Tick;
timer.Start();
}
private void Timer_Tick(object? sender, EventArgs e)
{
tick();
Stop();
}
public void Stop()
{
if (timer is not null)
{
timer.Stop();
timer.Tick -= Timer_Tick;
timer = null;
}
}
public override string ToString()
{
var sb = new StringBuilder();
var cc = CultureInfo.CurrentCulture;
sb.AppendLine(GetType().FullName);
sb.AppendLine(string.Format(cc, "Created at: {0}", created.ToString(cc)));
sb.AppendLine(IsRunning ? "Is Running: true" : "Is Running: false");
sb.AppendLine(string.Format(cc, "Time left: {0}", TimeLeft.ToString()));
return sb.ToString();
}
}
}
|
using System;
using System.Globalization;
using System.Text;
using System.Windows.Threading;
namespace GBLive.Common
{
public class DispatcherCountdownTimer
{
#region Fields
private readonly DateTime created = DateTime.Now;
private readonly Action tick;
private DispatcherTimer timer = new DispatcherTimer(DispatcherPriority.Background);
#endregion
#region Properties
public bool IsRunning
=> timer != null && timer.IsEnabled;
public TimeSpan TimeLeft
=> IsRunning ? ((created + timer.Interval) - DateTime.Now) : TimeSpan.Zero;
#endregion
public DispatcherCountdownTimer(TimeSpan span, Action tick)
{
// 10,000 ticks in 1 ms => 10,000 * 1000 ticks in 1 s == 10,000,000 ticks
if (span.Ticks < (10_000 * 1000))
{
throw new ArgumentOutOfRangeException("span.Ticks cannot be less than 1 second", nameof(span));
}
this.tick = tick ?? throw new ArgumentNullException(nameof(tick));
timer.Interval = span;
timer.Tick += Timer_Tick;
}
private void Timer_Tick(object? sender, EventArgs e)
{
tick();
Stop();
}
public void Start() => timer.Start();
public void Stop()
{
if (IsRunning)
{
timer.Stop();
timer.Tick -= Timer_Tick;
}
}
public override string ToString()
{
var sb = new StringBuilder();
var cc = CultureInfo.CurrentCulture;
sb.AppendLine(GetType().FullName);
sb.AppendLine(string.Format(cc, "Created at: {0}", created.ToString(cc)));
sb.AppendLine(IsRunning ? "Is Running: true" : "Is Running: false");
sb.AppendLine(string.Format(cc, "Time left: {0}", TimeLeft.ToString()));
return sb.ToString();
}
}
}
|
unlicense
|
C#
|
81ef8fee52cb7c62c8a4c1c1e427d511415eb1ea
|
Add clear properties function.
|
kcotugno/OpenARLog
|
OpenARLog.Data/QSO.cs
|
OpenARLog.Data/QSO.cs
|
/*
* Copyright (C) 2015 kcotugno
* Distributed under the MIT software license, see the accompanying
* LICENSE file or http://www.opensource.org/licenses/MIT
*
* Author: kcotugno
* Date: 8/15/2015
*/
using System;
namespace OpenARLog.Data
{
public class QSO
{
public long ID { get; set; }
public string Callsign { get; set; }
public string Name { get; set; }
public string Country { get; set; }
public string State { get; set; }
public string County { get; set; }
public string City { get; set; }
public string GridSquare { get; set; }
public string Frequency { get; set; }
public string Band { get; set; }
public string Mode { get; set; }
public DateTime? TimeOn { get; set; }
public DateTime? TimeOff { get; set; }
public QSO()
{
Clear();
}
public override string ToString()
{
return string.Format("ID: {0}, Callsign: {1}, Name: {2}, Country: {3}, State: {4}, " +
"County: {5}, City: {6}, Grid Square: {7}, Frequency: {8}, " +
"Band: {9}, Mode: {10}, Time On: {11}, Time Off: {12}", ID,
Callsign, Name, Country, State, Country, City, GridSquare,
Frequency, Band, Mode, TimeOn.ToString(), TimeOff.ToString());
}
public void Clear()
{
ID = 0;
Callsign = string.Empty;
Name = string.Empty;
Country = string.Empty;
State = string.Empty;
County = string.Empty;
City = string.Empty;
GridSquare = string.Empty;
Frequency = string.Empty;
Band = string.Empty;
Mode = string.Empty;
TimeOn = null;
TimeOff = null;
}
}
}
|
/*
* Copyright (C) 2015 kcotugno
* Distributed under the MIT software license, see the accompanying
* LICENSE file or http://www.opensource.org/licenses/MIT
*
* Author: kcotugno
* Date: 8/15/2015
*/
using System;
namespace OpenARLog.Data
{
public class QSO
{
public long ID { get; set; }
public string Callsign { get; set; }
public string Name { get; set; }
public string Country { get; set; }
public string State { get; set; }
public string County { get; set; }
public string City { get; set; }
public string GridSquare { get; set; }
public string Frequency { get; set; }
public string Band { get; set; }
public string Mode { get; set; }
public DateTime? TimeOn { get; set; }
public DateTime? TimeOff { get; set; }
public QSO()
{
ID = 0;
Callsign = string.Empty;
Name = string.Empty;
Country = string.Empty;
State = string.Empty;
County = string.Empty;
City = string.Empty;
GridSquare = string.Empty;
Frequency = string.Empty;
Band = string.Empty;
Mode = string.Empty;
TimeOn = null;
TimeOff = null;
}
public override string ToString()
{
return string.Format("ID: {0}, Callsign: {1}, Name: {2}, Country: {3}, State: {4}, " +
"County: {5}, City: {6}, Grid Square: {7}, Frequency: {8}, " +
"Band: {9}, Mode: {10}, Time On: {11}, Time Off: {12}", ID,
Callsign, Name, Country, State, Country, City, GridSquare,
Frequency, Band, Mode, TimeOn.ToString(), TimeOff.ToString());
}
}
}
|
mit
|
C#
|
7db230f0f1c6e7e27f0ed080d29a7a91463b75e4
|
Define extension method over IDefinition
|
terrajobst/platform-compat
|
src/Terrajobst.Cci/MemberExtensions.cs
|
src/Terrajobst.Cci/MemberExtensions.cs
|
using Microsoft.Cci;
using Microsoft.Cci.Extensions;
namespace Terrajobst.Cci
{
public static class MemberExtensions
{
public static string GetNamespaceName(this IDefinition definition)
{
if (definition is ITypeDefinitionMember member)
return member.ContainingTypeDefinition.GetNamespaceName();
if (definition is ITypeDefinition type)
return type.GetNamespace().GetNamespaceName();
if (definition is INamespaceDefinition nsp)
return nsp.FullName();
return string.Empty;
}
public static string GetTypeName(this IDefinition definition)
{
if (definition is ITypeDefinitionMember member)
return member.ContainingTypeDefinition.GetTypeName(false);
if (definition is ITypeDefinition type)
return type.GetTypeName(includeNamespace: false);
return string.Empty;
}
public static string GetMemberSignature(this IDefinition definition)
{
if (definition is IFieldDefinition field)
return field.Name.Value;
if (definition is ITypeDefinitionMember member)
return MemberHelper.GetMemberSignature(member, NameFormattingOptions.Signature |
NameFormattingOptions.TypeParameters |
NameFormattingOptions.ContractNullable |
NameFormattingOptions.OmitContainingType |
NameFormattingOptions.OmitContainingNamespace |
NameFormattingOptions.PreserveSpecialNames);
return string.Empty;
}
}
}
|
using Microsoft.Cci;
using Microsoft.Cci.Extensions;
namespace Terrajobst.Cci
{
public static class MemberExtensions
{
public static string GetNamespaceName(this ITypeDefinitionMember member)
{
return member.ContainingTypeDefinition.GetNamespaceName();
}
public static string GetTypeName(this ITypeDefinitionMember member)
{
return member.ContainingTypeDefinition.GetTypeName(false);
}
public static string GetMemberSignature(this ITypeDefinitionMember member)
{
if (member is IFieldDefinition)
return member.Name.Value;
return MemberHelper.GetMemberSignature(member, NameFormattingOptions.Signature |
NameFormattingOptions.TypeParameters |
NameFormattingOptions.ContractNullable |
NameFormattingOptions.OmitContainingType |
NameFormattingOptions.OmitContainingNamespace |
NameFormattingOptions.PreserveSpecialNames);
}
}
}
|
mit
|
C#
|
f5efa627bda8e8fa3a54d3f21b66911e2a3a36a5
|
Update version.
|
NForza/transit-csharp
|
src/Transit/Properties/AssemblyInfo.cs
|
src/Transit/Properties/AssemblyInfo.cs
|
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Transit")]
[assembly: AssemblyDescription("Transit is a data format and a set of libraries for conveying values between applications written in different languages. This library provides support for marshalling Transit data to/from .NET.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("NForza")]
[assembly: AssemblyProduct("Transit")]
[assembly: AssemblyCopyright("NForza 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.*")]
[assembly: AssemblyFileVersion("0.8.0.0")]
[assembly: AssemblyInformationalVersion("0.8.3-beta")]
// For tests:
[assembly: InternalsVisibleTo("Transit.Tests")]
|
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Transit")]
[assembly: AssemblyDescription("Transit is a data format and a set of libraries for conveying values between applications written in different languages. This library provides support for marshalling Transit data to/from .NET.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("NForza")]
[assembly: AssemblyProduct("Transit")]
[assembly: AssemblyCopyright("NForza 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.*")]
[assembly: AssemblyFileVersion("0.8.0.0")]
[assembly: AssemblyInformationalVersion("0.8.2-beta")]
// For tests:
[assembly: InternalsVisibleTo("Transit.Tests")]
|
apache-2.0
|
C#
|
93a05098d3ac54cd589d7a47874e8141b6e7100e
|
bring back Cyrillic, this seems to be working on .NET Core 2.0
|
tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web
|
src/Tugberk.Domain/StringExtensions.cs
|
src/Tugberk.Domain/StringExtensions.cs
|
using System;
using System.Text;
using System.Text.RegularExpressions;
namespace Tugberk.Domain
{
public static class StringExtensions
{
/// <remarks>
/// Does not allow leading or trailing hypens or whitespace.
/// </remarks>
public static readonly Regex SlugRegex = new Regex(@"(^[a-z0-9])([a-z0-9_-]+)*([a-z0-9])$", RegexOptions.Compiled);
public static string ToSlug(this string value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (SlugRegex.IsMatch(value))
{
return value;
}
return GenerateSlug(value);
}
/// <summary>
/// Credit for this method goes to http://stackoverflow.com/questions/2920744/url-slugify-alrogithm-in-cs and
/// https://github.com/benfoster/Fabrik.Common/blob/dev/src/Fabrik.Common/StringExtensions.cs.
/// </summary>
private static string GenerateSlug(string phrase)
{
string result = RemoveAccent(phrase).ToLowerInvariant();
result = result.Trim('-', '.');
result = result.Replace('.', '-');
result = result.Replace("#", "-sharp");
result = Regex.Replace(result, @"[^a-z0-9\s-]", string.Empty); // remove invalid characters
result = Regex.Replace(result, @"\s+", " ").Trim(); // convert multiple spaces into one space
return Regex.Replace(result, @"\s", "-"); // replace all spaces with hyphens
}
private static string RemoveAccent(string txt)
{
var bytes = Encoding.GetEncoding("Cyrillic").GetBytes(txt);
return Encoding.ASCII.GetString(bytes);
}
}
}
|
using System;
using System.Text;
using System.Text.RegularExpressions;
namespace Tugberk.Domain
{
public static class StringExtensions
{
/// <remarks>
/// Does not allow leading or trailing hypens or whitespace.
/// </remarks>
public static readonly Regex SlugRegex = new Regex(@"(^[a-z0-9])([a-z0-9_-]+)*([a-z0-9])$", RegexOptions.Compiled);
public static string ToSlug(this string value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (SlugRegex.IsMatch(value))
{
return value;
}
return GenerateSlug(value);
}
/// <summary>
/// Credit for this method goes to http://stackoverflow.com/questions/2920744/url-slugify-alrogithm-in-cs and
/// https://github.com/benfoster/Fabrik.Common/blob/dev/src/Fabrik.Common/StringExtensions.cs.
/// </summary>
private static string GenerateSlug(string phrase)
{
string result = RemoveAccent(phrase).ToLowerInvariant();
result = result.Trim('-', '.');
result = result.Replace('.', '-');
result = result.Replace("#", "-sharp");
result = Regex.Replace(result, @"[^a-z0-9\s-]", string.Empty); // remove invalid characters
result = Regex.Replace(result, @"\s+", " ").Trim(); // convert multiple spaces into one space
return Regex.Replace(result, @"\s", "-"); // replace all spaces with hyphens
}
private static string RemoveAccent(string txt)
{
// broken on rc2, see: https://github.com/dotnet/corefx/issues/9158
// byte[] bytes = Encoding.GetEncoding("Cyrillic").GetBytes(txt);
byte[] bytes = Encoding.UTF8.GetBytes(txt);
return Encoding.ASCII.GetString(bytes);
}
}
}
|
agpl-3.0
|
C#
|
fdcb4a71ad341d38570a56aab76ef573e3815c01
|
Fix incorrect array pool usage
|
ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework
|
osu.Framework/Graphics/Textures/ArrayPoolTextureUpload.cs
|
osu.Framework/Graphics/Textures/ArrayPoolTextureUpload.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Buffers;
using osu.Framework.Graphics.Primitives;
using osuTK.Graphics.ES30;
using SixLabors.ImageSharp.PixelFormats;
namespace osu.Framework.Graphics.Textures
{
public class ArrayPoolTextureUpload : ITextureUpload
{
private readonly ArrayPool<Rgba32> arrayPool;
private readonly Rgba32[] data;
/// <summary>
/// Create an empty raw texture with an efficient shared memory backing.
/// </summary>
/// <param name="width">The width of the texture.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="arrayPool">The source pool to retrieve memory from. Shared default is used if null.</param>
public ArrayPoolTextureUpload(int width, int height, ArrayPool<Rgba32> arrayPool = null)
{
this.arrayPool = arrayPool ?? ArrayPool<Rgba32>.Shared;
data = this.arrayPool.Rent(width * height);
}
public void Dispose()
{
arrayPool.Return(data);
}
public Span<Rgba32> RawData => data;
public ReadOnlySpan<Rgba32> Data => data;
public int Level { get; set; }
public virtual PixelFormat Format => PixelFormat.Rgba;
public RectangleI Bounds { get; set; }
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Buffers;
using osu.Framework.Graphics.Primitives;
using osuTK.Graphics.ES30;
using SixLabors.ImageSharp.PixelFormats;
namespace osu.Framework.Graphics.Textures
{
public class ArrayPoolTextureUpload : ITextureUpload
{
private readonly ArrayPool<Rgba32> arrayPool;
private readonly Rgba32[] data;
/// <summary>
/// Create an empty raw texture with an efficient shared memory backing.
/// </summary>
/// <param name="width">The width of the texture.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="arrayPool">The source pool to retrieve memory from. Shared default is used if null.</param>
public ArrayPoolTextureUpload(int width, int height, ArrayPool<Rgba32> arrayPool = null)
{
data = (this.arrayPool = ArrayPool<Rgba32>.Shared).Rent(width * height);
}
public void Dispose()
{
arrayPool.Return(data);
}
public Span<Rgba32> RawData => data;
public ReadOnlySpan<Rgba32> Data => data;
public int Level { get; set; }
public virtual PixelFormat Format => PixelFormat.Rgba;
public RectangleI Bounds { get; set; }
}
}
|
mit
|
C#
|
3ed646571680ac914ae6556b7f9f657dde56730d
|
Address comments
|
github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql
|
csharp/autobuilder/Semmle.Autobuild.CSharp/StandaloneBuildRule.cs
|
csharp/autobuilder/Semmle.Autobuild.CSharp/StandaloneBuildRule.cs
|
using Semmle.Autobuild.Shared;
namespace Semmle.Autobuild.CSharp
{
/// <summary>
/// Build using standalone extraction.
/// </summary>
class StandaloneBuildRule : IBuildRule
{
public BuildScript Analyse(Autobuilder builder, bool auto)
{
BuildScript GetCommand(string? solution)
{
string standalone;
if (builder.CodeQLExtractorLangRoot is object && builder.CodeQlPlatform is object) {
standalone = builder.Actions.PathCombine(builder.CodeQLExtractorLangRoot, "tools", builder.CodeQlPlatform, "Semmle.Extraction.CSharp.Standalone");
} else if (builder.SemmlePlatformTools is object) {
standalone = builder.Actions.PathCombine(builder.SemmlePlatformTools, "csharp", "Semmle.Extraction.CSharp.Standalone");
} else {
return BuildScript.Failure;
}
var cmd = new CommandBuilder(builder.Actions);
cmd.RunCommand(standalone);
if (solution != null)
cmd.QuoteArgument(solution);
cmd.Argument("--references:.");
if (!builder.Options.NugetRestore)
{
cmd.Argument("--skip-nuget");
}
return cmd.Script;
}
if (!builder.Options.Buildless)
return BuildScript.Failure;
var solutions = builder.Options.Solution.Length;
if (solutions == 0)
return GetCommand(null);
var script = BuildScript.Success;
foreach (var solution in builder.Options.Solution)
script &= GetCommand(solution);
return script;
}
}
}
|
using Semmle.Autobuild.Shared;
namespace Semmle.Autobuild.CSharp
{
/// <summary>
/// Build using standalone extraction.
/// </summary>
class StandaloneBuildRule : IBuildRule
{
public BuildScript Analyse(Autobuilder builder, bool auto)
{
BuildScript GetCommand(string? solution)
{
string standalone;
if (!(builder.CodeQLExtractorLangRoot is null) && !(builder.CodeQlPlatform is null)) {
standalone = builder.Actions.PathCombine(builder.CodeQLExtractorLangRoot, "tools", builder.CodeQlPlatform, "Semmle.Extraction.CSharp.Standalone");
} else if (!(builder.SemmlePlatformTools is null)) {
standalone = builder.Actions.PathCombine(builder.SemmlePlatformTools, "csharp", "Semmle.Extraction.CSharp.Standalone");
} else {
return BuildScript.Failure;
}
var cmd = new CommandBuilder(builder.Actions);
cmd.RunCommand(standalone);
if (solution != null)
cmd.QuoteArgument(solution);
cmd.Argument("--references:.");
if (!builder.Options.NugetRestore)
{
cmd.Argument("--skip-nuget");
}
return cmd.Script;
}
if (!builder.Options.Buildless)
return BuildScript.Failure;
var solutions = builder.Options.Solution.Length;
if (solutions == 0)
return GetCommand(null);
var script = BuildScript.Success;
foreach (var solution in builder.Options.Solution)
script &= GetCommand(solution);
return script;
}
}
}
|
mit
|
C#
|
19a46edb446cd14063ef7a038645cd9199bd6098
|
Fix sample game.
|
EVAST9919/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,naoey/osu-framework,naoey/osu-framework,Nabile-Rahmani/osu-framework,Tom94/osu-framework,ppy/osu-framework,RedNesto/osu-framework,paparony03/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,NeoAdonis/osu-framework,RedNesto/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,default0/osu-framework,ZLima12/osu-framework,Nabile-Rahmani/osu-framework,default0/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,paparony03/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,NeoAdonis/osu-framework
|
SampleGame/Program.cs
|
SampleGame/Program.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 osu.Framework.Desktop;
using osu.Framework.OS;
namespace osu.Desktop
{
public static class Program
{
[STAThread]
public static void Main()
{
BasicGameHost host = Host.GetSuitableHost();
host.Load(new SampleGame());
host.Run();
}
}
}
|
//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 osu.Framework.Desktop;
using osu.Framework.Framework;
namespace osu.Desktop
{
public static class Program
{
[STAThread]
public static void Main()
{
BasicGameHost host = Host.GetSuitableHost();
host.Load(new SampleGame());
host.Run();
}
}
}
|
mit
|
C#
|
a061a031a566b49e567a8fed0967cbd3b0b13bb4
|
reset to default persistent data on new stage load
|
ScopatGames/ShojiSplice
|
titleScripts/LoadScene.cs
|
titleScripts/LoadScene.cs
|
using UnityEngine;
using System.Collections;
public class LoadScene : MonoBehaviour {
public int sceneToLoad;
public bool resetDefaults;
private SceneFadeInOut sceneFadeInOut;
public void OnEnable () {
if (GameObject.FindGameObjectWithTag(Tags.gameController)){
sceneFadeInOut = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SceneFadeInOut> ();
if(resetDefaults){
GameObject.FindGameObjectWithTag(Tags.mainCamera).GetComponent<PersistentData>().ResetDefaults();
}
sceneFadeInOut.LoadScene(sceneToLoad);
}
else{
Application.LoadLevel (sceneToLoad);
}
}
}
|
using UnityEngine;
using System.Collections;
public class LoadScene : MonoBehaviour {
public int sceneToLoad;
private SceneFadeInOut sceneFadeInOut;
public void OnEnable () {
if (GameObject.FindGameObjectWithTag(Tags.gameController)){
sceneFadeInOut = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SceneFadeInOut> ();
sceneFadeInOut.LoadScene(sceneToLoad);
}
else{
Application.LoadLevel (sceneToLoad);
}
}
}
|
mit
|
C#
|
715d36409d391160f3de72ea1ad76dd41f10ae30
|
Raise serialization complete async, as it can take like 15 seconds
|
GuitarRich/Unicorn,kamsar/Unicorn,MacDennis76/Unicorn,PetersonDave/Unicorn,GuitarRich/Unicorn,rmwatson5/Unicorn,MacDennis76/Unicorn,rmwatson5/Unicorn,PetersonDave/Unicorn,kamsar/Unicorn
|
src/Unicorn/Pipelines/UnicornSyncEnd/SendSerializationCompleteEvent.cs
|
src/Unicorn/Pipelines/UnicornSyncEnd/SendSerializationCompleteEvent.cs
|
using System.Linq;
using Sitecore.Configuration;
using Sitecore.Data;
using Sitecore.Data.Serialization;
using Sitecore.Diagnostics;
using Sitecore.Eventing;
using Sitecore.Jobs;
using Unicorn.Predicates;
namespace Unicorn.Pipelines.UnicornSyncEnd
{
public class SendSerializationCompleteEvent : IUnicornSyncEndProcessor
{
public void Process(UnicornSyncEndPipelineArgs args)
{
var databases = args.SyncedConfigurations.SelectMany(config => config.Resolve<IPredicate>().GetRootPaths())
.Select(path => path.DatabaseName)
.Distinct();
foreach (var database in databases)
{
DeserializationComplete(database);
}
}
protected virtual void DeserializationComplete(string databaseName)
{
Assert.ArgumentNotNullOrEmpty(databaseName, "databaseName");
// raising this event can take a long time. like 16 seconds. So we boot it as a job so it can go in the background.
Job asyncSerializationFinished = new Job(new JobOptions("Raise deserialization complete async", "serialization", "shell", this, "RaiseEvent", new[] { databaseName }));
JobManager.Start(asyncSerializationFinished);
}
public virtual void RaiseEvent(string databaseName)
{
EventManager.RaiseEvent(new SerializationFinishedEvent());
Database database = Factory.GetDatabase(databaseName, false);
if (database != null)
{
database.RemoteEvents.Queue.QueueEvent(new SerializationFinishedEvent());
}
}
}
}
|
using System.Linq;
using Sitecore.Configuration;
using Sitecore.Data;
using Sitecore.Data.Serialization;
using Sitecore.Diagnostics;
using Sitecore.Eventing;
using Unicorn.Predicates;
namespace Unicorn.Pipelines.UnicornSyncEnd
{
public class SendSerializationCompleteEvent : IUnicornSyncEndProcessor
{
public void Process(UnicornSyncEndPipelineArgs args)
{
var databases = args.SyncedConfigurations.SelectMany(config => config.Resolve<IPredicate>().GetRootPaths())
.Select(path => path.DatabaseName)
.Distinct();
foreach (var database in databases)
{
DeserializationComplete(database);
}
}
protected virtual void DeserializationComplete(string databaseName)
{
Assert.ArgumentNotNullOrEmpty(databaseName, "databaseName");
EventManager.RaiseEvent(new SerializationFinishedEvent());
Database database = Factory.GetDatabase(databaseName, false);
if (database != null)
{
database.RemoteEvents.Queue.QueueEvent(new SerializationFinishedEvent());
}
}
}
}
|
mit
|
C#
|
2020e0045a7f578bc7ca1b08a3410960209c82d2
|
Remove unwanted enter.
|
KevinDockx/HttpCacheHeaders
|
test/Marvin.Cache.Headers.Test/Extensions/AppBuilderExtensionsFacts.cs
|
test/Marvin.Cache.Headers.Test/Extensions/AppBuilderExtensionsFacts.cs
|
using System;
using Microsoft.AspNetCore.Builder;
using Moq;
using Xunit;
namespace Marvin.Cache.Headers.Test.Extensions
{
public class AppBuilderExtensionsFacts
{
[Fact(Skip = "The Verify throws an exception because UseMiddleware is an extension function as well and can't be mocked, need to find ")]
public void Correctly_register_HttpCacheHeadersMiddleware()
{
var appBuilderMock = new Mock<IApplicationBuilder>();
appBuilderMock.Object.UseHttpCacheHeaders();
appBuilderMock.Verify(x => x.UseMiddleware<HttpCacheHeadersMiddleware>(), "Application builder isn't registering the middleware.");
}
[Fact]
public void When_no_ApplicationBuilder_expect_ArgumentNullException()
{
IApplicationBuilder appBuilder = null;
Assert.Throws<ArgumentNullException>(() => appBuilder.UseHttpCacheHeaders());
}
}
}
|
using System;
using Microsoft.AspNetCore.Builder;
using Moq;
using Xunit;
namespace Marvin.Cache.Headers.Test.Extensions
{
public class AppBuilderExtensionsFacts
{
[Fact(Skip = "The Verify throws an exception because UseMiddleware is an extension function as well and can't be mocked, need to find ")]
public void Correctly_register_HttpCacheHeadersMiddleware()
{
var appBuilderMock = new Mock<IApplicationBuilder>();
appBuilderMock.Object.UseHttpCacheHeaders();
appBuilderMock.Verify(x => x.UseMiddleware<HttpCacheHeadersMiddleware>(), "Application builder isn't registering the middleware.");
}
[Fact]
public void When_no_ApplicationBuilder_expect_ArgumentNullException()
{
IApplicationBuilder appBuilder = null;
Assert.Throws<ArgumentNullException>(() => appBuilder.UseHttpCacheHeaders());
}
}
}
|
mit
|
C#
|
b1a5197cc78d21b9a150a5f6ade59cb6be3a2684
|
Check null for extension
|
JeremyAnsel/helix-toolkit,helix-toolkit/helix-toolkit,holance/helix-toolkit,chrkon/helix-toolkit,Iluvatar82/helix-toolkit
|
Source/HelixToolkit.SharpDX.SharedModel/Extensions/MaterialExtension.cs
|
Source/HelixToolkit.SharpDX.SharedModel/Extensions/MaterialExtension.cs
|
#if !NETFX_CORE
namespace HelixToolkit.Wpf.SharpDX
#else
namespace HelixToolkit.UWP
#endif
{
using Model;
using System;
public static class MaterialExtension
{
public static PhongMaterial ConvertToPhongMaterial(this PhongMaterialCore core)
{
return core == null ? null : new PhongMaterial()
{
DiffuseColor = core.DiffuseColor,
AmbientColor = core.AmbientColor,
EmissiveColor = core.EmissiveColor,
SpecularColor = core.SpecularColor,
ReflectiveColor = core.ReflectiveColor,
SpecularShininess = core.SpecularShininess,
DiffuseAlphaMap = core.DiffuseAlphaMap,
DiffuseAlphaMapSampler = core.DiffuseAlphaMapSampler,
DiffuseMap = core.DiffuseMap,
DiffuseMapSampler = core.DiffuseMapSampler,
DisplacementMap = core.DisplacementMap,
DisplacementMapSampler = core.DisplacementMapSampler,
NormalMap = core.NormalMap,
NormalMapSampler = core.NormalMapSampler,
DisplacementMapScaleMask = core.DisplacementMapScaleMask,
Name = core.Name,
};
}
public static Material ConvertToMaterial(this MaterialCore core)
{
if(core is PhongMaterialCore p)
{
return p.ConvertToPhongMaterial();
}
else
{
throw new NotSupportedException($"Current material core to material conversion has not been supported yet.");
}
}
}
}
#if !NETFX_CORE
namespace HelixToolkit.Wpf.SharpDX.Model
#else
namespace HelixToolkit.UWP.Model
#endif
{
public partial class PhongMaterialCore
{
public static implicit operator PhongMaterial(PhongMaterialCore core)
{
return MaterialExtension.ConvertToPhongMaterial(core);
}
}
}
|
#if !NETFX_CORE
namespace HelixToolkit.Wpf.SharpDX
#else
namespace HelixToolkit.UWP
#endif
{
using Model;
using System;
public static class MaterialExtension
{
public static PhongMaterial ConvertToPhongMaterial(this PhongMaterialCore core)
{
return new PhongMaterial()
{
DiffuseColor = core.DiffuseColor,
AmbientColor = core.AmbientColor,
EmissiveColor = core.EmissiveColor,
SpecularColor = core.SpecularColor,
ReflectiveColor = core.ReflectiveColor,
SpecularShininess = core.SpecularShininess,
DiffuseAlphaMap = core.DiffuseAlphaMap,
DiffuseAlphaMapSampler = core.DiffuseAlphaMapSampler,
DiffuseMap = core.DiffuseMap,
DiffuseMapSampler = core.DiffuseMapSampler,
DisplacementMap = core.DisplacementMap,
DisplacementMapSampler = core.DisplacementMapSampler,
NormalMap = core.NormalMap,
NormalMapSampler = core.NormalMapSampler,
DisplacementMapScaleMask = core.DisplacementMapScaleMask,
Name = core.Name,
};
}
public static Material ConvertToMaterial(this MaterialCore core)
{
if(core is PhongMaterialCore p)
{
return p.ConvertToPhongMaterial();
}
else
{
throw new NotSupportedException($"Current material core to material conversion has not been supported yet.");
}
}
}
}
#if !NETFX_CORE
namespace HelixToolkit.Wpf.SharpDX.Model
#else
namespace HelixToolkit.UWP.Model
#endif
{
public partial class PhongMaterialCore
{
public static implicit operator PhongMaterial(PhongMaterialCore core)
{
return MaterialExtension.ConvertToPhongMaterial(core);
}
}
}
|
mit
|
C#
|
3166c6944dedcfd90c48d160d70e475b39e405fa
|
Update Base.props
|
wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors
|
src/Avalonia.Xaml.Interactions/Properties/AssemblyInfo.cs
|
src/Avalonia.Xaml.Interactions/Properties/AssemblyInfo.cs
|
using System.Runtime.CompilerServices;
using Avalonia.Metadata;
[assembly: InternalsVisibleTo("Avalonia.Xaml.Interactions.UnitTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001002940ed211918fcf63c506fad1d3f7f958b21ff8f06fd2089398296173f9ca93a69b9b380a828bf13fa80d1745beeb917ec3692f4d10e44b4c941619fc7bbd5052b26880697e6fa3f0ce322c4fa902d20b67a48b4144371218f6d39ad39145ea1fe5484052dd51a2ee62af3acd0759bcf92aaefec03978ded3cfaa84798e92de8")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions.Core")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions.Custom")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions.DragAndDrop")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions.Draggable")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions.Responsive")]
|
using System.Runtime.CompilerServices;
using Avalonia.Metadata;
[assembly: InternalsVisibleTo("Avalonia.Xaml.Interactions.UnitTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001002940ed211918fcf63c506fad1d3f7f958b21ff8f06fd2089398296173f9ca93a69b9b380a828bf13fa80d1745beeb917ec3692f4d10e44b4c941619fc7bbd5052b26880697e6fa3f0ce322c4fa902d20b67a48b4144371218f6d39ad39145ea1fe5484052dd51a2ee62af3acd0759bcf92aaefec03978ded3cfaa84798e92de8")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions.Core")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions.Custom")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions.DragAndDrop")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Xaml.Interactions.Draggable")]
|
mit
|
C#
|
782ec5ecb88e58c2e5adac01a48277aa0f3b7221
|
bump ver
|
AntonyCorbett/OnlyT,AntonyCorbett/OnlyT
|
SolutionInfo.cs
|
SolutionInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2018 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1.0.40")]
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2018 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1.0.39")]
|
mit
|
C#
|
91e32dde73727e000c7121da6427425556f91bd1
|
Update GraylogSink.cs
|
whir1/serilog-sinks-graylog
|
src/Serilog.Sinks.Graylog/GraylogSink.cs
|
src/Serilog.Sinks.Graylog/GraylogSink.cs
|
using System;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Serilog.Core;
using Serilog.Debugging;
using Serilog.Events;
using Serilog.Sinks.Graylog.Core;
using Serilog.Sinks.Graylog.Core.Transport;
namespace Serilog.Sinks.Graylog
{
public class GraylogSink : ILogEventSink, IDisposable
{
private readonly Lazy<IGelfConverter> _converter;
private readonly Lazy<ITransport> _transport;
public GraylogSink(GraylogSinkOptions options)
{
ISinkComponentsBuilder sinkComponentsBuilder = new SinkComponentsBuilder(options);
_transport = new Lazy<ITransport>(() => sinkComponentsBuilder.MakeTransport());
_converter = new Lazy<IGelfConverter>(() => sinkComponentsBuilder.MakeGelfConverter());
}
public void Dispose()
{
_transport.Value.Dispose();
}
public async void Emit(LogEvent logEvent)
{
try
{
await EmitAsync(logEvent);
}
catch (Exception exc)
{
SelfLog.WriteLine("Oops something going wrong {0}", exc);
}
}
private Task EmitAsync(LogEvent logEvent)
{
JObject json = _converter.Value.GetGelfJson(logEvent);
string payload = json.ToString(Newtonsoft.Json.Formatting.None);
return _transport.Value.Send(payload);
}
}
}
|
using System;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Serilog.Core;
using Serilog.Debugging;
using Serilog.Events;
using Serilog.Sinks.Graylog.Core;
using Serilog.Sinks.Graylog.Core.Transport;
namespace Serilog.Sinks.Graylog
{
public class GraylogSink : ILogEventSink, IDisposable
{
private readonly Lazy<IGelfConverter> _converter;
private readonly Lazy<ITransport> _transport;
public GraylogSink(GraylogSinkOptions options)
{
ISinkComponentsBuilder sinkComponentsBuilder = new SinkComponentsBuilder(options);
_transport = new Lazy<ITransport>(() => sinkComponentsBuilder.MakeTransport());
_converter = new Lazy<IGelfConverter>(() => sinkComponentsBuilder.MakeGelfConverter());
}
public void Dispose()
{
_transport.Value.Dispose();
}
public void Emit(LogEvent logEvent)
{
try
{
Task.Run(() => EmitAsync(logEvent)).GetAwaiter().GetResult();
}
catch (Exception exc)
{
SelfLog.WriteLine("Oops something going wrong {0}", exc);
}
}
private Task EmitAsync(LogEvent logEvent)
{
JObject json = _converter.Value.GetGelfJson(logEvent);
string payload = json.ToString(Newtonsoft.Json.Formatting.None);
return _transport.Value.Send(payload);
}
}
}
|
mit
|
C#
|
cf37b17b8d6d9deb2026fb1cfdafbb9c2e0ebf9c
|
Add detailed comments to FileFlags
|
JeremyKuhne/WInterop,JeremyKuhne/WInterop,JeremyKuhne/WInterop,JeremyKuhne/WInterop
|
src/WInterop/FileManagement/FileFlags.cs
|
src/WInterop/FileManagement/FileFlags.cs
|
// ------------------------
// WInterop Framework
// ------------------------
// Copyright (c) Jeremy W. Kuhne. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace WInterop.FileManagement
{
[Flags]
public enum FileFlags : uint
{
/// <summary>
/// Not technically a defined attribute, added here for convenience.
/// </summary>
NONE = 0x0,
FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000,
FILE_FLAG_OPEN_NO_RECALL = 0x00100000,
FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000,
FILE_FLAG_SESSION_AWARE = 0x00800000,
/// <summary>
/// Allows accessing via POSIX semantics, notably not ignoring case.
/// </summary>
FILE_FLAG_POSIX_SEMANTICS = 0x01000000,
FILE_FLAG_BACKUP_SEMANTICS = 0x02000000,
/// <summary>
/// Flags the file to be deleted when the final handle is closed.
/// </summary>
FILE_FLAG_DELETE_ON_CLOSE = 0x04000000,
/// <summary>
/// Hints that the access for a file will be mostly sequential to optimize caching behavior.
/// </summary>
FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000,
/// <summary>
/// Hints that the access for a file will be mostly random to optimize caching behavior.
/// Notably that the system shouldn't read ahead in anticipation of further reads.
/// </summary>
FILE_FLAG_RANDOM_ACCESS = 0x10000000,
/// <summary>
/// Causes data writes to skip the system cache and go straight to disk.
/// </summary>
/// <remarks>
/// Using this flag requires reading and writing aligned on physical sectors
/// and in sector sized chunks.
/// https://msdn.microsoft.com/en-us/library/windows/desktop/cc644950.aspx
///
/// File metadata is always cached, so it must be flushed either explicitly
/// or through the FILE_FLAG_WRITE_THROUGH flag.
/// </remarks>
FILE_FLAG_NO_BUFFERING = 0x20000000,
/// <summary>
/// Indicates that operations should potentially be asynchronous. If data is pending
/// Read/WriteFile will return ERROR_IO_PENDING and will signal the event specified
/// in the OVERLAPPED structure when complete.
/// </summary>
/// <remarks>
/// In this state the system will not maintain a file pointer, you must pass the
/// offset in the OVERLAPPED structure.
///
/// When this flag is *not* set, the file mode FILE_SYNCHRONOUS_IO_NONALERT is set,
/// which is the file handle object flag FO_SYNCHRONOUS_IO without FO_ALERTABLE_IO.
/// FILE_SYNCHRONOUS_IO_ALERT is FO_SYNCHRONOUS_IO with FO_ALTERTABLE_IO.
///
/// So when neither FILE_SYNCHRONOUS_IO_NONALERT or FILE_SYNCHRONOUS_IO_ALERT is set
/// the object is overlapped (e.g. async is the "default" state).
/// </remarks>
FILE_FLAG_OVERLAPPED = 0x40000000,
/// <summary>
/// Causes writes to be immediately flushed to disk (e.g. FlushFileBuffers)
/// https://msdn.microsoft.com/en-us/library/windows/desktop/aa364218.aspx
/// </summary>
FILE_FLAG_WRITE_THROUGH = 0x80000000
}
}
|
// ------------------------
// WInterop Framework
// ------------------------
// Copyright (c) Jeremy W. Kuhne. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace WInterop.FileManagement
{
[Flags]
public enum FileFlags : uint
{
/// <summary>
/// Not technically a defined attribute, added here for convenience.
/// </summary>
NONE = 0x0,
FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000,
FILE_FLAG_OPEN_NO_RECALL = 0x00100000,
FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000,
FILE_FLAG_SESSION_AWARE = 0x00800000,
FILE_FLAG_POSIX_SEMANTICS = 0x01000000,
FILE_FLAG_BACKUP_SEMANTICS = 0x02000000,
FILE_FLAG_DELETE_ON_CLOSE = 0x04000000,
FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000,
FILE_FLAG_RANDOM_ACCESS = 0x10000000,
FILE_FLAG_NO_BUFFERING = 0x20000000,
FILE_FLAG_OVERLAPPED = 0x40000000,
FILE_FLAG_WRITE_THROUGH = 0x80000000
}
}
|
mit
|
C#
|
33029ba31876013edffdd2eb468ea8f0d653624d
|
fix typing caused by breakpoint
|
hybrasyl/server,hybrasyl/server,baughj/hybrasylserver,baughj/hybrasylserver,baughj/hybrasylserver,hybrasyl/server
|
hybrasyl/ControlService.cs
|
hybrasyl/ControlService.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;
using Hybrasyl.Objects;
using StackExchange.Redis;
namespace Hybrasyl
{
[ServiceContract]
public interface IControlService
{
[OperationContract]
[WebGet(UriTemplate = "/Shutdown/{key}")]
string Shutdown(string key);
[OperationContract]
[WebGet(UriTemplate = "/CurrentUsers")]
List<User> CurrentUsers();
[OperationContract]
[WebGet(UriTemplate = "/User/{name}")]
User User(string name);
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single, IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ControlService : IControlService
{
public string Shutdown(string key)
{
if (key == Constants.ShutdownPassword)
{
World.MessageQueue.Add(new HybrasylControlMessage(ControlOpcodes.ShutdownServer, "build"));
return "Shutdown ControlMessage sent to Server.";
}
return "Shutdown ControlMessage not queued.";
}
public List<User> CurrentUsers() => World.ActiveUsers.Select(x => x.Value ).ToList();
public User User(string name)
{
return World.ActiveUsers.All(x => x.Value.Name != name) ? null : World.ActiveUsers.Single(x => x.Value.Name == name).Value;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;
using Hybrasyl.Objects;
using StackExchange.Redis;
namespace Hybrasyl
{
[ServiceContract]
public interface IControlService
{
[OperationContract]
[WebGet(UriTemplate = "/Shutdown/{key}")]
string Shutdown(string key);
[OperationContract]
[WebGet(UriTemplate = "/CurrentUsers")]
List<User> CurrentUsers();
[OperationContract]
[WebGet(UriTemplate = "/User/{name}")]
User User(string name);
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single, IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ControlService : IControlService
{
public string Shutdown(string key)
{
if (key == Constants.ShutdownPassword)
{
World.MessageQueue.Add(new HybrasylControlMessage(ControlOpcodes.ShutdownServer, "build"));
return "Shutdown ControlMessage sent to Server.";
}
return "Shutdown ControlMessage not queued.";
}
public List<User> CurrentUsers() => my BadImageFormatExceptionWorld.ActiveUsers.Select(x => x.Value ).ToList();
public User User(string name)
{
return World.ActiveUsers.All(x => x.Value.Name != name) ? null : World.ActiveUsers.Single(x => x.Value.Name == name).Value;
}
}
}
|
agpl-3.0
|
C#
|
5ebeec2373664dc38084c521a41baa0a5833a840
|
Rename acceptance test with proper underscores.
|
dupdob/Michonne,dupdob/Michonne,dupdob/Michonne
|
PastaPricer.Tests/Acceptance/PastaPricerAcceptanceTests.cs
|
PastaPricer.Tests/Acceptance/PastaPricerAcceptanceTests.cs
|
namespace PastaPricer.Tests.Acceptance
{
using NSubstitute;
using NUnit.Framework;
[TestFixture]
public class PastaPricerAcceptanceTests
{
[Test]
public void Should_Publish_Pasta_Price_Once_Started_And_MarketData_Is_Available()
{
// Mocks instantiation
var publisher = Substitute.For<IPastaPricerPublisher>();
var marketDataProvider = new MarketDataProvider();
var pastaPricer = new PastaPricerEngine(marketDataProvider, publisher);
publisher.DidNotReceiveWithAnyArgs().Publish(string.Empty, 0);
pastaPricer.Start();
publisher.DidNotReceiveWithAnyArgs().Publish(string.Empty, 0);
marketDataProvider.Start();
// It publishes!
publisher.ReceivedWithAnyArgs().Publish(string.Empty, 0);
}
}
}
|
namespace PastaPricer.Tests.Acceptance
{
using NSubstitute;
using NUnit.Framework;
[TestFixture]
public class PastaPricerAcceptanceTests
{
[Test]
public void Should_PublishPastaPriceOnceStartedAndMarketDataIsAvailable()
{
// Mocks instantiation
var publisher = Substitute.For<IPastaPricerPublisher>();
var marketDataProvider = new MarketDataProvider();
var pastaPricer = new PastaPricerEngine(marketDataProvider, publisher);
publisher.DidNotReceiveWithAnyArgs().Publish(string.Empty, 0);
pastaPricer.Start();
publisher.DidNotReceiveWithAnyArgs().Publish(string.Empty, 0);
marketDataProvider.Start();
// It publishes!
publisher.ReceivedWithAnyArgs().Publish(string.Empty, 0);
}
}
}
|
apache-2.0
|
C#
|
7d1476d62a126bc0e823a0b8418ff99465156361
|
修改版本号。
|
RabbitTeam/WeiXinSDK
|
Rabbit.WeiXin/SDK/Rabbit.WeiXin/Properties/AssemblyInfo.cs
|
Rabbit.WeiXin/SDK/Rabbit.WeiXin/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Rabbit.WeiXin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Rabbit.WeiXin")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("1d71eb76-a5dd-4078-a3df-71b54d037427")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0")]
[assembly: AssemblyFileVersion("0.2.1")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Rabbit.WeiXin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Rabbit.WeiXin")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("1d71eb76-a5dd-4078-a3df-71b54d037427")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0")]
[assembly: AssemblyFileVersion("0.2.0")]
|
apache-2.0
|
C#
|
57ebae31b9b23fc8ba9e861f74eb6fea7051fbe2
|
Fix serialization attributes
|
elastic/elasticsearch-net,elastic/elasticsearch-net
|
src/Nest/XPack/MachineLearning/PutCalendarJob/PutCalendarJobResponse.cs
|
src/Nest/XPack/MachineLearning/PutCalendarJob/PutCalendarJobResponse.cs
|
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Nest
{
/// <summary> The response from creating a calendar job. </summary>
public class PutCalendarJobResponse : ResponseBase
{
[DataMember(Name = "calendar_id")]
public string CalendarId { get; internal set; }
[DataMember(Name = "description")]
public string Description { get; internal set; }
[DataMember(Name = "job_ids")]
public IReadOnlyCollection<string> JobIds { get; internal set; } = EmptyReadOnly<string>.Collection;
}
}
|
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Nest
{
/// <summary> The response from creating a calendar job. </summary>
public class PutCalendarJobResponse : ResponseBase
{
[DataMember(Name = "calendar_id")]
public string CalendarId { get; internal set; }
[DataMember(Name = "job_ids")]
public string Description { get; internal set; }
[DataMember(Name = "description")]
public IReadOnlyCollection<string> JobIds { get; internal set; } = EmptyReadOnly<string>.Collection;
}
}
|
apache-2.0
|
C#
|
4192c5f1c43a5df6e17faf22c16de2b42918fd9c
|
Set color back to red.
|
Horizon0156/Trackify
|
BookingHelper/Bootstrapper.cs
|
BookingHelper/Bootstrapper.cs
|
using AutoMapper;
using BookingHelper.DataModels;
using BookingHelper.UI;
using BookingHelper.ViewModels;
using Horizon.Framework.Xaml.Extensions;
using MahApps.Metro;
using SimpleInjector;
using System;
using System.Windows;
namespace BookingHelper
{
/// <summary>
/// Bootstrapper for the BookingHelper application.
/// </summary>
public static class Bootstrapper
{
private static Container _container = new Container();
[STAThread]
public static int Main()
{
var app = new Application();
InitializeMetroTheme(app);
app.Startup += ShowMainWindow;
InitializeMappings();
InitializeDependencyInjection();
return app.Run();
}
private static void BindDataContextToMainWindow(MainWindow window)
{
window.DataContext = _container.GetInstance<MainWindowViewModel>();
}
private static void InitializeDependencyInjection()
{
_container.Register<IBookingsContext, BookingsContext>();
_container.RegisterInitializer<MainWindow>(BindDataContextToMainWindow);
}
private static void InitializeMappings()
{
Mapper.Initialize(config => config.CreateMap<Booking, BookingModel>().ReverseMap());
Mapper.AssertConfigurationIsValid();
}
private static void InitializeMetroTheme(Application app)
{
app.InjectResourceDictionary("MahApps.Metro", "Styles/Controls.xaml");
app.InjectResourceDictionary("MahApps.Metro", "Styles/Fonts.xaml");
app.InjectResourceDictionary("MahApps.Metro", "Styles/Colors.xaml");
ThemeManager.ChangeAppStyle(
app,
ThemeManager.GetAccent("Red"),
ThemeManager.GetAppTheme("BaseDark"));
}
private static void ShowMainWindow(object sender, StartupEventArgs e)
{
_container.GetInstance<MainWindow>().Show();
}
}
}
|
using AutoMapper;
using BookingHelper.DataModels;
using BookingHelper.UI;
using BookingHelper.ViewModels;
using Horizon.Framework.Xaml.Extensions;
using MahApps.Metro;
using SimpleInjector;
using System;
using System.Windows;
namespace BookingHelper
{
/// <summary>
/// Bootstrapper for the BookingHelper application.
/// </summary>
public static class Bootstrapper
{
private static Container _container = new Container();
[STAThread]
public static int Main()
{
var app = new Application();
InitializeMetroTheme(app);
app.Startup += ShowMainWindow;
InitializeMappings();
InitializeDependencyInjection();
return app.Run();
}
private static void BindDataContextToMainWindow(MainWindow window)
{
window.DataContext = _container.GetInstance<MainWindowViewModel>();
}
private static void InitializeDependencyInjection()
{
_container.Register<IBookingsContext, BookingsContext>();
_container.RegisterInitializer<MainWindow>(BindDataContextToMainWindow);
}
private static void InitializeMappings()
{
Mapper.Initialize(config => config.CreateMap<Booking, BookingModel>().ReverseMap());
Mapper.AssertConfigurationIsValid();
}
private static void InitializeMetroTheme(Application app)
{
app.InjectResourceDictionary("MahApps.Metro", "Styles/Controls.xaml");
app.InjectResourceDictionary("MahApps.Metro", "Styles/Fonts.xaml");
app.InjectResourceDictionary("MahApps.Metro", "Styles/Colors.xaml");
ThemeManager.ChangeAppStyle(
app,
ThemeManager.GetAccent("Green"),
ThemeManager.GetAppTheme("BaseDark"));
}
private static void ShowMainWindow(object sender, StartupEventArgs e)
{
_container.GetInstance<MainWindow>().Show();
}
}
}
|
mit
|
C#
|
4043d3ebcc300c52be0345fd57a2d1bde44820e3
|
Test namespace fix
|
madelson/DistributedLock
|
DistributedLock.Tests/Tests/SqlServer/SqlConnectionOptionsBuilderTest.cs
|
DistributedLock.Tests/Tests/SqlServer/SqlConnectionOptionsBuilderTest.cs
|
using Medallion.Threading.SqlServer;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
namespace Medallion.Threading.Tests.SqlServer
{
public class SqlConnectionOptionsBuilderTest
{
[Test]
public void TestValidatesArguments()
{
var builder = new SqlConnectionOptionsBuilder();
Assert.Throws<ArgumentOutOfRangeException>(() => builder.KeepaliveCadence(TimeSpan.FromMilliseconds(-2)));
Assert.Throws<ArgumentOutOfRangeException>(() => builder.KeepaliveCadence(TimeSpan.MaxValue));
Assert.Throws<ArgumentException>(() => SqlConnectionOptionsBuilder.GetOptions(o => o.UseMultiplexing().UseTransaction()));
}
[Test]
public void TestDefaults()
{
var options = SqlConnectionOptionsBuilder.GetOptions(null);
options.keepaliveCadence.ShouldEqual(TimeSpan.FromMinutes(10));
Assert.IsTrue(options.useMultiplexing);
Assert.IsFalse(options.useTransaction);
options.ShouldEqual(SqlConnectionOptionsBuilder.GetOptions(o => { }));
}
}
}
|
using Medallion.Threading.SqlServer;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
namespace Medallion.Threading.Tests.Tests.SqlServer
{
public class SqlConnectionOptionsBuilderTest
{
[Test]
public void TestValidatesArguments()
{
var builder = new SqlConnectionOptionsBuilder();
Assert.Throws<ArgumentOutOfRangeException>(() => builder.KeepaliveCadence(TimeSpan.FromMilliseconds(-2)));
Assert.Throws<ArgumentOutOfRangeException>(() => builder.KeepaliveCadence(TimeSpan.MaxValue));
Assert.Throws<ArgumentException>(() => SqlConnectionOptionsBuilder.GetOptions(o => o.UseMultiplexing().UseTransaction()));
}
[Test]
public void TestDefaults()
{
var options = SqlConnectionOptionsBuilder.GetOptions(null);
options.keepaliveCadence.ShouldEqual(TimeSpan.FromMinutes(10));
Assert.IsTrue(options.useMultiplexing);
Assert.IsFalse(options.useTransaction);
options.ShouldEqual(SqlConnectionOptionsBuilder.GetOptions(o => { }));
}
}
}
|
mit
|
C#
|
379eef1426228b857b16b4038db36ac33b9eb815
|
add properties to merchant dto
|
Paymentsense/Dapper.SimpleSave
|
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/MerchantDto.cs
|
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/MerchantDto.cs
|
using PS.Mothership.Core.Common.Template.Cust;
using PS.Mothership.Core.Common.Template.Gen;
using System;
using System.Runtime.Serialization;
using System.Collections.Generic;
using PS.Mothership.Core.Common.Dto.Contact;
namespace PS.Mothership.Core.Common.Dto.Merchant
{
[DataContract]
public class MerchantDto
{
[DataMember]
public Guid MerchantGuid { get; set; }
[DataMember]
public long? V1MerchantId { get; set; }
[DataMember]
public string LocatorId { get; set; }
[DataMember]
public long ThompsonCodeKey { get; set; }
[DataMember]
public long AnnualTurnover { get; set; }
[DataMember]
public CustNumberEmployeesEnum NumberEmployeesKey { get; set; }
[DataMember]
public GenBusinessLegalTypeEnum BusinessLegalTypeKey { get; set; }
[DataMember]
public long CurrentTradingBankKey { get; set; }
[DataMember]
public GenNoContactReasonEnum CallRestrictedReasonKey { get; set; }
[DataMember]
public long EmailRestrictedReasonKey { get; set; }
[DataMember]
public FullAddressDto Address { get; set; }
[DataMember]
public Guid PhoneGuid { get; set; }
[DataMember]
public string PhoneNumber { get; set; }
[DataMember]
public string Fax { get; set; }
[DataMember]
public Guid EmailAddressGuid { get; set; }
[DataMember]
public string Website { get; set; }
[DataMember]
public string CreditPreScreenFlag { get; set; }
[DataMember]
public string ExperianBusinessURN { get; set; }
[DataMember]
public string ExperianLocationURN { get; set; }
[DataMember]
public DateTime? ExperianLastUpdate { get; set; }
[DataMember]
public Guid UpdateSessionGuid { get; set; }
[DataMember]
public DateTimeOffset UpdateDate { get; set; }
[DataMember]
public IList<ContactDto> Contacts { get; set; }
public MerchantDto()
{
this.Contacts = new List<ContactDto>();
}
}
}
|
using PS.Mothership.Core.Common.Template.Cust;
using PS.Mothership.Core.Common.Template.Gen;
using System;
using System.Runtime.Serialization;
using System.Collections.Generic;
using PS.Mothership.Core.Common.Dto.Contact;
namespace PS.Mothership.Core.Common.Dto.Merchant
{
[DataContract]
public class MerchantDto
{
[DataMember]
public Guid MerchantGuid { get; set; }
[DataMember]
public long? V1MerchantId { get; set; }
[DataMember]
public string LocatorId { get; set; }
[DataMember]
public long ThompsonCodeKey { get; set; }
[DataMember]
public long AnnualTurnover { get; set; }
[DataMember]
public CustNumberEmployeesEnum NumberEmployeesKey { get; set; }
[DataMember]
public GenBusinessLegalTypeEnum BusinessLegalTypeKey { get; set; }
[DataMember]
public long CurrentTradingBankKey { get; set; }
[DataMember]
public GenNoContactReasonEnum CallRestrictedReasonKey { get; set; }
[DataMember]
public long EmailRestrictedReasonKey { get; set; }
[DataMember]
public FullAddressDto Address { get; set; }
[DataMember]
public Guid PhoneGuid { get; set; }
[DataMember]
public Guid EmailAddressGuid { get; set; }
[DataMember]
public string WebsiteURL { get; set; }
[DataMember]
public string CreditPreScreenFlag { get; set; }
[DataMember]
public string ExperianBusinessURN { get; set; }
[DataMember]
public string ExperianLocationURN { get; set; }
[DataMember]
public DateTime? ExperianLastUpdate { get; set; }
[DataMember]
public Guid UpdateSessionGuid { get; set; }
[DataMember]
public DateTimeOffset UpdateDate { get; set; }
[DataMember]
public IList<ContactDto> Contacts { get; set; }
public MerchantDto()
{
this.Contacts = new List<ContactDto>();
}
}
}
|
mit
|
C#
|
9db06fafd0b615b648076d1d875a7ea6fbc98d2d
|
Fix code formatting
|
peppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu
|
osu.Game/Overlays/Profile/Sections/Recent/OtherIcon.cs
|
osu.Game/Overlays/Profile/Sections/Recent/OtherIcon.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.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Profile.Sections.Recent
{
public class OtherIcon : Container
{
public OtherIcon(IconUsage inputIcon)
{
{
Child = new SpriteIcon
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = inputIcon,
};
}
}
}
}
|
// 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.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Profile.Sections.Recent
{
public class OtherIcon : Container
{
public OtherIcon(IconUsage inputIcon)
{
{
Child = new SpriteIcon
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = inputIcon,
};
}
}
}
}
|
mit
|
C#
|
7e43c94eda96bc439ec654d17c9e38f55f8e0aae
|
Check null exception
|
Silphid/Silphid.Unity,Silphid/Silphid.Unity
|
Sources/Silphid.Loadzup/Sources/Abstractions/Exceptions/HttpException.cs
|
Sources/Silphid.Loadzup/Sources/Abstractions/Exceptions/HttpException.cs
|
using System;
using System.Collections.Generic;
using System.Net;
using Silphid.Extensions;
using UnityEngine.Networking;
namespace Silphid.Loadzup
{
public class HttpException : LoadzupException
{
public Uri Uri { get; }
public HttpStatusCode StatusCode { get; }
public string ResponseBody { get; }
public Dictionary<string, string> ResponseHeaders { get; }
public HttpException(UnityWebRequest request) : this(new Uri(request.url), request.error)
{
StatusCode = (HttpStatusCode) request.responseCode;
ResponseBody = request.downloadHandler.text;
ResponseHeaders = request.GetResponseHeaders();
}
public HttpException(Uri uri, HttpStatusCode statusCode) : this(uri, $"StatusCode: {statusCode}")
{
ResponseBody = ((int) statusCode).ToString();
StatusCode = statusCode;
}
public HttpException(Uri uri, string message = null, Exception innerException = null)
: base(message, innerException)
{
Uri = uri;
}
public override string Message =>
$"{base.Message}\r\n" +
$"Uri: {Uri}\r\n" +
$"ResponseBody:\r\n{ResponseBody}\r\n" +
$"ResponseHeaders:\r\n{{\r\n{ResponseHeaders?.JoinAsString(" ")}}}";
}
}
|
using System;
using System.Collections.Generic;
using System.Net;
using Silphid.Extensions;
using UnityEngine.Networking;
namespace Silphid.Loadzup
{
public class HttpException : LoadzupException
{
public Uri Uri { get; }
public HttpStatusCode StatusCode { get; }
public string ResponseBody { get; }
public Dictionary<string, string> ResponseHeaders { get; }
public HttpException(UnityWebRequest request) : this(new Uri(request.url), request.error)
{
StatusCode = (HttpStatusCode) request.responseCode;
ResponseBody = request.downloadHandler.text;
ResponseHeaders = request.GetResponseHeaders();
}
public HttpException(Uri uri, HttpStatusCode statusCode) : this(uri, $"StatusCode: {statusCode}")
{
ResponseBody = ((int) statusCode).ToString();
StatusCode = statusCode;
}
public HttpException(Uri uri, string message = null, Exception innerException = null)
: base(message, innerException)
{
Uri = uri;
}
public override string Message =>
$"{base.Message}\r\n" +
$"Uri: {Uri}\r\n" +
$"ResponseBody:\r\n{ResponseBody}\r\n" +
$"ResponseHeaders:\r\n{{\r\n{ResponseHeaders.JoinAsString(" ")}}}";
}
}
|
mit
|
C#
|
fa368eb24de64ce6cb62a121904964eb1f7560fc
|
Fix ArrayOutOfBounds
|
Quickshot/DupImageLib,Quickshot/DupImage
|
DupImageLib/ImageMagickTransformer.cs
|
DupImageLib/ImageMagickTransformer.cs
|
using System.IO;
using ImageMagick;
namespace DupImageLib
{
/// <summary>
/// Implements IImageTransformer interface using Magick.NET for image transforms.
/// </summary>
public class ImageMagickTransformer : IImageTransformer
{
public byte[] TransformImage(Stream stream, int width, int height)
{
// Read image
var img = new MagickImage(stream);
var settings = new QuantizeSettings
{
ColorSpace = ColorSpace.Gray,
Colors = 256
};
img.Quantize(settings);
var size = new MagickGeometry(width, height) { IgnoreAspectRatio = true };
img.Resize(size);
var imgPixels = img.GetPixels().GetValues();
return imgPixels;
}
}
}
|
using System.IO;
using ImageMagick;
namespace DupImageLib
{
/// <summary>
/// Implements IImageTransformer interface using Magick.NET for image transforms.
/// </summary>
public class ImageMagickTransformer : IImageTransformer
{
public byte[] TransformImage(Stream stream, int width, int height)
{
// Read image
var img = new MagickImage(stream);
var settings = new QuantizeSettings
{
ColorSpace = ColorSpace.Gray,
Colors = 256
};
img.Quantize(settings);
var size = new MagickGeometry(width, height) { IgnoreAspectRatio = true };
img.Resize(size);
// Get pixel data from image and only return single channel instead of rgb data.
var imgPixels = img.GetPixels().GetValues();
var pixels = new byte[width * height];
for (var i = 0; i < pixels.Length; i++)
{
pixels[i] = imgPixels[i * 3];
}
return pixels;
}
}
}
|
unknown
|
C#
|
b285a8ff4e2f2cb81adc071a0f929cfd47c92b18
|
Fix #31
|
lucasdavid/Gamedalf,lucasdavid/Gamedalf
|
Gamedalf/Views/Shared/_Confirm.cshtml
|
Gamedalf/Views/Shared/_Confirm.cshtml
|
@model String
<div class="col-md-12">
<div class="form-group text-right">
<a href="@Url.Action("Index")" class="btn btn-default">Back</a>
<input type="submit" value="@Model" class="btn btn-primary" />
</div>
</div>
|
@model String
<div class="form-group text-right">
<a href="@Url.Action("Index")" class="btn btn-default">Back</a>
<input type="submit" value="@Model" class="btn btn-primary" />
</div>
|
mit
|
C#
|
2f31c6f23b2d6ab5b633c4e2ff26c49f35b1f162
|
fix crash on import midi null off event
|
stakira/OpenUtau,stakira/OpenUtau
|
OpenUtau.Core/Formats/Midi.cs
|
OpenUtau.Core/Formats/Midi.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NAudio.Midi;
using OpenUtau.Core.Ustx;
namespace OpenUtau.Core.Formats
{
public static class Midi
{
static public List<UVoicePart> Load(string file, UProject project)
{
List<UVoicePart> resultParts = new List<UVoicePart>();
MidiFile midi = new MidiFile(file);
for (int i = 0; i < midi.Tracks; i++)
{
Dictionary<int, UVoicePart> parts = new Dictionary<int, UVoicePart>();
foreach (var e in midi.Events.GetTrackEvents(i))
if (e is NoteOnEvent)
{
var _e = e as NoteOnEvent;
if (_e.OffEvent == null) {
continue;
}
if (!parts.ContainsKey(_e.Channel)) parts.Add(_e.Channel, new UVoicePart());
var note = project.CreateNote(
_e.NoteNumber,
(int)_e.AbsoluteTime * project.resolution / midi.DeltaTicksPerQuarterNote,
_e.NoteLength * project.resolution / midi.DeltaTicksPerQuarterNote);
parts[e.Channel].notes.Add(note);
}
foreach (var pair in parts)
{
pair.Value.Duration = pair.Value.GetMinDurTick(project);
resultParts.Add(pair.Value);
}
}
return resultParts;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NAudio.Midi;
using OpenUtau.Core.Ustx;
namespace OpenUtau.Core.Formats
{
public static class Midi
{
static public List<UVoicePart> Load(string file, UProject project)
{
List<UVoicePart> resultParts = new List<UVoicePart>();
MidiFile midi = new MidiFile(file);
for (int i = 0; i < midi.Tracks; i++)
{
Dictionary<int, UVoicePart> parts = new Dictionary<int, UVoicePart>();
foreach (var e in midi.Events.GetTrackEvents(i))
if (e is NoteOnEvent)
{
var _e = e as NoteOnEvent;
if (!parts.ContainsKey(_e.Channel)) parts.Add(_e.Channel, new UVoicePart());
var note = project.CreateNote(
_e.NoteNumber,
(int)_e.AbsoluteTime * project.resolution / midi.DeltaTicksPerQuarterNote,
_e.NoteLength * project.resolution / midi.DeltaTicksPerQuarterNote);
parts[e.Channel].notes.Add(note);
}
foreach (var pair in parts)
{
pair.Value.Duration = pair.Value.GetMinDurTick(project);
resultParts.Add(pair.Value);
}
}
return resultParts;
}
}
}
|
mit
|
C#
|
5bee99175f8c32969d16b23ec59b0f6f4f2817f7
|
Fix tests
|
github/VisualStudio,github/VisualStudio,github/VisualStudio
|
src/UnitTests/GitHub.App/ViewModels/GistCreationViewModelTests.cs
|
src/UnitTests/GitHub.App/ViewModels/GistCreationViewModelTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GitHub.Factories;
using GitHub.Services;
using GitHub.ViewModels;
using NSubstitute;
using Octokit;
using UnitTests;
using Xunit;
using System.Reactive.Linq;
using GitHub.Models;
using ReactiveUI;
public class GistCreationViewModelTests
{
static IGistCreationViewModel CreateViewModel(IServiceProvider provider, string selectedText = "", string fileName = "", bool isPrivate = false)
{
var selectedTextProvider = Substitute.For<ISelectedTextProvider>();
selectedTextProvider.GetSelectedText().Returns(selectedText);
var repositoryHost = provider.GetRepositoryHosts().GitHubHost;
var accounts = new ReactiveList<IAccount>() { Substitute.For<IAccount>(), Substitute.For<IAccount>() };
repositoryHost.ModelService.GetAccounts().Returns(Observable.Return(accounts));
return new GistCreationViewModel(repositoryHost, selectedTextProvider)
{
FileName = fileName,
IsPrivate = isPrivate
};
}
public class TheCreateGistCommand : TestBaseClass
{
[Theory]
[InlineData("Console.WriteLine", "Gist.cs", true)]
[InlineData("Console.WriteLine", "Gist.cs", false)]
public void CreatesAGistUsingTheApiClient(string selectedText, string fileName, bool isPrivate)
{
var provider = Substitutes.ServiceProvider;
var vm = CreateViewModel(provider, selectedText, fileName, isPrivate);
var repositoryHost = provider.GetRepositoryHosts().GitHubHost;
vm.CreateGist.Execute(null);
repositoryHost.ApiClient
.Received()
.CreateGist(
Arg.Is<NewGist>(g => g.Public == !isPrivate
&& g.Files.First().Key == fileName
&& g.Files.First().Value == selectedText));
}
[Theory]
[InlineData(null, false)]
[InlineData("", false)]
[InlineData("Gist.cs", true)]
public void CannotCreateGistIfFileNameIsMissing(string fileName, bool expected)
{
var provider = Substitutes.ServiceProvider;
var vm = CreateViewModel(provider, fileName: fileName);
var actual = vm.CreateGist.CanExecute(null);
Assert.Equal(expected, actual);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GitHub.Factories;
using GitHub.Services;
using GitHub.ViewModels;
using NSubstitute;
using Octokit;
using UnitTests;
using Xunit;
using System.Reactive.Linq;
using GitHub.Models;
public class GistCreationViewModelTests
{
static IGistCreationViewModel CreateViewModel(string selectedText = "" )
{
var selectedTextProvider = Substitute.For<ISelectedTextProvider>();
selectedTextProvider.GetSelectedText().Returns(selectedText);
var repositoryHost = Substitutes.ServiceProvider.GetRepositoryHosts().GitHubHost;
return new GistCreationViewModel(repositoryHost, selectedTextProvider);
}
public class TheCreateGistCommand : TestBaseClass
{
[Theory]
[InlineData("Console.WriteLine", "Gist.cs", true)]
[InlineData("Console.WriteLine", "Gist.cs", false)]
public void CreatesAGistUsingTheApiClient(string selectedText, string fileName, bool isPrivate)
{
var selectedTextProvider = Substitute.For<ISelectedTextProvider>();
selectedTextProvider.GetSelectedText().Returns(selectedText);
var repositoryHost = Substitutes.ServiceProvider.GetRepositoryHosts().GitHubHost;
var vm = new GistCreationViewModel(repositoryHost, selectedTextProvider)
{
FileName = fileName,
IsPrivate = isPrivate
};
vm.CreateGist.Execute(null);
repositoryHost.ApiClient
.Received()
.CreateGist(
Arg.Is<NewGist>(g => g.Public == !isPrivate
&& g.Files.First().Key == fileName
&& g.Files.First().Value == selectedText));
}
[Theory]
[InlineData(null, false)]
[InlineData("", false)]
[InlineData("Gist.cs", true)]
public void CannotCreateGistIfFileNameIsMissing(string fileName, bool expected)
{
var vm = CreateViewModel();
vm.FileName = fileName;
var actual = vm.CreateGist.CanExecute(null);
Assert.Equal(expected, actual);
}
}
}
|
mit
|
C#
|
d4510a9cf24ed3911102811b8650b70b541f497d
|
Add enumerated ports to the list of serial ports, this currently causes duplicates but meh.
|
rmcardle/LazerTagHost,afaucher/LazerTagHost,afaucher/LazerTagHost,rmcardle/LazerTagHost
|
LazerTagHostLibrary/LazerTagSerial.cs
|
LazerTagHostLibrary/LazerTagSerial.cs
|
using System;
using System.Collections.Generic;
using System.IO.Ports;
namespace LazerTagHostLibrary
{
public class LazerTagSerial
{
public LazerTagSerial ()
{
}
static public List<string> GetSerialPorts()
{
List<string> result = new List<string>();
try {
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("/dev");
System.IO.FileInfo[] fi = di.GetFiles("ttyUSB*");
foreach (System.IO.FileInfo f in fi) {
result.Add(f.FullName);
}
} catch (Exception) {
//eh
}
try {
String[] ports = SerialPort.GetPortNames();
foreach (String p in ports) {
result.Add(p);
}
} catch (Exception) {
//eh
}
return result;
}
}
}
|
using System;
using System.Collections.Generic;
namespace LazerTagHostLibrary
{
public class LazerTagSerial
{
public LazerTagSerial ()
{
}
static public List<string> GetSerialPorts()
{
List<string> result = new List<string>();
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("/dev");
System.IO.FileInfo[] fi = di.GetFiles("ttyUSB*");
foreach (System.IO.FileInfo f in fi) {
result.Add(f.FullName);
}
return result;
}
}
}
|
mit
|
C#
|
524ad9fcc846a9c145354490cd4317ec99d63908
|
remove debug
|
ifgx/rtm-phase2
|
Assets/scripts/environment/mushroom.cs
|
Assets/scripts/environment/mushroom.cs
|
using UnityEngine;
using System.Collections;
public class mushroom : MonoBehaviour, AudioProcessor.AudioCallbacks {
private AudioProcessor processor;
private bool initialized = false;
Animator animator;
private int danceMove = Random.Range (0, 3);
// Use this for initialization
void Start () {
processor = FindObjectOfType<AudioProcessor>();
//processor.init ();
animator = GetComponent<Animator> ();
}
// Update is called once per frame
void Update () {
if (processor.start) {
if (!initialized){
init();
}
}
if (GameModel.HerosInGame [0].GetPosition ().z > transform.position.z)
Destroy (this.gameObject);
//De
}
private void init (){
processor.addAudioCallback (this);
initialized = true;
}
public void onOnbeatDetected()
{
//Debug.LogWarning("Beat!!!");
danceMove = (danceMove + 1) % 3;
if (danceMove == 2)
animator.SetTrigger ("dance_trigger");
}
public void onSpectrum(float[] spectrum)
{
}
void OnDestroy() {
processor.removeAudioCallback (this);
}
}
|
using UnityEngine;
using System.Collections;
public class mushroom : MonoBehaviour, AudioProcessor.AudioCallbacks {
private AudioProcessor processor;
private bool initialized = false;
Animator animator;
private int danceMove = Random.Range (0, 3);
// Use this for initialization
void Start () {
processor = FindObjectOfType<AudioProcessor>();
//processor.init ();
animator = GetComponent<Animator> ();
}
// Update is called once per frame
void Update () {
if (processor.start) {
if (!initialized){
init();
}
}
if (GameModel.HerosInGame [0].GetPosition ().z > transform.position.z)
Destroy (this.gameObject);
//De
}
private void init (){
processor.addAudioCallback (this);
initialized = true;
}
public void onOnbeatDetected()
{
Debug.LogWarning("Beat!!!");
danceMove = (danceMove + 1) % 3;
if (danceMove == 2)
animator.SetTrigger ("dance_trigger");
}
public void onSpectrum(float[] spectrum)
{
}
void OnDestroy() {
processor.removeAudioCallback (this);
}
}
|
cc0-1.0
|
C#
|
2a65dfec3eef1179ca84beb40631cef14e2b513a
|
Update OData assembly version to 5.4.0.0
|
chimpinano/WebApi,abkmr/WebApi,abkmr/WebApi,congysu/WebApi,LianwMS/WebApi,lungisam/WebApi,LianwMS/WebApi,scz2011/WebApi,chimpinano/WebApi,lewischeng-ms/WebApi,congysu/WebApi,yonglehou/WebApi,lungisam/WebApi,lewischeng-ms/WebApi,yonglehou/WebApi,scz2011/WebApi
|
OData/src/CommonAssemblyInfo.cs
|
OData/src/CommonAssemblyInfo.cs
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
#if !BUILD_GENERATED_VERSION
[assembly: AssemblyCompany("Microsoft Open Technologies, Inc.")]
[assembly: AssemblyCopyright("© Microsoft Open Technologies, Inc. All rights reserved.")]
#endif
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
#if !NOT_CLS_COMPLIANT
[assembly: CLSCompliant(true)]
#endif
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyMetadata("Serviceable", "True")]
// ===========================================================================
// DO NOT EDIT OR REMOVE ANYTHING BELOW THIS COMMENT.
// Version numbers are automatically generated based on regular expressions.
// ===========================================================================
#if ASPNETODATA
#if !BUILD_GENERATED_VERSION
[assembly: AssemblyVersion("5.4.0.0")] // ASPNETODATA
[assembly: AssemblyFileVersion("5.4.0.0")] // ASPNETODATA
#endif
[assembly: AssemblyProduct("Microsoft ASP.NET Web API OData")]
#endif
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
#if !BUILD_GENERATED_VERSION
[assembly: AssemblyCompany("Microsoft Open Technologies, Inc.")]
[assembly: AssemblyCopyright("© Microsoft Open Technologies, Inc. All rights reserved.")]
#endif
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
#if !NOT_CLS_COMPLIANT
[assembly: CLSCompliant(true)]
#endif
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyMetadata("Serviceable", "True")]
// ===========================================================================
// DO NOT EDIT OR REMOVE ANYTHING BELOW THIS COMMENT.
// Version numbers are automatically generated based on regular expressions.
// ===========================================================================
#if ASPNETODATA
#if !BUILD_GENERATED_VERSION
[assembly: AssemblyVersion("5.3.1.0")] // ASPNETODATA
[assembly: AssemblyFileVersion("5.3.1.0")] // ASPNETODATA
#endif
[assembly: AssemblyProduct("Microsoft ASP.NET Web API OData")]
#endif
|
mit
|
C#
|
e66982910f5c802e48036fe4a0e4f8b4d9e2913d
|
Fix "its"/"it's" distinction
|
Arkhist/Hacknet-Pathfinder,Arkhist/Hacknet-Pathfinder,Arkhist/Hacknet-Pathfinder,Arkhist/Hacknet-Pathfinder
|
PathfinderAPI/Mission/GoalManager.cs
|
PathfinderAPI/Mission/GoalManager.cs
|
using System.Reflection;
using Hacknet.Mission;
using Pathfinder.Event;
using Pathfinder.Util;
namespace Pathfinder.Mission;
public static class GoalManager
{
private static readonly Dictionary<string, Type> CustomGoals = new Dictionary<string, Type>();
static GoalManager()
{
EventManager.onPluginUnload += OnPluginUnload;
}
internal static bool TryLoadCustomGoal(string type, out MisisonGoal customGoal)
{
if (CustomGoals.TryGetValue(type, out var goalType))
{
customGoal = (MisisonGoal)Activator.CreateInstance(goalType);
return true;
}
customGoal = null;
return false;
}
private static void OnPluginUnload(Assembly pluginAsm)
{
foreach (var name in CustomGoals.Where(x => x.Value.Assembly == pluginAsm).Select(x => x.Key).ToList())
CustomGoals.Remove(name);
}
public static void RegisterGoal<T>(string xmlName) where T : MisisonGoal => RegisterGoal(typeof(T), xmlName);
public static void RegisterGoal(Type goalType, string xmlName)
{
goalType.ThrowNotInherit<MisisonGoal>(nameof(goalType), " (yes, that is how it's spelled)");
CustomGoals.Add(xmlName.ToLower(), goalType);
}
public static void UnregisterGoal<T>() => UnregisterGoal(typeof(T));
public static void UnregisterGoal(Type goalType)
{
var xmlName = CustomGoals.FirstOrDefault(x => x.Value == goalType).Key;
if (xmlName != null)
CustomGoals.Remove(xmlName);
}
public static void UnregisterGoal(string xmlName)
{
CustomGoals.Remove(xmlName.ToLower());
}
}
|
using System.Reflection;
using Hacknet.Mission;
using Pathfinder.Event;
using Pathfinder.Util;
namespace Pathfinder.Mission;
public static class GoalManager
{
private static readonly Dictionary<string, Type> CustomGoals = new Dictionary<string, Type>();
static GoalManager()
{
EventManager.onPluginUnload += OnPluginUnload;
}
internal static bool TryLoadCustomGoal(string type, out MisisonGoal customGoal)
{
if (CustomGoals.TryGetValue(type, out var goalType))
{
customGoal = (MisisonGoal)Activator.CreateInstance(goalType);
return true;
}
customGoal = null;
return false;
}
private static void OnPluginUnload(Assembly pluginAsm)
{
foreach (var name in CustomGoals.Where(x => x.Value.Assembly == pluginAsm).Select(x => x.Key).ToList())
CustomGoals.Remove(name);
}
public static void RegisterGoal<T>(string xmlName) where T : MisisonGoal => RegisterGoal(typeof(T), xmlName);
public static void RegisterGoal(Type goalType, string xmlName)
{
goalType.ThrowNotInherit<MisisonGoal>(nameof(goalType), " (yes, that is how its spelled)");
CustomGoals.Add(xmlName.ToLower(), goalType);
}
public static void UnregisterGoal<T>() => UnregisterGoal(typeof(T));
public static void UnregisterGoal(Type goalType)
{
var xmlName = CustomGoals.FirstOrDefault(x => x.Value == goalType).Key;
if (xmlName != null)
CustomGoals.Remove(xmlName);
}
public static void UnregisterGoal(string xmlName)
{
CustomGoals.Remove(xmlName.ToLower());
}
}
|
mit
|
C#
|
ff3b2de8290fa19bb497c158fd6a1c7a86c8fdef
|
Check native registry view for Windows version
|
freenet/wintray,freenet/wintray
|
Browsers/Edge.cs
|
Browsers/Edge.cs
|
using System;
using System.IO;
using Microsoft.Win32;
namespace FreenetTray.Browsers {
class Edge: Browser {
private static string NTVersionRegistryKey = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
public Edge() {
RegistryKey reg = null;
if (Environment.Is64BitOperatingSystem) {
RegistryKey local64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
reg = local64.OpenSubKey(NTVersionRegistryKey);
} else {
RegistryKey local32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
reg = local32.OpenSubKey(NTVersionRegistryKey);
}
if (reg != null) {
string productName = reg.GetValue("ProductName") as string;
_isInstalled = productName.StartsWith("Windows 10");
} else {
_isInstalled = false;
}
_isUsable = _isInstalled;
// there's no version info but it isn't useful anyway
_version = new System.Version(0, 0);
_args = "microsoft-edge:";
// there is no .exe, instead a url like scheme is used with explorer.exe
_path = Path.Combine(Environment.GetEnvironmentVariable("windir"), "explorer.exe");
_name = "Edge";
}
}
}
|
using System;
using System.IO;
using Microsoft.Win32;
namespace FreenetTray.Browsers {
class Edge: Browser {
private static string NTVersionRegistryKey = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
public Edge() {
// for this key we want registry redirection enabled, so no registry view is used
var reg = Registry.LocalMachine.OpenSubKey(NTVersionRegistryKey);
string productName = reg.GetValue("ProductName") as string;
// there's no version info but it isn't useful anyway
_version = new System.Version(0, 0);
_isInstalled = productName.StartsWith("Windows 10");
_isUsable = _isInstalled;
_args = "microsoft-edge:";
// there is no .exe, instead a url like scheme is used with explorer.exe
_path = Path.Combine(Environment.GetEnvironmentVariable("windir"), "explorer.exe");
_name = "Edge";
}
}
}
|
mit
|
C#
|
65b1929354eec5dd3c171312c1abbd9e792e25ca
|
update for new docker ip
|
Pondidum/RabbitHarness,Pondidum/RabbitHarness
|
RabbitHarness.Tests/TestBase.cs
|
RabbitHarness.Tests/TestBase.cs
|
using System;
using RabbitMQ.Client;
namespace RabbitHarness.Tests
{
public class TestBase : IDisposable
{
protected const string Host = "10.0.75.2";
protected readonly string QueueName;
protected readonly string ExchangeName;
protected ConnectionFactory Factory { get; }
public TestBase()
{
Factory = new ConnectionFactory { HostName = Host };
QueueName = "TestsQueue" + Guid.NewGuid();
ExchangeName = "TestExchange" + Guid.NewGuid();
}
public void Dispose()
{
using (var connection = Factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.QueueDelete(QueueName);
channel.ExchangeDelete(ExchangeName);
}
}
}
}
|
using System;
using RabbitMQ.Client;
namespace RabbitHarness.Tests
{
public class TestBase : IDisposable
{
protected const string Host = "192.168.99.100";
protected readonly string QueueName;
protected readonly string ExchangeName;
protected ConnectionFactory Factory { get; }
public TestBase()
{
Factory = new ConnectionFactory { HostName = Host };
QueueName = "TestsQueue" + Guid.NewGuid();
ExchangeName = "TestExchange" + Guid.NewGuid();
}
public void Dispose()
{
using (var connection = Factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.QueueDelete(QueueName);
channel.ExchangeDelete(ExchangeName);
}
}
}
}
|
lgpl-2.1
|
C#
|
8ec210ff5d6c8c4584e69fb99ef30292ef977595
|
Update ValuesOut.cs
|
EricZimmerman/RegistryPlugins
|
RegistryPlugin.TaskCache/ValuesOut.cs
|
RegistryPlugin.TaskCache/ValuesOut.cs
|
using System;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.TaskCache
{
public class ValuesOut:IValueOut
{
public ValuesOut(int version, string keyName, DateTimeOffset createdOn, DateTimeOffset? lastStart, DateTimeOffset? lastStop, int taskState, int lastActionResult, string source, string description, string author, string path)
{
Version = version;
KeyName = keyName;
CreatedOn = createdOn;
LastStart = lastStart;
LastStop = lastStop;
TaskState = taskState;
LastActionResult = lastActionResult;
Source = source;
Description = description;
Author = author;
Path = path;
}
public int Version { get; }
public string KeyName { get; }
public string Path { get; }
public DateTimeOffset CreatedOn { get; }
public DateTimeOffset? LastStart { get; }
public DateTimeOffset? LastStop { get; }
public int TaskState { get; }
public int LastActionResult { get; }
public string Source { get; }
public string Description { get; }
public string Author { get; }
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"Created on: {CreatedOn.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
public string BatchValueData2 => $"Last start: {LastStart?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}, Last stop: {LastStop?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
public string BatchValueData3 => $"Path: {Path}";
public override string ToString()
{
return $"{BatchValueData1} {BatchValueData2} {BatchValueData3}";
}
}
}
|
using System;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.TaskCache
{
public class ValuesOut:IValueOut
{
public ValuesOut(int version, string keyName, DateTimeOffset createdOn, DateTimeOffset? lastStart, DateTimeOffset? lastStop, int taskState, int lastActionResult, string source, string description, string author, string path)
{
Version = version;
KeyName = keyName;
CreatedOn = createdOn;
LastStart = lastStart;
LastStop = lastStop;
TaskState = taskState;
LastActionResult = lastActionResult;
Source = source;
Description = description;
Author = author;
Path = path;
}
public int Version { get; }
public string KeyName { get; }
public string Path { get; }
public DateTimeOffset CreatedOn { get; }
public DateTimeOffset? LastStart { get; }
public DateTimeOffset? LastStop { get; }
public int TaskState { get; }
public int LastActionResult { get; }
public string Source { get; }
public string Description { get; }
public string Author { get; }
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"Created on: {CreatedOn.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
public string BatchValueData2 => $"Last start/stop: {LastStart?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}/{LastStop?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
public string BatchValueData3 => $"Path: {Path}";
public override string ToString()
{
return $"{BatchValueData1} {BatchValueData2} {BatchValueData3}";
}
}
}
|
mit
|
C#
|
773ec833666a5b8f71548c3e4a1d7ce969fe7cf7
|
Change version in AssemblyInfo
|
ProgTrade/SharpMath
|
SharpMath/Properties/AssemblyInfo.cs
|
SharpMath/Properties/AssemblyInfo.cs
|
// Author: Dominic Beger (Trade/ProgTrade) 2016
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SharpMath")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharpMath")]
[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("4706ae0f-30c8-460b-bbbf-5f189be4eb76")]
// 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.5.3.0")]
[assembly: AssemblyFileVersion("0.5.3.0")]
|
// Author: Dominic Beger (Trade/ProgTrade) 2016
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SharpMath")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharpMath")]
[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("4706ae0f-30c8-460b-bbbf-5f189be4eb76")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
mit
|
C#
|
d4793d7927b63a1286535dd4c20512b5cc178ee5
|
Remove unused variable.
|
JohanLarsson/Gu.Localization
|
Gu.Localization.Tests/TranslatorTests.cs
|
Gu.Localization.Tests/TranslatorTests.cs
|
namespace Gu.Localization.Tests
{
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Gu.Localization;
using NUnit.Framework;
public class TranslatorTests
{
[TestCase("AllLanguages", "en", "English")]
[TestCase("AllLanguages", "sv", "Svenska")]
[TestCase("Missing", "sv", "!Missing!")]
[TestCase("EnglishOnly", "sv", "")]
public void Translate(string key, string culture, string expected)
{
var cultureInfo = CultureInfo.GetCultureInfo(culture);
var translator = new Translator(new ResourceManagerWrapper(Properties.Resources.ResourceManager));
Translator.CurrentCulture = cultureInfo;
var actual = translator.Translate(key);
Assert.AreEqual(expected, actual);
}
[Test]
public void TranslateFromCodeBehindTest()
{
Translator.CurrentCulture = CultureInfo.GetCultureInfo("en");
var actual = Translator.Translate(Properties.Resources.ResourceManager, () => Properties.Resources.AllLanguages);
Assert.AreEqual("English", actual);
Translator.CurrentCulture = CultureInfo.GetCultureInfo("sv");
actual = Translator.Translate(Properties.Resources.ResourceManager, () => Properties.Resources.AllLanguages);
Assert.AreEqual("Svenska", actual);
}
[Test, Explicit("Static event, ew")]
public void NotifiesOnLanguageChanged()
{
var cultureInfos = new List<CultureInfo>();
Translator.LanguageChanged += (sender, info) => cultureInfos.Add(info);
Translator.CurrentCulture = CultureInfo.GetCultureInfo("en");
CollectionAssert.AreEqual(new[] { "en" }, cultureInfos.Select(x => x.TwoLetterISOLanguageName));
Translator.CurrentCulture = CultureInfo.GetCultureInfo("en");
CollectionAssert.AreEqual(new[] { "en" }, cultureInfos.Select(x => x.TwoLetterISOLanguageName));
Translator.CurrentCulture = CultureInfo.GetCultureInfo("sv");
CollectionAssert.AreEqual(new[] { "en", "sv" }, cultureInfos.Select(x => x.TwoLetterISOLanguageName));
}
}
}
|
namespace Gu.Localization.Tests
{
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Gu.Localization;
using NUnit.Framework;
public class TranslatorTests
{
[TestCase("AllLanguages", "en", "English")]
[TestCase("AllLanguages", "sv", "Svenska")]
[TestCase("Missing", "sv", "!Missing!")]
[TestCase("EnglishOnly", "sv", "")]
public void Translate(string key, string culture, string expected)
{
var cultureInfo = CultureInfo.GetCultureInfo(culture);
var translator = new Translator(new ResourceManagerWrapper(Properties.Resources.ResourceManager));
Translator.CurrentCulture = cultureInfo;
var actual = translator.Translate(key);
Assert.AreEqual(expected, actual);
}
[Test]
public void TranslateFromCodeBehindTest()
{
Translator.CurrentCulture = CultureInfo.GetCultureInfo("en");
var actual = Translator.Translate(Properties.Resources.ResourceManager, () => Properties.Resources.AllLanguages);
Assert.AreEqual("English", actual);
var allLanguages = Properties.Resources.AllLanguages;
Translator.CurrentCulture = CultureInfo.GetCultureInfo("sv");
actual = Translator.Translate(Properties.Resources.ResourceManager, () => Properties.Resources.AllLanguages);
Assert.AreEqual("Svenska", actual);
}
[Test, Explicit("Static event, ew")]
public void NotifiesOnLanguageChanged()
{
var cultureInfos = new List<CultureInfo>();
Translator.LanguageChanged += (sender, info) => cultureInfos.Add(info);
Translator.CurrentCulture = CultureInfo.GetCultureInfo("en");
CollectionAssert.AreEqual(new[] { "en" }, cultureInfos.Select(x => x.TwoLetterISOLanguageName));
Translator.CurrentCulture = CultureInfo.GetCultureInfo("en");
CollectionAssert.AreEqual(new[] { "en" }, cultureInfos.Select(x => x.TwoLetterISOLanguageName));
Translator.CurrentCulture = CultureInfo.GetCultureInfo("sv");
CollectionAssert.AreEqual(new[] { "en", "sv" }, cultureInfos.Select(x => x.TwoLetterISOLanguageName));
}
}
}
|
mit
|
C#
|
2731d0d4fa4a256f0a7f6e31d943be070a632a68
|
add license
|
NDark/ndinfrastructure,NDark/ndinfrastructure
|
Unity/EnumConverter/EnumConverter.cs
|
Unity/EnumConverter/EnumConverter.cs
|
/**
MIT License
Copyright (c) 2017 NDark
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.
*/
/*
@file EnumConverter.cs
@author NDark
@date 20170220 file started.
*/
using UnityEngine;
public class EnumIntConverter<S>
{
protected System.Collections.Generic.Dictionary<int , S > m_Converter
= new System.Collections.Generic.Dictionary<int , S > () ;
public virtual void DoInitialize()
{
m_IsInitialized = true ;
}
public virtual S GetEnum( int _Int )
{
if( false == m_IsInitialized )
{
DoInitialize() ;
}
if( true == m_Converter.ContainsKey( _Int ) )
{
return m_Converter[ _Int ] ;
}
else
{
return default(S);
}
}
public virtual int GetInteger( S _Enum )
{
int ret = 0;
var iEnum = m_Converter.GetEnumerator ();
while (iEnum.MoveNext())
{
if( iEnum.Current.Value.Equals( _Enum ) )
{
ret = iEnum.Current.Key ;
}
}
return ret;
}
public virtual string GetString( S _Enum )
{
return _Enum.ToString() ;
}
protected bool m_IsInitialized = false ;
}
public class EnumStrConverter<S>
{
protected System.Collections.Generic.Dictionary<string , S > m_Converter
= new System.Collections.Generic.Dictionary<string , S > () ;
public virtual void DoInitialize()
{
m_IsInitialized = true ;
}
public virtual S GetEnum( string _Key )
{
if( false == m_IsInitialized )
{
DoInitialize() ;
}
if( true == m_Converter.ContainsKey( _Key ) )
{
return m_Converter[ _Key ] ;
}
else
{
return default(S);
}
}
public virtual string GetString( S _Enum )
{
return _Enum.ToString() ;
}
protected bool m_IsInitialized = false ;
}
|
/*
@file EnumConverter.cs
@author NDark
@date 20170220 file started.
*/
using UnityEngine;
public class EnumIntConverter<S>
{
protected System.Collections.Generic.Dictionary<int , S > m_Converter
= new System.Collections.Generic.Dictionary<int , S > () ;
public virtual void DoInitialize()
{
m_IsInitialized = true ;
}
public virtual S GetEnum( int _Int )
{
if( false == m_IsInitialized )
{
DoInitialize() ;
}
if( true == m_Converter.ContainsKey( _Int ) )
{
return m_Converter[ _Int ] ;
}
else
{
return default(S);
}
}
public virtual int GetInteger( S _Enum )
{
int ret = 0;
var iEnum = m_Converter.GetEnumerator ();
while (iEnum.MoveNext())
{
if( iEnum.Current.Value.Equals( _Enum ) )
{
ret = iEnum.Current.Key ;
}
}
return ret;
}
public virtual string GetString( S _Enum )
{
return _Enum.ToString() ;
}
protected bool m_IsInitialized = false ;
}
public class EnumStrConverter<S>
{
protected System.Collections.Generic.Dictionary<string , S > m_Converter
= new System.Collections.Generic.Dictionary<string , S > () ;
public virtual void DoInitialize()
{
m_IsInitialized = true ;
}
public virtual S GetEnum( string _Key )
{
if( false == m_IsInitialized )
{
DoInitialize() ;
}
if( true == m_Converter.ContainsKey( _Key ) )
{
return m_Converter[ _Key ] ;
}
else
{
return default(S);
}
}
public virtual string GetString( S _Enum )
{
return _Enum.ToString() ;
}
protected bool m_IsInitialized = false ;
}
|
mit
|
C#
|
a62508fa3ef198d927e1b8ddef17305a0299fb49
|
Implement UpdateTPPCam()
|
bartlomiejwolk/TPPCamera
|
TPPCamSetterComponent/TPPCamSetter.cs
|
TPPCamSetterComponent/TPPCamSetter.cs
|
using TPPCamera.TPPCamComponent;
using UnityEngine;
namespace TPPCamera.TPPCamSetterComponent {
// todo extract to file
public enum Properties {
CameraOffset = 0x0001,
LookAtPointOffset = 0x0002
}
public class TPPCamSetter : MonoBehaviour {
#region FIELDS
[SerializeField]
private TPPCam cameraCo;
[SerializeField]
private TPPCamProperties tppCamProperties;
[SerializeField]
private Properties properties;
#endregion FIELDS
#region PROPERTIES
/// <summary>
/// Keeps info about what properties of the target camera component
/// should be updated.
/// </summary>
public Properties Properties {
get { return properties; }
set { properties = value; }
}
/// <summary>
/// Properties used to update the target camera component.
/// </summary>
public TPPCamProperties TppCamProperties {
get { return tppCamProperties; }
set { tppCamProperties = value; }
}
public TPPCam CameraCo {
get { return cameraCo; }
set { cameraCo = value; }
}
#endregion
#region METHODS
public void UpdateTPPCam() {
HandleUpdateCameraOffset();
}
private void HandleUpdateCameraOffset() {
var enabled = FlagsHelper.IsSet(
Properties,
Properties.CameraOffset);
if (!enabled) return;
CameraCo.CameraOffset = TppCamProperties.CameraOffset;
}
private void HandleUpdateLookAtPointOffset() {
var enabled = FlagsHelper.IsSet(
Properties,
Properties.LookAtPointOffset);
if (!enabled) return;
CameraCo.LookAtPointOffset = TppCamProperties.LookAtPointOffset;
}
#endregion
}
}
|
using TPPCamera.TPPCamComponent;
using UnityEngine;
namespace TPPCamera.TPPCamSetterComponent {
// todo extract to file
public enum Properties {
CameraOffset = 0x0001,
LookAtPointOffset = 0x0002
}
public class TPPCamSetter : MonoBehaviour {
#region FIELDS
[SerializeField]
private TPPCam cameraCo;
[SerializeField]
private TPPCamProperties tppCamProperties;
[SerializeField]
private Properties properties;
#endregion FIELDS
#region PROPERTIES
/// <summary>
/// Keeps info about what properties of the target camera component
/// should be updated.
/// </summary>
public Properties Properties {
get { return properties; }
set { properties = value; }
}
/// <summary>
/// Properties used to update the target camera component.
/// </summary>
public TPPCamProperties TppCamProperties {
get { return tppCamProperties; }
set { tppCamProperties = value; }
}
public TPPCam CameraCo {
get { return cameraCo; }
set { cameraCo = value; }
}
#endregion
#region METHODS
public void UpdateTPPCam() {
var enabled = FlagsHelper.IsSet(
Properties,
Properties.LookAtPointOffset);
if (enabled) {
}
}
#endregion
}
}
|
mit
|
C#
|
6b0842d0399f1f8e93ba9267195ea39d8fa69540
|
Make boolean literals keywords
|
jagrem/slang,jagrem/slang,jagrem/slang
|
slang.Tests/Lexing/Literals/BooleanLiteralTests.cs
|
slang.Tests/Lexing/Literals/BooleanLiteralTests.cs
|
using NUnit.Framework;
using slang.Lexing;
using System;
using System.Linq;
using FluentAssertions;
using System.Collections.Generic;
using slang.Lexing.Tokens.Keywords;
namespace slang.Tests.Lexing.Literals
{
[TestFixture]
public class BooleanLiteralTests
{
[TestCaseSource("GetLiterals")]
public void Given_a_literal_as_a_string_When_parsed_Then_a_literal_type_is_returned(string input, Type expectedType, string expectedValue)
{
var result = Lexer.Analyze (input).ToArray ();
result.ShouldBeEquivalentTo (new[] { new { Value = "$" }, new { Value = expectedValue }, new { Value = "EOF" } });
result[1].Should ().BeOfType(expectedType);
}
static IEnumerable<TestCaseData> GetLiterals()
{
yield return new TestCaseData ("true", typeof(Keyword), "true").SetName ("Given a lowercase 'true' When parsed Then a boolean literal is returned");
yield return new TestCaseData ("false", typeof(Keyword), "false").SetName ("Given lowercase 'false' When parsed Then a boolean literal is returned");
}
}
}
|
using NUnit.Framework;
using slang.Lexing;
using System;
using System.Linq;
using FluentAssertions;
using System.Collections.Generic;
using slang.Lexing.Tokens.Literals;
namespace slang.Tests.Lexing.Literals
{
[TestFixture]
public class BooleanLiteralTests
{
[TestCaseSource("GetLiterals")]
public void Given_a_literal_as_a_string_When_parsed_Then_a_literal_type_is_returned(string input, Type expectedType, string expectedValue)
{
var result = Lexer.Analyze (input).ToArray ();
result.ShouldBeEquivalentTo (new[] { new { Value = "$" }, new { Value = expectedValue }, new { Value = "EOF" } });
result[1].Should ().BeOfType(expectedType);
}
static IEnumerable<TestCaseData> GetLiterals()
{
yield return new TestCaseData ("true", typeof(BooleanLiteral), "true").SetName ("Given a lowercase 'true' When parsed Then a boolean literal is returned");
yield return new TestCaseData ("True", typeof(BooleanLiteral), "true").SetName ("Given capitalized 'true' When parsed Then a boolean literal is returned");
yield return new TestCaseData ("TRUE", typeof(BooleanLiteral), "true").SetName ("Given an all uppercase 'true' When parsed Then a boolean literal is returned");
yield return new TestCaseData ("false", typeof(BooleanLiteral), "false").SetName ("Given lowercase 'false' When parsed Then a boolean literal is returned");
yield return new TestCaseData ("False", typeof(BooleanLiteral), "false").SetName ("Given capitalized 'false' When parsed Then a boolean literal is returned");
yield return new TestCaseData ("FALSE", typeof(BooleanLiteral), "false").SetName ("Given an all uppercase 'false' When parsed Then a boolean literal is returned");
}
}
}
|
mit
|
C#
|
1cc155e026a3452102796d267f369be388c7fe67
|
バージョン1.0ってほどできてもいないので0.1へ変更
|
hidari/UstdCsv2Ju
|
UstdCsv2Ju/Properties/AssemblyInfo.cs
|
UstdCsv2Ju/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UstdCsv2Ju")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("hidari-lab.net")]
[assembly: AssemblyProduct("UstdCsv2Ju")]
[assembly: AssemblyCopyright("Copyright © 2014 Hidari0415")]
[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("7e45f7cc-258b-4ed2-b2bb-0d9ec6101c89")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UstdCsv2Ju")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("hidari-lab.net")]
[assembly: AssemblyProduct("UstdCsv2Ju")]
[assembly: AssemblyCopyright("Copyright © 2014 Hidari0415")]
[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("7e45f7cc-258b-4ed2-b2bb-0d9ec6101c89")]
// 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#
|
1a16877a339a4fe6dda3bdaa4398754f04b6e0f7
|
Debug only when test manager is connected
|
OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn
|
src/OmniSharp.DotNetTest/Services/DebugTestService.cs
|
src/OmniSharp.DotNetTest/Services/DebugTestService.cs
|
using System;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Logging;
using OmniSharp.DotNetTest.Models;
using OmniSharp.Eventing;
using OmniSharp.Mef;
using OmniSharp.Services;
namespace OmniSharp.DotNetTest.Services
{
[Shared]
[OmniSharpHandler(OmniSharpEndpoints.V2.DebugTestGetStartInfo, LanguageNames.CSharp)]
[OmniSharpHandler(OmniSharpEndpoints.V2.DebugTestLaunch, LanguageNames.CSharp)]
[OmniSharpHandler(OmniSharpEndpoints.V2.DebugTestStop, LanguageNames.CSharp)]
internal class DebugTestService : BaseTestService,
IRequestHandler<DebugTestGetStartInfoRequest, DebugTestGetStartInfoResponse>,
IRequestHandler<DebugTestLaunchRequest, DebugTestLaunchResponse>,
IRequestHandler<DebugTestStopRequest, DebugTestStopResponse>
{
private DebugSessionManager _debugSessionManager;
[ImportingConstructor]
public DebugTestService(DebugSessionManager debugSessionManager, OmniSharpWorkspace workspace, IDotNetCliService dotNetCli, IEventEmitter eventEmitter, ILoggerFactory loggerFactory)
: base(workspace, dotNetCli, eventEmitter, loggerFactory)
{
_debugSessionManager = debugSessionManager;
}
public Task<DebugTestGetStartInfoResponse> Handle(DebugTestGetStartInfoRequest request)
{
var testManager = CreateTestManager(request.FileName);
if (testManager.IsConnected)
{
//only if the test manager connected successfully, shall we proceed with the request
_debugSessionManager.StartSession(testManager);
return _debugSessionManager.DebugGetStartInfoAsync(request.MethodName, request.TestFrameworkName, request.TargetFrameworkVersion, CancellationToken.None);
}
throw new InvalidOperationException("The debugger could not be started");
}
public Task<DebugTestLaunchResponse> Handle(DebugTestLaunchRequest request)
{
return _debugSessionManager.DebugLaunchAsync(request.TargetProcessId);
}
public Task<DebugTestStopResponse> Handle(DebugTestStopRequest request)
{
return _debugSessionManager.DebugStopAsync();
}
}
}
|
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Logging;
using OmniSharp.DotNetTest.Models;
using OmniSharp.Eventing;
using OmniSharp.Mef;
using OmniSharp.Services;
namespace OmniSharp.DotNetTest.Services
{
[Shared]
[OmniSharpHandler(OmniSharpEndpoints.V2.DebugTestGetStartInfo, LanguageNames.CSharp)]
[OmniSharpHandler(OmniSharpEndpoints.V2.DebugTestLaunch, LanguageNames.CSharp)]
[OmniSharpHandler(OmniSharpEndpoints.V2.DebugTestStop, LanguageNames.CSharp)]
internal class DebugTestService : BaseTestService,
IRequestHandler<DebugTestGetStartInfoRequest, DebugTestGetStartInfoResponse>,
IRequestHandler<DebugTestLaunchRequest, DebugTestLaunchResponse>,
IRequestHandler<DebugTestStopRequest, DebugTestStopResponse>
{
private DebugSessionManager _debugSessionManager;
[ImportingConstructor]
public DebugTestService(DebugSessionManager debugSessionManager, OmniSharpWorkspace workspace, IDotNetCliService dotNetCli, IEventEmitter eventEmitter, ILoggerFactory loggerFactory)
: base(workspace, dotNetCli, eventEmitter, loggerFactory)
{
_debugSessionManager = debugSessionManager;
}
public Task<DebugTestGetStartInfoResponse> Handle(DebugTestGetStartInfoRequest request)
{
var testManager = CreateTestManager(request.FileName);
_debugSessionManager.StartSession(testManager);
return _debugSessionManager.DebugGetStartInfoAsync(request.MethodName, request.TestFrameworkName, request.TargetFrameworkVersion, CancellationToken.None);
}
public Task<DebugTestLaunchResponse> Handle(DebugTestLaunchRequest request)
{
return _debugSessionManager.DebugLaunchAsync(request.TargetProcessId);
}
public Task<DebugTestStopResponse> Handle(DebugTestStopRequest request)
{
return _debugSessionManager.DebugStopAsync();
}
}
}
|
mit
|
C#
|
b6f171b15b2e66b6797665e4f620ecf1aa9fc6d5
|
Update component name
|
eric-davis/JustSaying,Intelliflo/JustSaying,Intelliflo/JustSaying
|
JustEat.Simples.Messaging/Component.cs
|
JustEat.Simples.Messaging/Component.cs
|
namespace JustEat.Simples.NotificationStack.Messaging
{
public enum Component { BoxHandler, OrderEngine, OrderApi, FulfilmentApi, SmsSender, LegacyOrderView }
}
|
namespace JustEat.Simples.NotificationStack.Messaging
{
public enum Component { BoxHandler, OrderEngine, OrderApi, FulfilmentApi, SmsSender, OrderStatusChanger }
}
|
apache-2.0
|
C#
|
2e5bec422ad605848e57139b5c0cc4bc4a915486
|
Simplify parameters.
|
sharpjs/PSql,sharpjs/PSql
|
PSql.Core/_Commands/ConnectSqlCommand.cs
|
PSql.Core/_Commands/ConnectSqlCommand.cs
|
using System.Data.SqlClient;
using System.Management.Automation;
namespace PSql
{
[Cmdlet(VerbsCommunications.Connect, "Sql")]
[OutputType(typeof(SqlConnection))]
public class ConnectSqlCommand : Cmdlet
{
// -Context
[Parameter(ValueFromPipeline = true)]
public SqlContext Context { get; set; }
// -DatabaseName
[Parameter]
[Alias("Database")]
public string DatabaseName { get; set; }
protected override void ProcessRecord()
{
(var connection, _) = EnsureConnection(null, Context, DatabaseName);
WriteObject(connection);
}
}
}
|
using System.Data.SqlClient;
using System.Management.Automation;
namespace PSql
{
[Cmdlet(VerbsCommunications.Connect, "Sql", DefaultParameterSetName = BasicName)]
[OutputType(typeof(SqlConnection))]
public class ConnectSqlCommand : Cmdlet
{
private const string
BasicName = "Basic",
ContextName = "Context";
// -Context
[Alias("c")]
[Parameter(ParameterSetName = ContextName, Position = 0, Mandatory = true, ValueFromPipeline = true)]
[ValidateNotNull]
public SqlContext Context { get; set; }
// -ServerName
[Alias("s", "sn", "Server")]
[Parameter(ParameterSetName = BasicName, Position = 0)]
[ValidateNotNullOrEmpty]
public string ServerName { get; set; }
// -DatabaseName
[Alias("d", "dn", "Database")]
[Parameter(Position = 1)]
public string DatabaseName { get; set; }
protected override void ProcessRecord()
{
(var connection, _) = EnsureConnection(null, Context, DatabaseName);
WriteObject(connection);
}
}
}
|
isc
|
C#
|
53c2180a58478acd291d0b478f910a12e0c19b19
|
Improve user question when node conflict is not auto-resolved
|
configit-open-source/csmerge
|
Project/Item.cs
|
Project/Item.cs
|
using System;
using System.Xml.Linq;
namespace Project {
public abstract class Item: IEquatable<Item>, IConflictableItem {
public abstract override int GetHashCode();
public virtual string Action { get { return GetType().Name; } }
public abstract string Key { get; }
public bool IsResolveOption { get; set; }
protected Item() {
IsResolveOption = true;
}
public abstract bool Equals( Item other );
public static bool operator ==( Item i1, Item i2 ) {
if ( ReferenceEquals( null, i1 ) ^ ReferenceEquals( null, i2 ) ) {
return false;
}
return ReferenceEquals( null, i1 ) || i1.Equals( i2 );
}
public abstract override bool Equals( object obj );
public static bool operator !=( Item i1, Item i2 ) {
return !( i1 == i2 );
}
public abstract XElement ToElement( XNamespace ns );
public override string ToString() {
var element = ToElement( "" );
return element?.ToString() ?? Key;
}
}
}
|
using System;
using System.Xml.Linq;
namespace Project {
public abstract class Item: IEquatable<Item>, IConflictableItem {
public abstract override int GetHashCode();
public virtual string Action { get { return GetType().Name; } }
public abstract string Key { get; }
public bool IsResolveOption { get; set; }
protected Item() {
IsResolveOption = true;
}
public abstract bool Equals( Item other );
public static bool operator ==( Item i1, Item i2 ) {
if ( ReferenceEquals( null, i1 ) ^ ReferenceEquals( null, i2 ) ) {
return false;
}
return ReferenceEquals( null, i1 ) || i1.Equals( i2 );
}
public abstract override bool Equals( object obj );
public static bool operator !=( Item i1, Item i2 ) {
return !( i1 == i2 );
}
public abstract XElement ToElement( XNamespace ns );
public override string ToString() {
return Key;
}
}
}
|
mit
|
C#
|
03675d11b8e2962efafb4b8ff04a48d19cd37ce4
|
test harness wip
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
src/SFA.DAS.EAS.Portal.Jobs.TestHarness/Program.cs
|
src/SFA.DAS.EAS.Portal.Jobs.TestHarness/Program.cs
|
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SFA.DAS.EAS.Portal.Jobs.TestHarness.Scenarios;
using SFA.DAS.EAS.Portal.Jobs.TestHarness.Startup;
using SFA.DAS.EAS.Portal.Startup;
namespace SFA.DAS.EAS.Portal.Jobs.TestHarness
{
public static class Program
{
public static async Task Main(string[] args)
{
using (var host = CreateHostBuilder(args).Build())
{
await host.StartAsync();
var publishReserveFundingAddedEvent = host.Services.GetService<PublishReserveFundingAddedEvent>();
await publishReserveFundingAddedEvent.Run();
await host.WaitForShutdownAsync();
}
}
private static IHostBuilder CreateHostBuilder(string[] args) =>
new HostBuilder()
.ConfigureDasAppConfiguration(args)
.ConfigureDasLogging()
.UseDasEnvironment()
//.UseStructureMap()
.ConfigureServices(s => s.AddDasNServiceBus())
.ConfigureServices(s => s.AddTransient<PublishReserveFundingAddedEvent, PublishReserveFundingAddedEvent>());
//todo: DI
//.ConfigureContainer<Registry>(IoC.Initialize);
}
}
|
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SFA.DAS.EAS.Portal.Jobs.TestHarness.Scenarios;
using SFA.DAS.EAS.Portal.Jobs.TestHarness.Startup;
using SFA.DAS.EAS.Portal.Startup;
namespace SFA.DAS.EAS.Portal.Jobs.TestHarness
{
public static class Program
{
public static async Task Main(string[] args)
{
using (var host = CreateHostBuilder(args).Build())
{
await host.StartAsync();
var publishReserveFundingAddedEvent = host.Services.GetService<PublishReserveFundingAddedEvent>();
await publishReserveFundingAddedEvent.Run();
await host.WaitForShutdownAsync();
}
}
private static IHostBuilder CreateHostBuilder(string[] args) =>
new HostBuilder()
.ConfigureDasAppConfiguration(args)
.ConfigureDasLogging()
.UseDasEnvironment()
//.UseStructureMap()
.ConfigureServices(s => s.AddDasNServiceBus());
//todo: DI
//.ConfigureContainer<Registry>(IoC.Initialize);
}
}
|
mit
|
C#
|
9373d92c70cb201440c860517de3460c0b8f3368
|
Update StructuredLoggerCheckerUtil.cs
|
CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,bartdesmet/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,bartdesmet/roslyn
|
src/Tools/BuildBoss/StructuredLoggerCheckerUtil.cs
|
src/Tools/BuildBoss/StructuredLoggerCheckerUtil.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.
#nullable disable
using System;
using System.IO;
using System.Linq;
using Microsoft.Build.Logging.StructuredLogger;
namespace BuildBoss
{
/// <summary>
/// This type invokes the analyzer here:
///
/// https://github.com/KirillOsenkov/MSBuildStructuredLog/blob/master/src/StructuredLogger/Analyzers/DoubleWritesAnalyzer.cs
///
/// </summary>
internal sealed class StructuredLoggerCheckerUtil : ICheckerUtil
{
private readonly string _logFilePath;
internal StructuredLoggerCheckerUtil(string logFilePath)
{
_logFilePath = logFilePath;
}
public bool Check(TextWriter textWriter)
{
try
{
var build = Serialization.Read(_logFilePath);
var doubleWrites = DoubleWritesAnalyzer.GetDoubleWrites(build).ToArray();
if (doubleWrites.Any())
{
foreach (var doubleWrite in doubleWrites)
{
// Issue https://github.com/dotnet/roslyn/issues/62372
if (Path.GetFileName(doubleWrite.Key) == "Microsoft.VisualStudio.Text.Internal.dll")
{
continue;
}
textWriter.WriteLine($"Multiple writes to {doubleWrite.Key}");
foreach (var source in doubleWrite.Value)
{
textWriter.WriteLine($"\t{source}");
}
textWriter.WriteLine();
}
return false;
}
return true;
}
catch (Exception ex)
{
textWriter.WriteLine($"Error processing binary log file: {ex.Message}");
return false;
}
}
}
}
|
// 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.
#nullable disable
using System;
using System.IO;
using System.Linq;
using Microsoft.Build.Logging.StructuredLogger;
namespace BuildBoss
{
/// <summary>
/// This type invokes the analyzer here:
///
/// https://github.com/KirillOsenkov/MSBuildStructuredLog/blob/master/src/StructuredLogger/Analyzers/DoubleWritesAnalyzer.cs
///
/// </summary>
internal sealed class StructuredLoggerCheckerUtil : ICheckerUtil
{
private readonly string _logFilePath;
internal StructuredLoggerCheckerUtil(string logFilePath)
{
_logFilePath = logFilePath;
}
public bool Check(TextWriter textWriter)
{
try
{
var build = Serialization.Read(_logFilePath);
var doubleWrites = DoubleWritesAnalyzer.GetDoubleWrites(build).ToArray();
if (doubleWrites.Any())
{
foreach (var doubleWrite in doubleWrites)
{
textWriter.WriteLine($"Multiple writes to {doubleWrite.Key}");
foreach (var source in doubleWrite.Value)
{
textWriter.WriteLine($"\t{source}");
}
textWriter.WriteLine();
}
return false;
}
return true;
}
catch (Exception ex)
{
textWriter.WriteLine($"Error processing binary log file: {ex.Message}");
return false;
}
}
}
}
|
mit
|
C#
|
1179fbfea1fa716e55ee20eb2183ae9fe6f0d116
|
Update version
|
akorb/SteamShutdown
|
SteamShutdown/Properties/AssemblyInfo.cs
|
SteamShutdown/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SteamShutdown")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SteamShutdown")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[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("10eaad6a-d668-405a-9e9d-bab3026395ec")]
// 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.3.3.0")]
[assembly: AssemblyFileVersion("2.3.3.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SteamShutdown")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SteamShutdown")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[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("10eaad6a-d668-405a-9e9d-bab3026395ec")]
// 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.3.2.0")]
[assembly: AssemblyFileVersion("2.3.2.0")]
|
mit
|
C#
|
5cf710bdf43cd9181026485f7c46fa3ff551f94a
|
bump ver
|
AntonyCorbett/OnlyT,AntonyCorbett/OnlyT
|
SolutionInfo.cs
|
SolutionInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2019 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.0.12")]
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2019 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.0.11")]
|
mit
|
C#
|
62afebbf368f2c07f264c0e588e063a2e61b1bef
|
Add extra datatypes
|
SteamDatabase/ValveResourceFormat
|
ValveResourceFormat/Resource/DataType.cs
|
ValveResourceFormat/Resource/DataType.cs
|
namespace ValveResourceFormat
{
public enum DataType
{
SubStructure = 1,
Enum = 2,
Extref = 3,
String4 = 4,
Byte = 11,
Sint = 12,
Ushort = 13,
Number = 14,
Flags = 15,
Int64 = 16,
Uint64 = 17,
Float = 18,
Vector3 = 22,
Vector4 = 23,
Quaternion = 25,
Fltx4 = 27,
Color = 28,
Boolean = 30,
String = 31,
Matrix3x4 = 33,
Matrix3x4a = 36,
CTransform = 40,
}
}
|
using System;
namespace ValveResourceFormat
{
public enum DataType : short
{
SubStructure = 1,
Enum = 2,
Extref = 3,
String4 = 4,
Byte = 11,
Sint = 12,
Ushort = 13,
Number = 14,
Flags = 15,
Int64 = 16,
Uint64 = 17,
Float = 18,
Vector3 = 22,
Vector4 = 23,
Quaternion = 25,
Color = 28,
Boolean = 30,
String = 31,
}
}
|
mit
|
C#
|
3c8de530ed624fe211e370b8c989b688ae24fe15
|
add serialization between byte-stream and AccountStore data object
|
kingsamchen/EasyKeeper
|
VaultMarshal.cs
|
VaultMarshal.cs
|
/*
@ Kingsley Chen
*/
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace EasyKeeper {
public static class VaultMarshal {
private const uint ProtoclVersion = 1U;
public static void Marshal(string pwd, AccountStore store, Stream outStream)
{}
public static AccountStore Unmarshal(Stream inStream, string pwd)
{
return null;
}
private static byte[] AccountStoreToBytes(AccountStore store)
{
using (MemoryStream mem = new MemoryStream())
{
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(mem, store);
return mem.ToArray();
}
}
private static AccountStore AccountStoreFromBytes(byte[] rawBytes)
{
return null;
}
}
}
|
/*
@ Kingsley Chen
*/
using System.IO;
namespace EasyKeeper {
public static class VaultMarshal {
public static void Marshal(string pwd, AccountStore store, Stream stream)
{}
public static AccountStore Unmarshal(Stream stream, string pwd)
{
return null;
}
}
}
|
mit
|
C#
|
cf1113080053ba030cb38367be79313d1aff15a6
|
add new verify_txt_key
|
feinoujc/Mandrill.net
|
src/Mandrill.net/Model/Senders/MandrillSenderDomain.cs
|
src/Mandrill.net/Model/Senders/MandrillSenderDomain.cs
|
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
namespace Mandrill.Model
{
public class MandrillSenderDomain
{
public string Domain { get; set; }
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime CreatedAt { get; set; }
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime LastTestedAt { get; set; }
public MandrillSenderValidDetails SPF { get; set; }
public MandrillSenderValidDetails DKIM { get; set; }
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime VerifiedAt { get; set; }
public bool ValidSigning { get; set; }
public string VerifyTxtKey { get; set; }
public MandrillSenderVerifyDomain Verified { get; set; }
}
}
|
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
namespace Mandrill.Model
{
public class MandrillSenderDomain
{
public string Domain { get; set; }
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime CreatedAt { get; set; }
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime LastTestedAt { get; set; }
public MandrillSenderValidDetails SPF { get; set; }
public MandrillSenderValidDetails DKIM { get; set; }
[JsonConverter(typeof(IsoDateTimeConverter))]
public DateTime VerifiedAt { get; set; }
public bool ValidSigning { get; set; }
public MandrillSenderVerifyDomain Verified { get; set; }
}
}
|
mit
|
C#
|
adb0d25f5b9af4d61873addb795ad3fc63c56438
|
Remove dependencies on removed modules. (#1950)
|
stevetayloruk/Orchard2,petedavis/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,xkproject/Orchard2
|
src/OrchardCore.Modules/OrchardCore.OpenId/Manifest.cs
|
src/OrchardCore.Modules/OrchardCore.OpenId/Manifest.cs
|
using OrchardCore.Modules.Manifest;
using OrchardCore.OpenId;
[assembly: Module(
Name = "OpenID",
Author = "The Orchard Team",
Website = "http://orchardproject.net",
Version = "2.0.0"
)]
[assembly: Feature(
Id = OpenIdConstants.Features.Client,
Name = "OpenID Client",
Category = "OpenID Connect",
Description = "Auhenticates users from an external OpenID Connect identity provider.",
Dependencies = new[] { OpenIdConstants.Features.Core }
)]
[assembly: Feature(
Id = OpenIdConstants.Features.Core,
Name = "OpenID Core Components",
Category = "OpenID Connect",
Description = "Registers the core components used by the OpenID module."
)]
[assembly: Feature(
Id = OpenIdConstants.Features.Management,
Name = "OpenID Management Interface",
Category = "OpenID Connect",
Description = "Allows adding, editing and removing the registered applications.",
Dependencies = new[] { OpenIdConstants.Features.Core }
)]
[assembly: Feature(
Id = OpenIdConstants.Features.Server,
Name = "OpenID Authorization Server",
Category = "OpenID Connect",
Description = "Enables authentication of external applications using the OpenID Connect/OAuth 2.0 standards.",
Dependencies = new[]
{
OpenIdConstants.Features.Core,
OpenIdConstants.Features.Management,
"OrchardCore.Users",
"OrchardCore.Roles"
}
)]
[assembly: Feature(
Id = OpenIdConstants.Features.Validation,
Name = "OpenID Token Validation",
Category = "OpenID Connect",
Description = "Validates tokens issued by the Orchard OpenID server or by a remote server supporting JWT and OpenID Connect discovery.",
Dependencies = new[]
{
OpenIdConstants.Features.Core
}
)]
|
using OrchardCore.Modules.Manifest;
using OrchardCore.OpenId;
[assembly: Module(
Name = "OpenID",
Author = "The Orchard Team",
Website = "http://orchardproject.net",
Version = "2.0.0"
)]
[assembly: Feature(
Id = OpenIdConstants.Features.Client,
Name = "OpenID Client",
Category = "OpenID Connect",
Description = "Auhenticates users from an external OpenID Connect identity provider.",
Dependencies = new[]
{
OpenIdConstants.Features.Core,
"OrchardCore.Authentication",
"OrchardCore.DataProtection"
}
)]
[assembly: Feature(
Id = OpenIdConstants.Features.Core,
Name = "OpenID Core Components",
Category = "OpenID Connect",
Description = "Registers the core components used by the OpenID module."
)]
[assembly: Feature(
Id = OpenIdConstants.Features.Management,
Name = "OpenID Management Interface",
Category = "OpenID Connect",
Description = "Allows adding, editing and removing the registered applications.",
Dependencies = new[] { OpenIdConstants.Features.Core }
)]
[assembly: Feature(
Id = OpenIdConstants.Features.Server,
Name = "OpenID Authorization Server",
Category = "OpenID Connect",
Description = "Enables authentication of external applications using the OpenID Connect/OAuth 2.0 standards.",
Dependencies = new[]
{
OpenIdConstants.Features.Core,
OpenIdConstants.Features.Management,
"OrchardCore.Users",
"OrchardCore.Roles"
}
)]
[assembly: Feature(
Id = OpenIdConstants.Features.Validation,
Name = "OpenID Token Validation",
Category = "OpenID Connect",
Description = "Validates tokens issued by the Orchard OpenID server or by a remote server supporting JWT and OpenID Connect discovery.",
Dependencies = new[]
{
OpenIdConstants.Features.Core
}
)]
|
bsd-3-clause
|
C#
|
6f5507f40fc63f7b7d18dd4cdfde4abeb3447d2d
|
Tweak title screen animation timings
|
mikelovesrobots/daft-pong,mikelovesrobots/daft-pong
|
app/Assets/Scripts/TitleAnimation.cs
|
app/Assets/Scripts/TitleAnimation.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class TitleAnimation : MonoBehaviour {
private const float FADE_ANIMATION_TIME = 2f;
private const float MOVE_ANIMATION_TIME = 1f;
private const float FADE_IN_AMOUNT = 0.5f;
private const float FADE_OUT_AMOUNT = 0f;
private const string NAMED_COLOR_VALUE = "_TintColor";
public GameObject Mikelovesrobots;
public GameObject Title;
public GameObject StartGame;
public void Animate() {
FadeIn(Mikelovesrobots, 0f);
FadeOut(Mikelovesrobots, 2.5f);
FadeIn(Title, 4f);
MoveUp(Title, Vector3.up * 2, 5f);
FadeIn(StartGame, 6f);
}
private void FadeIn(GameObject target, float delay) {
target.SetActive(true);
SetColorToTransparent(target);
var options = new Hashtable();
options.Add("delay", delay);
options.Add("amount", FADE_IN_AMOUNT);
options.Add("time", FADE_ANIMATION_TIME);
options.Add("namedcolorvalue", NAMED_COLOR_VALUE);
options.Add("easetype", "easeInOutQuad");
iTween.FadeTo(target, options);
}
private void SetColorToTransparent(GameObject target) {
var color = target.renderer.material.GetColor(NAMED_COLOR_VALUE);
color.a = 0f;
target.renderer.material.SetColor(NAMED_COLOR_VALUE, color);
}
private void FadeOut(GameObject target, float delay) {
var options = new Hashtable();
options.Add("delay", delay);
options.Add("amount", FADE_OUT_AMOUNT);
options.Add("time", FADE_ANIMATION_TIME);
options.Add("namedcolorvalue", NAMED_COLOR_VALUE);
options.Add("easetype", "easeInOutQuad");
options.Add("oncomplete", "OnFadeOutComplete");
options.Add("oncompletetarget", gameObject);
options.Add("oncompleteparams", target);
iTween.FadeTo(target, options);
}
private void OnFadeOutComplete(GameObject target) {
target.SetActive(false);
}
private void MoveUp(GameObject target, Vector3 position, float delay) {
var options = new Hashtable();
options.Add("delay", delay);
options.Add("position", position);
options.Add("time", MOVE_ANIMATION_TIME);
options.Add("easetype", "easeInOutQuad");
iTween.MoveTo(target, options);
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class TitleAnimation : MonoBehaviour {
private const float FADE_ANIMATION_TIME = 2f;
private const float MOVE_ANIMATION_TIME = 2f;
private const float FADE_IN_AMOUNT = 0.5f;
private const float FADE_OUT_AMOUNT = 0f;
private const string NAMED_COLOR_VALUE = "_TintColor";
public GameObject Mikelovesrobots;
public GameObject Title;
public GameObject StartGame;
public void Animate() {
FadeIn(Mikelovesrobots, 0f);
FadeOut(Mikelovesrobots, 2.5f);
FadeIn(Title, 4f);
MoveUp(Title, Vector3.up * 2, 5f);
FadeIn(StartGame, 6f);
}
private void FadeIn(GameObject target, float delay) {
target.SetActive(true);
SetColorToTransparent(target);
var options = new Hashtable();
options.Add("delay", delay);
options.Add("amount", FADE_IN_AMOUNT);
options.Add("time", FADE_ANIMATION_TIME);
options.Add("namedcolorvalue", NAMED_COLOR_VALUE);
options.Add("easetype", "easeInOutQuad");
iTween.FadeTo(target, options);
}
private void SetColorToTransparent(GameObject target) {
var color = target.renderer.material.GetColor(NAMED_COLOR_VALUE);
color.a = 0f;
target.renderer.material.SetColor(NAMED_COLOR_VALUE, color);
}
private void FadeOut(GameObject target, float delay) {
var options = new Hashtable();
options.Add("delay", delay);
options.Add("amount", FADE_OUT_AMOUNT);
options.Add("time", FADE_ANIMATION_TIME);
options.Add("namedcolorvalue", NAMED_COLOR_VALUE);
options.Add("easetype", "easeInOutQuad");
options.Add("oncomplete", "OnFadeOutComplete");
options.Add("oncompletetarget", gameObject);
options.Add("oncompleteparams", target);
iTween.FadeTo(target, options);
}
private void OnFadeOutComplete(GameObject target) {
target.SetActive(false);
}
private void MoveUp(GameObject target, Vector3 position, float delay) {
var options = new Hashtable();
options.Add("delay", delay);
options.Add("position", position);
options.Add("time", MOVE_ANIMATION_TIME);
options.Add("easetype", "easeInOutQuad");
iTween.MoveTo(target, options);
}
}
|
mit
|
C#
|
3122ab76ce63591560b02bddc24bf91542c49c41
|
Use a fixed size buffer rather than marshalling
|
jherby2k/AudioWorks
|
AudioWorks/src/Extensions/AudioWorks.Extensions.Flac/StreamInfo.cs
|
AudioWorks/src/Extensions/AudioWorks.Extensions.Flac/StreamInfo.cs
|
/* Copyright © 2018 Jeremy Herbison
This file is part of AudioWorks.
AudioWorks is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
version.
AudioWorks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.
You should have received a copy of the GNU Affero General Public License along with AudioWorks. If not, see
<https://www.gnu.org/licenses/>. */
using System.Runtime.InteropServices;
namespace AudioWorks.Extensions.Flac
{
[StructLayout(LayoutKind.Sequential)]
unsafe struct StreamInfo
{
readonly uint MinBlockSize;
readonly uint MaxBlockSize;
readonly uint MinFrameSize;
readonly uint MaxFrameSize;
internal readonly uint SampleRate;
internal readonly uint Channels;
internal readonly uint BitsPerSample;
internal readonly ulong TotalSamples;
fixed byte Md5Sum[16];
}
}
|
/* Copyright © 2018 Jeremy Herbison
This file is part of AudioWorks.
AudioWorks is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
version.
AudioWorks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.
You should have received a copy of the GNU Affero General Public License along with AudioWorks. If not, see
<https://www.gnu.org/licenses/>. */
using System.Runtime.InteropServices;
namespace AudioWorks.Extensions.Flac
{
[StructLayout(LayoutKind.Sequential)]
readonly struct StreamInfo
{
readonly uint MinBlockSize;
readonly uint MaxBlockSize;
readonly uint MinFrameSize;
readonly uint MaxFrameSize;
internal readonly uint SampleRate;
internal readonly uint Channels;
internal readonly uint BitsPerSample;
internal readonly ulong TotalSamples;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] readonly byte[] Md5Sum;
}
}
|
agpl-3.0
|
C#
|
5b85f6f46fb8f65159264e2ea6f98a9dab6f4173
|
Update sexy course
|
gdm-201516-prodev3/wdad3,gdm-201516-prodev3/wdad3,gdm-201516-prodev3/wdad3
|
LibraryApp/App.Web/Views/LibraryItem/_LibraryItemsPagedList.cshtml
|
LibraryApp/App.Web/Views/LibraryItem/_LibraryItemsPagedList.cshtml
|
@model IPagedList<LibraryItem>
@using PagedList
@if (Model != null && Model.Count() > 0)
{
<section class="paged-content">
<ul>
@foreach(var libraryItem in Model)
{
<li class="libraryitem" data-id="@libraryItem.Id">
<h3>@libraryItem.Title</h3>
<div class="libraryitem__meta">
<span class="meta__author">@libraryItem.Author</span>
<span class="meta__item-type">@libraryItem.Type</span>
<span class="meta__year">@libraryItem.Year</span>
</div>
</li>
}
</ul>
</section>
<section class="paged-content">
<ajaxpager current-page="@Model.PageNumber"
total-pages="@Model.PageCount"
search-form-target="#libraryitem-simple-search-form"
update-link="~/LibraryItem.Index"
update-target="#libraryitems-list"></ajaxpager>
</section>
}
else
{
<div class="well well-sm">
Geen items gevonden!
</div>
}
|
@model IPagedList<LibraryItem>
@using PagedList
@if (Model != null && Model.Count() > 0)
{
<section class="paged-content">
@foreach(var libraryItem in Model)
{
<h3>@libraryItem.Title</h3>
}
</section>
}
else
{
<div class="well well-sm">
Geen items gevonden!
</div>
}
|
apache-2.0
|
C#
|
6eabf29d3db2720795339f0ad36f1544338942a4
|
Update SingletonCache.cs
|
hikalkan/samples,hikalkan/samples,hikalkan/samples,hikalkan/samples
|
SingletonVsStatic/SingletonVsStatic.SingletonLib/SingletonCache.cs
|
SingletonVsStatic/SingletonVsStatic.SingletonLib/SingletonCache.cs
|
using System;
using System.Collections.Generic;
namespace SingletonVsStatic.SingletonLib
{
public class SingletonCache
{
public static SingletonCache Instance { get; } = new SingletonCache();
private readonly IDictionary<string, object> _cacheDictionary;
protected internal SingletonCache()
{
_cacheDictionary = new Dictionary<string, object>();
}
public virtual void Add(string key, object value)
{
lock (_cacheDictionary)
{
_cacheDictionary[key] = value;
}
}
public virtual object GetOrNull(string key)
{
lock (_cacheDictionary)
{
if (_cacheDictionary.TryGetValue(key, out object value))
{
return value;
}
return null;
}
}
public virtual object GetOrAdd(string key, Func<object> factory)
{
lock (_cacheDictionary)
{
var value = GetOrNull(key);
if (value != null)
{
return value;
}
value = factory();
Add(key, value);
return value;
}
}
public virtual void Clear()
{
lock (_cacheDictionary)
{
_cacheDictionary.Clear();
}
}
public virtual bool Remove(string key)
{
lock (_cacheDictionary)
{
return _cacheDictionary.Remove(key);
}
}
public virtual int GetCount()
{
lock (_cacheDictionary)
{
return _cacheDictionary.Count;
}
}
}
}
|
using System;
using System.Collections.Generic;
namespace SingletonVsStatic.SingletonLib
{
public class SingletonCache
{
public static SingletonCache Instance { get; } = new SingletonCache();
private readonly IDictionary<string, object> _cacheDictionary;
internal SingletonCache()
{
_cacheDictionary = new Dictionary<string, object>();
}
public virtual void Add(string key, object value)
{
lock (_cacheDictionary)
{
_cacheDictionary[key] = value;
}
}
public virtual object GetOrNull(string key)
{
lock (_cacheDictionary)
{
if (_cacheDictionary.TryGetValue(key, out object value))
{
return value;
}
return null;
}
}
public virtual object GetOrAdd(string key, Func<object> factory)
{
lock (_cacheDictionary)
{
var value = GetOrNull(key);
if (value != null)
{
return value;
}
value = factory();
Add(key, value);
return value;
}
}
public virtual void Clear()
{
lock (_cacheDictionary)
{
_cacheDictionary.Clear();
}
}
public virtual bool Remove(string key)
{
lock (_cacheDictionary)
{
return _cacheDictionary.Remove(key);
}
}
public virtual int GetCount()
{
lock (_cacheDictionary)
{
return _cacheDictionary.Count;
}
}
}
}
|
mit
|
C#
|
eb110e56c72b3529cf9a7f649f499499315482a7
|
clean code a bit
|
MehdiK/Humanizer,hazzik/Humanizer
|
src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverter.cs
|
src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverter.cs
|
using System.Collections.Generic;
namespace Humanizer.Localisation.NumberToWords
{
internal class FrenchNumberToWordsConverter : FrenchNumberToWordsConverterBase
{
protected override void CollectPartsUnderAHundred(ICollection<string> parts, ref int number, GrammaticalGender gender, bool pluralize)
{
if (number == 71)
parts.Add("soixante et onze");
else if (number == 80)
parts.Add("quatre-vingt" + (pluralize ? "s" : string.Empty));
else if (number >= 70)
{
var @base = number < 80 ? 60 : 80;
int units = number - @base;
var tens = @base / 10;
parts.Add($"{GetTens(tens)}-{GetUnits(units, gender)}");
}
else
base.CollectPartsUnderAHundred(parts, ref number, gender, pluralize);
}
protected override string GetTens(int tens) => tens == 8 ? "quatre-vingt" : base.GetTens(tens);
}
}
|
using System.Collections.Generic;
namespace Humanizer.Localisation.NumberToWords
{
internal class FrenchNumberToWordsConverter : FrenchNumberToWordsConverterBase
{
protected override void CollectPartsUnderAHundred(ICollection<string> parts, ref int number, GrammaticalGender gender, bool pluralize)
{
if (number == 71)
parts.Add("soixante et onze");
else if (number == 80)
parts.Add(pluralize ? "quatre-vingts" : "quatre-vingt");
else if (number >= 70)
{
var @base = number < 80 ? 60 : 80;
int units = number - @base;
var tens = @base/10;
parts.Add(string.Format("{0}-{1}", GetTens(tens), GetUnits(units, gender)));
}
else
base.CollectPartsUnderAHundred(parts, ref number, gender, pluralize);
}
protected override string GetTens(int tens)
{
if (tens == 8)
return "quatre-vingt";
return base.GetTens(tens);
}
}
}
|
mit
|
C#
|
48200745c00b7681536ee66c657fa4cfa04e1f1d
|
Improve generation of verification keys.
|
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
|
src/MitternachtBot/Modules/Verification/Common/VerificationKeyManager.cs
|
src/MitternachtBot/Modules/Verification/Common/VerificationKeyManager.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using Mitternacht.Common.Collections;
namespace Mitternacht.Modules.Verification.Common {
public class VerificationKeyManager {
private static readonly RandomNumberGenerator _random = RandomNumberGenerator.Create();
private static readonly ConcurrentHashSet<VerificationKey> _verificationKeys = new ConcurrentHashSet<VerificationKey>();
public static List<VerificationKey> VerificationKeys => _verificationKeys.ToList();
private static string GenerateKey() {
var bytes = new byte[8];
_random.GetBytes(bytes);
return Convert.ToBase64String(bytes, Base64FormattingOptions.None);
}
public static VerificationKey GenerateVerificationKey(ulong guildid, ulong userid, long forumuserid, VerificationKeyScope keyscope) {
var vkey = new VerificationKey(GenerateKey(), keyscope, forumuserid, userid, guildid);
_verificationKeys.Add(vkey);
return vkey;
}
public static bool HasVerificationKey(VerificationKey key, bool ignoreKey = false)
=> _verificationKeys.Any(vkey => vkey.Equals(key, ignoreKey));
public static VerificationKey GetKey(ulong guildId, ulong userId, long forumUserId, VerificationKeyScope keyScope)
=> _verificationKeys.FirstOrDefault(vk => vk.IsKeyFor(guildId, userId, forumUserId, keyScope));
public static string GetKeyString(ulong guildId, ulong userId, long forumUserId, VerificationKeyScope keyScope)
=> GetKey(guildId, userId, forumUserId, keyScope)?.Key;
public static bool RemoveKey(ulong guildId, ulong userId, long forumUserId, VerificationKeyScope keyScope) {
var key = GetKey(guildId, userId, forumUserId, keyScope);
return key is null ? false : _verificationKeys.TryRemove(key);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Mitternacht.Common.Collections;
namespace Mitternacht.Modules.Verification.Common {
public class VerificationKeyManager {
private static readonly Random _random = new Random();
private static readonly ConcurrentHashSet<VerificationKey> _verificationKeys = new ConcurrentHashSet<VerificationKey>();
public static List<VerificationKey> VerificationKeys => _verificationKeys.ToList();
private static string GenerateKey() {
var bytes = new byte[8];
_random.NextBytes(bytes);
return Convert.ToBase64String(bytes, Base64FormattingOptions.None);
}
public static VerificationKey GenerateVerificationKey(ulong guildid, ulong userid, long forumuserid, VerificationKeyScope keyscope) {
string key;
while(HasKey(key = GenerateKey())) { }
var vkey = new VerificationKey(key, keyscope, forumuserid, userid, guildid);
_verificationKeys.Add(vkey);
return vkey;
}
public static bool HasKey(string key)
=> _verificationKeys.Any(vkey => vkey.Key.Equals(key, StringComparison.Ordinal));
public static bool HasVerificationKey(VerificationKey key, bool ignoreKey = false)
=> _verificationKeys.Any(vkey => vkey.Equals(key, ignoreKey));
public static VerificationKey GetKey(ulong guildId, ulong userId, long forumUserId, VerificationKeyScope keyScope)
=> _verificationKeys.FirstOrDefault(vk => vk.IsKeyFor(guildId, userId, forumUserId, keyScope));
public static string GetKeyString(ulong guildId, ulong userId, long forumUserId, VerificationKeyScope keyScope)
=> GetKey(guildId, userId, forumUserId, keyScope)?.Key;
public static bool RemoveKey(ulong guildId, ulong userId, long forumUserId, VerificationKeyScope keyScope) {
var key = GetKey(guildId, userId, forumUserId, keyScope);
return key is null ? false : _verificationKeys.TryRemove(key);
}
}
}
|
mit
|
C#
|
f96cb0d0421658bb1e6baf7e980f7af8d72f916c
|
fix Upgrade_20220822_StartAfter
|
signumsoftware/framework,signumsoftware/framework
|
Signum.Upgrade/Upgrades/Upgrade_20220822_StartAfter.cs
|
Signum.Upgrade/Upgrades/Upgrade_20220822_StartAfter.cs
|
using System;
using System.IO;
using System.Net;
using System.Net.Http;
namespace Signum.Upgrade.Upgrades;
class Upgrade_20220822_StartAfter : CodeUpgradeBase
{
public override string Description => "Rename StartXXAfter methods";
public override void Execute(UpgradeContext uctx)
{
uctx.ChangeCodeFile($@"Southwind.React\Startup.cs", file =>
{
file.Replace(
"ProcessRunnerLogic.StartRunningProcesses(",
"ProcessRunner.StartRunningProcessesAfter(");
file.Replace(
"SchedulerLogic.StartScheduledTasks();",
"ScheduleTaskRunner.StartScheduledTaskAfter(5 * 1000);");
file.Replace(
"AsyncEmailSenderLogic.StartRunningEmailSenderAsync(",
"AsyncEmailSender.StartAsyncEmailSenderAfter(");
});
}
}
|
using System;
using System.IO;
using System.Net;
using System.Net.Http;
namespace Signum.Upgrade.Upgrades;
class Upgrade_20220822_StartAfter : CodeUpgradeBase
{
public override string Description => "Rename StartXXAfter methods";
public override void Execute(UpgradeContext uctx)
{
uctx.ChangeCodeFile($@"Southwind.React\Startup.cs", file =>
{
file.Replace(
"ProcessRunnerLogic.StartRunningProcesses(",
"ProcessRunner.StartRunningProcessesAfter(");
file.Replace(
"SchedulerLogic.StartScheduledTasks(",
"ScheduleTaskRunner.StartScheduledTaskAfter(");
file.Replace(
"AsyncEmailSenderLogic.StartRunningEmailSenderAsync(",
"AsyncEmailSender.StartAsyncEmailSenderAfter(");
file.Replace(
"ProcessRunnerLogic.StartRunningProcesses(",
"ProcessRunner.StartRunningProcessesAfter(");
});
}
}
|
mit
|
C#
|
ca0f923ff6451740a4653a44eb1ca4eff681b3c2
|
use endpoint routing in sample as in readme
|
DigDes/SoapCore
|
samples/Server/Startup.cs
|
samples/Server/Startup.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using Models;
using SoapCore;
namespace Server
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddSoapCore();
services.TryAddSingleton<ISampleService, SampleService>();
services.AddMvc();
}
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseEndpoints(endpoints => {
endpoints.UseSoapEndpoint<ISampleService>("/Service.svc", new BasicHttpBinding(), SoapSerializer.DataContractSerializer);
endpoints.UseSoapEndpoint<ISampleService>("/Service.asmx", new BasicHttpBinding(), SoapSerializer.XmlSerializer);
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using Models;
using SoapCore;
namespace Server
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.TryAddSingleton<ISampleService, SampleService>();
services.AddMvc(x => x.EnableEndpointRouting = false);
services.AddSoapCore();
}
public void Configure(IApplicationBuilder app)
{
app.UseSoapEndpoint<ISampleService>("/Service.svc", new BasicHttpBinding(), SoapSerializer.DataContractSerializer);
app.UseSoapEndpoint<ISampleService>("/Service.asmx", new BasicHttpBinding(), SoapSerializer.XmlSerializer);
app.UseMvc();
}
}
}
|
mit
|
C#
|
ba1b30c03b89655553b7bc79f357af08da7e49b8
|
Fix PackerCompatibilityOptions is not marked as Flags.
|
scopely/msgpack-cli,modulexcite/msgpack-cli,msgpack/msgpack-cli,modulexcite/msgpack-cli,undeadlabs/msgpack-cli,undeadlabs/msgpack-cli,msgpack/msgpack-cli,scopely/msgpack-cli
|
src/MsgPack/PackerCompatibilityOptions.cs
|
src/MsgPack/PackerCompatibilityOptions.cs
|
#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010-2013 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion -- License Terms --
using System;
namespace MsgPack
{
/// <summary>
/// Defines compatibility options for <see cref="Packer"/>.
/// </summary>
[Flags]
public enum PackerCompatibilityOptions
{
/// <summary>
/// No compatibility options. <see cref="Packer"/>s use newest behavior.
/// </summary>
None = 0,
/// <summary>
/// Packs byte array as raw(str) value, and also prohibits usage of str8 type for legacy unpacker implementations.
/// </summary>
PackBinaryAsRaw = 0x1,
/// <summary>
/// Prohibits usage of any ext types for legacy unpacker implementations.
/// </summary>
ProhibitExtendedTypeObjects = 0x2,
/// <summary>
/// <see cref="Packer"/>s should be use classic behavior. That is, do not use str8 and any ext types, and byte arrays must be packed as raw.
/// </summary>
Classic = PackBinaryAsRaw | ProhibitExtendedTypeObjects
}
}
|
#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010-2013 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion -- License Terms --
using System;
namespace MsgPack
{
/// <summary>
/// Defines compatibility options for <see cref="Packer"/>.
/// </summary>
public enum PackerCompatibilityOptions
{
/// <summary>
/// No compatibility options. <see cref="Packer"/>s use newest behavior.
/// </summary>
None = 0,
/// <summary>
/// Packs byte array as raw(str) value, and also prohibits usage of str8 type for legacy unpacker implementations.
/// </summary>
PackBinaryAsRaw = 0x1,
/// <summary>
/// Prohibits usage of any ext types for legacy unpacker implementations.
/// </summary>
ProhibitExtendedTypeObjects = 0x2,
/// <summary>
/// <see cref="Packer"/>s should be use classic behavior. That is, do not use str8 and any ext types, and byte arrays must be packed as raw.
/// </summary>
Classic = PackBinaryAsRaw | ProhibitExtendedTypeObjects
}
}
|
apache-2.0
|
C#
|
ed4be3a7a118ed814c90cbe9823569c2131d47e8
|
Make Drawable inherit from Container: Fix for Winforms PixelLayoutHandler.
|
PowerOfCode/Eto,l8s/Eto,l8s/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,PowerOfCode/Eto,PowerOfCode/Eto,l8s/Eto,bbqchickenrobot/Eto-1
|
Source/Eto.Platform.Windows/Forms/PixelLayoutHandler.cs
|
Source/Eto.Platform.Windows/Forms/PixelLayoutHandler.cs
|
using System;
using SD = System.Drawing;
using SWF = System.Windows.Forms;
using Eto.Forms;
using Eto.Drawing;
namespace Eto.Platform.Windows
{
public class PixelLayoutHandler : WindowsLayout<SWF.Control, PixelLayout>, IPixelLayout
{
public override SWF.Control Control {
get {
return Widget.Container != null ? (SWF.Control)Widget.Container.ControlObject : null;
}
protected set {
base.Control = value;
}
}
public override Size DesiredSize
{
get { return Control.PreferredSize.ToEto (); }
}
public void Add(Control child, int x, int y)
{
var control = Widget.Container.ControlObject as SWF.Control;
var scrollableControl = control as SWF.ScrollableControl;
SWF.Control ctl = child.GetContainerControl ();
SD.Point pt = new SD.Point(x, y);
if (scrollableControl != null) pt.Offset(scrollableControl.AutoScrollPosition);
ctl.Location = pt;
control.Controls.Add(ctl);
ctl.BringToFront();
}
public void Move(Control child, int x, int y)
{
SWF.ScrollableControl parent = Widget.Container.ControlObject as SWF.ScrollableControl;
SWF.Control ctl = child.GetContainerControl ();
SD.Point pt = new SD.Point(x, y);
if (parent != null) pt.Offset(parent.AutoScrollPosition);
ctl.Location = pt;
}
public void Remove (Control child)
{
var parent = Widget.Container.ControlObject as SWF.ScrollableControl;
var ctl = child.GetContainerControl ();
if (parent != null) parent.Controls.Remove(ctl);
}
}
}
|
using System;
using SD = System.Drawing;
using SWF = System.Windows.Forms;
using Eto.Forms;
using Eto.Drawing;
namespace Eto.Platform.Windows
{
public class PixelLayoutHandler : WindowsLayout<SWF.Control, PixelLayout>, IPixelLayout
{
public override SWF.Control Control {
get {
return Widget.Container != null ? (SWF.Control)Widget.Container.ControlObject : null;
}
protected set {
base.Control = value;
}
}
public override Size DesiredSize
{
get { return Control.PreferredSize.ToEto (); }
}
public void Add(Control child, int x, int y)
{
SWF.ScrollableControl parent = Widget.Container.ControlObject as SWF.ScrollableControl;
SWF.Control ctl = child.GetContainerControl ();
SD.Point pt = new SD.Point(x, y);
if (parent != null) pt.Offset(parent.AutoScrollPosition);
ctl.Location = pt;
parent.Controls.Add(ctl);
ctl.BringToFront();
}
public void Move(Control child, int x, int y)
{
SWF.ScrollableControl parent = Widget.Container.ControlObject as SWF.ScrollableControl;
SWF.Control ctl = child.GetContainerControl ();
SD.Point pt = new SD.Point(x, y);
if (parent != null) pt.Offset(parent.AutoScrollPosition);
ctl.Location = pt;
}
public void Remove (Control child)
{
var parent = Widget.Container.ControlObject as SWF.ScrollableControl;
var ctl = child.GetContainerControl ();
if (parent != null) parent.Controls.Remove(ctl);
}
}
}
|
bsd-3-clause
|
C#
|
a0f2e2e28ce385fd735d299902e25730690ed2ca
|
update version
|
prodot/ReCommended-Extension
|
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
|
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
|
using System.Reflection;
using ReCommendedExtension;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2019 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("3.6.1.0")]
[assembly: AssemblyFileVersion("3.6.1")]
|
using System.Reflection;
using ReCommendedExtension;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2019 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("3.6.0.0")]
[assembly: AssemblyFileVersion("3.6.0")]
|
apache-2.0
|
C#
|
4156a9a66d62d2988a4e543519ba90e2d0d6ccbe
|
Allow event chaining.
|
eightyeight/vlrtt,eightyeight/vlrtt
|
modules/stateMachine/main.cs
|
modules/stateMachine/main.cs
|
function StateMachine::onEvent(%this, %event) {
// See if there's a transition callback ssociated with this event.
%script = "on" @ %event;
if(%this.isMethod(%script)) {
%this.call(%script);
}
// Figure out the new state to transition to.
%trans = %this.transition[%this.state, %event];
// If it doesn't exist, see if there's a wildcard transition for this event.
if(%trans $= "") {
%trans = %this.transition["*", %event];
}
// Apply the state change.
if(%trans !$= "") {
// Callback for leaving the current state.
%script = "leave" @ %this.state;
if(%this.isMethod(%script)) {
%this.call(%script);
}
// Change the state!
%this.state = %trans;
// Callback upon entering the new state.
%script = "enter" @ %this.state;
if(%this.isMethod(%script)) {
%this.call(%script);
}
}
return %this;
}
|
function StateMachine::onEvent(%this, %event) {
// See if there's a transition callback ssociated with this event.
%script = "on" @ %event;
if(%this.isMethod(%script)) {
%this.call(%script);
}
// Figure out the new state to transition to.
%trans = %this.transition[%this.state, %event];
// If it doesn't exist, see if there's a wildcard transition for this event.
if(%trans $= "") {
%trans = %this.transition["*", %event];
}
// Apply the state change.
if(%trans !$= "") {
// Callback for leaving the current state.
%script = "leave" @ %this.state;
if(%this.isMethod(%script)) {
%this.call(%script);
}
// Change the state!
%this.state = %trans;
// Callback upon entering the new state.
%script = "enter" @ %this.state;
if(%this.isMethod(%script)) {
%this.call(%script);
}
}
}
|
mit
|
C#
|
b7bf27f6a0882eef5e039c5beb428e69466b4fef
|
Fix labels on SSD
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
Battery-Commander.Web/Views/Shared/DisplayTemplates/SSDStatusModel.cshtml
|
Battery-Commander.Web/Views/Shared/DisplayTemplates/SSDStatusModel.cshtml
|
@model Soldier.SSDStatusModel
@if (Model != null)
{
<div>
@switch (Model.Rank)
{
case Rank.E1:
case Rank.E2:
case Rank.E3:
case Rank.E4:
<span class="label label-default">SSD 1</span>
return;
case Rank.E5:
<span class="label label-default">SSD 2</span>
return;
case Rank.E6:
<span class="label label-default">SSD 3</span>
return;
case Rank.E7:
<span class="label label-default">SSD 4</span>
return;
case Rank.E8:
<span class="label label-default">SSD 5</span>
return;
default:
return;
}
</div>
}
|
@model Soldier.SSDStatusModel
@if (Model != null)
{
<div>
@switch (Model.Rank)
{
case Rank.E1:
case Rank.E2:
case Rank.E3:
case Rank.E4:
<span class="label">SSD 1</span>
return;
case Rank.E5:
<span class="label">SSD 2</span>
return;
case Rank.E6:
<span class="label">SSD 3</span>
return;
case Rank.E7:
<span class="label">SSD 4</span>
return;
case Rank.E8:
<span class="label">SSD 5</span>
return;
default:
return;
}
</div>
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.