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 |
|---|---|---|---|---|---|---|---|---|
36e0410fb373a9a9cc84be3acdb0652524a33edf
|
Fix for nullable doubles in entities
|
colethecoder/chronological
|
Chronological/DataType.cs
|
Chronological/DataType.cs
|
using System;
using Newtonsoft.Json.Linq;
namespace Chronological
{
public class DataType
{
public string TimeSeriesInsightsType { get; }
internal DataType(string dataType)
{
TimeSeriesInsightsType = dataType;
}
internal JProperty ToJProperty()
{
return new JProperty("type", TimeSeriesInsightsType);
}
internal static DataType FromType(Type type)
{
switch (type)
{
case Type doubleType when doubleType == typeof(double) || doubleType == typeof(double?):
return Double;
case Type stringType when stringType == typeof(string):
return String;
case Type dateTimeType when dateTimeType == typeof(DateTime):
return DateTime;
case Type boolType when boolType == typeof(bool) || boolType == typeof(bool?):
return Boolean;
default:
//Todo: Better exceptions
throw new Exception("Unexpected Type");
}
}
public static DataType Double => new DataType("Double");
public static DataType String => new DataType("String");
public static DataType DateTime => new DataType("DateTime");
public static DataType Boolean => new DataType("Boolean");
}
}
|
using System;
using Newtonsoft.Json.Linq;
namespace Chronological
{
public class DataType
{
public string TimeSeriesInsightsType { get; }
internal DataType(string dataType)
{
TimeSeriesInsightsType = dataType;
}
internal JProperty ToJProperty()
{
return new JProperty("type", TimeSeriesInsightsType);
}
internal static DataType FromType(Type type)
{
switch (type)
{
case Type doubleType when doubleType == typeof(double):
return Double;
case Type stringType when stringType == typeof(string):
return String;
case Type dateTimeType when dateTimeType == typeof(DateTime):
return DateTime;
case Type boolType when boolType == typeof(bool) || boolType == typeof(bool?):
return Boolean;
default:
//Todo: Better exceptions
throw new Exception("Unexpected Type");
}
}
public static DataType Double => new DataType("Double");
public static DataType String => new DataType("String");
public static DataType DateTime => new DataType("DateTime");
public static DataType Boolean => new DataType("Boolean");
}
}
|
mit
|
C#
|
f8eb3502fd2fd9e4f4792a38bb2797922af6625f
|
Enable log4net logging in the Downloader
|
serverdensity/sd-agent-windows
|
BoxedIce.ServerDensity.Agent.Downloader/Properties/AssemblyInfo.cs
|
BoxedIce.ServerDensity.Agent.Downloader/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Server Density Update Downloader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Boxed Ice")]
[assembly: AssemblyProduct("Server Density Update Downloader")]
[assembly: AssemblyCopyright("Copyright © Boxed Ice 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("93cbc57a-eae8-406d-a1bc-5d7c049d9dc4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
|
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("Server Density Update Downloader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Boxed Ice")]
[assembly: AssemblyProduct("Server Density Update Downloader")]
[assembly: AssemblyCopyright("Copyright © Boxed Ice 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("93cbc57a-eae8-406d-a1bc-5d7c049d9dc4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
|
bsd-3-clause
|
C#
|
8324a458889d19f4d72dbf1ff3df5dbe8346d225
|
Revert "Temporary fix test"
|
viciousviper/dokan-dotnet,viciousviper/dokan-dotnet,dokan-dev/dokan-dotnet,magol/dokan-dotnet,magol/dokan-dotnet,dokan-dev/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,magol/dokan-dotnet,viciousviper/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,dokan-dev/dokan-dotnet
|
DokanNet.Tests/Mounter.cs
|
DokanNet.Tests/Mounter.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Globalization;
using System.IO;
using System.Threading;
namespace DokanNet.Tests
{
[TestClass]
public static class Mounter
{
private static Thread mounterThread;
[AssemblyInitialize]
public static void AssemblyInitialize(TestContext context)
{
(mounterThread = new Thread(new ThreadStart(() => DokanOperationsFixture.Operations.Mount(DokanOperationsFixture.MOUNT_POINT.ToString(CultureInfo.InvariantCulture), DokanOptions.DebugMode | DokanOptions.NetworkDrive, 1)))).Start();
var drive = new DriveInfo(DokanOperationsFixture.MOUNT_POINT.ToString(CultureInfo.InvariantCulture));
while (!drive.IsReady)
Thread.Sleep(50);
}
[AssemblyCleanup]
public static void AssemblyCleanup()
{
mounterThread.Abort();
Dokan.Unmount(DokanOperationsFixture.MOUNT_POINT);
Dokan.RemoveMountPoint(DokanOperationsFixture.MOUNT_POINT.ToString(CultureInfo.InvariantCulture));
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Globalization;
using System.IO;
using System.Threading;
namespace DokanNet.Tests
{
[TestClass]
public static class Mounter
{
private static Thread mounterThread;
[AssemblyInitialize]
public static void AssemblyInitialize(TestContext context)
{
(mounterThread = new Thread(new ThreadStart(() => DokanOperationsFixture.Operations.Mount(DokanOperationsFixture.MOUNT_POINT.ToString(CultureInfo.InvariantCulture), DokanOptions.DebugMode, 1)))).Start();
var drive = new DriveInfo(DokanOperationsFixture.MOUNT_POINT.ToString(CultureInfo.InvariantCulture));
while (!drive.IsReady)
Thread.Sleep(50);
}
[AssemblyCleanup]
public static void AssemblyCleanup()
{
mounterThread.Abort();
Dokan.Unmount(DokanOperationsFixture.MOUNT_POINT);
Dokan.RemoveMountPoint(DokanOperationsFixture.MOUNT_POINT.ToString(CultureInfo.InvariantCulture));
}
}
}
|
mit
|
C#
|
548ac8a8dc7f483c1eb8903ce9daebecffe5613a
|
Make interface test more interesting
|
jonathanvdc/ecsc
|
tests/cs/interface/Interface.cs
|
tests/cs/interface/Interface.cs
|
using System;
interface IFlyable
{
void Fly();
string Name { get; }
}
class Bird : IFlyable
{
public Bird()
{
Name = "Bird";
}
public string Name { get; private set; }
public void Fly()
{
Console.WriteLine("Chirp");
}
}
class Plane : IFlyable
{
public Plane() { }
public string Name => "Plane";
public void Fly()
{
Console.WriteLine("Nnneeaoowww");
}
}
static class Program
{
public static IFlyable[] GetBirdInstancesAndPlaneInstancesMixed()
{
return new IFlyable[]
{
new Bird(),
new Plane()
};
}
public static void Main(string[] Args)
{
var items = GetBirdInstancesAndPlaneInstancesMixed();
for (int i = 0; i < items.Length; i++)
{
Console.Write(items[i].Name + ": ");
items[i].Fly();
}
}
}
|
using System;
interface IFlyable
{
void Fly();
string Name { get; }
}
class Bird : IFlyable
{
public Bird() { }
public string Name => "Bird";
public void Fly()
{
Console.WriteLine("Chirp");
}
}
class Plane : IFlyable
{
public Plane() { }
public string Name => "Plane";
public void Fly()
{
Console.WriteLine("Nnneeaoowww");
}
}
static class Program
{
public static IFlyable[] GetBirdInstancesAndPlaneInstancesMixed()
{
return new IFlyable[]
{
new Bird(),
new Plane()
};
}
public static void Main(string[] Args)
{
var items = GetBirdInstancesAndPlaneInstancesMixed();
for (int i = 0; i < items.Length; i++)
{
Console.Write(items[i].Name + ": ");
items[i].Fly();
}
}
}
|
mit
|
C#
|
9f96694c03c1c7114ab781d0bdc52f59e604c179
|
Fix weird StaticModel behavior.
|
florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho
|
bindings/src/Shapes/Shape.cs
|
bindings/src/Shapes/Shape.cs
|
using Urho.Resources;
namespace Urho.Shapes
{
public abstract class Shape : StaticModel
{
Material material;
public override void OnAttachedToNode(Node node)
{
Model = Application.ResourceCache.GetModel(ModelResource);
Color = color;
}
protected abstract string ModelResource { get; }
Color color;
public Color Color
{
set
{
if (material == null)
{
//try to restore material (after deserialization)
material = GetMaterial(0);
if (material == null)
{
material = new Material();
material.SetTechnique(0, Application.ResourceCache.GetTechnique("Techniques/NoTextureAlpha.xml"), 1, 1);
}
SetMaterial(material);
}
material.SetShaderParameter("MatDiffColor", value);
color = value;
}
get
{
return color;
}
}
public override void OnDeserialize(IComponentDeserializer d)
{
color = d.Deserialize<Color>(nameof(Color));
}
public override void OnSerialize(IComponentSerializer s)
{
s.Serialize(nameof(Color), Color);
}
}
}
|
using Urho.Resources;
namespace Urho.Shapes
{
public abstract class Shape : StaticModel
{
Material material;
public override void OnAttachedToNode(Node node)
{
Model = Application.ResourceCache.GetModel(ModelResource);
}
protected abstract string ModelResource { get; }
Color color;
public Color Color
{
set
{
if (material == null)
{
//try to restore material (after deserialization)
material = GetMaterial(0);
if (material == null)
{
material = new Material();
material.SetTechnique(0, Application.ResourceCache.GetTechnique("Techniques/NoTextureAlpha.xml"), 1, 1);
}
SetMaterial(material);
}
material.SetShaderParameter("MatDiffColor", value);
color = value;
}
get
{
return color;
}
}
public override void OnDeserialize(IComponentDeserializer d)
{
Color = d.Deserialize<Color>(nameof(Color));
}
public override void OnSerialize(IComponentSerializer s)
{
s.Serialize(nameof(Color), Color);
}
}
}
|
mit
|
C#
|
c08a860e209b972e2d520f4a8bc0295f28993f30
|
add GetCurrentCultures to SignumAuthenticationAndProfilerAttribute
|
AlejandroCano/framework,signumsoftware/framework,AlejandroCano/framework,avifatal/framework,signumsoftware/framework,avifatal/framework
|
Signum.React/Filters/SignumAuthenticationAndProfilerAttribute.cs
|
Signum.React/Filters/SignumAuthenticationAndProfilerAttribute.cs
|
using Signum.Engine;
using Signum.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using System.Web.Http.Routing;
namespace Signum.React.Filters
{
public class SignumAuthenticationAndProfilerAttribute : FilterAttribute, IAuthorizationFilter
{
public const string SavedRequestKey = "SAVED_REQUEST";
public static Func<HttpActionContext, IDisposable> Authenticate;
public static Func<HttpActionContext, IDisposable> GetCurrentCultures;
public async Task<HttpResponseMessage> ExecuteAuthorizationFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation)
{
string action = ProfilerActionSplitterAttribute.GetActionDescription(actionContext);
using (TimeTracker.Start(action))
{
using (HeavyProfiler.Log("Web.API " + actionContext.Request.Method, () => actionContext.Request.RequestUri.ToString()))
{
//if (ProfilerLogic.SessionTimeout != null)
//{
// IDisposable sessionTimeout = Connector.CommandTimeoutScope(ProfilerLogic.SessionTimeout.Value);
// if (sessionTimeout != null)
// actionContext.Request.RegisterForDispose(sessionTimeout);
//}
actionContext.Request.Properties[SavedRequestKey] = await actionContext.Request.Content.ReadAsStringAsync();
using (Authenticate == null ? null : Authenticate(actionContext))
{
using (GetCurrentCultures(actionContext))
{
if (actionContext.Response != null)
return actionContext.Response;
return await continuation();
}
}
}
}
}
}
}
|
using Signum.Engine;
using Signum.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using System.Web.Http.Routing;
namespace Signum.React.Filters
{
public class SignumAuthenticationAndProfilerAttribute : FilterAttribute, IAuthorizationFilter
{
public const string SavedRequestKey = "SAVED_REQUEST";
public static Func<HttpActionContext, IDisposable> Authenticate;
public async Task<HttpResponseMessage> ExecuteAuthorizationFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation)
{
string action = ProfilerActionSplitterAttribute.GetActionDescription(actionContext);
using (TimeTracker.Start(action))
{
using (HeavyProfiler.Log("Web.API " + actionContext.Request.Method, () => actionContext.Request.RequestUri.ToString()))
{
//if (ProfilerLogic.SessionTimeout != null)
//{
// IDisposable sessionTimeout = Connector.CommandTimeoutScope(ProfilerLogic.SessionTimeout.Value);
// if (sessionTimeout != null)
// actionContext.Request.RegisterForDispose(sessionTimeout);
//}
actionContext.Request.Properties[SavedRequestKey] = await actionContext.Request.Content.ReadAsStringAsync();
using (Authenticate == null ? null : Authenticate(actionContext))
{
if (actionContext.Response != null)
return actionContext.Response;
return await continuation();
}
}
}
}
}
}
|
mit
|
C#
|
b77a3a3857b90deb6c995ce96086189bb88d515b
|
Remove using
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
|
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
|
using System.Reactive.Disposables;
using ReactiveUI;
using WalletWasabi.Fluent.Model;
using WalletWasabi.Fluent.ViewModels.NavBar;
using WalletWasabi.Gui;
namespace WalletWasabi.Fluent.ViewModels.Settings
{
public class SettingsPageViewModel : NavBarItemViewModel
{
private bool _isModified;
private int _selectedTab;
public SettingsPageViewModel(Config config, UiConfig uiConfig)
{
Title = "Settings";
_selectedTab = 0;
GeneralTab = new GeneralTabViewModel(config, uiConfig);
PrivacyTab = new PrivacyTabViewModel(config, uiConfig);
NetworkTab = new NetworkTabViewModel(config, uiConfig);
BitcoinTab = new BitcoinTabViewModel(config, uiConfig);
}
public GeneralTabViewModel GeneralTab { get; }
public PrivacyTabViewModel PrivacyTab { get; }
public NetworkTabViewModel NetworkTab { get; }
public BitcoinTabViewModel BitcoinTab { get; }
public bool IsModified
{
get => _isModified;
set => this.RaiseAndSetIfChanged(ref _isModified, value);
}
public int SelectedTab
{
get => _selectedTab;
set => this.RaiseAndSetIfChanged(ref _selectedTab, value);
}
public override string IconName => "settings_regular";
private void OnRestartNeeded(object? sender, RestartNeededEventArgs e)
{
IsModified = e.IsRestartNeeded;
}
protected override void OnNavigatedTo(bool inStack, CompositeDisposable disposable)
{
base.OnNavigatedTo(inStack, disposable);
SettingsTabViewModelBase.RestartNeeded += OnRestartNeeded;
disposable.Add(Disposable.Create(() =>
{
SettingsTabViewModelBase.RestartNeeded -= OnRestartNeeded;
}));
}
}
}
|
using System.Reactive.Disposables;
using ReactiveUI;
using Splat;
using WalletWasabi.Fluent.Model;
using WalletWasabi.Fluent.ViewModels.NavBar;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Gui;
namespace WalletWasabi.Fluent.ViewModels.Settings
{
public class SettingsPageViewModel : NavBarItemViewModel
{
private bool _isModified;
private int _selectedTab;
public SettingsPageViewModel(Config config, UiConfig uiConfig)
{
Title = "Settings";
_selectedTab = 0;
GeneralTab = new GeneralTabViewModel(config, uiConfig);
PrivacyTab = new PrivacyTabViewModel(config, uiConfig);
NetworkTab = new NetworkTabViewModel(config, uiConfig);
BitcoinTab = new BitcoinTabViewModel(config, uiConfig);
}
public GeneralTabViewModel GeneralTab { get; }
public PrivacyTabViewModel PrivacyTab { get; }
public NetworkTabViewModel NetworkTab { get; }
public BitcoinTabViewModel BitcoinTab { get; }
public bool IsModified
{
get => _isModified;
set => this.RaiseAndSetIfChanged(ref _isModified, value);
}
public int SelectedTab
{
get => _selectedTab;
set => this.RaiseAndSetIfChanged(ref _selectedTab, value);
}
public override string IconName => "settings_regular";
private void OnRestartNeeded(object? sender, RestartNeededEventArgs e)
{
IsModified = e.IsRestartNeeded;
}
protected override void OnNavigatedTo(bool inStack, CompositeDisposable disposable)
{
base.OnNavigatedTo(inStack, disposable);
SettingsTabViewModelBase.RestartNeeded += OnRestartNeeded;
disposable.Add(Disposable.Create(() =>
{
SettingsTabViewModelBase.RestartNeeded -= OnRestartNeeded;
}));
}
}
}
|
mit
|
C#
|
fd9dc7df3f136a324f766773c3165f64835b5cfd
|
Handle missing files in Noark5-test NumberOfChangesLogged
|
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
|
src/Arkivverket.Arkade/Tests/Noark5/NumberOfChangesLogged.cs
|
src/Arkivverket.Arkade/Tests/Noark5/NumberOfChangesLogged.cs
|
using System;
using System.Collections.Generic;
using Arkivverket.Arkade.Core;
using Arkivverket.Arkade.Core.Noark5;
using Arkivverket.Arkade.ExternalModels.ChangeLog;
using Arkivverket.Arkade.Resources;
using Arkivverket.Arkade.Util;
namespace Arkivverket.Arkade.Tests.Noark5
{
/// <summary>
/// Noark5 - test #42
/// </summary>
public class NumberOfChangesLogged : Noark5XmlReaderBaseTest
{
private readonly Archive _archive;
public NumberOfChangesLogged(Archive archive)
{
_archive = archive;
}
public override string GetName()
{
return Noark5Messages.NumberOfChangesLogged;
}
public override TestType GetTestType()
{
return TestType.ContentAnalysis;
}
protected override List<TestResult> GetTestResults()
{
var testResults = new List<TestResult>();
try
{
var changeLog = SerializeUtil.DeserializeFromFile<endringslogg>(
_archive.WorkingDirectory.Content().WithFile(ArkadeConstants.ChangeLogXmlFileName).FullName
);
int numberOfChangesLogged = changeLog.endring.Length;
testResults.Add(new TestResult(ResultType.Success, new Location(ArkadeConstants.ChangeLogXmlFileName),
string.Format(Noark5Messages.NumberOfChangesLoggedMessage, numberOfChangesLogged)));
}
catch (Exception)
{
testResults.Add(new TestResult(ResultType.Error, new Location(string.Empty),
string.Format(Noark5Messages.FileNotFound, ArkadeConstants.ChangeLogXmlFileName)));
}
return testResults;
}
protected override void ReadStartElementEvent(object sender, ReadElementEventArgs eventArgs)
{
}
protected override void ReadAttributeEvent(object sender, ReadElementEventArgs eventArgs)
{
}
protected override void ReadEndElementEvent(object sender, ReadElementEventArgs eventArgs)
{
}
protected override void ReadElementValueEvent(object sender, ReadElementEventArgs eventArgs)
{
}
}
}
|
using System.Collections.Generic;
using Arkivverket.Arkade.Core;
using Arkivverket.Arkade.Core.Noark5;
using Arkivverket.Arkade.ExternalModels.ChangeLog;
using Arkivverket.Arkade.Resources;
using Arkivverket.Arkade.Util;
namespace Arkivverket.Arkade.Tests.Noark5
{
/// <summary>
/// Noark5 - test #42
/// </summary>
public class NumberOfChangesLogged : Noark5XmlReaderBaseTest
{
private readonly endringslogg _changeLog;
public NumberOfChangesLogged(Archive archive)
{
_changeLog = SerializeUtil.DeserializeFromFile<endringslogg>(
archive.WorkingDirectory.Content().WithFile(ArkadeConstants.ChangeLogXmlFileName).FullName
);
}
public override string GetName()
{
return Noark5Messages.NumberOfChangesLogged;
}
public override TestType GetTestType()
{
return TestType.ContentAnalysis;
}
protected override List<TestResult> GetTestResults()
{
int numberOfChangesLogged = _changeLog.endring.Length;
return new List<TestResult>
{
new TestResult(ResultType.Success, new Location(ArkadeConstants.ChangeLogXmlFileName),
string.Format(Noark5Messages.NumberOfChangesLoggedMessage, numberOfChangesLogged))
};
}
protected override void ReadStartElementEvent(object sender, ReadElementEventArgs eventArgs)
{
}
protected override void ReadAttributeEvent(object sender, ReadElementEventArgs eventArgs)
{
}
protected override void ReadEndElementEvent(object sender, ReadElementEventArgs eventArgs)
{
}
protected override void ReadElementValueEvent(object sender, ReadElementEventArgs eventArgs)
{
}
}
}
|
agpl-3.0
|
C#
|
af45ec43f5f3a77019bff01c0ffecfd3fe8b8f10
|
Update MemoryCachedCurrencyConverterEntryKind.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Finance/Cache/MemoryCachedCurrencyConverterEntryKind.cs
|
TIKSN.Core/Finance/Cache/MemoryCachedCurrencyConverterEntryKind.cs
|
namespace TIKSN.Finance.Cache
{
public enum MemoryCachedCurrencyConverterEntryKind
{
ExchangeRate,
CurrencyPairs
}
}
|
namespace TIKSN.Finance.Cache
{
public enum MemoryCachedCurrencyConverterEntryKind
{
ExchangeRate,
CurrencyPairs
}
}
|
mit
|
C#
|
9793e6ab5cda20d9dda9576f48f8dafaa1a3581c
|
Remove unused using
|
knopki/rabotat-screenshooter
|
Program.cs
|
Program.cs
|
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace rabotat_screenshooter
{
class Program
{
static public string path = "";
static void Main(string[] args)
{
if (args.Length > 0) {
path = args[0];
}
var imageName = Path.Combine(path,
Environment.UserName.ToLower() + "_" +
Environment.UserDomainName.ToLower() + "_" +
Environment.MachineName.ToLower() + "_" +
DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".png");
Image screen = Pranas.ScreenshotCapture.TakeScreenshot();
screen.Save(imageName, ImageFormat.Png);
}
}
}
|
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Diagnostics;
namespace rabotat_screenshooter
{
class Program
{
static public string path = "";
static void Main(string[] args)
{
if (args.Length > 0) {
path = args[0];
}
var imageName = Path.Combine(path,
Environment.UserName.ToLower() + "_" +
Environment.UserDomainName.ToLower() + "_" +
Environment.MachineName.ToLower() + "_" +
DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".png");
Image screen = Pranas.ScreenshotCapture.TakeScreenshot();
screen.Save(imageName, ImageFormat.Png);
}
}
}
|
mit
|
C#
|
7ec405f87e44b59fe825ec330d2abaafcdacefa0
|
Update binding redirects for 0.3.0 builds
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
tooling/Microsoft.VisualStudio.BlazorExtension/Properties/AssemblyInfo.cs
|
tooling/Microsoft.VisualStudio.BlazorExtension/Properties/AssemblyInfo.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.VisualStudio.Shell;
// Add binding redirects for each assembly we ship in VS. This is required so that these assemblies show
// up in the Load context, which means that we can use ServiceHub and other nice things.
//
// The versions here need to match what the build is producing. If you change the version numbers
// for the Blazor assemblies, this needs to change as well.
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.AspNetCore.Blazor.AngleSharp",
GenerateCodeBase = true,
PublicKeyToken = "",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "0.9.9.0",
NewVersion = "0.9.9.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.AspNetCore.Blazor.Razor.Extensions",
GenerateCodeBase = true,
PublicKeyToken = "",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "0.3.0.0",
NewVersion = "0.3.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.VisualStudio.LanguageServices.Blazor",
GenerateCodeBase = true,
PublicKeyToken = "",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "0.3.0.0",
NewVersion = "0.3.0.0")]
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.VisualStudio.Shell;
// Add binding redirects for each assembly we ship in VS. This is required so that these assemblies show
// up in the Load context, which means that we can use ServiceHub and other nice things.
//
// The versions here need to match what the build is producing. If you change the version numbers
// for the Blazor assemblies, this needs to change as well.
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.AspNetCore.Blazor.AngleSharp",
GenerateCodeBase = true,
PublicKeyToken = "",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "0.9.9.0",
NewVersion = "0.9.9.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.AspNetCore.Blazor.Razor.Extensions",
GenerateCodeBase = true,
PublicKeyToken = "",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "0.2.0.0",
NewVersion = "0.2.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.VisualStudio.LanguageServices.Blazor",
GenerateCodeBase = true,
PublicKeyToken = "",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "0.2.0.0",
NewVersion = "0.2.0.0")]
|
apache-2.0
|
C#
|
ed637bc26e8895c5f1efc83408527960ee8542b1
|
Hide taiko swell ticks (#5950)
|
peppy/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,EVAST9919/osu,johnneijzen/osu,2yangk23/osu,NeoAdonis/osu,ZLima12/osu,smoogipoo/osu,ZLima12/osu,EVAST9919/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,johnneijzen/osu,ppy/osu,peppy/osu-new,smoogipooo/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,2yangk23/osu
|
osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs
|
osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.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;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableSwellTick : DrawableTaikoHitObject<SwellTick>
{
public override bool DisplayResult => false;
public DrawableSwellTick(SwellTick hitObject)
: base(hitObject)
{
}
protected override void UpdateInitialTransforms() => this.FadeOut();
public void TriggerResult(HitResult type)
{
HitObject.StartTime = Time.Current;
ApplyResult(r => r.Type = type);
}
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
}
public override bool OnPressed(TaikoAction action) => false;
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableSwellTick : DrawableTaikoHitObject<SwellTick>
{
public override bool DisplayResult => false;
public DrawableSwellTick(SwellTick hitObject)
: base(hitObject)
{
}
public void TriggerResult(HitResult type)
{
HitObject.StartTime = Time.Current;
ApplyResult(r => r.Type = type);
}
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
}
public override bool OnPressed(TaikoAction action) => false;
}
}
|
mit
|
C#
|
a854b502a89311968d48f20e44d7a115142e82ed
|
Use ConfigureAwait(false) to work correct on UI
|
Selz/PexelsNet
|
PexelsNet/PexelsClient.cs
|
PexelsNet/PexelsClient.cs
|
using System;
using System.Net.Http;
using Newtonsoft.Json;
using System.Threading.Tasks;
namespace PexelsNet
{
public class PexelsClient
{
private readonly string _apiKey;
private const string BaseUrl = "http://api.pexels.com/v1/";
public PexelsClient(string apiKey)
{
_apiKey = apiKey;
}
private HttpClient InitHttpClient()
{
var client = new HttpClient();
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", _apiKey);
return client;
}
public async Task<Page> SearchAsync(string query, int page = 1, int perPage = 15)
{
var client = InitHttpClient();
HttpResponseMessage response = await client.GetAsync(BaseUrl + "search?query=" + Uri.EscapeDataString(query) + "&per_page=" + perPage + "&page=" + page);
return await GetResultAsync(response).ConfigureAwait(false);
}
public async Task<Page> PopularAsync(int page = 1, int perPage = 15)
{
var client = InitHttpClient();
HttpResponseMessage response = await client.GetAsync(BaseUrl + "popular?per_page=" + perPage + "&page=" + page).ConfigureAwait(false);
return await GetResultAsync(response).ConfigureAwait(false);
}
private static async Task<Page> GetResultAsync(HttpResponseMessage response)
{
var body = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
response.EnsureSuccessStatusCode();
if (response.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<Page>(body);
}
throw new PexelsNetException(response.StatusCode, body);
}
}
}
|
using System;
using System.Net.Http;
using Newtonsoft.Json;
using System.Threading.Tasks;
namespace PexelsNet
{
public class PexelsClient
{
private readonly string _apiKey;
private const string BaseUrl = "http://api.pexels.com/v1/";
public PexelsClient(string apiKey)
{
_apiKey = apiKey;
}
private HttpClient InitHttpClient()
{
var client = new HttpClient();
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", _apiKey);
return client;
}
public async Task<Page> SearchAsync(string query, int page = 1, int perPage = 15)
{
var client = InitHttpClient();
HttpResponseMessage response = await client.GetAsync(BaseUrl + "search?query=" + Uri.EscapeDataString(query) + "&per_page=" + perPage + "&page=" + page);
return await GetResultAsync(response);
}
public async Task<Page> PopularAsync(int page = 1, int perPage = 15)
{
var client = InitHttpClient();
HttpResponseMessage response = await client.GetAsync(BaseUrl + "popular?per_page=" + perPage + "&page=" + page);
return await GetResultAsync(response);
}
private static async Task<Page> GetResultAsync(HttpResponseMessage response)
{
var body = await response.Content.ReadAsStringAsync();
response.EnsureSuccessStatusCode();
if (response.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<Page>(body);
}
throw new PexelsNetException(response.StatusCode, body);
}
}
}
|
mit
|
C#
|
948dac8af429d91f9c6a6a6e491a2ce04fbf5443
|
Use cross platform compatible paths for debug run.
|
polyethene/IronAHK,michaltakac/IronAHK,michaltakac/IronAHK,yatsek/IronAHK,michaltakac/IronAHK,yatsek/IronAHK,michaltakac/IronAHK,yatsek/IronAHK,yatsek/IronAHK,michaltakac/IronAHK,polyethene/IronAHK,polyethene/IronAHK,polyethene/IronAHK,yatsek/IronAHK
|
IronAHK/Debug.cs
|
IronAHK/Debug.cs
|
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
namespace IronAHK
{
partial class Program
{
const bool debug =
#if DEBUG
true
#else
false
#endif
;
[Conditional("DEBUG"), DllImport("kernel32.dll")]
static extern void AllocConsole();
[Conditional("DEBUG")]
static void Start(ref string[] args)
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
AllocConsole();
const string source = "..{0}..{0}..{0}Tests{0}Code{0}isolated.ahk";
const string binary = "test.exe";
args = string.Format(source + " --out " + binary, Path.DirectorySeparatorChar).Split(' ');
}
}
}
|
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
namespace IronAHK
{
partial class Program
{
const bool debug =
#if DEBUG
true
#else
false
#endif
;
[Conditional("DEBUG"), DllImport("kernel32.dll")]
static extern void AllocConsole();
[Conditional("DEBUG")]
static void Start(ref string[] args)
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
AllocConsole();
args = new[] { string.Format("..{0}..{0}..{0}Tests{0}Code{0}isolated.ahk", Path.DirectorySeparatorChar), "/out", "test.exe" };
}
}
}
|
bsd-2-clause
|
C#
|
c3bf6a0287c16682e71a750728c40cfc2a99b06f
|
Remove weird vestigial `Current` reimplementation
|
smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,UselessToucan/osu,peppy/osu-new,ppy/osu,peppy/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu
|
osu.Game/Skinning/LegacyScoreCounter.cs
|
osu.Game/Skinning/LegacyScoreCounter.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;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Play.HUD;
using osuTK;
namespace osu.Game.Skinning
{
public class LegacyScoreCounter : GameplayScoreCounter, ISkinnableComponent
{
private readonly ISkin skin;
protected override double RollingDuration => 1000;
protected override Easing RollingEasing => Easing.Out;
public LegacyScoreCounter(ISkin skin)
: base(6)
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
this.skin = skin;
Scale = new Vector2(0.96f);
Margin = new MarginPadding(10);
}
protected sealed override OsuSpriteText CreateSpriteText() => new LegacySpriteText(skin, LegacyFont.Score)
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
};
}
}
|
// 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.Bindables;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Play.HUD;
using osuTK;
namespace osu.Game.Skinning
{
public class LegacyScoreCounter : GameplayScoreCounter, ISkinnableComponent
{
private readonly ISkin skin;
protected override double RollingDuration => 1000;
protected override Easing RollingEasing => Easing.Out;
public new Bindable<double> Current { get; } = new Bindable<double>();
public LegacyScoreCounter(ISkin skin)
: base(6)
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
this.skin = skin;
// base class uses int for display, but externally we bind to ScoreProcessor as a double for now.
Current.BindValueChanged(v => base.Current.Value = (int)v.NewValue);
Scale = new Vector2(0.96f);
Margin = new MarginPadding(10);
}
protected sealed override OsuSpriteText CreateSpriteText() => new LegacySpriteText(skin, LegacyFont.Score)
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
};
}
}
|
mit
|
C#
|
277e925239e7d9a27e977970f1d33b227dac4f73
|
Use full URI rather than CURIE for property type
|
BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB
|
samples/Samples/Embedded/EntityFramework/FoafCore/IPerson.cs
|
samples/Samples/Embedded/EntityFramework/FoafCore/IPerson.cs
|
using System.Collections.Generic;
using BrightstarDB.EntityFramework;
namespace BrightstarDB.Samples.EntityFramework.FoafCore
{
[Entity("http://xmlns.com/foaf/0.1/Person")]
public interface IPerson
{
[Identifier("http://www.brightstardb.com/people/")]
string Id { get; }
[PropertyType("http://xmlns.com/foaf/0.1/nick")]
string Nickname { get; set; }
[PropertyType("http://xmlns.com/foaf/0.1/name")]
string Name { get; set; }
[PropertyType("http://xmlns.com/foaf/0.1/Organization")]
string Organisation { get; set; }
[PropertyType("http://xmlns.com/foaf/0.1/knows")]
ICollection<IPerson> Knows { get; set; }
[InversePropertyType("http://xmlns.com/foaf/0.1/knows")]
ICollection<IPerson> KnownBy { get; set; }
}
}
|
using System.Collections.Generic;
using BrightstarDB.EntityFramework;
namespace BrightstarDB.Samples.EntityFramework.FoafCore
{
[Entity("http://xmlns.com/foaf/0.1/Person")]
public interface IPerson
{
[Identifier("http://www.brightstardb.com/people/")]
string Id { get; }
[PropertyType("foaf:nick")]
string Nickname { get; set; }
[PropertyType("foaf:name")]
string Name { get; set; }
[PropertyType("foaf:Organization")]
string Organisation { get; set; }
[PropertyType("foaf:knows")]
ICollection<IPerson> Knows { get; set; }
[InversePropertyType("foaf:knows")]
ICollection<IPerson> KnownBy { get; set; }
}
}
|
mit
|
C#
|
f0625fb55adff57e75e30d74dfd8cfc5156635cf
|
Test broken by QueryWrapper.ShouldContain issue
|
Novakov/Nancy,EIrwin/Nancy,horsdal/Nancy,fly19890211/Nancy,AlexPuiu/Nancy,cgourlay/Nancy,khellang/Nancy,asbjornu/Nancy,phillip-haydon/Nancy,kekekeks/Nancy,phillip-haydon/Nancy,sloncho/Nancy,jongleur1983/Nancy,phillip-haydon/Nancy,jongleur1983/Nancy,tparnell8/Nancy,sroylance/Nancy,anton-gogolev/Nancy,AcklenAvenue/Nancy,adamhathcock/Nancy,jchannon/Nancy,xt0rted/Nancy,AIexandr/Nancy,ayoung/Nancy,tparnell8/Nancy,damianh/Nancy,cgourlay/Nancy,sadiqhirani/Nancy,NancyFx/Nancy,jonathanfoster/Nancy,AIexandr/Nancy,VQComms/Nancy,EIrwin/Nancy,JoeStead/Nancy,guodf/Nancy,albertjan/Nancy,jmptrader/Nancy,hitesh97/Nancy,thecodejunkie/Nancy,joebuschmann/Nancy,albertjan/Nancy,nicklv/Nancy,davidallyoung/Nancy,rudygt/Nancy,AIexandr/Nancy,fly19890211/Nancy,tsdl2013/Nancy,thecodejunkie/Nancy,wtilton/Nancy,SaveTrees/Nancy,NancyFx/Nancy,lijunle/Nancy,tparnell8/Nancy,duszekmestre/Nancy,AlexPuiu/Nancy,tareq-s/Nancy,rudygt/Nancy,davidallyoung/Nancy,vladlopes/Nancy,AcklenAvenue/Nancy,JoeStead/Nancy,felipeleusin/Nancy,grumpydev/Nancy,hitesh97/Nancy,Worthaboutapig/Nancy,felipeleusin/Nancy,davidallyoung/Nancy,nicklv/Nancy,JoeStead/Nancy,asbjornu/Nancy,anton-gogolev/Nancy,daniellor/Nancy,ccellar/Nancy,thecodejunkie/Nancy,Worthaboutapig/Nancy,jonathanfoster/Nancy,dbabox/Nancy,danbarua/Nancy,kekekeks/Nancy,grumpydev/Nancy,SaveTrees/Nancy,hitesh97/Nancy,dbabox/Nancy,murador/Nancy,Crisfole/Nancy,felipeleusin/Nancy,asbjornu/Nancy,malikdiarra/Nancy,thecodejunkie/Nancy,VQComms/Nancy,tsdl2013/Nancy,charleypeng/Nancy,malikdiarra/Nancy,vladlopes/Nancy,NancyFx/Nancy,malikdiarra/Nancy,dbolkensteyn/Nancy,Worthaboutapig/Nancy,joebuschmann/Nancy,danbarua/Nancy,vladlopes/Nancy,phillip-haydon/Nancy,jchannon/Nancy,NancyFx/Nancy,charleypeng/Nancy,blairconrad/Nancy,jeff-pang/Nancy,murador/Nancy,jeff-pang/Nancy,AIexandr/Nancy,charleypeng/Nancy,Novakov/Nancy,AlexPuiu/Nancy,danbarua/Nancy,sadiqhirani/Nancy,ccellar/Nancy,jonathanfoster/Nancy,dbolkensteyn/Nancy,sadiqhirani/Nancy,adamhathcock/Nancy,MetSystem/Nancy,sroylance/Nancy,EliotJones/NancyTest,jongleur1983/Nancy,jchannon/Nancy,daniellor/Nancy,MetSystem/Nancy,jeff-pang/Nancy,lijunle/Nancy,AcklenAvenue/Nancy,duszekmestre/Nancy,duszekmestre/Nancy,cgourlay/Nancy,Worthaboutapig/Nancy,EIrwin/Nancy,SaveTrees/Nancy,EIrwin/Nancy,VQComms/Nancy,AIexandr/Nancy,tareq-s/Nancy,dbabox/Nancy,joebuschmann/Nancy,nicklv/Nancy,albertjan/Nancy,sloncho/Nancy,damianh/Nancy,sroylance/Nancy,VQComms/Nancy,horsdal/Nancy,adamhathcock/Nancy,ayoung/Nancy,murador/Nancy,rudygt/Nancy,jmptrader/Nancy,duszekmestre/Nancy,albertjan/Nancy,murador/Nancy,sloncho/Nancy,kekekeks/Nancy,anton-gogolev/Nancy,guodf/Nancy,felipeleusin/Nancy,JoeStead/Nancy,jongleur1983/Nancy,dbolkensteyn/Nancy,EliotJones/NancyTest,ccellar/Nancy,grumpydev/Nancy,xt0rted/Nancy,sadiqhirani/Nancy,rudygt/Nancy,AlexPuiu/Nancy,wtilton/Nancy,dbabox/Nancy,dbolkensteyn/Nancy,wtilton/Nancy,asbjornu/Nancy,tparnell8/Nancy,ayoung/Nancy,ccellar/Nancy,khellang/Nancy,Crisfole/Nancy,vladlopes/Nancy,xt0rted/Nancy,asbjornu/Nancy,khellang/Nancy,Novakov/Nancy,blairconrad/Nancy,jchannon/Nancy,blairconrad/Nancy,charleypeng/Nancy,hitesh97/Nancy,Novakov/Nancy,tareq-s/Nancy,jmptrader/Nancy,jmptrader/Nancy,jonathanfoster/Nancy,cgourlay/Nancy,lijunle/Nancy,horsdal/Nancy,daniellor/Nancy,davidallyoung/Nancy,MetSystem/Nancy,blairconrad/Nancy,lijunle/Nancy,Crisfole/Nancy,khellang/Nancy,ayoung/Nancy,danbarua/Nancy,AcklenAvenue/Nancy,tsdl2013/Nancy,jeff-pang/Nancy,nicklv/Nancy,joebuschmann/Nancy,xt0rted/Nancy,EliotJones/NancyTest,sroylance/Nancy,fly19890211/Nancy,guodf/Nancy,damianh/Nancy,VQComms/Nancy,charleypeng/Nancy,SaveTrees/Nancy,guodf/Nancy,jchannon/Nancy,davidallyoung/Nancy,tsdl2013/Nancy,anton-gogolev/Nancy,MetSystem/Nancy,horsdal/Nancy,tareq-s/Nancy,grumpydev/Nancy,EliotJones/NancyTest,malikdiarra/Nancy,wtilton/Nancy,fly19890211/Nancy,sloncho/Nancy,adamhathcock/Nancy,daniellor/Nancy
|
src/Nancy.Testing.Tests/BrowserResponseBodyWrapperFixture.cs
|
src/Nancy.Testing.Tests/BrowserResponseBodyWrapperFixture.cs
|
namespace Nancy.Testing.Tests
{
using System.IO;
using System.Linq;
using System.Text;
using Nancy;
using Nancy.Tests;
using Xunit;
public class BrowserResponseBodyWrapperFixture
{
[Fact]
public void Should_contain_response_body()
{
// Given
var body = new BrowserResponseBodyWrapper(new Response
{
Contents = stream =>
{
var writer = new StreamWriter(stream);
writer.Write("This is the content");
writer.Flush();
}
});
var content = Encoding.ASCII.GetBytes("This is the content");
// When
var result = body.SequenceEqual(content);
// Then
result.ShouldBeTrue();
}
[Fact]
public void Should_return_querywrapper_for_css_selector_match()
{
// Given
var body = new BrowserResponseBodyWrapper(new Response
{
Contents = stream =>
{
var writer = new StreamWriter(stream);
writer.Write("<div>Outer and <div id='bar'>inner</div></div>");
writer.Flush();
}
});
// When
var result = body["#bar"];
// Then
#if __MonoCS__
AssertExtensions.ShouldContain(result, "inner", System.StringComparison.OrdinalIgnoreCase);
#else
result.ShouldContain("inner");
#endif
}
}
}
|
namespace Nancy.Testing.Tests
{
using System.IO;
using System.Linq;
using System.Text;
using Nancy;
using Nancy.Tests;
using Xunit;
public class BrowserResponseBodyWrapperFixture
{
[Fact]
public void Should_contain_response_body()
{
// Given
var body = new BrowserResponseBodyWrapper(new Response
{
Contents = stream =>
{
var writer = new StreamWriter(stream);
writer.Write("This is the content");
writer.Flush();
}
});
var content = Encoding.ASCII.GetBytes("This is the content");
// When
var result = body.SequenceEqual(content);
// Then
result.ShouldBeTrue();
}
[Fact]
public void Should_return_querywrapper_for_css_selector_match()
{
// Given
var body = new BrowserResponseBodyWrapper(new Response
{
Contents = stream =>
{
var writer = new StreamWriter(stream);
writer.Write("<div>Outer and <div id='#bar'>inner</div></div>");
writer.Flush();
}
});
// When
var result = body["#bar"];
// Then
#if __MonoCS__
AssertExtensions.ShouldContain(result, "inner", System.StringComparison.OrdinalIgnoreCase);
#else
result.ShouldContain("inner");
#endif
}
}
}
|
mit
|
C#
|
4d85137e2c6348b2e6e2ffb0219b0669f833af66
|
remove redundant using
|
saturn72/saturn72
|
src/NetCore/Saturn72.Core.Services/Events/IEventPublisher.cs
|
src/NetCore/Saturn72.Core.Services/Events/IEventPublisher.cs
|
using System.Threading;
namespace Saturn72.Core.Services.Events
{
public interface IEventPublisher
{
void Publish<TEvent>(TEvent eventMessage) where TEvent : EventBase;
void PublishAsync<TEvent>(TEvent eventMessage, CancellationToken cancelationToken) where TEvent : EventBase;
}
}
|
using System.Threading;
using System.Threading.Tasks;
namespace Saturn72.Core.Services.Events
{
public interface IEventPublisher
{
void Publish<TEvent>(TEvent eventMessage) where TEvent : EventBase;
void PublishAsync<TEvent>(TEvent eventMessage, CancellationToken cancelationToken) where TEvent : EventBase;
}
}
|
mit
|
C#
|
ecbf9a77061aac89cebff489e6e0ff6efa1cca14
|
Fix build
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content
|
Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs
|
Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs
|
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.Components.Weapon.Melee;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Random;
namespace Content.Server.GameObjects.Components.Mining
{
[RegisterComponent]
public class AsteroidRockComponent : Component, IAttackBy
{
public override string Name => "AsteroidRock";
private static readonly string[] SpriteStates = {"0", "1", "2", "3", "4"};
#pragma warning disable 649
[Dependency] private readonly IRobustRandom _random;
#pragma warning restore 649
public override void Initialize()
{
base.Initialize();
var spriteComponent = Owner.GetComponent<SpriteComponent>();
spriteComponent.LayerSetState(0, _random.Pick(SpriteStates));
}
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
{
var item = eventArgs.AttackWith;
if (!item.TryGetComponent(out MeleeWeaponComponent meleeWeaponComponent)) return false;
Owner.GetComponent<DamageableComponent>().TakeDamage(DamageType.Brute, meleeWeaponComponent.Damage);
if (!item.TryGetComponent(out PickaxeComponent pickaxeComponent)) return true;
if (!string.IsNullOrWhiteSpace(pickaxeComponent.MiningSound) &&
item.TryGetComponent<SoundComponent>(out var soundComponent))
{
soundComponent.Play(pickaxeComponent.MiningSound, AudioParams.Default);
}
return true;
}
}
}
|
using System;
using System.Runtime.InteropServices;
using Content.Server.GameObjects.Components.Sound;
using Content.Server.GameObjects.Components.Weapon.Melee;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Renderable;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
namespace Content.Server.GameObjects.Components.Mining
{
[RegisterComponent]
public class AsteroidRockComponent : Component, IAttackBy
{
public override string Name => "AsteroidRock";
private static readonly string[] SpriteStates = {"0", "1", "2", "3", "4"};
public override void Initialize()
{
base.Initialize();
var spriteComponent = Owner.GetComponent<SpriteComponent>();
var random = new Random(Owner.Uid.GetHashCode() ^ DateTime.Now.GetHashCode());
spriteComponent.LayerSetState(0, random.Pick(SpriteStates));
}
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
{
var item = eventArgs.AttackWith;
if (!item.TryGetComponent(out MeleeWeaponComponent meleeWeaponComponent)) return false;
Owner.GetComponent<DamageableComponent>().TakeDamage(DamageType.Brute, meleeWeaponComponent.Damage);
if (!item.TryGetComponent(out PickaxeComponent pickaxeComponent)) return true;
if (!string.IsNullOrWhiteSpace(pickaxeComponent.MiningSound) &&
item.TryGetComponent<SoundComponent>(out var soundComponent))
{
soundComponent.Play(pickaxeComponent.MiningSound, AudioParams.Default);
}
return true;
}
}
}
|
mit
|
C#
|
c4b9703a02bcdf4fd39aa53e63f1c3057ea1fd12
|
Remove warning
|
mono/cecil,fnajera-rac-de/cecil,sailro/cecil,jbevain/cecil,SiliconStudio/Mono.Cecil
|
rocks/Test/Mono.Cecil.Tests/SecurityDeclarationRocksTests.cs
|
rocks/Test/Mono.Cecil.Tests/SecurityDeclarationRocksTests.cs
|
using System.Security.Permissions;
using NUnit.Framework;
using Mono.Cecil.Rocks;
namespace Mono.Cecil.Tests {
[TestFixture]
public class SecurityDeclarationRocksTests : BaseTestFixture {
[Test]
public void ToPermissionSetFromPermissionSetAttribute ()
{
TestModule ("decsec-xml.dll", module => {
var type = module.GetType ("SubLibrary");
Assert.IsTrue (type.HasSecurityDeclarations);
Assert.AreEqual (1, type.SecurityDeclarations.Count);
var declaration = type.SecurityDeclarations [0];
var permission_set = declaration.ToPermissionSet ();
Assert.IsNotNull (permission_set);
string permission_set_value = "<PermissionSet class=\"System.Security.PermissionSe"
+ "t\"\r\nversion=\"1\">\r\n<IPermission class=\"{0}\"\r\nversion=\"1\"\r\nFla"
+ "gs=\"UnmanagedCode\"/>\r\n</PermissionSet>\r\n";
permission_set_value = string.Format (permission_set_value, typeof (SecurityPermission).AssemblyQualifiedName);
Assert.AreEqual (Normalize (permission_set_value), Normalize (permission_set.ToXml ().ToString ()));
});
}
[Test]
public void ToPermissionSetFromSecurityAttribute ()
{
TestModule ("decsec-att.dll", module => {
var type = module.GetType ("SubLibrary");
Assert.IsTrue (type.HasSecurityDeclarations);
Assert.AreEqual (1, type.SecurityDeclarations.Count);
var declaration = type.SecurityDeclarations [0];
var permission_set = declaration.ToPermissionSet ();
Assert.IsNotNull (permission_set);
string permission_set_value = "<PermissionSet class=\"System.Security.PermissionSe"
+ "t\"\r\nversion=\"1\">\r\n<IPermission class=\"{0}\"\r\nversion=\"1\"\r\nFla"
+ "gs=\"UnmanagedCode\"/>\r\n</PermissionSet>\r\n";
permission_set_value = string.Format (permission_set_value, typeof (SecurityPermission).AssemblyQualifiedName);
Assert.AreEqual (Normalize (permission_set_value), Normalize (permission_set.ToXml ().ToString ()));
});
}
}
}
|
using System.Security.Permissions;
using NUnit.Framework;
using Mono.Cecil.Rocks;
namespace Mono.Cecil.Tests {
[TestFixture]
public class SecurityDeclarationRocksTests : BaseTestFixture {
[Test]
public void ToPermissionSetFromPermissionSetAttribute ()
{
TestModule ("decsec-xml.dll", module => {
var type = module.GetType ("SubLibrary");
Assert.IsTrue (type.HasSecurityDeclarations);
Assert.AreEqual (1, type.SecurityDeclarations.Count);
var declaration = type.SecurityDeclarations [0];
var permission_set = declaration.ToPermissionSet ();
Assert.IsNotNull (permission_set);
string permission_set_value = "<PermissionSet class=\"System.Security.PermissionSe"
+ "t\"\r\nversion=\"1\">\r\n<IPermission class=\"{0}\"\r\nversion=\"1\"\r\nFla"
+ "gs=\"UnmanagedCode\"/>\r\n</PermissionSet>\r\n";
permission_set_value = string.Format (permission_set_value, typeof (SecurityPermission).AssemblyQualifiedName);
Assert.AreEqual (Normalize (permission_set_value), Normalize (permission_set.ToXml ().ToString ()));
});
}
[Test]
public void ToPermissionSetFromSecurityAttribute ()
{
TestModule ("decsec-att.dll", module => {
var type = module.GetType ("SubLibrary");
Assert.IsTrue (type.HasSecurityDeclarations);
Assert.AreEqual (1, type.SecurityDeclarations.Count);
var declaration = type.SecurityDeclarations [0];
var permission_set = declaration.ToPermissionSet ();
Assert.IsNotNull (permission_set);
string permission_set_value = "<PermissionSet class=\"System.Security.PermissionSe"
+ "t\"\r\nversion=\"1\">\r\n<IPermission class=\"{0}\"\r\nversion=\"1\"\r\nFla"
+ "gs=\"UnmanagedCode\"/>\r\n</PermissionSet>\r\n";
permission_set_value = string.Format (permission_set_value, typeof (SecurityPermission).AssemblyQualifiedName);
Assert.AreEqual (Normalize (permission_set_value), Normalize (permission_set.ToXml ().ToString ()));
});
}
static string Normalize (string s)
{
return s.Replace ("\n", "").Replace ("\r", "");
}
}
}
|
mit
|
C#
|
683087d55c85a52e1928ab249a16f303f431f784
|
remove unused code fron SniffingConnectionPool, already marked obsolete in 5.x
|
elastic/elasticsearch-net,elastic/elasticsearch-net,CSGOpenSource/elasticsearch-net,CSGOpenSource/elasticsearch-net,CSGOpenSource/elasticsearch-net
|
src/Elasticsearch.Net/ConnectionPool/SniffingConnectionPool.cs
|
src/Elasticsearch.Net/ConnectionPool/SniffingConnectionPool.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Elasticsearch.Net
{
public class SniffingConnectionPool : StaticConnectionPool
{
private readonly ReaderWriterLockSlim _readerWriter = new ReaderWriterLockSlim();
/// <inheritdoc/>
public override bool SupportsReseeding => true;
/// <inheritdoc/>
public override bool SupportsPinging => true;
public SniffingConnectionPool(IEnumerable<Uri> uris, bool randomize = true, IDateTimeProvider dateTimeProvider = null)
: base(uris, randomize, dateTimeProvider)
{ }
public SniffingConnectionPool(IEnumerable<Node> nodes, bool randomize = true, IDateTimeProvider dateTimeProvider = null)
: base(nodes, randomize, dateTimeProvider)
{ }
/// <inheritdoc/>
public override IReadOnlyCollection<Node> Nodes
{
get
{
try
{
//since internalnodes can be changed after returning we return
//a completely new list of cloned nodes
this._readerWriter.EnterReadLock();
return this.InternalNodes.Select(n => n.Clone()).ToList();
}
finally
{
this._readerWriter.ExitReadLock();
}
}
}
/// <inheritdoc/>
public override void Reseed(IEnumerable<Node> nodes)
{
if (!nodes.HasAny()) return;
try
{
this._readerWriter.EnterWriteLock();
var sortedNodes = nodes
.OrderBy(item => this.Randomize ? this.Random.Next() : 1)
.DistinctBy(n => n.Uri)
.ToList();
this.InternalNodes = sortedNodes;
this.GlobalCursor = -1;
this.LastUpdate = this.DateTimeProvider.Now();
}
finally
{
this._readerWriter.ExitWriteLock();
}
}
/// <inheritdoc/>
public override IEnumerable<Node> CreateView(Action<AuditEvent, Node> audit = null)
{
this._readerWriter.EnterReadLock();
try
{
return base.CreateView(audit);
}
finally
{
this._readerWriter.ExitReadLock();
}
}
protected override void DisposeManagedResources()
{
this._readerWriter?.Dispose();
base.DisposeManagedResources();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Elasticsearch.Net
{
public class SniffingConnectionPool : StaticConnectionPool
{
private readonly ReaderWriterLockSlim _readerWriter = new ReaderWriterLockSlim();
/// <inheritdoc/>
public override bool SupportsReseeding => true;
/// <inheritdoc/>
public override bool SupportsPinging => true;
public SniffingConnectionPool(IEnumerable<Uri> uris, bool randomize = true, IDateTimeProvider dateTimeProvider = null)
: base(uris, randomize, dateTimeProvider)
{ }
public SniffingConnectionPool(IEnumerable<Node> nodes, bool randomize = true, IDateTimeProvider dateTimeProvider = null)
: base(nodes, randomize, dateTimeProvider)
{ }
public SniffingConnectionPool(IEnumerable<Node> nodes, Func<Node, bool> predicate, bool randomize = true, IDateTimeProvider dateTimeProvider = null)
: base(nodes, randomize, dateTimeProvider)
{ }
private static bool DefaultPredicate(Node node) => !node.MasterOnlyNode;
/// <inheritdoc/>
public override IReadOnlyCollection<Node> Nodes
{
get
{
try
{
//since internalnodes can be changed after returning we return
//a completely new list of cloned nodes
this._readerWriter.EnterReadLock();
return this.InternalNodes.Select(n => n.Clone()).ToList();
}
finally
{
this._readerWriter.ExitReadLock();
}
}
}
/// <inheritdoc/>
public override void Reseed(IEnumerable<Node> nodes)
{
if (!nodes.HasAny()) return;
try
{
this._readerWriter.EnterWriteLock();
var sortedNodes = nodes
.OrderBy(item => this.Randomize ? this.Random.Next() : 1)
.DistinctBy(n => n.Uri)
.ToList();
this.InternalNodes = sortedNodes;
this.GlobalCursor = -1;
this.LastUpdate = this.DateTimeProvider.Now();
}
finally
{
this._readerWriter.ExitWriteLock();
}
}
/// <inheritdoc/>
public override IEnumerable<Node> CreateView(Action<AuditEvent, Node> audit = null)
{
this._readerWriter.EnterReadLock();
try
{
return base.CreateView(audit);
}
finally
{
this._readerWriter.ExitReadLock();
}
}
protected override void DisposeManagedResources()
{
this._readerWriter?.Dispose();
base.DisposeManagedResources();
}
}
}
|
apache-2.0
|
C#
|
9c0c6f7efc2941d332e00d76b2c5e0d7e0f55387
|
fix sub-menus win32 trayicons
|
grokys/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,Perspex/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia
|
src/Windows/Avalonia.Win32/Win32NativeToManagedMenuExporter.cs
|
src/Windows/Avalonia.Win32/Win32NativeToManagedMenuExporter.cs
|
using System.Collections.Generic;
using Avalonia.Controls;
using Avalonia.Controls.Platform;
#nullable enable
namespace Avalonia.Win32
{
internal class Win32NativeToManagedMenuExporter : INativeMenuExporter
{
private NativeMenu? _nativeMenu;
public void SetNativeMenu(NativeMenu nativeMenu)
{
_nativeMenu = nativeMenu;
}
private IEnumerable<MenuItem>? Populate (NativeMenu nativeMenu)
{
var items = new List<MenuItem>();
foreach (var menuItem in nativeMenu.Items)
{
if (menuItem is NativeMenuItemSeparator separator)
{
items.Add(new MenuItem { Header = "-" });
}
else if (menuItem is NativeMenuItem item)
{
var newItem = new MenuItem { Header = item.Header, Icon = item.Icon, Command = item.Command, CommandParameter = item.CommandParameter };
if(item.Menu != null)
{
newItem.Items = Populate(item.Menu);
}
else if (item.HasClickHandlers && item is INativeMenuItemExporterEventsImplBridge bridge)
{
newItem.Click += (s, e) => bridge.RaiseClicked();
}
items.Add(newItem);
}
}
return items;
}
public IEnumerable<MenuItem>? GetMenu ()
{
if(_nativeMenu != null)
{
return Populate(_nativeMenu);
}
return null;
}
}
}
|
using System.Collections.Generic;
using Avalonia.Controls;
using Avalonia.Controls.Platform;
#nullable enable
namespace Avalonia.Win32
{
internal class Win32NativeToManagedMenuExporter : INativeMenuExporter
{
private NativeMenu? _nativeMenu;
public void SetNativeMenu(NativeMenu nativeMenu)
{
_nativeMenu = nativeMenu;
}
private IEnumerable<MenuItem>? Populate (NativeMenu nativeMenu)
{
var items = new List<MenuItem>();
foreach (var menuItem in nativeMenu.Items)
{
if (menuItem is NativeMenuItemSeparator separator)
{
items.Add(new MenuItem { Header = "-" });
}
else if (menuItem is NativeMenuItem item)
{
var newItem = new MenuItem { Header = item.Header, Icon = item.Icon, Command = item.Command, CommandParameter = item.CommandParameter };
if(item.Menu != null)
{
newItem.ContextMenu = new ContextMenu() { Items = Populate(item.Menu) };
}
else if (item.HasClickHandlers && item is INativeMenuItemExporterEventsImplBridge bridge)
{
newItem.Click += (s, e) => bridge.RaiseClicked();
}
items.Add(newItem);
}
}
return items;
}
public IEnumerable<MenuItem>? GetMenu ()
{
if(_nativeMenu != null)
{
return Populate(_nativeMenu);
}
return null;
}
}
}
|
mit
|
C#
|
ab74ee13a1efd79b08e6a7d28db22b99b72166aa
|
Fix test error
|
adamped/exrin,exrin/Exrin,exrin/Exrin
|
Exrin/Exrin.Framework.Tests/Helper/NavigationService.cs
|
Exrin/Exrin.Framework.Tests/Helper/NavigationService.cs
|
using Exrin.Abstraction;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Exrin.Framework.Tests.Helper
{
public class NavigationService : INavigationService
{
public Task GoBack()
{
throw new NotImplementedException();
}
public Task GoBack(object parameter)
{
throw new NotImplementedException();
}
public void Init(INavigationContainer page, bool showNavigationBar)
{
throw new NotImplementedException();
}
public void Map(string key, Type viewType, Type viewModelType)
{
throw new NotImplementedException();
}
public Task Navigate(string pageKey)
{
throw new NotImplementedException();
}
public Task Navigate(string pageKey, object args)
{
throw new NotImplementedException();
}
}
}
|
using Exrin.Abstraction;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Exrin.Framework.Tests.Helper
{
public class NavigationService : INavigationService
{
public Task GoBack()
{
throw new NotImplementedException();
}
public Task GoBack(object parameter)
{
throw new NotImplementedException();
}
public void Init(INavigationContainer page)
{
throw new NotImplementedException();
}
public void Map(string key, Type viewType, Type viewModelType)
{
throw new NotImplementedException();
}
public Task Navigate(string pageKey)
{
throw new NotImplementedException();
}
public Task Navigate(string pageKey, object args)
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
5108dadfbc0d7fb8aeb0139a993bd40bf05f7ff2
|
use inline code in markdown text flow
|
smoogipoo/osu,ppy/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,ppy/osu
|
osu.Game/Graphics/Containers/Markdown/OsuMarkdownTextFlowContainer.cs
|
osu.Game/Graphics/Containers/Markdown/OsuMarkdownTextFlowContainer.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 Markdig.Syntax.Inlines;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays;
namespace osu.Game.Graphics.Containers.Markdown
{
public class OsuMarkdownTextFlowContainer : MarkdownTextFlowContainer
{
protected override void AddLinkText(string text, LinkInline linkInline)
=> AddDrawable(new OsuMarkdownLinkText(text, linkInline));
// TODO : Change font to monospace
protected override void AddCodeInLine(CodeInline codeInline) => AddDrawable(new OsuMarkdownInlineCode
{
Text = codeInline.Content
});
protected override SpriteText CreateEmphasisedSpriteText(bool bold, bool italic)
=> CreateSpriteText().With(t => t.Font = t.Font.With(weight: bold ? FontWeight.Bold : FontWeight.Regular, italics: italic));
private class OsuMarkdownInlineCode : Container
{
[Resolved]
private IMarkdownTextComponent parentTextComponent { get; set; }
public string Text;
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background6,
},
parentTextComponent.CreateSpriteText().With(t =>
{
t.Colour = colourProvider.Light1;
t.Text = Text;
}),
};
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Markdig.Syntax.Inlines;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays;
namespace osu.Game.Graphics.Containers.Markdown
{
public class OsuMarkdownTextFlowContainer : MarkdownTextFlowContainer
{
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
protected override void AddLinkText(string text, LinkInline linkInline)
=> AddDrawable(new OsuMarkdownLinkText(text, linkInline));
// TODO : Add background (colour B6) and change font to monospace
protected override void AddCodeInLine(CodeInline codeInline)
=> AddText(codeInline.Content, t => { t.Colour = colourProvider.Light1; });
protected override SpriteText CreateEmphasisedSpriteText(bool bold, bool italic)
=> CreateSpriteText().With(t => t.Font = t.Font.With(weight: bold ? FontWeight.Bold : FontWeight.Regular, italics: italic));
private class OsuMarkdownInlineCode : Container
{
[Resolved]
private IMarkdownTextComponent parentTextComponent { get; set; }
public string Text;
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background6,
},
parentTextComponent.CreateSpriteText().With(t =>
{
t.Colour = colourProvider.Light1;
t.Text = Text;
}),
};
}
}
}
}
|
mit
|
C#
|
31da8048c5be06ef22fabd4f37d00b3922fd505c
|
Remove unnecessary parameter
|
appharbor/appharbor-cli
|
src/AppHarbor.Tests/Commands/CreateCommandTest.cs
|
src/AppHarbor.Tests/Commands/CreateCommandTest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using AppHarbor.Commands;
using Moq;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.Xunit;
using Xunit;
using Xunit.Extensions;
namespace AppHarbor.Tests.Commands
{
public class CreateCommandTest
{
[Theory, AutoCommandData]
public void ShouldThrowWhenNoArguments(CreateCommand command)
{
var exception = Assert.Throws<CommandException>(() => command.Execute(new string[0]));
Assert.Equal("An application name must be provided to create an application", exception.Message);
}
[Theory, AutoCommandData]
public void ShouldCreateApplicationWithOnlyName([Frozen]Mock<IAppHarborClient> client, CreateCommand command)
{
var arguments = new string[] { "foo" };
command.Execute(arguments);
client.Verify(x => x.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()), Times.Once());
}
[Theory, AutoCommandData]
public void ShouldCreateApplicationWithRegion([Frozen]Mock<IAppHarborClient> client, CreateCommand command, string[] arguments)
{
command.Execute(arguments);
client.Verify(x => x.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()), Times.Once());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using AppHarbor.Commands;
using Moq;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.Xunit;
using Xunit;
using Xunit.Extensions;
namespace AppHarbor.Tests.Commands
{
public class CreateCommandTest
{
[Theory, AutoCommandData]
public void ShouldThrowWhenNoArguments(CreateCommand command)
{
var exception = Assert.Throws<CommandException>(() => command.Execute(new string[0]));
Assert.Equal("An application name must be provided to create an application", exception.Message);
}
[Theory, AutoCommandData]
public void ShouldCreateApplicationWithOnlyName([Frozen]Mock<IAppHarborClient> client, CreateCommand command, Fixture fixture)
{
var arguments = new string[] { "foo" };
command.Execute(arguments);
client.Verify(x => x.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()), Times.Once());
}
[Theory, AutoCommandData]
public void ShouldCreateApplicationWithRegion([Frozen]Mock<IAppHarborClient> client, CreateCommand command, string[] arguments)
{
command.Execute(arguments);
client.Verify(x => x.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()), Times.Once());
}
}
}
|
mit
|
C#
|
61397201744dbb1aa44dcc00b6fefb032bf0af87
|
add otchestvo
|
kotikov1994/BlogAdd
|
TemplateTest1/TemplateTest1/Views/Shared/_Layout.cshtml
|
TemplateTest1/TemplateTest1/Views/Shared/_Layout.cshtml
|
<!doctype html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="~/Content/css/reset.css">
<link rel="stylesheet" href="~/Content/css/style.css">
</head>
<body>
<div class="wrap">
<div class="left-column">
<div class="wrap-avatar">
<img src="~/Content/images/photo-main.png" alt="" />
<h2>Котиков Илья Вячеславович</h2>
<h3>студент гр.213501</h3>
</div>
<div class="menu">
<ul>
<li><a href="#">Latest Post</a></li>
<li><a href="#">Archive</a></li>
<li><a href="#">About Me</a></li>
</ul>
</div>
<div class="search-form">
<input type="text" />
<button></button>
</div>
@Html.Action("Recent", "Article")
@Html.Action("Recent","Comment")
</div>
<div class="right-column">
@RenderBody()
</div>
</div>
</body>
</html>
|
<!doctype html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="~/Content/css/reset.css">
<link rel="stylesheet" href="~/Content/css/style.css">
</head>
<body>
<div class="wrap">
<div class="left-column">
<div class="wrap-avatar">
<img src="~/Content/images/photo-main.png" alt="" />
<h2>Котиков Илья</h2>
<h3>студент гр.213501</h3>
</div>
<div class="menu">
<ul>
<li><a href="#">Latest Post</a></li>
<li><a href="#">Archive</a></li>
<li><a href="#">About Me</a></li>
</ul>
</div>
<div class="search-form">
<input type="text" />
<button></button>
</div>
@Html.Action("Recent", "Article")
@Html.Action("Recent","Comment")
</div>
<div class="right-column">
@RenderBody()
</div>
</div>
</body>
</html>
|
mit
|
C#
|
dab8bf25b1e2e500e15901970c1e950bd5a78bf8
|
Fix for incorrect getter in MainPageViewModel
|
rrampersad/TestAppMobileCenter
|
TestAppMobilecenter/TestAppMobilecenter/ViewModels/MainPageViewModel.cs
|
TestAppMobilecenter/TestAppMobilecenter/ViewModels/MainPageViewModel.cs
|
using Microsoft.Azure.Mobile.Analytics;
using Microsoft.Azure.Mobile.Crashes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using TestAppMobilecenter.Commands;
namespace TestAppMobilecenter.ViewModels
{
public class MainPageViewModel : ViewModelBase
{
public ICommand CrashAppCommand { get; private set; }
public ICommand IncreaseCountCommand { get; private set; }
private int _counter;
public int Counter
{
get
{
return _counter;
}
set
{
SetProperty(ref _counter, value);
}
}
public MainPageViewModel()
{
CrashAppCommand = new Command(() =>
{
Analytics.TrackEvent("Crash Clicked");
Crashes.GenerateTestCrash();
});
IncreaseCountCommand = new Command(IncreaseCount);
}
private void IncreaseCount()
{
Analytics.TrackEvent("Counter");
Counter++;
}
}
}
|
using Microsoft.Azure.Mobile.Analytics;
using Microsoft.Azure.Mobile.Crashes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using TestAppMobilecenter.Commands;
namespace TestAppMobilecenter.ViewModels
{
public class MainPageViewModel : ViewModelBase
{
public ICommand CrashAppCommand { get; private set; }
public ICommand IncreaseCountCommand { get; private set; }
private int _counter;
public int Counter
{
get => _counter;
set
{
SetProperty(ref _counter, value);
}
}
public MainPageViewModel()
{
CrashAppCommand = new Command(() =>
{
Analytics.TrackEvent("Crash Clicked");
Crashes.GenerateTestCrash();
});
IncreaseCountCommand = new Command(IncreaseCount);
}
private void IncreaseCount()
{
Analytics.TrackEvent("Counter");
Counter++;
}
}
}
|
apache-2.0
|
C#
|
3b2f918cdf06d7f3a7c6f9efb6c5583f924f38db
|
Call Storyboard.SetTargetName on Children.
|
escape-llc/yet-another-chart-component
|
YetAnotherChartComponent/YetAnotherChartComponent/Support/Storyboard.cs
|
YetAnotherChartComponent/YetAnotherChartComponent/Support/Storyboard.cs
|
using System;
using System.Reflection;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media.Animation;
namespace eScapeLLC.UWP.Charts {
/// <summary>
/// Extension methods for <see cref="Storyboard"/> and friends.
/// </summary>
public static class StoryboardExtensions {
/// <summary>
/// Clone the <see cref="Timeline"/> via reflection on writable public instance properties.
/// </summary>
/// <param name="tl">Source.</param>
/// <returns>New instance.</returns>
public static Timeline Clone(this Timeline tl) {
if (tl == null) return null;
var clone = Activator.CreateInstance(tl.GetType());
foreach (var pi in tl.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
if (pi.CanWrite) {
pi.SetValue(clone, pi.GetValue(tl));
}
}
// TODO what about keyframe animations?
return clone as Timeline;
}
/// <summary>
/// Clone the given <see cref="Storyboard"/> and its children.
/// </summary>
/// <param name="sb">Source.</param>
/// <param name="fe">Target.</param>
/// <returns></returns>
public static Storyboard Clone(this Storyboard sb, FrameworkElement fe) {
if (sb == null) return null;
var clone = new Storyboard() {
AutoReverse = sb.AutoReverse,
BeginTime = sb.BeginTime,
Duration = sb.Duration,
FillBehavior = sb.FillBehavior,
RepeatBehavior = sb.RepeatBehavior,
SpeedRatio = sb.SpeedRatio
};
foreach (var tl in sb.Children) {
var tclone = tl.Clone();
var tname = Storyboard.GetTargetName(tl);
if(!String.IsNullOrEmpty(tname)) {
Storyboard.SetTargetName(tclone, tname);
}
Storyboard.SetTargetProperty(tclone, Storyboard.GetTargetProperty(tl));
clone.Children.Add(tclone);
}
Storyboard.SetTarget(clone, fe);
return clone;
}
}
}
|
using System;
using System.Reflection;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media.Animation;
namespace eScapeLLC.UWP.Charts {
/// <summary>
/// Extension methods for <see cref="Storyboard"/> and friends.
/// </summary>
public static class StoryboardExtensions {
/// <summary>
/// Clone the <see cref="Timeline"/> via reflection on writable public instance properties.
/// </summary>
/// <param name="tl">Source.</param>
/// <returns>New instance.</returns>
public static Timeline Clone(this Timeline tl) {
if (tl == null) return null;
var clone = Activator.CreateInstance(tl.GetType());
foreach (var pi in tl.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
if (pi.CanWrite) {
pi.SetValue(clone, pi.GetValue(tl));
}
}
return clone as Timeline;
}
/// <summary>
/// Clone the given <see cref="Storyboard"/> and its children.
/// </summary>
/// <param name="sb">Source.</param>
/// <param name="fe">Target.</param>
/// <returns></returns>
public static Storyboard Clone(this Storyboard sb, FrameworkElement fe) {
if (sb == null) return null;
var clone = new Storyboard() {
AutoReverse = sb.AutoReverse,
BeginTime = sb.BeginTime,
Duration = sb.Duration,
FillBehavior = sb.FillBehavior,
RepeatBehavior = sb.RepeatBehavior,
SpeedRatio = sb.SpeedRatio
};
foreach (var tl in sb.Children) {
var tclone = tl.Clone();
Storyboard.SetTargetProperty(tclone, Storyboard.GetTargetProperty(tl));
clone.Children.Add(tclone);
}
Storyboard.SetTarget(clone, fe);
return clone;
}
}
}
|
apache-2.0
|
C#
|
b8a17d41104139fedc943eafbb4a11584eac2c53
|
Format date
|
mbuhova/JobFinder-System,mbuhova/JobFinder-System
|
JobFinder-System/JobFinder.Web/Areas/Admin/Views/Offer/Index.cshtml
|
JobFinder-System/JobFinder.Web/Areas/Admin/Views/Offer/Index.cshtml
|
@using JobFinder.Web.Models
@{
ViewBag.Title = "Offers";
}
@(Html.Kendo().Grid<AdminOfferViewModel>().Name("offers").Columns(columns =>
{
columns.Bound(c => c.Id).Hidden();
columns.Bound(c => c.Title);
columns.Bound(c => c.Description);
columns.Bound(c => c.DateCreated).Format("{0:dd-MM-yyyy}");
columns.Bound(c => c.CompanyName);
columns.Bound(c => c.IsActive);
columns.Command(c => c.Edit());
})
.Pageable(page => page.Refresh(true))
.Sortable()
.Filterable()
.Editable(edit =>
{
edit.Mode(GridEditMode.PopUp);
})
.DataSource(data =>
data
.Ajax()
.Model(m => m.Id(o => o.Id))
.Read(read => read.Action("Read", "Offer"))
.Update(update => update.Action("Update", "Offer")))
)
@*
.Editable(edit =>
{
edit.Mode(GridEditMode.PopUp);
})
columns.Command(c => c.Edit());*@
|
@using JobFinder.Web.Models
@{
ViewBag.Title = "Offers";
}
@(Html.Kendo().Grid<AdminOfferViewModel>().Name("offers").Columns(columns =>
{
columns.Bound(c => c.Id).Hidden();
columns.Bound(c => c.Title);
columns.Bound(c => c.Description);
columns.Bound(c => c.DateCreated);
columns.Bound(c => c.CompanyName);
columns.Bound(c => c.IsActive);
columns.Command(c => c.Edit());
})
.Pageable(page => page.Refresh(true))
.Sortable()
.Filterable()
.Editable(edit =>
{
edit.Mode(GridEditMode.PopUp);
})
.DataSource(data =>
data
.Ajax()
.Model(m => m.Id(o => o.Id))
.Read(read => read.Action("Read", "Offer"))
.Update(update => update.Action("Update", "Offer")))
)
@*
.Editable(edit =>
{
edit.Mode(GridEditMode.PopUp);
})
columns.Command(c => c.Edit());*@
|
mit
|
C#
|
b67da455c43ed72e1928535e1494ef20875d5291
|
debug stuff
|
Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns
|
TCC.UI/PacketInspector.cs
|
TCC.UI/PacketInspector.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TCC.Parsing;
using Tera;
using Tera.Game;
namespace TCC
{
public static class PacketInspector
{
public static void InspectPacket(Message msg)
{
List<string> exclusionList = new List<string>()
{
"S_USER_LOCATION", "S_SOCIAL", "PROJECTILE", "S_PARTY_MATCH_LINK", "C_PLAYER_LOCATION", "S_NPC_LOCATION"
};
var opName = PacketRouter.OpCodeNamer.GetName(msg.OpCode);
TeraMessageReader tmr = new TeraMessageReader(msg, PacketRouter.OpCodeNamer, PacketRouter.Version, PacketRouter.SystemMessageNamer);
if (exclusionList.Any(opName.Contains)) return;
//if (opName.Equals("S_LOAD_HINT"))
//{
// Console.WriteLine("[{0}] ({1})", opName, msg.Payload.Count);
// StringBuilder sb = new StringBuilder();
// foreach (var b in msg.Payload)
// {
// sb.Append(b);
// }
// int j = 0;
// for (int i = 8; i+j < sb.Length; i+=8)
// {
// sb.Insert(i+j, " ");
// j++;
// }
// Console.WriteLine(sb.ToString());
//}
if(opName.Equals("S_LOAD_TOPO") || opName.Equals("C_LOAD_TOPO_FIN")|| opName.Equals("S_SPAWN_ME"))
Console.WriteLine(opName);
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TCC.Parsing;
using Tera;
using Tera.Game;
namespace TCC
{
public static class PacketInspector
{
public static void InspectPacket(Message msg)
{
List<string> exclusionList = new List<string>()
{
"S_USER_LOCATION", "S_SOCIAL", "PROJECTILE", "S_PARTY_MATCH_LINK", "C_PLAYER_LOCATION", "S_NPC_LOCATION"
};
var opName = PacketRouter.OpCodeNamer.GetName(msg.OpCode);
TeraMessageReader tmr = new TeraMessageReader(msg, PacketRouter.OpCodeNamer, PacketRouter.Version, PacketRouter.SystemMessageNamer);
if (exclusionList.Any(opName.Contains)) return;
if (opName.Equals("S_LOAD_HINT"))
{
Console.WriteLine("[{0}] ({1})", opName, msg.Payload.Count);
StringBuilder sb = new StringBuilder();
foreach (var b in msg.Payload)
{
sb.Append(b);
}
int j = 0;
for (int i = 8; i+j < sb.Length; i+=8)
{
sb.Insert(i+j, " ");
j++;
}
Console.WriteLine(sb.ToString());
}
}
}
}
|
mit
|
C#
|
5e16985ce872636a244fe39df9b676a9f099f262
|
Fix parsing problem.
|
nseckinoral/xomni-sdk-dotnet
|
XOMNI.SDK/XOMNI.SDK.Public/Clients/Social/AuthorizationURLClient.cs
|
XOMNI.SDK/XOMNI.SDK.Public/Clients/Social/AuthorizationURLClient.cs
|
using System;
using System.Net.Http;
using System.Threading.Tasks;
using XOMNI.SDK.Public.Clients;
using XOMNI.SDK.Public.Models;
namespace XOMNI.SDK.Public.Clients.Social
{
public class AuthorizationURLClient : BaseClient
{
public AuthorizationURLClient(HttpClient httpClient)
: base(httpClient)
{
}
public async Task<string> GetAsync(string socialPlatformName)
{
string path = string.Format("/social/authurl/{0}", socialPlatformName);
using (var response = await Client.GetAsync(path).ConfigureAwait(false))
{
return await response.Content.ReadAsAsync<string>().ConfigureAwait(false);
}
}
}
}
|
using System;
using System.Net.Http;
using System.Threading.Tasks;
using XOMNI.SDK.Public.Clients;
using XOMNI.SDK.Public.Models;
namespace XOMNI.SDK.Public.Clients.Social
{
public class AuthorizationURLClient : BaseClient
{
public AuthorizationURLClient(HttpClient httpClient)
: base(httpClient)
{
}
public async Task<ApiResponse<string>> GetAsync(string socialPlatformName)
{
string path = string.Format("/social/authurl/{0}", socialPlatformName);
using (var response = await Client.GetAsync(path).ConfigureAwait(false))
{
return await response.Content.ReadAsAsync<ApiResponse<string>>().ConfigureAwait(false);
}
}
}
}
|
mit
|
C#
|
4a4bf7a546906a99ed4aacae09c197c69679adb7
|
Add new test for String.SubstringRightSafe
|
DaveSenn/Extend
|
PortableExtensions.Testing/System.String/String.SubstringRightSafe.Test.cs
|
PortableExtensions.Testing/System.String/String.SubstringRightSafe.Test.cs
|
#region Using
using System;
using NUnit.Framework;
#endregion
namespace PortableExtensions.Testing
{
[TestFixture]
public partial class StringExTest
{
[TestCase]
public void SubstringRightSafeTestCase()
{
var actual = "testabc".SubstringRightSafe( 3 );
Assert.AreEqual( "abc", actual );
actual = "testabc".SubstringRightSafe( 300 );
Assert.AreEqual( "testabc", actual );
actual = "".SubstringRightSafe(300);
Assert.AreEqual("", actual);
}
[TestCase]
[ExpectedException( typeof ( ArgumentNullException ) )]
public void SubstringRightSafeTestCaseNullCheck()
{
var actual = StringEx.SubstringRight( null, 5 );
}
}
}
|
#region Using
using System;
using NUnit.Framework;
#endregion
namespace PortableExtensions.Testing
{
[TestFixture]
public partial class StringExTest
{
[TestCase]
public void SubstringRightSafeTestCase()
{
var actual = "testabc".SubstringRightSafe( 3 );
Assert.AreEqual( "abc", actual );
actual = "testabc".SubstringRightSafe( 300 );
Assert.AreEqual( "testabc", actual );
}
[TestCase]
[ExpectedException( typeof ( ArgumentNullException ) )]
public void SubstringRightSafeTestCaseNullCheck()
{
var actual = StringEx.SubstringRight( null, 5 );
}
}
}
|
mit
|
C#
|
70925113277f5e4194d9294e00c19529454bac06
|
Use the IFilteringMigrationSource as source
|
schambers/fluentmigrator,stsrki/fluentmigrator,stsrki/fluentmigrator,fluentmigrator/fluentmigrator,igitur/fluentmigrator,spaccabit/fluentmigrator,amroel/fluentmigrator,eloekset/fluentmigrator,amroel/fluentmigrator,eloekset/fluentmigrator,spaccabit/fluentmigrator,igitur/fluentmigrator,schambers/fluentmigrator,fluentmigrator/fluentmigrator
|
src/FluentMigrator.Runner.Core/Initialization/ProfileSource.cs
|
src/FluentMigrator.Runner.Core/Initialization/ProfileSource.cs
|
#region License
// Copyright (c) 2018, FluentMigrator Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Reflection;
using JetBrains.Annotations;
namespace FluentMigrator.Runner.Initialization
{
/// <summary>
/// The default implementation of <see cref="IProfileSource"/>
/// </summary>
public class ProfileSource : IProfileSource
{
[NotNull]
private readonly IFilteringMigrationSource _source;
[NotNull]
private readonly IMigrationRunnerConventions _conventions;
[NotNull]
private readonly IServiceProvider _serviceProvider;
[NotNull]
private readonly ConcurrentDictionary<Type, IMigration> _instanceCache = new ConcurrentDictionary<Type, IMigration>();
/// <summary>
/// Initializes a new instance of the <see cref="ProfileSource"/> class.
/// </summary>
/// <param name="source">The assembly source</param>
/// <param name="conventions">The migration runner conventios</param>
/// <param name="serviceProvider">The service provider</param>
public ProfileSource(
[NotNull] IFilteringMigrationSource source,
[NotNull] IMigrationRunnerConventions conventions,
[NotNull] IServiceProvider serviceProvider)
{
_source = source;
_conventions = conventions;
_serviceProvider = serviceProvider;
}
/// <inheritdoc />
public IEnumerable<IMigration> GetProfiles(string profile) =>
_source.GetMigrations(t => IsSelectedProfile(t, profile));
private bool IsSelectedProfile(Type type, string profile)
{
if (!_conventions.TypeIsProfile(type))
return false;
var profileAttribute = type.GetCustomAttribute<ProfileAttribute>();
return string.IsNullOrEmpty(profile) || string.Equals(profileAttribute.ProfileName, profile);
}
}
}
|
#region License
// Copyright (c) 2018, FluentMigrator Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection;
namespace FluentMigrator.Runner.Initialization
{
/// <summary>
/// The default implementation of <see cref="IProfileSource"/>
/// </summary>
public class ProfileSource : IProfileSource
{
[NotNull]
private readonly IAssemblySource _source;
[NotNull]
private readonly IMigrationRunnerConventions _conventions;
[NotNull]
private readonly IServiceProvider _serviceProvider;
[NotNull]
private readonly ConcurrentDictionary<Type, IMigration> _instanceCache = new ConcurrentDictionary<Type, IMigration>();
/// <summary>
/// Initializes a new instance of the <see cref="ProfileSource"/> class.
/// </summary>
/// <param name="source">The assembly source</param>
/// <param name="conventions">The migration runner conventios</param>
/// <param name="serviceProvider">The service provider</param>
public ProfileSource(
[NotNull] IAssemblySource source,
[NotNull] IMigrationRunnerConventions conventions,
[NotNull] IServiceProvider serviceProvider)
{
_source = source;
_conventions = conventions;
_serviceProvider = serviceProvider;
}
/// <inheritdoc />
public IEnumerable<IMigration> GetProfiles(string profile)
{
var instances = from type in _source.Assemblies.SelectMany(a => a.GetExportedTypes())
where _conventions.TypeIsProfile(type)
let profileAttribute = type.GetCustomAttribute<ProfileAttribute>()
where string.IsNullOrEmpty(profile) || string.Equals(profileAttribute.ProfileName, profile)
select _instanceCache.GetOrAdd(type, t => (IMigration)ActivatorUtilities.CreateInstance(_serviceProvider, t));
return instances;
}
}
}
|
apache-2.0
|
C#
|
5df03a979ae3ffef50d2e88ab19cdf83421034cd
|
fix toc crash on new document
|
mike-ward/Markdown-Edit,punker76/Markdown-Edit
|
src/MarkdownEdit/Controls/DisplayDocumentStructureViewModel.cs
|
src/MarkdownEdit/Controls/DisplayDocumentStructureViewModel.cs
|
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
using CommonMark.Syntax;
using MarkdownEdit.Models;
namespace MarkdownEdit.Controls
{
internal class DisplayDocumentStructureViewModel : INotifyPropertyChanged
{
public struct DocumentStructure
{
public string Heading { get; set; }
public int Level { get; set; }
public FontWeight FontWeight { get; set; }
public int Offset { get; set; }
}
private DocumentStructure[] _structure;
public DocumentStructure[] Structure
{
get { return _structure; }
set { Set(ref _structure, value); }
}
public void Update(Block ast)
{
if (ast == null) return;
Structure = AbstractSyntaxTree.EnumerateBlocks(ast.FirstChild)
.Where(b => b.Tag == BlockTag.AtxHeading || b.Tag == BlockTag.SetextHeading)
.Select(b => new DocumentStructure
{
Heading = InlineContent(b.InlineContent),
Level = b.Heading.Level * 20,
FontWeight = b.Heading.Level == 1 ? FontWeights.Bold : FontWeights.Normal,
Offset = b.SourcePosition
})
.ToArray();
}
private string InlineContent(Inline inline )
{
var content = inline.LiteralContent;
if (inline.FirstChild != null) content += InlineContent(inline.FirstChild);
return content;
}
public void Selected(int index)
{
var offset = index <= Structure.Length ? Structure[index].Offset : 0;
MainWindow.ScrollToOffsetCommand.Execute(offset, Application.Current.MainWindow);
}
public event PropertyChangedEventHandler PropertyChanged;
private void Set<T>(ref T property, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(property, value)) return;
property = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
|
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
using CommonMark.Syntax;
using MarkdownEdit.Models;
namespace MarkdownEdit.Controls
{
internal class DisplayDocumentStructureViewModel : INotifyPropertyChanged
{
public struct DocumentStructure
{
public string Heading { get; set; }
public int Level { get; set; }
public FontWeight FontWeight { get; set; }
public int Offset { get; set; }
}
private DocumentStructure[] _structure;
public DocumentStructure[] Structure
{
get { return _structure; }
set { Set(ref _structure, value); }
}
public void Update(Block ast)
{
Structure = AbstractSyntaxTree.EnumerateBlocks(ast.FirstChild)
.Where(b => b.Tag == BlockTag.AtxHeading || b.Tag == BlockTag.SetextHeading)
.Select(b => new DocumentStructure
{
Heading = InlineContent(b.InlineContent),
Level = b.Heading.Level * 20,
FontWeight = b.Heading.Level == 1 ? FontWeights.Bold : FontWeights.Normal,
Offset = b.SourcePosition
})
.ToArray();
}
private string InlineContent(Inline inline )
{
var content = inline.LiteralContent;
if (inline.FirstChild != null) content += InlineContent(inline.FirstChild);
return content;
}
public void Selected(int index)
{
var offset = index <= Structure.Length ? Structure[index].Offset : 0;
MainWindow.ScrollToOffsetCommand.Execute(offset, Application.Current.MainWindow);
}
public event PropertyChangedEventHandler PropertyChanged;
private void Set<T>(ref T property, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(property, value)) return;
property = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
|
mit
|
C#
|
46f6362b96537d51c871604a9850d3263d210983
|
Move BankAccountOptions to the Stripe namespace
|
richardlawley/stripe.net,stripe/stripe-dotnet
|
src/Stripe.net/Services/_sources_token/BankAccountOptions.cs
|
src/Stripe.net/Services/_sources_token/BankAccountOptions.cs
|
using Newtonsoft.Json;
namespace Stripe
{
public class BankAccountOptions : INestedOptions
{
[JsonProperty("bank_account")]
public string TokenId { get; set; }
[JsonProperty("bank_account[account_holder_name]")]
public string AccountHolderName { get; set; }
[JsonProperty("bank_account[account_holder_type]")]
public string AccountHolderType { get; set; }
[JsonProperty("bank_account[account_number]")]
public string AccountNumber { get; set; }
[JsonProperty("bank_account[country]")]
public string Country { get; set; }
[JsonProperty("bank_account[currency]")]
public string Currency { get; set; }
[JsonProperty("bank_account[routing_number]")]
public string RoutingNumber { get; set; }
}
}
|
using Newtonsoft.Json;
using Stripe;
public class BankAccountOptions : INestedOptions
{
[JsonProperty("bank_account")]
public string TokenId { get; set; }
[JsonProperty("bank_account[account_holder_name]")]
public string AccountHolderName { get; set; }
[JsonProperty("bank_account[account_holder_type]")]
public string AccountHolderType { get; set; }
[JsonProperty("bank_account[account_number]")]
public string AccountNumber { get; set; }
[JsonProperty("bank_account[country]")]
public string Country { get; set; }
[JsonProperty("bank_account[currency]")]
public string Currency { get; set; }
[JsonProperty("bank_account[routing_number]")]
public string RoutingNumber { get; set; }
}
|
apache-2.0
|
C#
|
eb95322b8596a92b5bb77d1330da4b881efb73ad
|
Change - Consolidated sub-expressions unit-tests.
|
jdevillard/JmesPath.Net
|
tests/jmespath.net.tests/Expressions/JmesPathSubExpressionTest.cs
|
tests/jmespath.net.tests/Expressions/JmesPathSubExpressionTest.cs
|
using Newtonsoft.Json.Linq;
using Xunit;
using DevLab.JmesPath.Expressions;
using DevLab.JmesPath.Utils;
namespace jmespath.net.tests.Expressions
{
public class JmesPathSubExpressionTest
{
/*
* http://jmespath.org/specification.html#subexpressions
*
* search(foo.bar, {"foo": {"bar": "value"}}) -> "value"
* search(foo."bar", {"foo": {"bar": "value"}}) -> "value"
* search(foo.bar, {"foo": {"baz": "value"}}) -> null
* search(foo.bar.baz, {"foo": {"bar": {"baz": "value"}}}) -> "value"
*
*/
[Fact]
public void JmesPathSubExpression_Transform()
{
JmesPathSubExpression_Transform(new[] {"foo", "bar"}, "{\"foo\": {\"bar\": \"value\" }}", "\"value\"");
JmesPathSubExpression_Transform(new[] { "foo", "bar" }, "{\"foo\": {\"bar\": \"value\" }}", "\"value\"");
JmesPathSubExpression_Transform(new[] { "foo", "bar" }, "{\"foo\": {\"baz\": \"value\" }}", null);
JmesPathSubExpression_Transform(new[] { "foo", "bar", "baz" }, "{\"foo\": {\"bar\": { \"baz\": \"value\" }}}", "\"value\"");
}
public void JmesPathSubExpression_Transform(string[] expressions, string input, string expected)
{
JmesPathExpression expression = null;
foreach (var identifier in expressions)
{
JmesPathExpression ident = new JmesPathIdentifier(identifier);
expression = expression != null
? new JmesPathSubExpression(expression, ident)
: ident
;
}
var token = JToken.Parse(input);
var result = expression.Transform(token);
var actual = result?.AsString();
Assert.Equal(expected, actual);
}
}
}
|
using Newtonsoft.Json.Linq;
using Xunit;
using DevLab.JmesPath.Expressions;
using DevLab.JmesPath.Utils;
namespace jmespath.net.tests.Expressions
{
public class JmesPathSubExpressionTest
{
[Fact]
public void JmesPathSubExpression_identifier()
{
const string json = "{\"foo\": {\"bar\": \"baz\"}}";
var token = JToken.Parse(json);
var expr = new JmesPathIdentifier("foo");
var sub = new JmesPathIdentifier("bar");
var combined = new JmesPathSubExpression(expr, sub);
var result = combined.Transform(token);
Assert.Equal("\"baz\"", result.AsString());
}
}
}
|
apache-2.0
|
C#
|
5f38444ac569163b4a193d44503a31610337c158
|
Update the SqliteAnchorStateBuilder unit tests
|
openchain/openchain
|
test/Openchain.Sqlite.Tests/SqliteAnchorStateBuilderTests.cs
|
test/Openchain.Sqlite.Tests/SqliteAnchorStateBuilderTests.cs
|
// Copyright 2015 Coinprism, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Memory;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
namespace Openchain.Sqlite.Tests
{
public class SqliteAnchorStateBuilderTests
{
private readonly IConfigurationSection configuration =
new ConfigurationRoot(new[] { new MemoryConfigurationProvider(new Dictionary<string, string>() { ["config:path"] = ":memory:" }) })
.GetSection("config");
[Fact]
public void Name_Success()
{
Assert.Equal("SQLite", new SqliteAnchorStateBuilder().Name);
}
[Fact]
public async Task Build_Success()
{
SqliteAnchorStateBuilder builder = new SqliteAnchorStateBuilder();
await builder.Initialize(new ServiceCollection().BuildServiceProvider(), configuration);
SqliteAnchorState ledger = builder.Build(null);
Assert.NotNull(ledger);
}
[Fact]
public async Task InitializeTables_CallTwice()
{
SqliteAnchorStateBuilder builder = new SqliteAnchorStateBuilder();
await builder.Initialize(new ServiceCollection().BuildServiceProvider(), configuration);
SqliteAnchorState ledger = builder.Build(null);
await SqliteAnchorStateBuilder.InitializeTables(ledger.Connection);
await SqliteAnchorStateBuilder.InitializeTables(ledger.Connection);
Assert.Equal(ConnectionState.Open, ledger.Connection.State);
}
}
}
|
// Copyright 2015 Coinprism, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
namespace Openchain.Sqlite.Tests
{
public class SqliteAnchorStateBuilderTests
{
[Fact]
public void Name_Success()
{
Assert.Equal("SQLite", new SqliteAnchorStateBuilder().Name);
}
[Fact]
public async Task Build_Success()
{
Dictionary<string, string> parameters = new Dictionary<string, string>() { ["path"] = ":memory:" };
SqliteAnchorStateBuilder builder = new SqliteAnchorStateBuilder();
await builder.Initialize(new ServiceCollection().BuildServiceProvider(), parameters);
SqliteAnchorState ledger = builder.Build(null);
Assert.NotNull(ledger);
}
[Fact]
public async Task InitializeTables_CallTwice()
{
Dictionary<string, string> parameters = new Dictionary<string, string>() { ["path"] = ":memory:" };
SqliteAnchorStateBuilder builder = new SqliteAnchorStateBuilder();
await builder.Initialize(new ServiceCollection().BuildServiceProvider(), parameters);
SqliteAnchorState ledger = builder.Build(null);
await SqliteAnchorStateBuilder.InitializeTables(ledger.Connection);
await SqliteAnchorStateBuilder.InitializeTables(ledger.Connection);
Assert.Equal(ConnectionState.Open, ledger.Connection.State);
}
}
}
|
apache-2.0
|
C#
|
cb7ab70f8fbed617b1ec79dce1caefa6d3a10102
|
Add Id property in TraktCheckinPostResponse
|
henrikfroehling/TraktApiSharp
|
Source/Lib/TraktApiSharp/Objects/Post/Checkins/Responses/TraktCheckinPostResponse.cs
|
Source/Lib/TraktApiSharp/Objects/Post/Checkins/Responses/TraktCheckinPostResponse.cs
|
namespace TraktApiSharp.Objects.Post.Checkins.Responses
{
using Attributes;
using Basic;
using Newtonsoft.Json;
using System;
public abstract class TraktCheckinPostResponse
{
/// <summary>Gets or sets the history id for the checkin response.</summary>
[JsonProperty(PropertyName = "id")]
public ulong Id { get; set; }
/// <summary>Gets or sets the UTC datetime, when the checked in movie or episode was watched.</summary>
[JsonProperty(PropertyName = "watched_at")]
public DateTime? WatchedAt { get; set; }
/// <summary>
/// Gets or sets the sharing options for the checkin response.
/// See also <seealso cref="TraktSharing" />.
/// <para>Nullable</para>
/// </summary>
[JsonProperty(PropertyName = "sharing")]
[Nullable]
public TraktSharing Sharing { get; set; }
}
}
|
namespace TraktApiSharp.Objects.Post.Checkins.Responses
{
using Attributes;
using Basic;
using Newtonsoft.Json;
using System;
public abstract class TraktCheckinPostResponse
{
/// <summary>Gets or sets the UTC datetime, when the checked in movie or episode was watched.</summary>
[JsonProperty(PropertyName = "watched_at")]
public DateTime? WatchedAt { get; set; }
/// <summary>
/// Gets or sets the sharing options for the checkin response.
/// See also <seealso cref="TraktSharing" />.
/// <para>Nullable</para>
/// </summary>
[JsonProperty(PropertyName = "sharing")]
[Nullable]
public TraktSharing Sharing { get; set; }
}
}
|
mit
|
C#
|
6633b47035c419ae798100283f18fcac5e7b6a9e
|
order checkout missing map to product resolved
|
mpenchev86/JustOrderIt,mpenchev86/JustOrderIt,mpenchev86/ASP.NET-MVC-FinalProject,mpenchev86/JustOrderIt,mpenchev86/ASP.NET-MVC-FinalProject,mpenchev86/ASP.NET-MVC-FinalProject
|
Source/Web/MvcProject.Web/Areas/Public/ViewModels/Products/ProductForShoppingCart.cs
|
Source/Web/MvcProject.Web/Areas/Public/ViewModels/Products/ProductForShoppingCart.cs
|
namespace MvcProject.Web.Areas.Public.ViewModels.Products
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutoMapper;
using Data.Models;
using Data.Models.Catalog;
using Infrastructure.Mapping;
using Services.Web;
public class ProductForShoppingCart : BasePublicViewModel<int>, IMapFrom<Product>, IMapTo<Product>/*, IMapFrom<ProductCacheViewModel>*/, IHaveCustomMappings
{
public string EncodedId
{
get { return IdentifierProvider.EncodeIntIdStatic(this.Id); }
}
public string Title { get; set; }
public decimal UnitPrice { get; set; }
public decimal? ShippingPrice { get; set; }
public string ImageUrlPath { get; set; }
public string ImageFileExtension { get; set; }
public void CreateMappings(IMapperConfigurationExpression configuration)
{
configuration.CreateMap<Product, ProductForShoppingCart>()
.ForMember(dest => dest.ImageUrlPath, opt => opt.MapFrom(
src => src.MainImage != null ? src.MainImage.UrlPath : (src.Images.Any() ? src.Images.FirstOrDefault().UrlPath : "")))
.ForMember(dest => dest.ImageFileExtension, opt => opt.MapFrom(
src => src.MainImage != null ? src.MainImage.FileExtension : (src.Images.Any() ? src.Images.FirstOrDefault().FileExtension : "")))
;
configuration.CreateMap<ProductForShoppingCart, Product>();
//configuration.CreateMap<ProductCacheViewModel, ProductForShoppingCart>()
// .ForMember(dest => dest.ImageUrlPath, opt => opt.MapFrom(
// src => src.MainImage != null ? src.MainImage.UrlPath : (src.Images.Any() ? src.Images.FirstOrDefault().UrlPath : "")))
// .ForMember(dest => dest.ImageFileExtension, opt => opt.MapFrom(
// src => src.MainImage != null ? src.MainImage.FileExtension : (src.Images.Any() ? src.Images.FirstOrDefault().FileExtension : "")))
// ;
}
}
}
|
namespace MvcProject.Web.Areas.Public.ViewModels.Products
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutoMapper;
using Data.Models;
using Data.Models.Catalog;
using Infrastructure.Mapping;
using Services.Web;
public class ProductForShoppingCart : BasePublicViewModel<int>, IMapFrom<Product>/*, IMapFrom<ProductCacheViewModel>*/, IHaveCustomMappings
{
public string EncodedId
{
get { return IdentifierProvider.EncodeIntIdStatic(this.Id); }
}
public string Title { get; set; }
public decimal UnitPrice { get; set; }
public decimal? ShippingPrice { get; set; }
public string ImageUrlPath { get; set; }
public string ImageFileExtension { get; set; }
public void CreateMappings(IMapperConfigurationExpression configuration)
{
configuration.CreateMap<Product, ProductForShoppingCart>()
.ForMember(dest => dest.ImageUrlPath, opt => opt.MapFrom(
src => src.MainImage != null ? src.MainImage.UrlPath : (src.Images.Any() ? src.Images.FirstOrDefault().UrlPath : "")))
.ForMember(dest => dest.ImageFileExtension, opt => opt.MapFrom(
src => src.MainImage != null ? src.MainImage.FileExtension : (src.Images.Any() ? src.Images.FirstOrDefault().FileExtension : "")))
;
//configuration.CreateMap<ProductCacheViewModel, ProductForShoppingCart>()
// .ForMember(dest => dest.ImageUrlPath, opt => opt.MapFrom(
// src => src.MainImage != null ? src.MainImage.UrlPath : (src.Images.Any() ? src.Images.FirstOrDefault().UrlPath : "")))
// .ForMember(dest => dest.ImageFileExtension, opt => opt.MapFrom(
// src => src.MainImage != null ? src.MainImage.FileExtension : (src.Images.Any() ? src.Images.FirstOrDefault().FileExtension : "")))
// ;
}
}
}
|
mit
|
C#
|
3deb34a0bd257ce54c20c9e2fb982f9f02e45b54
|
remove nullable mark
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/PasswordFinderResultViewModel.cs
|
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/PasswordFinderResultViewModel.cs
|
using WalletWasabi.Fluent.ViewModels.Navigation;
namespace WalletWasabi.Fluent.ViewModels.Login.PasswordFinder
{
public partial class PasswordFinderResultViewModel : RoutableViewModel
{
[AutoNotify] private string _password;
[AutoNotify] private bool _success;
public PasswordFinderResultViewModel(string password)
{
Title = "Password Finder";
_password = password;
NextCommand = CancelCommand;
}
}
}
|
using WalletWasabi.Fluent.ViewModels.Navigation;
namespace WalletWasabi.Fluent.ViewModels.Login.PasswordFinder
{
public partial class PasswordFinderResultViewModel : RoutableViewModel
{
[AutoNotify] private string? _password;
[AutoNotify] private bool _success;
public PasswordFinderResultViewModel(string password)
{
Title = "Password Finder";
_password = password;
NextCommand = CancelCommand;
}
}
}
|
mit
|
C#
|
4eed544671f5f26f7e6ddc65ec473e090cefcd78
|
Duplicate test case.
|
jordangray/WebApiContrib.Formatting.Xlsx,WebApiContrib/WebApiContrib.Formatting.Xlsx,WebApiContrib/WebApiContrib.Formatting.Xlsx,balajichekka/WebApiContrib.Formatting.Xlsx
|
ExcelWebApi/ExcelWebApi.Tests/ExcelMediaTypeFormatterTests.cs
|
ExcelWebApi/ExcelWebApi.Tests/ExcelMediaTypeFormatterTests.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ExcelWebApi.Tests
{
[TestClass]
public class ExcelMediaTypeFormatterTests
{
[TestMethod]
public void SupportedMediaTypes_SupportsExcelMediaTypes()
{
}
[TestMethod]
public void CanWriteType_TypeCollection_CanWriteType()
{
}
[TestMethod]
public void CanWriteType_TypeObject_CannotWriteType()
{
}
[TestMethod]
public void WriteToStreamAsync_WithGenericCollection_WritesExcelDocumentToStream()
{
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ExcelWebApi.Tests
{
[TestClass]
public class ExcelMediaTypeFormatterTests
{
[TestMethod]
public void SupportedMediaTypes_SupportsExcelMediaTypes()
{
}
[TestMethod]
public void CanWriteType_TypeCollection_CanWriteType()
{
}
[TestMethod]
public void CanWriteType_TypeObject_CannotWriteType()
{
}
[TestMethod]
public void WriteToStreamAsync_WithGenericCollection_WritesExcelDocumentToStream()
{
}
[TestMethod]
public void WriteToStreamAsync_WritesExcelDocumentToStream()
{
}
}
}
|
mit
|
C#
|
949bb63a128e4e9897d80f79f67457cd5a6c5603
|
Update AddingLabelControl.cs
|
asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/CSharp/DrawingObjects/Controls/AddingLabelControl.cs
|
Examples/CSharp/DrawingObjects/Controls/AddingLabelControl.cs
|
using System.IO;
using Aspose.Cells;
using Aspose.Cells.Drawing;
using System.Drawing;
namespace Aspose.Cells.Examples.DrawingObjects.Controls
{
public class AddingLabelControl__
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Create a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet in the workbook.
Worksheet sheet = workbook.Worksheets[0];
//Add a new label to the worksheet.
Aspose.Cells.Drawing.Label label = sheet.Shapes.AddLabel(2, 0, 2, 0, 60, 120);
//Set the caption of the label.
label.Text = "This is a Label";
//Set the Placement Type, the way the
//label is attached to the cells.
label.Placement = PlacementType.FreeFloating;
//Set the fill color of the label.
label.FillFormat.ForeColor = Color.Yellow;
//Saves the file.
workbook.Save(dataDir + "book1.out.xls");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
using Aspose.Cells.Drawing;
using System.Drawing;
namespace Aspose.Cells.Examples.DrawingObjects.Controls
{
public class AddingLabelControl__
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Create a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet in the workbook.
Worksheet sheet = workbook.Worksheets[0];
//Add a new label to the worksheet.
Aspose.Cells.Drawing.Label label = sheet.Shapes.AddLabel(2, 0, 2, 0, 60, 120);
//Set the caption of the label.
label.Text = "This is a Label";
//Set the Placement Type, the way the
//label is attached to the cells.
label.Placement = PlacementType.FreeFloating;
//Set the fill color of the label.
label.FillFormat.ForeColor = Color.Yellow;
//Saves the file.
workbook.Save(dataDir + "book1.out.xls");
}
}
}
|
mit
|
C#
|
379ce01db49f74b9f16eebf9206bbd983ee5f9d4
|
Add GetClientIP method to the base APi controller.
|
enarod/enarod-web-api,enarod/enarod-web-api,enarod/enarod-web-api
|
Infopulse.EDemocracy.Web/Controllers/API/BaseApiController.cs
|
Infopulse.EDemocracy.Web/Controllers/API/BaseApiController.cs
|
using Infopulse.EDemocracy.Data.Interfaces;
using Infopulse.EDemocracy.Data.Repositories;
using System.Linq;
using System.Net.Http;
using System.Security.Claims;
using System.ServiceModel.Channels;
using System.Web;
using System.Web.Http;
namespace Infopulse.EDemocracy.Web.Controllers.API
{
/// <summary>
/// The base class for api controllers
/// </summary>
public abstract class BaseApiController : ApiController
{
protected IUserDetailRepository userDetailRepository;
protected BaseApiController()
{
this.userDetailRepository = new UserDetailRepository();
}
/// <summary>
/// Gets UserEmail of signed in user.
/// </summary>
/// <returns>Signed in user's email.</returns>
protected string GetSignedInUserEmail()
{
var identity = User.Identity as ClaimsIdentity;
if (identity != null)
{
var emailClaim = identity.Claims.SingleOrDefault(c => c.Type == ClaimTypes.Email);
var email = emailClaim.Value;
return email;
}
return null;
}
/// <summary>
/// Gets ID of signed in user.
/// </summary>
/// <returns>User ID.</returns>
protected int GetSignedInUserId()
{
var userEmail = GetSignedInUserEmail();
var userId = userDetailRepository.GetUserId(userEmail);
return userId;
}
protected string GetClientIP(HttpRequestMessage request = null)
{
request = request ?? Request;
var ip = Request.GetOwinContext().Request.RemoteIpAddress; // WebAPI 2.2 feature
if (!string.IsNullOrWhiteSpace(ip)) return ip;
if (request.Properties.ContainsKey("MS_HttpContext"))
{
return ((HttpContextWrapper)request.Properties["MS_HttpContext"]).Request.UserHostAddress;
}
else if (request.Properties.ContainsKey(RemoteEndpointMessageProperty.Name))
{
RemoteEndpointMessageProperty prop = (RemoteEndpointMessageProperty)request.Properties[RemoteEndpointMessageProperty.Name];
return prop.Address;
}
else if (HttpContext.Current != null)
{
return HttpContext.Current.Request.UserHostAddress;
}
else
{
return null;
}
}
}
}
|
using Infopulse.EDemocracy.Data.Interfaces;
using Infopulse.EDemocracy.Data.Repositories;
using System.Linq;
using System.Security.Claims;
using System.Web.Http;
namespace Infopulse.EDemocracy.Web.Controllers.API
{
/// <summary>
/// The base class for api controllers
/// </summary>
public class BaseApiController : ApiController
{
protected IUserDetailRepository userDetailRepository;
public BaseApiController()
{
this.userDetailRepository = new UserDetailRepository();
}
/// <summary>
/// Gets UserEmail of signed in user.
/// </summary>
/// <returns>Signed in user's email.</returns>
public string GetSignedInUserEmail()
{
var identity = User.Identity as ClaimsIdentity;
if (identity != null)
{
var emailClaim = identity.Claims.SingleOrDefault(c => c.Type == ClaimTypes.Email);
var email = emailClaim.Value;
return email;
}
return null;
}
/// <summary>
/// Gets ID of signed in user.
/// </summary>
/// <returns>User ID.</returns>
public int GetSignedInUserId()
{
var userEmail = GetSignedInUserEmail();
var userId = userDetailRepository.GetUserId(userEmail);
return userId;
}
}
}
|
cc0-1.0
|
C#
|
00ef65ba2dcaadd329a5a5b8da3169e95dafb16b
|
create directory
|
ArsenShnurkov/BitSharp
|
BitSharp.BlockHelper/Generator.cs
|
BitSharp.BlockHelper/Generator.cs
|
using BitSharp.BlockHelper;
using BitSharp.Common.ExtensionMethods;
using BitSharp.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitSharp.BlockHelper
{
public class BlockHelper
{
public static void Main(string[] args)
{
var projectFolder = Environment.CurrentDirectory;
while (!projectFolder.EndsWith(@"\BitSharp.BlockHelper", StringComparison.InvariantCultureIgnoreCase))
projectFolder = Path.GetDirectoryName(projectFolder);
var blockFolder = Path.Combine(projectFolder, "Blocks");
if (!Directory.Exists(blockFolder))
Directory.CreateDirectory(blockFolder);
var blockExplorerProvider = new BlockExplorerProvider();
var height = 0;
foreach (var block in blockExplorerProvider.GetBlocks(Enumerable.Range(0, 10.THOUSAND())))
{
var heightFile = new FileInfo(Path.Combine(blockFolder, "{0}.blk".Format2(height)));
height++;
using (var stream = new FileStream(heightFile.FullName, FileMode.Create))
using (var writer = new BinaryWriter(stream))
{
writer.Write(DataEncoder.EncodeBlock(block));
}
var hashFile = new FileInfo(Path.Combine(blockFolder, "{0}.blk".Format2(block.Hash)));
using (var stream = new FileStream(hashFile.FullName, FileMode.Create))
using (var writer = new BinaryWriter(stream))
{
writer.Write(DataEncoder.EncodeBlock(block));
}
}
}
}
}
|
using BitSharp.BlockHelper;
using BitSharp.Common.ExtensionMethods;
using BitSharp.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitSharp.BlockHelper
{
public class BlockHelper
{
public static void Main(string[] args)
{
var projectFolder = Environment.CurrentDirectory;
while (!projectFolder.EndsWith(@"\BitSharp.BlockHelper", StringComparison.InvariantCultureIgnoreCase))
projectFolder = Path.GetDirectoryName(projectFolder);
var blockFolder = Path.Combine(projectFolder, "Blocks");
var blockExplorerProvider = new BlockExplorerProvider();
var height = 0;
foreach (var block in blockExplorerProvider.GetBlocks(Enumerable.Range(0, 10.THOUSAND())))
{
var heightFile = new FileInfo(Path.Combine(blockFolder, "{0}.blk".Format2(height)));
height++;
using (var stream = new FileStream(heightFile.FullName, FileMode.Create))
using (var writer = new BinaryWriter(stream))
{
writer.Write(DataEncoder.EncodeBlock(block));
}
var hashFile = new FileInfo(Path.Combine(blockFolder, "{0}.blk".Format2(block.Hash)));
using (var stream = new FileStream(hashFile.FullName, FileMode.Create))
using (var writer = new BinaryWriter(stream))
{
writer.Write(DataEncoder.EncodeBlock(block));
}
}
}
}
}
|
unlicense
|
C#
|
ae461337732e2ef595ce3737c1f18f5e44c3a242
|
优化ReadBytes方法,以提升性能。
|
RabbitTeam/WeiXinSDK
|
Rabbit.WeiXin/SDK/Rabbit.WeiXin/Utility/Extensions/StreamExtensions.cs
|
Rabbit.WeiXin/SDK/Rabbit.WeiXin/Utility/Extensions/StreamExtensions.cs
|
using System;
using System.Collections.Generic;
using System.IO;
namespace Rabbit.WeiXin.Utility.Extensions
{
/// <summary>
/// 流扩展方法。
/// </summary>
internal static class StreamExtensions
{
/// <summary>
/// 将流读取成字节组。
/// </summary>
/// <param name="stream">流。</param>
/// <returns>字节组。</returns>
public static byte[] ReadBytes(this Stream stream)
{
if (!stream.NotNull("stream").CanRead)
throw new NotSupportedException(stream + "不支持读取。");
Action trySeekBegin = () =>
{
if (!stream.CanSeek)
return;
stream.Seek(0, SeekOrigin.Begin);
};
trySeekBegin();
var list = new List<byte>(stream.Length > int.MaxValue ? int.MaxValue : (int)stream.Length);
int b;
while ((b = stream.ReadByte()) != -1)
list.Add((byte)b);
trySeekBegin();
return list.ToArray();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
namespace Rabbit.WeiXin.Utility.Extensions
{
/// <summary>
/// 流扩展方法。
/// </summary>
internal static class StreamExtensions
{
/// <summary>
/// 将流读取成字节组。
/// </summary>
/// <param name="stream">流。</param>
/// <returns>字节组。</returns>
public static byte[] ReadBytes(this Stream stream)
{
if (!stream.NotNull("stream").CanRead)
throw new NotSupportedException(stream + "不支持读取。");
Action trySeekBegin = () =>
{
if (!stream.CanSeek)
return;
stream.Seek(0, SeekOrigin.Begin);
};
trySeekBegin();
var list = new List<byte>();
int b;
while ((b = stream.ReadByte()) != -1)
list.Add((byte)b);
trySeekBegin();
return list.ToArray();
}
}
}
|
apache-2.0
|
C#
|
131bc625bb73d39f5c8ce177614887f800214fe5
|
replace deprecated sgid10 with open sgid
|
agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov,agrc/api.mapserv.utah.gov
|
WebAPI.API/Commands/Address/GetAddressGridsWithAddressPointsCommand.cs
|
WebAPI.API/Commands/Address/GetAddressGridsWithAddressPointsCommand.cs
|
using System.Collections.Generic;
using System.Configuration;
using Dapper;
using Npgsql;
using WebAPI.Common.Abstractions;
namespace WebAPI.API.Commands.Address
{
public class GetAddressGridsWithAddressPointsCommand : Command<IEnumerable<string>>
{
public static readonly string ConnectionString = ConfigurationManager.AppSettings["open_sgid_connection"];
private const string Sql = "select distinct addsystem from location.address_points " +
"order by addsystem asc;";
public override string ToString()
{
return string.Format("{0}, ConnectionString: {1}", "GetAddressGridsWithAddressPointsCommand", ConnectionString);
}
protected override void Execute()
{
using var session = new NpgsqlConnection(ConnectionString);
session.Open();
Result = session.Query<string>(Sql);
}
}
}
|
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using Dapper;
using WebAPI.Common.Abstractions;
namespace WebAPI.API.Commands.Address
{
public class GetAddressGridsWithAddressPointsCommand : Command<IEnumerable<string>>
{
public GetAddressGridsWithAddressPointsCommand()
{
ConnectionString = ConfigurationManager.AppSettings["location_connection"];
}
public GetAddressGridsWithAddressPointsCommand(string connectionString)
{
ConnectionString = connectionString;
}
public string ConnectionString { get; set; }
public override string ToString()
{
return string.Format("{0}, ConnectionString: {1}", "GetAddressGridsWithAddressPointsCommand", ConnectionString);
}
protected override void Execute()
{
using (var connection = new SqlConnection(ConnectionString))
{
connection.Open();
Result = connection.Query<string>("SELECT DISTINCT ADDSYSTEM FROM ADDRESSPOINTS");
}
}
}
}
|
mit
|
C#
|
47174449b51d5d17c6754a4315880324a0a7709e
|
add Settings menu item
|
greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d
|
Assets/HappyFunTimes/HappyFunTimesCore/Editor/HFTMenuItems.cs
|
Assets/HappyFunTimes/HappyFunTimesCore/Editor/HFTMenuItems.cs
|
/*
* Copyright 2014, Gregg Tavares.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Gregg Tavares. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using UnityEngine;
using UnityEditor;
namespace HappyFunTimesEditor {
public class HFTMenuItems {
[MenuItem ("Window/HappyFunTimes/Settings", false, 1)]
static void HappyFunTimesWindow () {
ScriptableObject s = HappyFunTimes.HFTHappyFunTimesSettings.GetInstance();
Selection.objects = new UnityEngine.Object[] { s };
}
[MenuItem("Window/HappyFunTimes/Docs", false, 2)]
static void Docs() {
Application.OpenURL("http://docs.happyfuntimes.net/docs/unity");
}
[MenuItem("Window/HappyFunTimes/Troubleshooting", false, 2)]
static void HappyFunTimesTroubleShooting() {
Application.OpenURL("http://docs.happyfuntimes.net/docs/troubleshooting.html");
}
[MenuItem("Window/HappyFunTimes/Support", false, 3)]
static void HappyFunTimesSupport() {
Application.OpenURL("http://github.com/greggman/HappyFunTimes/issues");
}
[MenuItem("Window/HappyFunTimes/SuperHappyFunTimes", false, 12)]
static void SuperHappyFunTimes() {
Application.OpenURL("http://superhappyfuntimes.net");
}
}
} // namespace HappyFunTimesEditor
|
/*
* Copyright 2014, Gregg Tavares.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Gregg Tavares. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using UnityEngine;
using UnityEditor;
namespace HappyFunTimesEditor {
public class HFTMenuItems {
[MenuItem("Window/HappyFunTimes/Docs", false, 1)]
static void Docs() {
Application.OpenURL("http://docs.happyfuntimes.net/docs/unity");
}
[MenuItem("Window/HappyFunTimes/Troubleshooting", false, 2)]
static void HappyFunTimesTroubleShooting() {
Application.OpenURL("http://docs.happyfuntimes.net/docs/troubleshooting.html");
}
[MenuItem("Window/HappyFunTimes/Support", false, 3)]
static void HappyFunTimesSupport() {
Application.OpenURL("http://github.com/greggman/HappyFunTimes/issues");
}
[MenuItem("Window/HappyFunTimes/SuperHappyFunTimes", false, 12)]
static void SuperHappyFunTimes() {
Application.OpenURL("http://superhappyfuntimes.net");
}
}
} // namespace HappyFunTimesEditor
|
bsd-3-clause
|
C#
|
d639557d8c918d8c4a9da9ba9537133dc55bbf53
|
Add default security header configuration to app
|
andrewlock/blog-examples,andrewlock/blog-examples,andrewlock/blog-examples,andrewlock/blog-examples
|
adding-default-security-headers/src/AddingDefaultSecurityHeaders/Startup.cs
|
adding-default-security-headers/src/AddingDefaultSecurityHeaders/Startup.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AddingDefaultSecurityHeaders.Middleware;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace AddingDefaultSecurityHeaders
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; set; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseIISPlatformHandler();
app.UseSecurityHeadersMiddleware(
new SecurityHeadersBuilder()
.AddDefaultSecurePolicy());
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
// Entry point for the application.
public static void Main(string[] args) => WebApplication.Run<Startup>(args);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace AddingDefaultSecurityHeaders
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; set; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseIISPlatformHandler();
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
// Entry point for the application.
public static void Main(string[] args) => WebApplication.Run<Startup>(args);
}
}
|
mit
|
C#
|
3a682876e5a62769f66ed601f573725211a0438c
|
clear highlighted objects in a non-event-driven way
|
davidyu/ld29,davidyu/ld29
|
warmup/Assets/MapUIController.cs
|
warmup/Assets/MapUIController.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
public class MapUIController : MonoBehaviour {
private MapManager manager;
public List<GameObject> highlightedCells = new List<GameObject>();
// Use this for initialization
void Start () {
manager = GetComponent<MapManager>();
}
// Update is called once per frame
void Update () {
Vector3 mousePos = Input.mousePosition;
mousePos.z = -Camera.main.transform.position.z; // why? I don't know! Otherwise nothing works
Vector3 worldPos = Camera.main.ScreenToWorldPoint( mousePos );
int gridx = (int) Math.Ceiling( worldPos.x / ( MapManager.margin.x ) ) - 1,
gridy = (int) Math.Ceiling( worldPos.y / ( MapManager.margin.y ) );
if ( gridx % 2 == 0 && gridy % 2 == 0 ) { // hack to only process cells and not margins
print( gridx / 2 + "," + gridy / 2 );
int index = (int) ( gridy / 2 + ( gridx / 2 ) * manager.GridSize.x );
GameObject target = manager.grid[ index ];
if ( !highlightedCells.Exists( x => x == target ) ) {
highlightedCells.Add( target );
}
} // ignore otherwise
// TODO clear all but the last highlighted cells
while ( highlightedCells.Count > 1 ) {
GameObject cell = highlightedCells[ 0 ];
cell.GetComponent<Tile>().state = TileState.NORMAL;
highlightedCells.RemoveAt(0);
}
// highlight cells
highlightedCells.ForEach( x => x.GetComponent<Tile>().state = TileState.HILIGHTED );
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
public class MapUIController : MonoBehaviour {
private MapManager manager;
public List<GameObject> highlightedCells = new List<GameObject>();
// Use this for initialization
void Start () {
manager = GetComponent<MapManager>();
}
// Update is called once per frame
void Update () {
if( Input.GetMouseButtonDown( 0 ) ) {
Vector3 mousePos = Input.mousePosition;
mousePos.z = -Camera.main.transform.position.z;
Vector3 worldPos = Camera.main.ScreenToWorldPoint( mousePos );
int gridx = (int) Math.Ceiling( worldPos.x / ( MapManager.margin.x ) ) - 1,
gridy = (int) Math.Ceiling( worldPos.y / ( MapManager.margin.y ) );
if ( gridx % 2 == 0 && gridy % 2 == 0 ) { // hack to only process cells and not margins
print( gridx / 2 + "," + gridy / 2 );
int index = (int) ( gridy / 2 + ( gridx / 2 ) * manager.GridSize.x );
GameObject target = manager.grid[ index ];
if ( !highlightedCells.Exists( x => x == target ) ) {
highlightedCells.Add( target );
}
} // ignore otherwise
// TODO clear all but the last highlighted cells
// highlight cells
highlightedCells.ForEach( x => x.GetComponent<Tile>().state = TileState.HILIGHTED );
}
}
}
|
mit
|
C#
|
1d54f0003c093318439a8924535f14b368931a3c
|
Move JQuery to the top of the layout so scripts inside a page work
|
CS297Sp16/LCC_Co-op_Site,CS297Sp16/LCC_Co-op_Site,CS297Sp16/LCC_Co-op_Site
|
Coop_Listing_Site/Coop_Listing_Site/Views/Shared/_Layout.cshtml
|
Coop_Listing_Site/Coop_Listing_Site/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Co-op Listing", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
@if (User.Identity.IsAuthenticated)
{
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("Control Panel", "Index", "ControlPanel")</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>@Html.ActionLink("Logout", "LogOut", "Auth")</li>
</ul>
}
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
</div>
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Co-op Listing", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
@if (User.Identity.IsAuthenticated)
{
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("Control Panel", "Index", "ControlPanel")</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>@Html.ActionLink("Logout", "LogOut", "Auth")</li>
</ul>
}
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
b7332a1b9ffe28bdf35219da4df8446b52171bb1
|
Remove empty line
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml.cs
|
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml.cs
|
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Markup.Xaml;
using ReactiveUI;
using System;
using System.Reactive.Linq;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinListView : UserControl
{
public static readonly StyledProperty<bool> SelectAllNonPrivateVisibleProperty =
AvaloniaProperty.Register<CoinListView, bool>(nameof(SelectAllNonPrivateVisible), defaultBindingMode: BindingMode.OneWayToSource);
public bool SelectAllNonPrivateVisible
{
get => GetValue(SelectAllNonPrivateVisibleProperty);
set => SetValue(SelectAllNonPrivateVisibleProperty, value);
}
public static readonly StyledProperty<bool> SelectAllPrivateVisibleProperty =
AvaloniaProperty.Register<CoinListView, bool>(nameof(SelectAllPrivateVisible), defaultBindingMode: BindingMode.OneWayToSource);
public bool SelectAllPrivateVisible
{
get => GetValue(SelectAllPrivateVisibleProperty);
set => SetValue(SelectAllPrivateVisibleProperty, value);
}
public CoinListView()
{
InitializeComponent();
SelectAllNonPrivateVisible = true;
SelectAllPrivateVisible = true;
this.WhenAnyValue(x => x.DataContext)
.Subscribe(dataContext =>
{
if (dataContext is CoinListViewModel viewmodel)
{
// Value is only propagated when DataContext is set at the beginning.
viewmodel.SelectAllNonPrivateVisible = SelectAllNonPrivateVisible;
viewmodel.SelectAllPrivateVisible = SelectAllPrivateVisible;
}
});
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Markup.Xaml;
using ReactiveUI;
using System;
using System.Reactive.Linq;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinListView : UserControl
{
public static readonly StyledProperty<bool> SelectAllNonPrivateVisibleProperty =
AvaloniaProperty.Register<CoinListView, bool>(nameof(SelectAllNonPrivateVisible), defaultBindingMode: BindingMode.OneWayToSource);
public bool SelectAllNonPrivateVisible
{
get => GetValue(SelectAllNonPrivateVisibleProperty);
set => SetValue(SelectAllNonPrivateVisibleProperty, value);
}
public static readonly StyledProperty<bool> SelectAllPrivateVisibleProperty =
AvaloniaProperty.Register<CoinListView, bool>(nameof(SelectAllPrivateVisible), defaultBindingMode: BindingMode.OneWayToSource);
public bool SelectAllPrivateVisible
{
get => GetValue(SelectAllPrivateVisibleProperty);
set => SetValue(SelectAllPrivateVisibleProperty, value);
}
public CoinListView()
{
InitializeComponent();
SelectAllNonPrivateVisible = true;
SelectAllPrivateVisible = true;
this.WhenAnyValue(x => x.DataContext)
.Subscribe(dataContext =>
{
if (dataContext is CoinListViewModel viewmodel)
{
// Value is only propagated when DataContext is set at the beginning.
viewmodel.SelectAllNonPrivateVisible = SelectAllNonPrivateVisible;
viewmodel.SelectAllPrivateVisible = SelectAllPrivateVisible;
}
});
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|
mit
|
C#
|
7ce816a9936ba939fc916e4bff815f7471914b23
|
Clean up white spacing of in ProtobufMessageSerializer.cs
|
jonnii/chinchilla
|
src/Chinchilla.Serializers.Protobuf/ProtobufMessageSerializer.cs
|
src/Chinchilla.Serializers.Protobuf/ProtobufMessageSerializer.cs
|
using Google.Protobuf;
using System;
using System.Collections.Generic;
namespace Chinchilla.Serializers.Protobuf
{
public class ProtobufMessageSerializer : IMessageSerializer
{
private class SerializerFunc
{
public SerializerFunc(Func<byte[], object> fromProto, Func<object, byte[]> toProto)
{
FromProto = fromProto;
ToProto = toProto;
}
internal Func<byte[], object> FromProto { get; }
internal Func<object, byte[]> ToProto { get; }
}
private Dictionary<Type, SerializerFunc> _cache = new Dictionary<Type, SerializerFunc>();
private ProtobufMessageSerializer()
{
}
public void Register<T>(MessageParser<T> parser) where T : Google.Protobuf.IMessage<T>
{
var toBytes = new Func<byte[], object>(b => parser.ParseFrom(b));
var fromBytes = new Func<object, byte[]>(o => MessageExtensions.ToByteArray((T)o));
if (!_cache.ContainsKey(typeof(T)))
{
_cache.Add(typeof(T), new SerializerFunc(toBytes, fromBytes));
}
}
public static IMessageSerializer Create(Action<ProtobufMessageSerializer> create)
{
var s = new ProtobufMessageSerializer();
create(s);
return s;
}
public string ContentType { get; } = "application/x-protobuf";
public IMessage<T> Deserialize<T>(byte[] message)
{
var typeSerializer = _cache[typeof(T)].FromProto; ;
return Message.Create((T)typeSerializer(message));
}
public byte[] Serialize<T>(IMessage<T> message)
{
var typeSerializer = _cache[typeof(T)].ToProto;
return typeSerializer(message.Body);
}
}
}
|
using System;
using System.Collections.Generic;
using Google.Protobuf;
namespace Chinchilla.Serializers.Protobuf
{
public class ProtobufMessageSerializer : IMessageSerializer
{
private class SerializerFunc
{
public SerializerFunc(Func<byte[], object> fromProto, Func<object, byte[]> toProto)
{
FromProto = fromProto;
ToProto = toProto;
}
internal Func<byte[], object> FromProto { get; }
internal Func<object, byte[]> ToProto { get; }
}
private Dictionary<Type, SerializerFunc> _cache = new Dictionary<Type, SerializerFunc>();
private ProtobufMessageSerializer()
{
}
public void Register<T>(MessageParser<T> parser) where T : Google.Protobuf.IMessage<T>
{
var toBytes = new Func<byte[], object>(b => parser.ParseFrom(b));
var fromBytes = new Func<object, byte[]>(o => MessageExtensions.ToByteArray((T)o));
if (!_cache.ContainsKey(typeof(T)))
{
_cache.Add(typeof(T), new SerializerFunc(toBytes, fromBytes));
}
}
public static IMessageSerializer Create(Action<ProtobufMessageSerializer> create)
{
var s = new ProtobufMessageSerializer();
create(s);
return s;
}
public string ContentType { get; } = "application/x-protobuf";
public IMessage<T> Deserialize<T>(byte[] message)
{
var typeSerializer = _cache[typeof(T)].FromProto; ;
return Message.Create((T) typeSerializer(message));
}
public byte[] Serialize<T>(IMessage<T> message)
{
var typeSerializer = _cache[typeof(T)].ToProto;
return typeSerializer(message.Body);
}
}
}
|
apache-2.0
|
C#
|
eee77a8f10dae2cd2221477b6999203844d10772
|
Improve XML docs for ActionResultStatusCodeAttribute (#22598)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Mvc/Mvc.Core/src/Infrastructure/ActionResultStatusCodeAttribute.cs
|
src/Mvc/Mvc.Core/src/Infrastructure/ActionResultStatusCodeAttribute.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
/// <summary>
/// Attribute annotated on ActionResult constructor and helper method parameters to indicate
/// that the parameter is used to set the "statusCode" for the ActionResult.
/// <para>
/// Analyzers match this parameter by type name. This allows users to annotate custom results \ custom helpers
/// with a user-defined attribute without having to expose this type.
/// </para>
/// <para>
/// This attribute is intentionally marked Inherited=false since the analyzer does not walk the inheritance graph.
/// </para>
/// </summary>
/// <example>
/// Annotated constructor parameter:
/// <code>
/// public StatusCodeResult([ActionResultStatusCode] int statusCode)
/// {
/// StatusCode = statusCode;
/// }
/// </code>
/// </example>
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public sealed class ActionResultStatusCodeAttribute : Attribute
{
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
/// <summary>
/// Attribute annoted on ActionResult constructor and helper method parameters to indicate
/// that the parameter is used to set the "statusCode" for the ActionResult.
/// <para>
/// Analyzers match this parameter by type name. This allows users to annotate custom results \ custom helpers
/// with a user defined attribute without having to expose this type.
/// </para>
/// <para>
/// This attribute is intentionally marked Inherited=false since the analyzer does not walk the inheritance graph.
/// </para>
/// </summary>
/// <example>
/// StatusCodeResult([ActionResultStatusCodeParameter] int statusCode)
/// </example>
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public sealed class ActionResultStatusCodeAttribute : Attribute
{
}
}
|
apache-2.0
|
C#
|
b4966bd5bd63b8e8b21a3f691eaf32560aecfd61
|
Update SinkOptions.cs
|
serilog/serilog-sinks-mssqlserver
|
src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/Options/SinkOptions.cs
|
src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/Options/SinkOptions.cs
|
using System;
namespace Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options
{
/// <summary>
/// Stores configuration options for the sink
/// </summary>
public class SinkOptions
{
/// <summary>
/// Intiailizes a new SinkOptions instance with default values
/// </summary>
public SinkOptions()
{
SchemaName = MSSqlServerSink.DefaultSchemaName;
BatchPostingLimit = MSSqlServerSink.DefaultBatchPostingLimit;
BatchPeriod = MSSqlServerSink.DefaultPeriod;
}
internal SinkOptions(
string tableName,
int? batchPostingLimit,
TimeSpan? batchPeriod,
bool autoCreateSqlTable,
string schemaName) : this()
{
TableName = tableName;
BatchPostingLimit = batchPostingLimit ?? BatchPostingLimit;
BatchPeriod = batchPeriod ?? BatchPeriod;
AutoCreateSqlTable = autoCreateSqlTable;
SchemaName = schemaName ?? SchemaName;
}
/// <summary>
/// Name of the database table for writing the log events
/// </summary>
public string TableName { get; set; }
/// <summary>
/// Name of the database schema (default: "dbo")
/// </summary>
public string SchemaName { get; set; }
/// <summary>
/// Flag to automatically create the log events table if it does not exist (default: false)
/// </summary>
public bool AutoCreateSqlTable { get; set; }
/// <summary>
/// Limits how many log events are written to the database per batch (default: 50)
/// </summary>
public int BatchPostingLimit { get; set; }
/// <summary>
/// Time span until a batch of log events is written to the database (default: 5 seconds)
/// </summary>
public TimeSpan BatchPeriod { get; set; }
/// <summary>
/// Flag to enable SQL authentication using Azure Managed Identities (default: false)
/// </summary>
public bool UseAzureManagedIdentity { get; set; }
/// <summary>
/// Azure service token provider to be used for Azure Managed Identities
/// </summary>
public string AzureServiceTokenProviderResource { get; set; }
}
}
|
using System;
namespace Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options
{
/// <summary>
/// Stores configuration options for the sink
/// </summary>
public class SinkOptions
{
/// <summary>
/// Intiailizes a new SinkOptions instance with default values
/// </summary>
public SinkOptions()
{
SchemaName = MSSqlServerSink.DefaultSchemaName;
BatchPostingLimit = MSSqlServerSink.DefaultBatchPostingLimit;
BatchPeriod = MSSqlServerSink.DefaultPeriod;
}
internal SinkOptions(
string tableName,
int? batchPostingLimit,
TimeSpan? batchPeriod,
bool autoCreateSqlTable,
string schemaName) : this()
{
TableName = tableName;
BatchPostingLimit = batchPostingLimit ?? BatchPostingLimit;
BatchPeriod = batchPeriod ?? BatchPeriod;
AutoCreateSqlTable = autoCreateSqlTable;
SchemaName = schemaName ?? SchemaName;
}
/// <summary>
/// Name of the database table for writing the log events
/// </summary>
public string TableName { get; set; }
/// <summary>
/// Name of the database schema (default: "dbo")
/// </summary>
public string SchemaName { get; set; }
/// <summary>
/// Flag to automatically create the log events tabke if it does not exist (default: false)
/// </summary>
public bool AutoCreateSqlTable { get; set; }
/// <summary>
/// Limits how many log events are written to the database per batch (default: 50)
/// </summary>
public int BatchPostingLimit { get; set; }
/// <summary>
/// Time span until a batch of log events is written to the database (default: 5 seconds)
/// </summary>
public TimeSpan BatchPeriod { get; set; }
/// <summary>
/// Flag to enable SQL authentication using Azure Managed Identities (default: false)
/// </summary>
public bool UseAzureManagedIdentity { get; set; }
/// <summary>
/// Azure service token provider to be used for Azure Managed Identities
/// </summary>
public string AzureServiceTokenProviderResource { get; set; }
}
}
|
apache-2.0
|
C#
|
76260e5d58f2bea558810ee261c208dab9cb1b51
|
Add triple variant of Zip as IEnumerable<> extension
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi/Crypto/Extensions.cs
|
WalletWasabi/Crypto/Extensions.cs
|
using System.Collections.Generic;
using WalletWasabi.Helpers;
using WalletWasabi.Crypto.Groups;
namespace System.Linq
{
public static class Extensions
{
public static GroupElement Sum(this IEnumerable<GroupElement> groupElements) =>
groupElements.Aggregate(GroupElement.Infinity, (ge, acc) => ge + acc);
public static IEnumerable<TResult> Zip<TFirst, TSecond, TThird, TResult>(this IEnumerable<TFirst> first, IEnumerable<TSecond> second, IEnumerable<TThird> third, Func<TFirst, TSecond, TThird, TResult> resultSelector)
{
Guard.NotNull(nameof(first), first);
Guard.NotNull(nameof(second), second);
Guard.NotNull(nameof(third), third);
Guard.NotNull(nameof(resultSelector), resultSelector);
using var e1 = first.GetEnumerator();
using var e2 = second.GetEnumerator();
using var e3 = third.GetEnumerator();
while (e1.MoveNext() && e2.MoveNext() && e3.MoveNext())
{
yield return resultSelector(e1.Current, e2.Current, e3.Current);
}
}
}
}
|
using System.Collections.Generic;
using WalletWasabi.Crypto.Groups;
namespace System.Linq
{
public static class Extensions
{
public static GroupElement Sum(this IEnumerable<GroupElement> groupElements) =>
groupElements.Aggregate(GroupElement.Infinity, (ge, acc) => ge + acc);
}
}
|
mit
|
C#
|
404df82113a47312081144c0114566a30019cb25
|
Fix peon build
|
paulomenezes/warcraft
|
Warcraft/Commands/BuilderUnits.cs
|
Warcraft/Commands/BuilderUnits.cs
|
using Warcraft.Managers;
using Warcraft.Units;
using Warcraft.Util;
namespace Warcraft.Commands
{
class BuilderUnits : ICommand
{
public bool go;
public bool completed;
public bool remove;
public int elapsed;
public InformationUnit informationUnit;
public Util.Units type;
ManagerUnits managerUnits;
public BuilderUnits(Util.Units type, ManagerUnits managerUnits, InformationUnit informationUnit)
{
this.informationUnit = informationUnit;
this.type = type;
this.managerUnits = managerUnits;
}
public void execute()
{
if (!go && ManagerResources.CompareGold(managerUnits.index, informationUnit.CostGold) && ManagerResources.CompareFood(managerUnits.index, informationUnit.CostFood))
{
ManagerResources.ReduceGold(managerUnits.index, informationUnit.CostGold);
ManagerResources.ReduceFood(managerUnits.index, informationUnit.CostFood);
go = true;
completed = false;
remove = false;
}
}
public void Update()
{
if (go)
{
elapsed++;
if (elapsed > informationUnit.BuildTime)
{
completed = true;
go = false;
elapsed = 0;
}
}
}
}
}
|
using Warcraft.Managers;
using Warcraft.Units;
using Warcraft.Util;
namespace Warcraft.Commands
{
class BuilderUnits : ICommand
{
public bool go;
public bool completed;
public bool remove;
public int elapsed;
public InformationUnit informationUnit;
public Util.Units type;
ManagerUnits managerUnits;
public BuilderUnits(Util.Units type, ManagerUnits managerUnits, InformationUnit informationUnit)
{
this.informationUnit = informationUnit;
this.type = type;
this.managerUnits = managerUnits;
}
public void execute()
{
if (ManagerResources.CompareGold(managerUnits.index, informationUnit.CostGold) && ManagerResources.CompareFood(managerUnits.index, informationUnit.CostFood))
{
ManagerResources.ReduceGold(managerUnits.index, informationUnit.CostGold);
ManagerResources.ReduceFood(managerUnits.index, informationUnit.CostFood);
go = true;
completed = false;
remove = false;
}
}
public void Update()
{
if (go)
{
elapsed++;
if (elapsed > informationUnit.BuildTime)
{
completed = true;
go = false;
elapsed = 0;
}
}
}
}
}
|
mit
|
C#
|
577c057ce4f5a37ad161bd3cfa8de5c55e64e3fb
|
Fix Slowest() and Fastest() extension methods
|
Catel/Catel.Benchmarks
|
src/Catel.BenchmarkCombiner/Models/Extensions/MeasurementGroupExtensions.cs
|
src/Catel.BenchmarkCombiner/Models/Extensions/MeasurementGroupExtensions.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="MeasurementGroupExtensions.cs" company="Catel development team">
// Copyright (c) 2008 - 2016 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Catel.BenchmarkCombiner
{
using System.Linq;
public static class MeasurementGroupExtensions
{
public static VersionMeasurements Slowest(this MeasurementGroup group)
{
var ordered = group.Measurements.OrderBy(x => x.AverageNanoSecondsPerOperation);
return ordered.LastOrDefault();
}
public static VersionMeasurements Fastest(this MeasurementGroup group)
{
var ordered = group.Measurements.OrderBy(x => x.AverageNanoSecondsPerOperation);
return ordered.FirstOrDefault();
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="MeasurementGroupExtensions.cs" company="Catel development team">
// Copyright (c) 2008 - 2016 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Catel.BenchmarkCombiner
{
using System.Linq;
public static class MeasurementGroupExtensions
{
public static VersionMeasurements Slowest(this MeasurementGroup group)
{
var ordered = group.Measurements.OrderBy(x => x.AverageNanoSeconds);
return ordered.LastOrDefault();
}
public static VersionMeasurements Fastest(this MeasurementGroup group)
{
var ordered = group.Measurements.OrderBy(x => x.AverageNanoSeconds);
return ordered.FirstOrDefault();
}
}
}
|
mit
|
C#
|
96932fbab5cab645f32be7d9b31fea6d58e4ff57
|
Revert of a change which shouldn't be committed.
|
dapplo/Dapplo.HttpExtensions
|
src/Dapplo.HttpExtensions/ContentConverter/ByteArrayHttpContentConverter.cs
|
src/Dapplo.HttpExtensions/ContentConverter/ByteArrayHttpContentConverter.cs
|
// Copyright (c) Dapplo and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Dapplo.HttpExtensions.ContentConverter;
/// <summary>
/// This can convert HttpContent from/to a byte[]
/// </summary>
public class ByteArrayHttpContentConverter : IHttpContentConverter
{
#pragma warning disable IDE0090 // Use 'new(...)'
private static readonly LogSource Log = new LogSource();
#pragma warning restore IDE0090 // Use 'new(...)'
/// <summary>
/// Instance of this IHttpContentConverter for reusing
/// </summary>
public static Lazy<ByteArrayHttpContentConverter> Instance { get; } = new(() => new ByteArrayHttpContentConverter());
/// <summary>
/// Order or priority of the IHttpContentConverter
/// </summary>
public int Order => 0;
/// <summary>
/// Check if we can convert from the HttpContent to a byte array
/// </summary>
/// <param name="typeToConvertTo">To what type will the result be assigned</param>
/// <param name="httpContent">HttpContent</param>
/// <returns>true if we can convert the HttpContent to a ByteArray</returns>
public bool CanConvertFromHttpContent(Type typeToConvertTo, HttpContent httpContent)
{
return typeToConvertTo == typeof(byte[]);
}
/// <inheritdoc />
public async Task<object> ConvertFromHttpContentAsync(Type resultType, HttpContent httpContent, CancellationToken cancellationToken = default)
{
if (!CanConvertFromHttpContent(resultType, httpContent))
{
throw new NotSupportedException("CanConvertFromHttpContent resulted in false, this is not supposed to be called.");
}
Log.Debug().WriteLine("Retrieving the content as byte[], Content-Type: {0}", httpContent.Headers.ContentType);
#if NET461 || NETCOREAPP3_1 || NETSTANDARD1_3 || NETSTANDARD2_0
return await httpContent.ReadAsByteArrayAsync().ConfigureAwait(false);
#else
return await httpContent.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false);
#endif
}
/// <inheritdoc />
public bool CanConvertToHttpContent(Type typeToConvert, object content)
{
return typeToConvert == typeof(byte[]);
}
/// <inheritdoc />
public HttpContent ConvertToHttpContent(Type typeToConvert, object content)
{
var byteArray = content as byte[];
return new ByteArrayContent(byteArray);
}
/// <inheritdoc />
public void AddAcceptHeadersForType(Type resultType, HttpRequestMessage httpRequestMessage)
{
if (resultType is null)
{
throw new ArgumentNullException(nameof(resultType));
}
if (httpRequestMessage is null)
{
throw new ArgumentNullException(nameof(httpRequestMessage));
}
}
}
|
// Copyright (c) Dapplo and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Dapplo.HttpExtensions.ContentConverter;
/// <summary>
/// This can convert HttpContent from/to a byte[]
/// </summary>
public class ByteArrayHttpContentConverter : IHttpContentConverter
{
#pragma warning disable IDE0090 // Use 'new(...)'
private static readonly LogSource Log = new LogSource();
#pragma warning restore IDE0090 // Use 'new(...)'
/// <summary>
/// Instance of this IHttpContentConverter for reusing
/// </summary>
public static Lazy<ByteArrayHttpContentConverter> Instance { get; } = new(() => new ByteArrayHttpContentConverter());
/// <summary>
/// Order or priority of the IHttpContentConverter
/// </summary>
public int Order => 0;
/// <summary>
/// Check if we can convert from the HttpContent to a byte array
/// </summary>
/// <param name="typeToConvertTo">To what type will the result be assigned</param>
/// <param name="httpContent">HttpContent</param>
/// <returns>true if we can convert the HttpContent to a ByteArray</returns>
public bool CanConvertFromHttpContent(Type typeToConvertTo, HttpContent httpContent)
{
return typeToConvertTo == typeof(byte[]);
}
/// <inheritdoc />
public async Task<object> ConvertFromHttpContentAsync(Type resultType, HttpContent httpContent, CancellationToken cancellationToken = default)
{
if (!CanConvertFromHttpContent(resultType, httpContent))
{
throw new NotSupportedException("CanConvertFromHttpContent resulted in false, this is not supposed to be called.");
}
Log.Debug().WriteLine("Retrieving the content as byte[], Content-Type: {0}", httpContent.Headers.ContentType);
#if NET472 || NETCOREAPP3_1 || NETSTANDARD2_0
return await httpContent.ReadAsByteArrayAsync().ConfigureAwait(false);
#else
return await httpContent.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false);
#endif
}
/// <inheritdoc />
public bool CanConvertToHttpContent(Type typeToConvert, object content)
{
return typeToConvert == typeof(byte[]);
}
/// <inheritdoc />
public HttpContent ConvertToHttpContent(Type typeToConvert, object content)
{
var byteArray = content as byte[];
return new ByteArrayContent(byteArray);
}
/// <inheritdoc />
public void AddAcceptHeadersForType(Type resultType, HttpRequestMessage httpRequestMessage)
{
if (resultType is null)
{
throw new ArgumentNullException(nameof(resultType));
}
if (httpRequestMessage is null)
{
throw new ArgumentNullException(nameof(httpRequestMessage));
}
}
}
|
mit
|
C#
|
8160f16351530b5439722054c0ebca99d0d208cc
|
Fix codacy complaints
|
FubarDevelopment/FtpServer
|
src/FubarDev.FtpServer.Abstractions/FileSystem/Error/FileSystemException.cs
|
src/FubarDev.FtpServer.Abstractions/FileSystem/Error/FileSystemException.cs
|
// <copyright file="FileSystemException.cs" company="40three GmbH">
// Copyright (c) 40three GmbH. All rights reserved.
// </copyright>
namespace FubarDev.FtpServer.FileSystem.Error
{
/// <summary>
/// Represents an error condition the underlying file system wants to communicate to the client.
/// </summary>
public abstract class FileSystemException : System.Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemException"/> class.
/// </summary>
protected FileSystemException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemException"/> class.
/// </summary>
/// <param name="message">Error message</param>
protected FileSystemException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemException"/> class.
/// </summary>
/// <param name="message">Error message</param>
/// <param name="innerException">Underlying exception</param>
protected FileSystemException(string message, System.Exception innerException)
: base(message, innerException)
{
}
/// <summary>
/// Gets the FTP error code.
/// </summary>
public abstract int FtpErrorCode { get; }
/// <summary>
/// Gets a human-readable generic error description.
/// </summary>
public abstract string FtpErrorName { get; }
}
}
|
// <copyright file="FileSystemException.cs" company="40three GmbH">
// Copyright (c) 40three GmbH. All rights reserved.
// </copyright>
namespace FubarDev.FtpServer.FileSystem.Error
{
/// <summary>
/// Represents an error condition the underlying file system wants to communicate to the client.
/// </summary>
public abstract class FileSystemException : System.Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemException"/> class.
/// </summary>
public FileSystemException()
: base()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemException"/> class.
/// </summary>
/// <param name="message">Error message</param>
public FileSystemException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemException"/> class.
/// </summary>
/// <param name="message">Error message</param>
/// <param name="innerException">Underlying exception</param>
public FileSystemException(string message, System.Exception innerException)
: base(message, innerException)
{
}
/// <summary>
/// Gets the FTP error code.
/// </summary>
public abstract int FtpErrorCode { get; }
/// <summary>
/// Gets a human-readable generic error description.
/// </summary>
public abstract string FtpErrorName { get; }
}
}
|
mit
|
C#
|
eeba48277fd4491aaa42f4ffda2a84ca130d9c92
|
Add summary to SensitiveAttribute,NonSensitiveAttribute
|
gigya/microdot
|
Gigya.ServiceContract/Attributes/EventAttrubute.cs
|
Gigya.ServiceContract/Attributes/EventAttrubute.cs
|
using System;
namespace Gigya.ServiceContract.Attributes
{
/// <summary>Mark the parameter as containing sensitive data.
/// When sensitive data is automaticity logged (e.g. event publisher) it will be encrypted.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter| AttributeTargets.Method)]
public class SensitiveAttribute : Attribute
{
/// <summary>Mark the parameter as containing Secretive data.
///it will never log automaticity (e.g. event publisher).
/// </summary>
public bool Secretive { get; set; }
}
/// <summary>Mark the parameter as containing nonsensitive data.
/// When nonsensitive data is automaticity logged (e.g. event publisher) it wont be encrypted.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public class NonSensitiveAttribute : Attribute{}
}
|
using System;
namespace Gigya.ServiceContract.Attributes
{
[AttributeUsage(AttributeTargets.Parameter| AttributeTargets.Method)]
public class SensitiveAttribute : Attribute
{
public bool Secretive { get; set; }
}
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public class NonSensitiveAttribute : Attribute{}
}
|
apache-2.0
|
C#
|
001f5a59f521433bd20fc0bde9bfaac5b7e077cc
|
Fix model position translation for header views.
|
ZhangLeiCharles/mobile,eatskolnikov/mobile,ZhangLeiCharles/mobile,eatskolnikov/mobile,masterrr/mobile,masterrr/mobile,eatskolnikov/mobile,peeedge/mobile,peeedge/mobile
|
Joey/UI/Fragments/RecentTimeEntriesListFragment.cs
|
Joey/UI/Fragments/RecentTimeEntriesListFragment.cs
|
using System;
using System.Linq;
using Android.OS;
using Android.Util;
using Android.Views;
using Android.Widget;
using Toggl.Joey.UI.Adapters;
using ListFragment = Android.Support.V4.App.ListFragment;
namespace Toggl.Joey.UI.Fragments
{
public class RecentTimeEntriesListFragment : ListFragment
{
public override void OnViewCreated (View view, Bundle savedInstanceState)
{
base.OnViewCreated (view, savedInstanceState);
var headerView = new View (Activity);
int headerWidth = (int) TypedValue.ApplyDimension (ComplexUnitType.Dip, 6, Resources.DisplayMetrics);
headerView.SetMinimumHeight (headerWidth);
ListView.AddHeaderView (headerView);
ListAdapter = new RecentTimeEntriesAdapter ();
}
public override void OnListItemClick (ListView l, View v, int position, long id)
{
RecentTimeEntriesAdapter adapter = null;
if (l.Adapter is HeaderViewListAdapter) {
var headerAdapter = (HeaderViewListAdapter)l.Adapter;
adapter = headerAdapter.WrappedAdapter as RecentTimeEntriesAdapter;
// Adjust the position by taking into account the fact that we've got headers
position -= headerAdapter.HeadersCount;
} else if (l.Adapter is RecentTimeEntriesAdapter) {
adapter = (RecentTimeEntriesAdapter)l.Adapter;
}
if (adapter == null)
return;
var model = adapter.GetModel (position);
if (model == null)
return;
model.Continue ();
}
}
}
|
using System;
using System.Linq;
using Android.OS;
using Android.Util;
using Android.Views;
using Android.Widget;
using Toggl.Joey.UI.Adapters;
using ListFragment = Android.Support.V4.App.ListFragment;
namespace Toggl.Joey.UI.Fragments
{
public class RecentTimeEntriesListFragment : ListFragment
{
public override void OnViewCreated (View view, Bundle savedInstanceState)
{
base.OnViewCreated (view, savedInstanceState);
var headerView = new View (Activity);
int headerWidth = (int) TypedValue.ApplyDimension (ComplexUnitType.Dip, 6, Resources.DisplayMetrics);
headerView.SetMinimumHeight (headerWidth);
ListView.AddHeaderView (headerView);
ListAdapter = new RecentTimeEntriesAdapter ();
}
public override void OnListItemClick (ListView l, View v, int position, long id)
{
var headerAdapter = l.Adapter as HeaderViewListAdapter;
RecentTimeEntriesAdapter adapter = null;
if (headerAdapter != null)
adapter = headerAdapter.WrappedAdapter as RecentTimeEntriesAdapter;
if (adapter == null)
return;
var model = adapter.GetModel (position);
if (model == null)
return;
model.Continue ();
}
}
}
|
bsd-3-clause
|
C#
|
9bea5791efcfaec68758609fe45abd9c46fbd942
|
Change putMessage function to prevent double serialization.
|
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
|
AzureStorage/Queue/AzureQueue.cs
|
AzureStorage/Queue/AzureQueue.cs
|
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Queue;
namespace AzureStorage.Queue
{
public class AzureQueue<T> : IAzureQueue<T> where T : class
{
private readonly CloudQueue _queue;
public AzureQueue(string conectionString, string queueName)
{
queueName = queueName.ToLower();
var storageAccount = CloudStorageAccount.Parse(conectionString);
var queueClient = storageAccount.CreateCloudQueueClient();
_queue = queueClient.GetQueueReference(queueName);
_queue.CreateIfNotExistsAsync().Wait();
}
public Task PutMessageAsync(T itm)
{
var msg = itm.ToString();
return _queue.AddMessageAsync(new CloudQueueMessage(msg));
}
public async Task<AzureQueueMessage<T>> GetMessageAsync()
{
var msg = await _queue.GetMessageAsync();
if (msg == null)
return null;
await _queue.DeleteMessageAsync(msg);
return AzureQueueMessage<T>.Create(Newtonsoft.Json.JsonConvert.DeserializeObject<T>(msg.AsString), msg);
}
public Task ProcessMessageAsync(AzureQueueMessage<T> token)
{
return _queue.DeleteMessageAsync(token.Token);
}
public Task ClearAsync()
{
return _queue.ClearAsync();
}
}
}
|
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Queue;
namespace AzureStorage.Queue
{
public class AzureQueue<T> : IAzureQueue<T> where T : class
{
private readonly CloudQueue _queue;
public AzureQueue(string conectionString, string queueName)
{
queueName = queueName.ToLower();
var storageAccount = CloudStorageAccount.Parse(conectionString);
var queueClient = storageAccount.CreateCloudQueueClient();
_queue = queueClient.GetQueueReference(queueName);
_queue.CreateIfNotExistsAsync().Wait();
}
public Task PutMessageAsync(T itm)
{
var msg = Newtonsoft.Json.JsonConvert.SerializeObject(itm);
return _queue.AddMessageAsync(new CloudQueueMessage(msg));
}
public async Task<AzureQueueMessage<T>> GetMessageAsync()
{
var msg = await _queue.GetMessageAsync();
if (msg == null)
return null;
await _queue.DeleteMessageAsync(msg);
return AzureQueueMessage<T>.Create(Newtonsoft.Json.JsonConvert.DeserializeObject<T>(msg.AsString), msg);
}
public Task ProcessMessageAsync(AzureQueueMessage<T> token)
{
return _queue.DeleteMessageAsync(token.Token);
}
public Task ClearAsync()
{
return _queue.ClearAsync();
}
}
}
|
mit
|
C#
|
1f5979246286111bedb0367e8ef7c5e755922f82
|
Update Harass
|
ClickBuddy/ClickElo
|
ClickLux/ClickLux/Mode/Harass.cs
|
ClickLux/ClickLux/Mode/Harass.cs
|
using EloBuddy;
using EloBuddy.SDK;
using Settings = ClickLux.Config.Modes.Harass;
namespace ClickLux.Modes
{
public sealed class Harass : ModeBase
{
public override bool ShouldBeExecuted()
{
return (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass) || Settings.AutoHarass) && Settings.Mana;
}
public override void Execute()
{
if (Settings.UseQ)
{
var target = TargetSelector.GetTarget(Q.Range, DamageType.Magical);
ModeManager.QLogic.Cast(target, Orbwalker.ActiveModes.Harass);
}
if (Settings.UseE)
{
var target = TargetSelector.GetTarget(E.Range, DamageType.Magical);
ModeManager.ELogic.Cast(target, Orbwalker.ActiveModes.Harass);
}
}
}
}
|
using EloBuddy;
using EloBuddy.SDK;
// Using the config like this makes your life easier, trust me
using Settings = ClickLux.Config.Modes.Harass;
namespace ClickLux.Modes
{
public sealed class Harass : ModeBase
{
public override bool ShouldBeExecuted()
{
return (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass) || Settings.AutoHarass) && Settings.Mana;
}
public override void Execute()
{
if (Settings.UseQ)
{
var target = TargetSelector.GetTarget(Q.Range, DamageType.Magical);
ModeManager.QLogic.Cast(target, Orbwalker.ActiveModes.Harass);
}
if (Settings.UseE)
{
var target = TargetSelector.GetTarget(E.Range, DamageType.Magical);
ModeManager.ELogic.Cast(target, Orbwalker.ActiveModes.Harass);
}
}
}
}
|
apache-2.0
|
C#
|
3edd67dfd9f58af489850b98da1c1f02b934a71e
|
Add motivational commenting
|
yanyiyun/LockstepFramework,SnpM/Lockstep-Framework,erebuswolf/LockstepFramework
|
Core/Simulation/Math/Vector3d.cs
|
Core/Simulation/Math/Vector3d.cs
|
using UnityEngine;
using System.Collections;
namespace Lockstep
{
//THIS IS HAPPENING!!!!
public struct Vector3d
{
[FixedNumber]
public long x;
[FixedNumber]
public long y;
[FixedNumber]
public long z; //Height
public void Normalize () {
long magnitude = FixedMath.Sqrt(x * x + y * y + z * z);
x = x.Div(magnitude);
y = y.Div(magnitude);
z = z.Div(magnitude);
}
public Vector2d ToVector2d () {
return new Vector2d(x,y);
}
public Vector3 ToVector3 () {
return new Vector3(x.ToPreciseFloat(),z.ToPreciseFloat(),y.ToPreciseFloat());
}
}
}
|
using UnityEngine;
using System.Collections;
namespace Lockstep
{
//TODO: Go on with this venture?
public struct Vector3d
{
[FixedNumber]
public long x;
[FixedNumber]
public long y;
[FixedNumber]
public long z; //Height
public void Normalize () {
long magnitude = FixedMath.Sqrt(x * x + y * y + z * z);
x = x.Div(magnitude);
y = y.Div(magnitude);
z = z.Div(magnitude);
}
public Vector2d ToVector2d () {
return new Vector2d(x,y);
}
public Vector3 ToVector3 () {
return new Vector3(x.ToPreciseFloat(),z.ToPreciseFloat(),y.ToPreciseFloat());
}
}
}
|
mit
|
C#
|
15e48b0fffbe4f42d7bb64dc0246ed3a7ad9e28b
|
Disable Tracing test whihc use private reflection.
|
BrennanConroy/corefx,seanshpark/corefx,jlin177/corefx,richlander/corefx,gkhanna79/corefx,zhenlan/corefx,parjong/corefx,MaggieTsang/corefx,MaggieTsang/corefx,ericstj/corefx,axelheer/corefx,krk/corefx,MaggieTsang/corefx,ViktorHofer/corefx,nbarbettini/corefx,Jiayili1/corefx,ViktorHofer/corefx,JosephTremoulet/corefx,tijoytom/corefx,the-dwyer/corefx,ericstj/corefx,ViktorHofer/corefx,MaggieTsang/corefx,zhenlan/corefx,krk/corefx,axelheer/corefx,nchikanov/corefx,shimingsg/corefx,DnlHarvey/corefx,stone-li/corefx,mmitche/corefx,fgreinacher/corefx,the-dwyer/corefx,seanshpark/corefx,tijoytom/corefx,the-dwyer/corefx,ericstj/corefx,alexperovich/corefx,fgreinacher/corefx,Jiayili1/corefx,mazong1123/corefx,ViktorHofer/corefx,dotnet-bot/corefx,gkhanna79/corefx,stone-li/corefx,krk/corefx,zhenlan/corefx,seanshpark/corefx,dotnet-bot/corefx,krytarowski/corefx,JosephTremoulet/corefx,BrennanConroy/corefx,parjong/corefx,tijoytom/corefx,yizhang82/corefx,mazong1123/corefx,wtgodbe/corefx,shimingsg/corefx,dotnet-bot/corefx,mazong1123/corefx,rubo/corefx,jlin177/corefx,nchikanov/corefx,nbarbettini/corefx,billwert/corefx,ViktorHofer/corefx,mmitche/corefx,krk/corefx,jlin177/corefx,DnlHarvey/corefx,yizhang82/corefx,axelheer/corefx,shimingsg/corefx,JosephTremoulet/corefx,rubo/corefx,wtgodbe/corefx,DnlHarvey/corefx,nchikanov/corefx,gkhanna79/corefx,parjong/corefx,stone-li/corefx,mmitche/corefx,seanshpark/corefx,JosephTremoulet/corefx,stone-li/corefx,parjong/corefx,parjong/corefx,DnlHarvey/corefx,twsouthwick/corefx,richlander/corefx,ravimeda/corefx,rubo/corefx,cydhaselton/corefx,zhenlan/corefx,jlin177/corefx,DnlHarvey/corefx,cydhaselton/corefx,ptoonen/corefx,yizhang82/corefx,twsouthwick/corefx,ravimeda/corefx,mmitche/corefx,Ermiar/corefx,mazong1123/corefx,ravimeda/corefx,alexperovich/corefx,mmitche/corefx,zhenlan/corefx,yizhang82/corefx,alexperovich/corefx,tijoytom/corefx,nchikanov/corefx,cydhaselton/corefx,Ermiar/corefx,rubo/corefx,the-dwyer/corefx,billwert/corefx,mazong1123/corefx,ptoonen/corefx,krk/corefx,stone-li/corefx,twsouthwick/corefx,billwert/corefx,wtgodbe/corefx,krytarowski/corefx,Jiayili1/corefx,mazong1123/corefx,ericstj/corefx,dotnet-bot/corefx,ravimeda/corefx,parjong/corefx,cydhaselton/corefx,zhenlan/corefx,seanshpark/corefx,nbarbettini/corefx,ericstj/corefx,MaggieTsang/corefx,gkhanna79/corefx,seanshpark/corefx,Jiayili1/corefx,alexperovich/corefx,BrennanConroy/corefx,ptoonen/corefx,nchikanov/corefx,DnlHarvey/corefx,billwert/corefx,cydhaselton/corefx,Jiayili1/corefx,DnlHarvey/corefx,shimingsg/corefx,ravimeda/corefx,nchikanov/corefx,nbarbettini/corefx,wtgodbe/corefx,Ermiar/corefx,seanshpark/corefx,krytarowski/corefx,yizhang82/corefx,shimingsg/corefx,zhenlan/corefx,cydhaselton/corefx,wtgodbe/corefx,Jiayili1/corefx,ptoonen/corefx,stone-li/corefx,krk/corefx,richlander/corefx,alexperovich/corefx,MaggieTsang/corefx,nchikanov/corefx,dotnet-bot/corefx,krytarowski/corefx,ravimeda/corefx,cydhaselton/corefx,richlander/corefx,the-dwyer/corefx,richlander/corefx,ViktorHofer/corefx,gkhanna79/corefx,mmitche/corefx,stone-li/corefx,the-dwyer/corefx,twsouthwick/corefx,dotnet-bot/corefx,nbarbettini/corefx,alexperovich/corefx,krytarowski/corefx,wtgodbe/corefx,JosephTremoulet/corefx,ptoonen/corefx,axelheer/corefx,gkhanna79/corefx,dotnet-bot/corefx,yizhang82/corefx,ptoonen/corefx,jlin177/corefx,axelheer/corefx,twsouthwick/corefx,richlander/corefx,alexperovich/corefx,fgreinacher/corefx,nbarbettini/corefx,tijoytom/corefx,nbarbettini/corefx,billwert/corefx,jlin177/corefx,Ermiar/corefx,Ermiar/corefx,rubo/corefx,JosephTremoulet/corefx,krytarowski/corefx,richlander/corefx,yizhang82/corefx,tijoytom/corefx,twsouthwick/corefx,ravimeda/corefx,MaggieTsang/corefx,mazong1123/corefx,Ermiar/corefx,shimingsg/corefx,mmitche/corefx,jlin177/corefx,tijoytom/corefx,ptoonen/corefx,krk/corefx,the-dwyer/corefx,gkhanna79/corefx,fgreinacher/corefx,shimingsg/corefx,parjong/corefx,JosephTremoulet/corefx,krytarowski/corefx,ViktorHofer/corefx,Ermiar/corefx,billwert/corefx,ericstj/corefx,wtgodbe/corefx,axelheer/corefx,billwert/corefx,twsouthwick/corefx,ericstj/corefx,Jiayili1/corefx
|
src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsEventSourceLifetime.cs
|
src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsEventSourceLifetime.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using System.Diagnostics.Tracing;
using System.Reflection;
namespace BasicEventSourceTests
{
public class TestsEventSourceLifetime
{
/// <summary>
/// Validates that the EventProvider AppDomain.ProcessExit handler does not keep the EventProvider instance
/// alive.
/// </summary>
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // non-Windows EventSources don't have lifetime
[ActiveIssue(20837,TargetFrameworkMonikers.UapAot)]
public void Test_EventSource_Lifetime()
{
TestUtilities.CheckNoEventSourcesRunning("Start");
WeakReference wrProvider = new WeakReference(null);
WeakReference wrEventSource = new WeakReference(null);
// Need to call separate method (ExerciseEventSource) to reference the event source
// in order to avoid the debug JIT lifetimes (extended to the end of the current method)
ExerciseEventSource(wrProvider, wrEventSource);
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
Assert.Equal(null, wrEventSource.Target);
Assert.Equal(null, wrProvider.Target);
TestUtilities.CheckNoEventSourcesRunning("Stop");
}
private void ExerciseEventSource(WeakReference wrProvider, WeakReference wrEventSource)
{
using (var es = new LifetimeTestEventSource())
{
FieldInfo field = es.GetType().GetTypeInfo().BaseType.GetField("m_provider", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
object provider = field.GetValue(es);
wrProvider.Target = provider;
wrEventSource.Target = es;
es.Event0();
}
}
private class LifetimeTestEventSource : EventSource
{
[Event(1)]
public void Event0()
{ WriteEvent(1); }
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using System.Diagnostics.Tracing;
using System.Reflection;
namespace BasicEventSourceTests
{
public class TestsEventSourceLifetime
{
/// <summary>
/// Validates that the EventProvider AppDomain.ProcessExit handler does not keep the EventProvider instance
/// alive.
/// </summary>
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // non-Windows EventSources don't have lifetime
public void Test_EventSource_Lifetime()
{
TestUtilities.CheckNoEventSourcesRunning("Start");
WeakReference wrProvider = new WeakReference(null);
WeakReference wrEventSource = new WeakReference(null);
// Need to call separate method (ExerciseEventSource) to reference the event source
// in order to avoid the debug JIT lifetimes (extended to the end of the current method)
ExerciseEventSource(wrProvider, wrEventSource);
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
Assert.Equal(null, wrEventSource.Target);
Assert.Equal(null, wrProvider.Target);
TestUtilities.CheckNoEventSourcesRunning("Stop");
}
private void ExerciseEventSource(WeakReference wrProvider, WeakReference wrEventSource)
{
using (var es = new LifetimeTestEventSource())
{
FieldInfo field = es.GetType().GetTypeInfo().BaseType.GetField("m_provider", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
object provider = field.GetValue(es);
wrProvider.Target = provider;
wrEventSource.Target = es;
es.Event0();
}
}
private class LifetimeTestEventSource : EventSource
{
[Event(1)]
public void Event0()
{ WriteEvent(1); }
}
}
}
|
mit
|
C#
|
d883641d68da5f24510c01c4cafed617c8774e50
|
Implement new suspend/resume functionality for DeadSessionController
|
tgstation/tgstation-server,tgstation/tgstation-server,tgstation/tgstation-server-tools,Cyberboss/tgstation-server,Cyberboss/tgstation-server
|
src/Tgstation.Server.Host/Components/Watchdog/DeadSessionController.cs
|
src/Tgstation.Server.Host/Components/Watchdog/DeadSessionController.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Host.Components.Deployment;
namespace Tgstation.Server.Host.Components.Watchdog
{
/// <summary>
/// Implements a fake "dead" <see cref="ISessionController"/>
/// </summary>
sealed class DeadSessionController : ISessionController
{
/// <inheritdoc />
public Task<LaunchResult> LaunchResult { get; }
/// <inheritdoc />
public bool IsPrimary => false;
/// <inheritdoc />
public bool TerminationWasRequested => false;
/// <inheritdoc />
public ApiValidationStatus ApiValidationStatus => throw new NotSupportedException();
/// <inheritdoc />
public IDmbProvider Dmb { get; }
/// <inheritdoc />
public ushort? Port => null;
/// <inheritdoc />
public bool ClosePortOnReboot
{
get => false;
set => throw new NotSupportedException();
}
/// <inheritdoc />
public RebootState RebootState => throw new NotSupportedException();
/// <inheritdoc />
public Task OnReboot { get; }
/// <inheritdoc />
public Task<int> Lifetime { get; }
/// <summary>
/// If the <see cref="DeadSessionController"/> was <see cref="Dispose"/>d
/// </summary>
bool disposed;
/// <summary>
/// Construct a <see cref="DeadSessionController"/>
/// </summary>
/// <param name="dmbProvider">The value of <see cref="Dmb"/></param>
public DeadSessionController(IDmbProvider dmbProvider)
{
Dmb = dmbProvider ?? throw new ArgumentNullException(nameof(dmbProvider));
LaunchResult = Task.FromResult(new LaunchResult
{
StartupTime = TimeSpan.FromSeconds(0)
});
Lifetime = Task.FromResult(-1);
OnReboot = new TaskCompletionSource<object>().Task;
}
/// <inheritdoc />
public void Dispose()
{
lock (this)
{
if (disposed)
return;
disposed = true;
}
Dmb.Dispose();
}
/// <inheritdoc />
public void EnableCustomChatCommands() => throw new NotSupportedException();
/// <inheritdoc />
public ReattachInformation Release() => throw new NotSupportedException();
/// <inheritdoc />
public void ResetRebootState() => throw new NotSupportedException();
/// <inheritdoc />
public Task<string> SendCommand(string command, CancellationToken cancellationToken) => throw new NotSupportedException();
/// <inheritdoc />
public void SetHighPriority() => throw new NotSupportedException();
/// <inheritdoc />
public Task<bool> SetPort(ushort newPort, CancellationToken cancellatonToken) => throw new NotSupportedException();
/// <inheritdoc />
public Task<bool> SetRebootState(RebootState newRebootState, CancellationToken cancellationToken) => throw new NotSupportedException();
/// <inheritdoc />
public void ReplaceDmbProvider(IDmbProvider newProvider) => throw new NotSupportedException();
/// <inheritdoc />
public void Suspend() => throw new NotSupportedException();
/// <inheritdoc />
public void Resume() => throw new NotSupportedException();
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Host.Components.Deployment;
namespace Tgstation.Server.Host.Components.Watchdog
{
/// <summary>
/// Implements a fake "dead" <see cref="ISessionController"/>
/// </summary>
sealed class DeadSessionController : ISessionController
{
/// <inheritdoc />
public Task<LaunchResult> LaunchResult { get; }
/// <inheritdoc />
public bool IsPrimary => false;
/// <inheritdoc />
public bool TerminationWasRequested => false;
/// <inheritdoc />
public ApiValidationStatus ApiValidationStatus => throw new NotSupportedException();
/// <inheritdoc />
public IDmbProvider Dmb { get; }
/// <inheritdoc />
public ushort? Port => null;
/// <inheritdoc />
public bool ClosePortOnReboot
{
get => false;
set => throw new NotSupportedException();
}
/// <inheritdoc />
public RebootState RebootState => throw new NotSupportedException();
/// <inheritdoc />
public Task OnReboot { get; }
/// <inheritdoc />
public Task<int> Lifetime { get; }
/// <summary>
/// If the <see cref="DeadSessionController"/> was <see cref="Dispose"/>d
/// </summary>
bool disposed;
/// <summary>
/// Construct a <see cref="DeadSessionController"/>
/// </summary>
/// <param name="dmbProvider">The value of <see cref="Dmb"/></param>
public DeadSessionController(IDmbProvider dmbProvider)
{
Dmb = dmbProvider ?? throw new ArgumentNullException(nameof(dmbProvider));
LaunchResult = Task.FromResult(new LaunchResult
{
StartupTime = TimeSpan.FromSeconds(0)
});
Lifetime = Task.FromResult(-1);
OnReboot = new TaskCompletionSource<object>().Task;
}
/// <inheritdoc />
public void Dispose()
{
lock (this)
{
if (disposed)
return;
disposed = true;
}
Dmb.Dispose();
}
/// <inheritdoc />
public void EnableCustomChatCommands() => throw new NotSupportedException();
/// <inheritdoc />
public ReattachInformation Release() => throw new NotSupportedException();
/// <inheritdoc />
public void ResetRebootState() => throw new NotSupportedException();
/// <inheritdoc />
public Task<string> SendCommand(string command, CancellationToken cancellationToken) => throw new NotSupportedException();
/// <inheritdoc />
public void SetHighPriority() => throw new NotSupportedException();
/// <inheritdoc />
public Task<bool> SetPort(ushort newPort, CancellationToken cancellatonToken) => throw new NotSupportedException();
/// <inheritdoc />
public Task<bool> SetRebootState(RebootState newRebootState, CancellationToken cancellationToken) => throw new NotSupportedException();
/// <inheritdoc />
public void ReplaceDmbProvider(IDmbProvider newProvider) => throw new NotSupportedException();
}
}
|
agpl-3.0
|
C#
|
4acc459b009539cb33cb64e80b5fbcdee156b6f7
|
Save waypoints in array, provide get method
|
emazzotta/unity-tower-defense
|
Assets/Scripts/GameController.cs
|
Assets/Scripts/GameController.cs
|
using UnityEngine;
using System.Collections;
public class GameController : MonoBehaviour {
public GameObject towerBaseWrap;
public GameObject originalTowerBase;
public GameObject gameField;
private GameObject[,] towerBases;
private GameObject[] waypoints;
private int gameFieldWidth = 0;
private int gameFieldHeight = 0;
private Color wayColor;
void Start () {
this.wayColor = Color.Lerp(Color.red, Color.green, 0F);
this.gameFieldWidth = (int)(gameField.transform.localScale.x);
this.gameFieldHeight = (int)(gameField.transform.localScale.z);
this.towerBases = new GameObject[this.gameFieldWidth, this.gameFieldHeight];
this.waypoints = new GameObject[this.gameFieldWidth];
this.initGamePlatform ();
this.drawWaypoint ();
}
void initGamePlatform() {
for (int x = 0; x < this.gameFieldWidth; x++) {
for (int z = 0; z < this.gameFieldHeight; z++) {
GameObject newTowerBase = Instantiate (originalTowerBase);
newTowerBase.GetComponent<TowerBaseController>().setBuildable(true);
newTowerBase.transform.position = new Vector3 (originalTowerBase.transform.position.x + x, 0.1f, originalTowerBase.transform.position.z - z);
this.towerBases [x, z] = newTowerBase;
newTowerBase.transform.SetParent (towerBaseWrap.transform);
}
}
Destroy (originalTowerBase);
}
void drawWaypoint() {
for (int x = 0; x < this.gameFieldWidth; x++) {
GameObject baseZ = this.towerBases [x, 5];
baseZ.GetComponent<Renderer> ().material.color = wayColor;
baseZ.GetComponent<TowerBaseController>().setBuildable(false);
this.waypoints[x] = baseZ;
}
}
public GameObject[] getWaypoints() {
return this.waypoints;
}
}
|
using UnityEngine;
using System.Collections;
public class GameController : MonoBehaviour {
public GameObject towerBaseWrap;
public GameObject originalTowerBase;
public GameObject gameField;
private GameObject[,] towerBases;
private int gameFieldWidth = 0;
private int gameFieldHeight = 0;
private Color wayColor;
void Start () {
this.wayColor = Color.Lerp(Color.red, Color.green, 0F);
this.gameFieldWidth = (int)(gameField.transform.localScale.x);
this.gameFieldHeight = (int)(gameField.transform.localScale.z);
this.towerBases = new GameObject[this.gameFieldWidth, this.gameFieldHeight];
this.initGamePlatform ();
this.drawWaypoint ();
}
void initGamePlatform() {
for (int x = 0; x < this.gameFieldWidth; x++) {
for (int z = 0; z < this.gameFieldHeight; z++) {
GameObject newTowerBase = Instantiate (originalTowerBase);
newTowerBase.GetComponent<TowerBaseController>().setBuildable(true);
newTowerBase.transform.position = new Vector3 (originalTowerBase.transform.position.x + x, 0.1f, originalTowerBase.transform.position.z - z);
this.towerBases [x, z] = newTowerBase;
newTowerBase.transform.SetParent (towerBaseWrap.transform);
}
}
Destroy (originalTowerBase);
}
void drawWaypoint() {
for (int x = 0; x < this.gameFieldWidth; x++) {
GameObject baseZ = this.towerBases [x, 5];
baseZ.GetComponent<Renderer> ().material.color = wayColor;
baseZ.GetComponent<TowerBaseController>().setBuildable(false);
}
}
}
|
mit
|
C#
|
d8974990dd336f59e4f670de4254eb2319ea4089
|
Remove old variables
|
Thealexbarney/LibDspAdpcm,Thealexbarney/LibDspAdpcm,Thealexbarney/VGAudio,Thealexbarney/VGAudio
|
src/DspAdpcm.Benchmark/AdpcmBenchmarks/BuildParseBenchmarks.cs
|
src/DspAdpcm.Benchmark/AdpcmBenchmarks/BuildParseBenchmarks.cs
|
using BenchmarkDotNet.Attributes;
using DspAdpcm.Adpcm;
using DspAdpcm.Adpcm.Formats;
namespace DspAdpcm.Benchmark.BuildParse
{
public class BuildParseBenchmarks
{
[Params(300)]
public double lengthSeconds;
[Params(2)]
public int numChannels;
private int sampleRate = 48000;
private AdpcmStream adpcm;
private byte[] brstm;
private byte[] dsp;
private byte[] idsp;
[Setup]
public void Setup()
{
adpcm = GenerateAudio.GenerateAdpcmEmpty((int)(sampleRate * lengthSeconds), numChannels, sampleRate);
brstm = new Brstm(adpcm).GetFile();
idsp = new Idsp(adpcm).GetFile();
dsp = new Dsp(adpcm).GetFile();
}
[Benchmark] public byte[] BuildDsp() => new Dsp(adpcm).GetFile();
[Benchmark] public byte[] BuildBxstm() => new Brstm(adpcm).GetFile();
[Benchmark] public byte[] BuildIdsp() => new Idsp(adpcm).GetFile();
[Benchmark] public Dsp ParseDsp() => new Dsp(dsp);
[Benchmark] public Brstm ParseBxstm() => new Brstm(brstm);
[Benchmark] public Idsp ParseIdsp() => new Idsp(idsp);
[Benchmark] public byte[] RebuildDsp() => new Dsp(dsp).GetFile();
[Benchmark] public byte[] RebuildBxstm() => new Brstm(brstm).GetFile();
[Benchmark] public byte[] RebuildIdsp() => new Idsp(idsp).GetFile();
}
}
|
using BenchmarkDotNet.Attributes;
using DspAdpcm.Adpcm;
using DspAdpcm.Adpcm.Formats;
namespace DspAdpcm.Benchmark.BuildParse
{
public class BuildParseBenchmarks
{
[Params(300)]
public double lengthSeconds;
[Params(2)]
public int numChannels;
private int sampleRate = 48000;
private AdpcmStream adpcm;
private byte[] brstm;
private byte[] bcstm;
private byte[] bfstm;
private byte[] dsp;
private byte[] idsp;
[Setup]
public void Setup()
{
adpcm = GenerateAudio.GenerateAdpcmEmpty((int)(sampleRate * lengthSeconds), numChannels, sampleRate);
brstm = new Brstm(adpcm).GetFile();
idsp = new Idsp(adpcm).GetFile();
dsp = new Dsp(adpcm).GetFile();
}
[Benchmark] public byte[] BuildDsp() => new Dsp(adpcm).GetFile();
[Benchmark] public byte[] BuildBxstm() => new Brstm(adpcm).GetFile();
[Benchmark] public byte[] BuildIdsp() => new Idsp(adpcm).GetFile();
[Benchmark] public Dsp ParseDsp() => new Dsp(dsp);
[Benchmark] public Brstm ParseBxstm() => new Brstm(brstm);
[Benchmark] public Idsp ParseIdsp() => new Idsp(idsp);
[Benchmark] public byte[] RebuildDsp() => new Dsp(dsp).GetFile();
[Benchmark] public byte[] RebuildBxstm() => new Brstm(brstm).GetFile();
[Benchmark] public byte[] RebuildIdsp() => new Idsp(idsp).GetFile();
}
}
|
mit
|
C#
|
2b5c7ce841acdbe8835806d6350f9149bad68466
|
Remove unnecessary/bad index call that causes test to hang on 1.1.2
|
wawrzyn/elasticsearch-net,adam-mccoy/elasticsearch-net,jonyadamit/elasticsearch-net,Grastveit/NEST,cstlaurent/elasticsearch-net,UdiBen/elasticsearch-net,starckgates/elasticsearch-net,RossLieberman/NEST,TheFireCookie/elasticsearch-net,gayancc/elasticsearch-net,ststeiger/elasticsearch-net,wawrzyn/elasticsearch-net,amyzheng424/elasticsearch-net,abibell/elasticsearch-net,mac2000/elasticsearch-net,LeoYao/elasticsearch-net,RossLieberman/NEST,abibell/elasticsearch-net,ststeiger/elasticsearch-net,KodrAus/elasticsearch-net,starckgates/elasticsearch-net,abibell/elasticsearch-net,robrich/elasticsearch-net,cstlaurent/elasticsearch-net,starckgates/elasticsearch-net,SeanKilleen/elasticsearch-net,SeanKilleen/elasticsearch-net,tkirill/elasticsearch-net,robertlyson/elasticsearch-net,ststeiger/elasticsearch-net,CSGOpenSource/elasticsearch-net,joehmchan/elasticsearch-net,joehmchan/elasticsearch-net,jonyadamit/elasticsearch-net,elastic/elasticsearch-net,KodrAus/elasticsearch-net,junlapong/elasticsearch-net,robrich/elasticsearch-net,geofeedia/elasticsearch-net,adam-mccoy/elasticsearch-net,faisal00813/elasticsearch-net,SeanKilleen/elasticsearch-net,geofeedia/elasticsearch-net,wawrzyn/elasticsearch-net,geofeedia/elasticsearch-net,robertlyson/elasticsearch-net,amyzheng424/elasticsearch-net,robrich/elasticsearch-net,UdiBen/elasticsearch-net,DavidSSL/elasticsearch-net,azubanov/elasticsearch-net,mac2000/elasticsearch-net,Grastveit/NEST,DavidSSL/elasticsearch-net,CSGOpenSource/elasticsearch-net,LeoYao/elasticsearch-net,RossLieberman/NEST,tkirill/elasticsearch-net,gayancc/elasticsearch-net,junlapong/elasticsearch-net,jonyadamit/elasticsearch-net,faisal00813/elasticsearch-net,Grastveit/NEST,elastic/elasticsearch-net,CSGOpenSource/elasticsearch-net,junlapong/elasticsearch-net,tkirill/elasticsearch-net,TheFireCookie/elasticsearch-net,UdiBen/elasticsearch-net,faisal00813/elasticsearch-net,azubanov/elasticsearch-net,cstlaurent/elasticsearch-net,mac2000/elasticsearch-net,amyzheng424/elasticsearch-net,adam-mccoy/elasticsearch-net,gayancc/elasticsearch-net,DavidSSL/elasticsearch-net,joehmchan/elasticsearch-net,KodrAus/elasticsearch-net,LeoYao/elasticsearch-net,TheFireCookie/elasticsearch-net,robertlyson/elasticsearch-net,azubanov/elasticsearch-net
|
src/Tests/Nest.Tests.Integration/Index/IndexUsingUrlIdTests.cs
|
src/Tests/Nest.Tests.Integration/Index/IndexUsingUrlIdTests.cs
|
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using Nest.Tests.MockData;
using Nest.Tests.MockData.Domain;
using NUnit.Framework;
namespace Nest.Tests.Integration.Index
{
[TestFixture]
public class IndexUsingUrlIdTests : IntegrationTests
{
[Test]
public void IndexUsingAnUrlAsId()
{
var id = "http://www.skusuplier.com/products/123?affiliateId=23131#oopsIcopiedAnAnchor";
var newProduct = new Product
{
Id = id,
Name = "Top Product"
};
var response = this._client.Index(newProduct);
var productInElasticsearch = this._client.Source<Product>(i=>i.Id(id));
Assert.NotNull(productInElasticsearch);
Assert.AreEqual(productInElasticsearch.Id, id);
Assert.True(response.IsValid);
}
[Test]
public void IndexUsingAnUrlAsIdUsingCustomUrlParameterInSettings()
{
var settings = ElasticsearchConfiguration.Settings().SetGlobalQueryStringParameters(new NameValueCollection
{
{"apiKey", "my-api-key"}
});
var client = new ElasticClient(settings);
var id = "http://www.skusuplier.com/products/123?affiliateId=23131#oopsIcopiedAnAnchor";
var newProduct = new Product
{
Id = id,
Name = "Top Product"
};
var response = client.Index(newProduct);
var productInElasticsearch = client.Source<Product>(id);
Assert.NotNull(productInElasticsearch);
Assert.AreEqual(productInElasticsearch.Id, id);
Assert.True(response.IsValid);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using Nest.Tests.MockData;
using Nest.Tests.MockData.Domain;
using NUnit.Framework;
namespace Nest.Tests.Integration.Index
{
[TestFixture]
public class IndexUsingUrlIdTests : IntegrationTests
{
[Test]
public void IndexUsingAnUrlAsId()
{
var id = "http://www.skusuplier.com/products/123?affiliateId=23131#oopsIcopiedAnAnchor";
var newProduct = new Product
{
Id = id,
Name = "Top Product"
};
var response = this._client.Index(newProduct);
var productInElasticsearch = this._client.Source<Product>(i=>i.Id(id));
Assert.NotNull(productInElasticsearch);
Assert.AreEqual(productInElasticsearch.Id, id);
Assert.True(response.IsValid);
}
[Test]
public void IndexUsingAnUrlAsIdUsingCustomUrlParameterInSettings()
{
var settings = ElasticsearchConfiguration.Settings().SetGlobalQueryStringParameters(new NameValueCollection
{
{"apiKey", "my-api-key"}
});
var client = new ElasticClient(settings);
var id = "http://www.skusuplier.com/products/123?affiliateId=23131#oopsIcopiedAnAnchor";
var newProduct = new Product
{
Id = id,
Name = "Top Product"
};
var response = client.Index(newProduct);
client.Index("", f => f.Index("blah"));
var productInElasticsearch = client.Source<Product>(id);
Assert.NotNull(productInElasticsearch);
Assert.AreEqual(productInElasticsearch.Id, id);
Assert.True(response.IsValid);
}
}
}
|
apache-2.0
|
C#
|
1bbf6053d736694c6d164dd9ff5c58401a93fae4
|
Update EventBoxProfilerEditor.cs
|
onechenxing/EventBox
|
Editor/EventBoxProfilerEditor.cs
|
Editor/EventBoxProfilerEditor.cs
|
//----------------------------------------------
// C# 简化全局事件监控
// @author: ChenXing
// @email: onechenxing@163.com
// @date: 2015/09/02
//----------------------------------------------
using UnityEngine;
using UnityEditor;
using System.Collections;
namespace CxLib.Editor
{
/// <summary>
/// EventBox监控窗口
/// </summary>
public class EventBoxProfilerEditor : EditorWindow
{
/// <summary>
/// 滚动位置
/// </summary>
Vector2 scrollPosition;
/// <summary>
/// 打开面板
/// </summary>
[MenuItem("CxTools/EventBoxProfiler")]
public static void Open()
{
var window = EditorWindow.GetWindow(typeof(EventBoxProfilerEditor), false, "EventBoxProfiler");
window.autoRepaintOnSceneChange = true;
}
/// <summary>
/// 主绘制入口函数
/// </summary>
void OnGUI()
{
scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(position.width), GUILayout.Height(position.height));
GUILayout.Label(EventBox.Print());
GUILayout.EndScrollView();
}
}
}
|
//----------------------------------------------
// C# 简化全局事件监控
// @author: ChenXing
// @email: onechenxing@163.com
// @date: 2015/09/02
//----------------------------------------------
using UnityEngine;
using UnityEditor;
using System.Collections;
namespace CxLib.EventBox
{
/// <summary>
/// EventBox监控窗口
/// </summary>
public class EventBoxProfilerEditor : EditorWindow
{
/// <summary>
/// 滚动位置
/// </summary>
Vector2 scrollPosition;
/// <summary>
/// 打开面板
/// </summary>
[MenuItem("CxTools/EventBoxProfiler")]
public static void Open()
{
var window = EditorWindow.GetWindow(typeof(EventBoxProfilerEditor), false, "EventBoxProfiler");
window.autoRepaintOnSceneChange = true;
}
/// <summary>
/// 主绘制入口函数
/// </summary>
void OnGUI()
{
scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(position.width), GUILayout.Height(position.height));
GUILayout.Label(EventBox.Print());
GUILayout.EndScrollView();
}
}
}
|
mit
|
C#
|
dd546233f65505a188e46ffee1c6ad5b608daf2f
|
Update version number.
|
Damnae/storybrew
|
editor/Properties/AssemblyInfo.cs
|
editor/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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.18.*")]
|
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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.17.*")]
|
mit
|
C#
|
7591c73dae4b1f6a161e88696d39437767fff0c1
|
Update version number.
|
Damnae/storybrew
|
editor/Properties/AssemblyInfo.cs
|
editor/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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.70.*")]
|
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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.69.*")]
|
mit
|
C#
|
57d05ac5dca32e167caed9e56680ba744fe567ca
|
fix opacity not interpolated in animated brush
|
AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,grokys/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia
|
src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs
|
src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs
|
using System;
using Avalonia.Data;
using Avalonia.Media;
using Avalonia.Media.Immutable;
#nullable enable
namespace Avalonia.Animation.Animators
{
/// <summary>
/// Animator that handles <see cref="SolidColorBrush"/> values.
/// </summary>
public class ISolidColorBrushAnimator : Animator<ISolidColorBrush?>
{
private static readonly DoubleAnimator s_doubleAnimator = new DoubleAnimator();
public override ISolidColorBrush? Interpolate(double progress, ISolidColorBrush? oldValue, ISolidColorBrush? newValue)
{
if (oldValue is null || newValue is null)
{
return progress >= 0.5 ? newValue : oldValue;
}
return new ImmutableSolidColorBrush(
ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color),
s_doubleAnimator.Interpolate(progress, oldValue.Opacity, newValue.Opacity));
}
public override IDisposable BindAnimation(Animatable control, IObservable<ISolidColorBrush?> instance)
{
if (Property is null)
{
throw new InvalidOperationException("Animator has no property specified.");
}
return control.Bind((AvaloniaProperty<IBrush?>)Property, instance, BindingPriority.Animation);
}
}
[Obsolete("Use ISolidColorBrushAnimator instead")]
public class SolidColorBrushAnimator : Animator<SolidColorBrush?>
{
public override SolidColorBrush? Interpolate(double progress, SolidColorBrush? oldValue, SolidColorBrush? newValue)
{
if (oldValue is null || newValue is null)
{
return progress >= 0.5 ? newValue : oldValue;
}
return new SolidColorBrush(ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color));
}
}
}
|
using System;
using Avalonia.Data;
using Avalonia.Media;
using Avalonia.Media.Immutable;
#nullable enable
namespace Avalonia.Animation.Animators
{
/// <summary>
/// Animator that handles <see cref="SolidColorBrush"/> values.
/// </summary>
public class ISolidColorBrushAnimator : Animator<ISolidColorBrush?>
{
public override ISolidColorBrush? Interpolate(double progress, ISolidColorBrush? oldValue, ISolidColorBrush? newValue)
{
if (oldValue is null || newValue is null)
{
return progress >= 0.5 ? newValue : oldValue;
}
return new ImmutableSolidColorBrush(ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color));
}
public override IDisposable BindAnimation(Animatable control, IObservable<ISolidColorBrush?> instance)
{
if (Property is null)
{
throw new InvalidOperationException("Animator has no property specified.");
}
return control.Bind((AvaloniaProperty<IBrush?>)Property, instance, BindingPriority.Animation);
}
}
[Obsolete("Use ISolidColorBrushAnimator instead")]
public class SolidColorBrushAnimator : Animator<SolidColorBrush?>
{
public override SolidColorBrush? Interpolate(double progress, SolidColorBrush? oldValue, SolidColorBrush? newValue)
{
if (oldValue is null || newValue is null)
{
return progress >= 0.5 ? newValue : oldValue;
}
return new SolidColorBrush(ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color));
}
}
}
|
mit
|
C#
|
17d49f03e09df0554600af3a77e48b7946a2da6c
|
test cases
|
tiksn/TIKSN-Framework
|
TIKSN.Finance.Tests/PricingStrategy/PsychologicalPricingStrategyTests.cs
|
TIKSN.Finance.Tests/PricingStrategy/PsychologicalPricingStrategyTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TIKSN.Finance.PricingStrategy;
using System.Collections.Generic;
using System;
using System.Linq;
namespace TIKSN.Finance.Tests.PricingStrategy
{
[TestClass]
public class PsychologicalPricingStrategyTests
{
[TestMethod]
public void BalkTests()
{
var prices = new Dictionary<decimal, decimal>();
prices.Add(1m, 0.99m);
prices.Add(2m, 1.99m);
prices.Add(46m, 45m);
prices.Add(47m, 49m);
prices.Add(48m, 49m);
prices.Add(49m, 49m);
prices.Add(50m, 49m);
prices.Add(55m, 55m);
prices.Add(69m, 69m);
prices.Add(8m, 7.99m);
prices.Add(51m, 49m);
prices.Add(83m, 85m);
prices.Add(18m, 19m);
prices.Add(364m, 369m);
prices.Add(794m, 799m);
prices.Add(191m, 199m);
prices.Add(149m, 149m);
prices.Add(761m, 765m);
prices.Add(154m, 155m);
prices.Add(9444m, 9449m);
prices.Add(658m, 659m);
prices.Add(1776m, 1779m);
prices.Add(9267m, 9299m);
prices.Add(3176m, 3199m);
prices.Add(50771m, 50799m);
prices.Add(68423m, 68999m);
prices.Add(97360m, 97999m);
prices.Add(762783m, 769999m);
prices.Add(6283m, 6299m);
prices.Add(870387m, 870000m);
prices.Add(526213m, 525555m);
prices.Add(418130m, 419999m);
var strategy = new PsychologicalPricingStrategy();
foreach (var price in prices)
{
var actualEstimatedPrice = strategy.EstimateMarketPrice(price.Key);
var expectedEstimatedPrice = price.Value;
Assert.AreEqual(expectedEstimatedPrice, actualEstimatedPrice, "Actual: {0} Expected: {1}", actualEstimatedPrice, expectedEstimatedPrice);
}
}
[TestMethod]
public void EstimatedPriceIsPrimarelyBeneficial()
{
var ratios = new List<decimal>();
var strategy = new PsychologicalPricingStrategy();
var RNG = new Random();
for (int i = 0; i < 100; i++)
{
var initialPrice = (decimal)RNG.NextDouble();
var estimatedPrice = strategy.EstimateMarketPrice(initialPrice);
ratios.Add(estimatedPrice / initialPrice);
}
for (int i = 0; i < 100; i++)
{
var initialPrice = (decimal)RNG.NextDouble() * 10m;
var estimatedPrice = strategy.EstimateMarketPrice(initialPrice);
ratios.Add(estimatedPrice / initialPrice);
}
for (int i = 0; i < 100; i++)
{
var initialPrice = (decimal)RNG.NextDouble() * 100m;
var estimatedPrice = strategy.EstimateMarketPrice(initialPrice);
ratios.Add(estimatedPrice / initialPrice);
}
for (int i = 0; i < 100; i++)
{
var initialPrice = (decimal)RNG.Next(0, 10);
var estimatedPrice = strategy.EstimateMarketPrice(initialPrice);
ratios.Add(estimatedPrice / initialPrice);
}
for (int i = 0; i < 100; i++)
{
var initialPrice = (decimal)RNG.Next(10, 100);
var estimatedPrice = strategy.EstimateMarketPrice(initialPrice);
ratios.Add(estimatedPrice / initialPrice);
}
for (int i = 0; i < 100; i++)
{
var initialPrice = (decimal)RNG.Next(100, 10000);
var estimatedPrice = strategy.EstimateMarketPrice(initialPrice);
ratios.Add(estimatedPrice / initialPrice);
}
for (int i = 0; i < 100; i++)
{
var initialPrice = (decimal)RNG.Next();
var estimatedPrice = strategy.EstimateMarketPrice(initialPrice);
ratios.Add(estimatedPrice / initialPrice);
}
var averageRatio = ratios.Average();
var averagePercentage = averageRatio * 100m;
Assert.IsTrue(averagePercentage >= 100);
Assert.IsTrue(averagePercentage <= 102);
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TIKSN.Finance.PricingStrategy;
using System.Collections.Generic;
namespace TIKSN.Finance.Tests.PricingStrategy
{
[TestClass]
public class PsychologicalPricingStrategyTests
{
[TestMethod]
public void BalkTests()
{
var prices = new Dictionary<decimal, decimal>();
prices.Add(1m, 0.99m);
var strategy = new PsychologicalPricingStrategy();
foreach (var price in prices)
{
var actualEstimatedPrice = strategy.EstimateMarketPrice(price.Key);
var expectedEstimatedPrice = price.Value;
Assert.AreEqual(expectedEstimatedPrice, actualEstimatedPrice, "Actual: {0} Expected: {1}", actualEstimatedPrice, expectedEstimatedPrice);
}
}
}
}
|
mit
|
C#
|
a7f7087024eaf0a595c5adf610817f9a3f10fef2
|
package title change to enable upload to NuGet
|
sklementiev/mixins
|
Mixins/Properties/AssemblyInfo.cs
|
Mixins/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mixins.NET")]
[assembly: AssemblyDescription("Mixins implementation in .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sergey Klementiev")]
[assembly: AssemblyProduct("Mixins")]
[assembly: AssemblyCopyright("The MIT License (MIT) Copyright (c) 2016 Sergey Klementiev")]
[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("bae40040-46fc-4a0b-9f11-8aea47ea5d93")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mixins")]
[assembly: AssemblyDescription("Mixins implementation in .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sergey Klementiev")]
[assembly: AssemblyProduct("Mixins")]
[assembly: AssemblyCopyright("The MIT License (MIT) Copyright (c) 2016 Sergey Klementiev")]
[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("bae40040-46fc-4a0b-9f11-8aea47ea5d93")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
a05f99345634035ad1985eae32bc8ef80971d767
|
fix invalid argument order in test
|
rit-sse-mycroft/core
|
Mycroft.Tests/Cmd/TestCommand.cs
|
Mycroft.Tests/Cmd/TestCommand.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Mycroft.Cmd;
using System.IO;
using System.Diagnostics;
using System.Runtime.Serialization;
namespace Mycroft.Tests.Cmd
{
[TestClass]
public class TestCommand
{
[TestMethod]
public void TestParse()
{
// Blank manifest should return null
Command nullReturned = Command.Parse("", null);
Assert.AreEqual(null, nullReturned, "Should return null");
// sample input taken from the wiki
var input = @"MSG_QUERY : {
""id"": ""uuid"",
""capability"": ""weather"",
""remoteProcedure"": ""get_temperature"",
""args"" : [""farenheit""],
""instanceId"":[""xxxx""],
""priority"": 30
}}";
// JSON of "MSG_QUERY" should return "MSG"
String msgQuery = Command.getType(input);
Assert.AreEqual("MSG", msgQuery, "Get type should return 'MSG' ");
try
{
// if this breaks, errors could lie in MSG command etc
Command.Parse(input, null);
}
catch (SerializationException e)
{
throw new Exception("JSON could not be parsed into an object - serialization error", e);
}
//random input should return null because objects name is incorrect
var input1 = @"CTL_FOOBAR : {
""id"": ""uuid"",
""capability"": ""weather"",
""remoteProcedure"": ""get_temperature"",
""args"" : [""farenheit""],
""instanceId"":[""xxxx""],
""priority"": 30
}}";
Command returned = Command.Parse(input1, null);
Assert.AreEqual(null, returned, "An incorrect class name should return a null value");
}
}
class BaseCommand : Command
{
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Mycroft.Cmd;
using System.IO;
using System.Diagnostics;
using System.Runtime.Serialization;
namespace Mycroft.Tests.Cmd
{
[TestClass]
public class TestCommand
{
[TestMethod]
public void TestParse()
{
// Blank manifest should return null
Command nullReturned = Command.Parse("", null);
Assert.AreEqual(null, nullReturned, "Should return null");
// sample input taken from the wiki
var input = @"MSG_QUERY : {
""id"": ""uuid"",
""capability"": ""weather"",
""remoteProcedure"": ""get_temperature"",
""args"" : [""farenheit""],
""instanceId"":[""xxxx""],
""priority"": 30
}}";
// JSON of "MSG_QUERY" should return "MSG"
String msgQuery = Command.getType(input);
Assert.AreEqual(msgQuery, "MSG", "Get type should return 'MSG' ");
try
{
// if this breaks, errors could lie in MSG command etc
Command.Parse(input, null);
}
catch (SerializationException e)
{
throw new Exception("JSON could not be parsed into an object - serialization error", e);
}
//random input should return null because objects name is incorrect
var input1 = @"CTL_FOOBAR : {
""id"": ""uuid"",
""capability"": ""weather"",
""remoteProcedure"": ""get_temperature"",
""args"" : [""farenheit""],
""instanceId"":[""xxxx""],
""priority"": 30
}}";
Command returned = Command.Parse(input1, null);
Assert.AreEqual(null, returned, "An incorrect class name should return a null value");
}
}
class BaseCommand : Command
{
}
}
|
bsd-3-clause
|
C#
|
8b44bf90e8ef69ff17c8959cf68d784f77426b9b
|
Fix CodeFactor
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Controls/WalletExplorer/TransactionInfoTabViewModel.cs
|
WalletWasabi.Gui/Controls/WalletExplorer/TransactionInfoTabViewModel.cs
|
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using ReactiveUI;
using Splat;
using WalletWasabi.Gui.Controls.TransactionDetails.ViewModels;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class TransactionInfoTabViewModel : WasabiDocumentTabViewModel
{
public TransactionInfoTabViewModel(TransactionDetailsViewModel transaction) : base("")
{
Global = Locator.Current.GetService<Global>();
Transaction = transaction;
Title = $"Transaction ({transaction.TransactionId[0..10]}) Details";
}
protected Global Global { get; }
public TransactionDetailsViewModel Transaction { get; }
public override void OnOpen(CompositeDisposable disposables)
{
Global.UiConfig.WhenAnyValue(x => x.LurkingWifeMode)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x => Transaction.RaisePropertyChanged(nameof(Transaction.TransactionId)))
.DisposeWith(disposables);
base.OnOpen(disposables);
}
}
}
|
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using ReactiveUI;
using Splat;
using WalletWasabi.Gui.Controls.TransactionDetails.ViewModels;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class TransactionInfoTabViewModel : WasabiDocumentTabViewModel
{
public TransactionInfoTabViewModel(TransactionDetailsViewModel transaction) : base("")
{
Global = Locator.Current.GetService<Global>();
Transaction = transaction;
Title = $"Transaction ({transaction.TransactionId[0..10]}) Details";
}
public override void OnOpen(CompositeDisposable disposables)
{
Global.UiConfig.WhenAnyValue(x => x.LurkingWifeMode)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x => Transaction.RaisePropertyChanged(nameof(Transaction.TransactionId)))
.DisposeWith(disposables);
base.OnOpen(disposables);
}
protected Global Global { get; }
public TransactionDetailsViewModel Transaction { get; }
}
}
|
mit
|
C#
|
7080fd3cb5a9f1a600cccded679a17ea2cbf9cc6
|
Use PascalCase
|
nozzlegear/davenport.net
|
Davenport/Entities/FindOptions.cs
|
Davenport/Entities/FindOptions.cs
|
using System.Collections.Generic;
using Davenport.Infrastructure;
using Newtonsoft.Json;
namespace Davenport.Entities
{
public class FindOptions : Serializable
{
[JsonProperty("fields")]
public string Fields { get; set; }
[JsonProperty("sort")]
public IEnumerable<object> Sort { get; set; }
[JsonProperty("limit")]
public int? Limit { get; set; }
[JsonProperty("skip")]
public int? Skip { get; set; }
[JsonProperty("use_index")]
public object UseIndex { get; set; }
[JsonProperty("selector")]
internal string Selector { get; set; }
}
}
|
using System.Collections.Generic;
using Davenport.Infrastructure;
using Newtonsoft.Json;
namespace Davenport.Entities
{
public class FindOptions : Serializable
{
[JsonProperty("fields")]
public string fields { get; set; }
[JsonProperty("sort")]
public IEnumerable<object> sort { get; set; }
[JsonProperty("limit")]
public int? limit { get; set; }
[JsonProperty("skip")]
public int? skip { get; set; }
[JsonProperty("use_index")]
public object use_index { get; set; }
[JsonProperty("selector")]
internal string Selector { get; set; }
}
}
|
mit
|
C#
|
dc1a06612a4c7272ae5ae8ea9addb63c23d36a41
|
refactor AutofacConfig
|
Borayvor/Templates,Borayvor/Templates,Borayvor/Templates,Borayvor/Templates
|
MyMvcProjectTemplate/Web/MyMvcProjectTemplate.Web/App_Start/AutofacConfig.cs
|
MyMvcProjectTemplate/Web/MyMvcProjectTemplate.Web/App_Start/AutofacConfig.cs
|
namespace MyMvcProjectTemplate.Web.App_Start
{
using System.Data.Entity;
using System.Reflection;
using System.Web.Mvc;
using Autofac;
using Autofac.Integration.Mvc;
using Controllers;
using Data;
using Data.Common.Repositories;
using Services.ApplicationUser;
using Services.Photocourse;
using Services.Web;
using Services.Web.Contracts;
using Web;
public static class AutofacConfig
{
public static void RegisterAutofac()
{
var builder = new ContainerBuilder();
// Register your MVC controllers.
builder.RegisterControllers(typeof(MvcApplication).Assembly);
// OPTIONAL: Register model binders that require DI.
builder.RegisterModelBinders(Assembly.GetExecutingAssembly());
builder.RegisterModelBinderProvider();
// OPTIONAL: Register web abstractions like HttpContextBase.
builder.RegisterModule<AutofacWebTypesModule>();
// OPTIONAL: Enable property injection in view pages.
builder.RegisterSource(new ViewRegistrationSource());
// OPTIONAL: Enable property injection into action filters.
builder.RegisterFilterProvider();
// Register services
RegisterServices(builder);
// Set the dependency resolver to be Autofac.
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
}
private static void RegisterServices(ContainerBuilder builder)
{
builder.Register(x => new ApplicationDbContext())
.As<DbContext>()
.InstancePerRequest();
builder.Register(x => new HttpCacheService())
.As<ICacheService>()
.InstancePerRequest();
builder.RegisterGeneric(typeof(EfDbRepository<>))
.As(typeof(IEfDbRepository<>))
.InstancePerRequest();
var userServicesAssembly = Assembly.GetAssembly(typeof(ApplicationUserProfileService));
builder.RegisterAssemblyTypes(userServicesAssembly).AsImplementedInterfaces();
builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
.AssignableTo<BaseController>().PropertiesAutowired();
}
}
}
|
namespace MyMvcProjectTemplate.Web.App_Start
{
using System.Data.Entity;
using System.Reflection;
using System.Web.Mvc;
using Autofac;
using Autofac.Integration.Mvc;
using Controllers;
using Data;
using Data.Common.Repositories;
using Services.ApplicationUser;
using Services.Photocourse;
using Services.Web;
using Services.Web.Contracts;
using Web;
public static class AutofacConfig
{
public static void RegisterAutofac()
{
var builder = new ContainerBuilder();
// Register your MVC controllers.
builder.RegisterControllers(typeof(MvcApplication).Assembly);
// OPTIONAL: Register model binders that require DI.
builder.RegisterModelBinders(Assembly.GetExecutingAssembly());
builder.RegisterModelBinderProvider();
// OPTIONAL: Register web abstractions like HttpContextBase.
builder.RegisterModule<AutofacWebTypesModule>();
// OPTIONAL: Enable property injection in view pages.
builder.RegisterSource(new ViewRegistrationSource());
// OPTIONAL: Enable property injection into action filters.
builder.RegisterFilterProvider();
// Register services
RegisterServices(builder);
// Set the dependency resolver to be Autofac.
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
}
private static void RegisterServices(ContainerBuilder builder)
{
builder.Register(x => new ApplicationDbContext())
.As<DbContext>()
.InstancePerRequest();
builder.Register(x => new HttpCacheService())
.As<ICacheService>()
.InstancePerRequest();
builder.RegisterGeneric(typeof(EfDbRepository<>))
.As(typeof(IEfDbRepository<>))
.InstancePerRequest();
var userServicesAssembly = Assembly.GetAssembly(typeof(ApplicationUserProfileService));
builder.RegisterAssemblyTypes(userServicesAssembly).AsImplementedInterfaces();
var photocourseServiceAssembly = Assembly.GetAssembly(typeof(PhotocourseService));
builder.RegisterAssemblyTypes(photocourseServiceAssembly).AsImplementedInterfaces();
builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
.AssignableTo<BaseController>().PropertiesAutowired();
}
}
}
|
mit
|
C#
|
0b0374f63e80d0a8f54c5df837e99f1584db15f8
|
Enable extension scenarios in SynthesisConfigRegistrar
|
kamsar/Synthesis
|
Source/Synthesis/Pipelines/Initialize/SynthesisConfigRegistrar.cs
|
Source/Synthesis/Pipelines/Initialize/SynthesisConfigRegistrar.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using Sitecore.Diagnostics;
using Sitecore.Pipelines;
using Synthesis.Configuration;
using Synthesis.Configuration.Registration;
using Synthesis.Utility;
namespace Synthesis.Pipelines.Initialize
{
/// <summary>
/// Registers all Synthesis configurations defined in a specific set of assemblies.
/// To register the Synthesis default configuration, load configurations in the Synthesis assembly.
/// </summary>
public class SynthesisConfigRegistrar
{
protected readonly List<Assembly> Assemblies = new List<Assembly>();
public virtual void Process(PipelineArgs args)
{
var types = GetTypesInRegisteredAssemblies();
var configurations = GetConfigurationsFromTypes(types);
foreach (var configRegistration in configurations)
{
ProviderResolver.RegisterConfiguration(configRegistration.GetConfiguration());
}
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "We want to ignore all load errors on assembly types")]
protected virtual IEnumerable<Type> GetTypesInRegisteredAssemblies()
{
if (Assemblies.Count == 0) throw new InvalidOperationException("You must specify the assemblies to scan for Synthesis configurations, e.g. <assemblies hint=\"list: AddAssembly\"><default>Synthesis</default></assemblies>");
IEnumerable<Assembly> assemblies = Assemblies;
return assemblies.SelectMany(delegate (Assembly x)
{
try { return x.GetExportedTypes(); }
catch (ReflectionTypeLoadException rex) { return rex.Types.Where(y => y != null).ToArray(); } // http://haacked.com/archive/2012/07/23/get-all-types-in-an-assembly.aspx
catch { return new Type[] { }; }
}).ToList();
}
protected virtual IEnumerable<ISynthesisConfigurationRegistration> GetConfigurationsFromTypes(IEnumerable<Type> types)
{
return types
.Where(type => typeof (ISynthesisConfigurationRegistration).IsAssignableFrom(type) && !type.IsAbstract && !type.IsInterface)
.Select(Activator.CreateInstance)
.OfType<ISynthesisConfigurationRegistration>()
.ToArray();
}
public virtual void AddAssembly(string name)
{
// ignore assemblies already added
if (Assemblies.Any(existing => existing.GetName().Name.Equals(name, StringComparison.Ordinal))) return;
if (name.Contains("*"))
{
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
var assemblyName = assembly.GetName().Name;
if (WildcardUtility.IsWildcardMatch(assemblyName, name)) AddAssembly(assemblyName);
}
return;
}
Assembly a = Assembly.Load(name);
if (a == null) throw new ArgumentException("The assembly name was not valid");
Assemblies.Add(a);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using Sitecore.Diagnostics;
using Sitecore.Pipelines;
using Synthesis.Configuration;
using Synthesis.Configuration.Registration;
using Synthesis.Utility;
namespace Synthesis.Pipelines.Initialize
{
/// <summary>
/// Registers all Synthesis configurations defined in a specific set of assemblies.
/// To register the Synthesis default configuration, load configurations in the Synthesis assembly.
/// </summary>
public class SynthesisConfigRegistrar
{
private readonly List<Assembly> _assemblies = new List<Assembly>();
public virtual void Process(PipelineArgs args)
{
var types = GetTypesInRegisteredAssemblies();
var configurations = GetConfigurationsFromTypes(types);
foreach (var configRegistration in configurations)
{
ProviderResolver.RegisterConfiguration(configRegistration.GetConfiguration());
}
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "We want to ignore all load errors on assembly types")]
protected virtual IEnumerable<Type> GetTypesInRegisteredAssemblies()
{
if (_assemblies.Count == 0) throw new InvalidOperationException("You must specify the assemblies to scan for Synthesis configurations, e.g. <assemblies hint=\"list: AddAssembly\"><default>Synthesis</default></assemblies>");
IEnumerable<Assembly> assemblies = _assemblies;
return assemblies.SelectMany(delegate (Assembly x)
{
try { return x.GetExportedTypes(); }
catch (ReflectionTypeLoadException rex) { return rex.Types.Where(y => y != null).ToArray(); } // http://haacked.com/archive/2012/07/23/get-all-types-in-an-assembly.aspx
catch { return new Type[] { }; }
}).ToList();
}
protected virtual IEnumerable<ISynthesisConfigurationRegistration> GetConfigurationsFromTypes(IEnumerable<Type> types)
{
return types
.Where(type => typeof (ISynthesisConfigurationRegistration).IsAssignableFrom(type) && !type.IsAbstract && !type.IsInterface)
.Select(Activator.CreateInstance)
.OfType<ISynthesisConfigurationRegistration>()
.ToArray();
}
public void AddAssembly(string name)
{
// ignore assemblies already added
if (_assemblies.Any(existing => existing.GetName().Name.Equals(name, StringComparison.Ordinal))) return;
if (name.Contains("*"))
{
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
var assemblyName = assembly.GetName().Name;
if (WildcardUtility.IsWildcardMatch(assemblyName, name)) AddAssembly(assemblyName);
}
return;
}
Assembly a = Assembly.Load(name);
if (a == null) throw new ArgumentException("The assembly name was not valid");
_assemblies.Add(a);
}
}
}
|
mit
|
C#
|
b31d5b5b6a56ed418e0b9d3d18986327d9ec355d
|
Update IAzureTableStorageQueryRepository.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/AzureStorage/IAzureTableStorageQueryRepository.cs
|
TIKSN.Core/Data/AzureStorage/IAzureTableStorageQueryRepository.cs
|
using Microsoft.Azure.Cosmos.Table;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.AzureStorage
{
public interface IAzureTableStorageQueryRepository<T> where T : ITableEntity
{
Task<T> RetrieveAsync(string partitionKey, string rowKey, CancellationToken cancellationToken);
Task<IEnumerable<T>> SearchAsync(IDictionary<string, object> filters, CancellationToken cancellationToken);
}
}
|
using Microsoft.WindowsAzure.Storage.Table;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.AzureStorage
{
public interface IAzureTableStorageQueryRepository<T> where T : ITableEntity
{
Task<T> RetrieveAsync(string partitionKey, string rowKey, CancellationToken cancellationToken);
Task<IEnumerable<T>> SearchAsync(IDictionary<string, object> filters, CancellationToken cancellationToken);
}
}
|
mit
|
C#
|
e0fb31ccc46ac71dc430f683efc84408e536bd6e
|
Add Do<T> method (evil).
|
Grabacr07/MetroTrilithon
|
source/MetroTrilithon/Linq/EnumerableEx.cs
|
source/MetroTrilithon/Linq/EnumerableEx.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MetroTrilithon.Linq
{
public static class EnumerableEx
{
public static IEnumerable<T> Return<T>(T value)
{
yield return value;
}
public static IEnumerable<T> Do<T>(this IEnumerable<T> source, Action<T> action)
{
foreach (var item in source)
{
action(item);
yield return item;
}
}
public static string JoinString<T>(this IEnumerable<T> source, string separator)
{
return string.Join(separator, source is IEnumerable<string> ? (IEnumerable<string>)source : source.Select(x => x.ToString()));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MetroTrilithon.Linq
{
public static class EnumerableEx
{
public static IEnumerable<T> Return<T>(T value)
{
yield return value;
}
public static string JoinString<T>(this IEnumerable<T> source, string separator)
{
return string.Join(separator, source is IEnumerable<string> ? (IEnumerable<string>)source : source.Select(x => x.ToString()));
}
}
}
|
mit
|
C#
|
9e75b1469164d6cba9bdd2b77b6c65b3bc70389d
|
Add skeleton code to PhysicalParser.cs
|
ngEPL/Mocca
|
Mocca/Physical/PhysicalParser.cs
|
Mocca/Physical/PhysicalParser.cs
|
using System;
using System.Collections.Generic;
using Mocca.Compiler;
using Mocca.DataType;
using Mocca.Blocks;
namespace Mocca.Physical {
public enum PhysicalDevice {
Microbit,
Arduino,
RaspberryPi,
Unknown
}
public class PhysicalParser {
public Block block;
public PhysicalDevice device;
public PhysicalParser(Block block) {
this.block = block;
this.device = checkDevices(block);
}
public string Parse() {
switch (device) {
case PhysicalDevice.Arduino:
return ParseArduino();
case PhysicalDevice.Microbit:
return ParseMicrobit();
case PhysicalDevice.RaspberryPi:
return ParseRaspberryPi();
default:
throw new FormatException();
}
}
#region Microbit
public string ParseMicrobit() {
var type = this.block.type;
var value = this.block.value;
switch (type.name) {
case "DisplayScroll":
return "display.scroll(" + value[0].ToString() + ")";
case "DisplayShow":
return "display.show(" + value[0].ToString() + ")";
case "Sleep":
return "sleep(" + value[0].ToString() + ")";
default:
throw new FormatException();
}
}
#endregion Microbit
#region Arduino
public string ParseArduino() {
return null;
}
#endregion Arduino
#region RaspberryPi
public string ParseRaspberryPi() {
return null;
}
#endregion RaspberryPi
public PhysicalDevice checkDevices(Block cmd) {
if (cmd.type.category != BlockCategory.Hardware) {
return PhysicalDevice.Unknown;
}
PhysicalDevice ret;
switch (cmd.type.extModule) {
case "microbit":
ret = PhysicalDevice.Microbit;
break;
case "arduino":
ret = PhysicalDevice.Arduino;
break;
case "rbpi":
ret = PhysicalDevice.RaspberryPi;
break;
default:
ret = PhysicalDevice.Unknown;
break;
}
return ret;
}
}
}
|
using System;
using System.Collections.Generic;
using Mocca.Compiler;
using Mocca.DataType;
namespace Mocca.Physical {
public enum PhysicalDevice {
Microbit,
Arduino,
RaspberryPi,
Unknown
}
public class PhysicalParser {
public MoccaCommand cmd;
public PhysicalDevice device;
public PhysicalParser(MoccaCommand cmd) {
this.cmd = cmd;
this.device = checkDevices(cmd);
}
public PhysicalDevice checkDevices(MoccaCommand cmd) {
PhysicalDevice ret;
switch (cmd.args[0].ToString()) {
case "microbit":
ret = PhysicalDevice.Microbit;
break;
case "arduino":
ret = PhysicalDevice.Arduino;
break;
case "rbpi":
ret = PhysicalDevice.RaspberryPi;
break;
default:
ret = PhysicalDevice.Unknown;
break;
}
return ret;
}
}
}
|
mit
|
C#
|
6b3174ecc1d832ac91875d6f1b53eddd29ec3b11
|
Bump version 2.7
|
rabbit-link/rabbit-link,rabbit-link/rabbit-link
|
src/RabbitLink/Properties/AssemblyInfo.cs
|
src/RabbitLink/Properties/AssemblyInfo.cs
|
#region Usings
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RabbitLink")]
[assembly: AssemblyDescription("Advanced .Net API for RabbitMQ")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RabbitLink")]
[assembly: AssemblyCopyright("Copyright © Artur Kraev 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("b2148830-a507-44a5-bc99-efda7f36e21d")]
// 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.2.7.0")]
[assembly: AssemblyFileVersion("0.2.7.0")]
|
#region Usings
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RabbitLink")]
[assembly: AssemblyDescription("Advanced .Net API for RabbitMQ")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RabbitLink")]
[assembly: AssemblyCopyright("Copyright © Artur Kraev 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("b2148830-a507-44a5-bc99-efda7f36e21d")]
// 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.2.6.0")]
[assembly: AssemblyFileVersion("0.2.6.0")]
|
mit
|
C#
|
0dd44a75250b1fab51533cf89a668f1868b4ccdd
|
Update for lint fix
|
GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,jsimonweb/csharp-docs-samples,jsimonweb/csharp-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,jsimonweb/csharp-docs-samples,jsimonweb/csharp-docs-samples,GoogleCloudPlatform/dotnet-docs-samples
|
bigquery/api/GettingStarted/QuickStart/Properties/AssemblyInfo.cs
|
bigquery/api/GettingStarted/QuickStart/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QuickStart")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QuickStart")]
[assembly: AssemblyCopyright("Copyright \u00A9 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("569d225b-83c3-4228-b418-a5242d49e54d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QuickStart")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QuickStart")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("569d225b-83c3-4228-b418-a5242d49e54d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
55c03dc04d0505f462c41876a50797acc3698f0b
|
Fix silly mistake in ordering and update test colour scheme
|
NeoAdonis/osu,peppy/osu,ppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,ppy/osu,peppy/osu
|
osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs
|
osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.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;
using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Taiko;
using osu.Framework.Bindables;
using osu.Game.Overlays;
using osu.Framework.Allocation;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneProfileRulesetSelector : OsuTestScene
{
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);
public TestSceneProfileRulesetSelector()
{
ProfileRulesetSelector selector;
var user = new Bindable<APIUser>();
Child = selector = new ProfileRulesetSelector
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
User = { BindTarget = user }
};
AddStep("set osu! as default", () => selector.SetDefaultRuleset(new OsuRuleset().RulesetInfo));
AddStep("set taiko as default", () => selector.SetDefaultRuleset(new TaikoRuleset().RulesetInfo));
AddStep("set catch as default", () => selector.SetDefaultRuleset(new CatchRuleset().RulesetInfo));
AddStep("set mania as default", () => selector.SetDefaultRuleset(new ManiaRuleset().RulesetInfo));
AddStep("User with osu as default", () => user.Value = new APIUser { Id = 0, PlayMode = "osu" });
AddStep("User with taiko as default", () => user.Value = new APIUser { Id = 1, PlayMode = "taiko" });
AddStep("User with catch as default", () => user.Value = new APIUser { Id = 2, PlayMode = "fruits" });
AddStep("User with mania as default", () => user.Value = new APIUser { Id = 3, PlayMode = "mania" });
AddStep("null user", () => user.Value = null);
}
}
}
|
// 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;
using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Taiko;
using osu.Framework.Bindables;
using osu.Game.Overlays;
using osu.Framework.Allocation;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneProfileRulesetSelector : OsuTestScene
{
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
public TestSceneProfileRulesetSelector()
{
ProfileRulesetSelector selector;
var user = new Bindable<APIUser>();
Child = selector = new ProfileRulesetSelector
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
User = { BindTarget = user }
};
AddStep("set osu! as default", () => selector.SetDefaultRuleset(new OsuRuleset().RulesetInfo));
AddStep("set taiko as default", () => selector.SetDefaultRuleset(new TaikoRuleset().RulesetInfo));
AddStep("set catch as default", () => selector.SetDefaultRuleset(new CatchRuleset().RulesetInfo));
AddStep("set mania as default", () => selector.SetDefaultRuleset(new ManiaRuleset().RulesetInfo));
AddStep("User with osu as default", () => user.Value = new APIUser { Id = 0, PlayMode = "osu" });
AddStep("User with taiko as default", () => user.Value = new APIUser { Id = 2, PlayMode = "taiko" });
AddStep("User with catch as default", () => user.Value = new APIUser { Id = 3, PlayMode = "fruits" });
AddStep("User with mania as default", () => user.Value = new APIUser { Id = 1, PlayMode = "mania" });
AddStep("null user", () => user.Value = null);
}
}
}
|
mit
|
C#
|
afc531c0d76376c021491708825e7333938e218e
|
fix camera rotation (oblique angle) issue (#85)
|
unity3d-jp/AlembicImporter,unity3d-jp/AlembicImporter,unity3d-jp/AlembicImporter
|
AlembicImporter/Assets/UTJ/Alembic/Scripts/Importer/AlembicCamera.cs
|
AlembicImporter/Assets/UTJ/Alembic/Scripts/Importer/AlembicCamera.cs
|
using UnityEngine;
namespace UTJ.Alembic
{
[ExecuteInEditMode]
public class AlembicCamera : AlembicElement
{
aiCamera m_abcSchema;
aiCameraData m_abcData;
Camera m_camera;
bool m_ignoreClippingPlanes = false;
public override aiSchema abcSchema { get { return m_abcSchema; } }
public override bool visibility { get { return m_abcData.visibility; } }
public override void AbcSetup(aiObject abcObj, aiSchema abcSchema)
{
base.AbcSetup( abcObj, abcSchema);
m_abcSchema = (aiCamera)abcSchema;
m_camera = GetOrAddComponent<Camera>();
// flip forward direction (camera in Alembic has inverted forward direction)
abcTreeNode.gameObject.transform.localEulerAngles = new Vector3(0, 180, 0);
}
public override void AbcSyncDataEnd()
{
if (!m_abcSchema.schema.isDataUpdated)
return;
m_abcSchema.sample.GetData(ref m_abcData);
if (!abcTreeNode.stream.ignoreVisibility)
abcTreeNode.gameObject.SetActive(m_abcData.visibility);
m_camera.fieldOfView = m_abcData.fieldOfView;
if (!m_ignoreClippingPlanes)
{
m_camera.nearClipPlane = m_abcData.nearClippingPlane;
m_camera.farClipPlane = m_abcData.farClippingPlane;
}
// no use for focusDistance and focalLength yet (could be usefull for DoF component)
}
}
}
|
using UnityEngine;
namespace UTJ.Alembic
{
[ExecuteInEditMode]
public class AlembicCamera : AlembicElement
{
aiCamera m_abcSchema;
aiCameraData m_abcData;
Camera m_camera;
bool m_ignoreClippingPlanes = false;
public override aiSchema abcSchema { get { return m_abcSchema; } }
public override bool visibility { get { return m_abcData.visibility; } }
public override void AbcSetup(aiObject abcObj, aiSchema abcSchema)
{
base.AbcSetup( abcObj, abcSchema);
m_abcSchema = (aiCamera)abcSchema;
m_camera = GetOrAddComponent<Camera>();
}
public override void AbcSyncDataEnd()
{
if (!m_abcSchema.schema.isDataUpdated)
return;
m_abcSchema.sample.GetData(ref m_abcData);
if (!abcTreeNode.stream.ignoreVisibility)
abcTreeNode.gameObject.SetActive(m_abcData.visibility);
abcTreeNode.gameObject.transform.forward = -abcTreeNode.gameObject.transform.parent.forward;
m_camera.fieldOfView = m_abcData.fieldOfView;
if (!m_ignoreClippingPlanes)
{
m_camera.nearClipPlane = m_abcData.nearClippingPlane;
m_camera.farClipPlane = m_abcData.farClippingPlane;
}
// no use for focusDistance and focalLength yet (could be usefull for DoF component)
}
}
}
|
mit
|
C#
|
c6ba105672b2eb43880d628f0bb68082f3128733
|
Update namespace #5
|
chrisber/typescript-addin,chrisber/typescript-addin
|
src/TypeScriptBinding/Hosting/CompletionEntryDetailsProvider.cs
|
src/TypeScriptBinding/Hosting/CompletionEntryDetailsProvider.cs
|
//
// CompletionEntryDetailsProvider.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// 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 MonoDevelop.Core;
using TypeScriptLanguageService;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class CompletionEntryDetailsProvider
{
TypeScriptContext context;
FilePath fileName;
int offset;
public CompletionEntryDetailsProvider(TypeScriptContext context, FilePath fileName, int offset)
{
this.context = context;
this.fileName = fileName;
this.offset = offset;
}
public CompletionEntryDetails GetCompletionEntryDetails(string entryName)
{
return context.GetCompletionEntryDetails(fileName, offset, entryName);
}
}
}
|
//
// CompletionEntryDetailsProvider.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2013 Matthew Ward
//
// 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 MonoDevelop.Core;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class CompletionEntryDetailsProvider
{
TypeScriptContext context;
FilePath fileName;
int offset;
public CompletionEntryDetailsProvider(TypeScriptContext context, FilePath fileName, int offset)
{
this.context = context;
this.fileName = fileName;
this.offset = offset;
}
public CompletionEntryDetails GetCompletionEntryDetails(string entryName)
{
return context.GetCompletionEntryDetails(fileName, offset, entryName);
}
}
}
|
mit
|
C#
|
eb707987408c3970e058048aded6c5b7de61e171
|
Bump assembly to version 2.0.0.
|
paulyoder/LinqToExcel
|
src/LinqToExcel/Properties/AssemblyInfo.cs
|
src/LinqToExcel/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LinqToExcel")]
[assembly: AssemblyDescription("Easily retrieve data from spreadsheets and csv files by using LINQ")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Yoder Web Solutions, LLC")]
[assembly: AssemblyProduct("LinqToExcel")]
[assembly: AssemblyCopyright("Copyright © Paul Yoder 2013")]
[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("1633c6fa-8845-45dc-a7f2-36ca5e9171a8")]
// 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("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0-PRERELEASE")]
[assembly: System.Security.AllowPartiallyTrustedCallers]
|
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("LinqToExcel")]
[assembly: AssemblyDescription("Easily retrieve data from spreadsheets and csv files by using LINQ")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Yoder Web Solutions, LLC")]
[assembly: AssemblyProduct("LinqToExcel")]
[assembly: AssemblyCopyright("Copyright © Paul Yoder 2013")]
[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("1633c6fa-8845-45dc-a7f2-36ca5e9171a8")]
// 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.11.0")]
[assembly: AssemblyFileVersion("1.11.0")]
[assembly: System.Security.AllowPartiallyTrustedCallers]
|
mit
|
C#
|
b940ab0fa5d484a477c4aedf2ff95afaf97a55a2
|
Make CreateCommand implement ICommand
|
appharbor/appharbor-cli
|
src/AppHarbor/Commands/CreateCommand.cs
|
src/AppHarbor/Commands/CreateCommand.cs
|
using System;
namespace AppHarbor.Commands
{
public class CreateCommand : ICommand
{
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
|
namespace AppHarbor.Commands
{
public class CreateCommand
{
}
}
|
mit
|
C#
|
efdcd749adaff23142fbb72f756fb1b6de98a7bb
|
Fix nullref during GridContainerContent construction
|
peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework
|
osu.Framework/Graphics/Containers/GridContainerContent.cs
|
osu.Framework/Graphics/Containers/GridContainerContent.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Framework.Graphics.Containers
{
public class GridContainerContent
{
public GridContainerContent(Drawable[][] drawables)
{
_ = new ArrayWrapper<Drawable>[drawables?.Length ?? 0];
if (drawables != null)
{
for (int i = 0; i < drawables.Length; i++)
{
if (drawables[i] != null)
{
_[i] = new ArrayWrapper<Drawable> { _ = new Drawable[drawables[i].Length] };
for (int j = 0; j < drawables[i].Length; j++)
{
_[i][j] = drawables[i][j];
}
}
}
}
}
public ArrayWrapper<Drawable>[] _ { get; set; }
public ArrayWrapper<Drawable> this[int index]
{
get => _[index];
set => _[index] = value;
}
public class ArrayWrapper<T>
{
public T[] _ { get; set; }
public T this[int index]
{
get => _[index];
set => _[index] = value;
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Framework.Graphics.Containers
{
public class GridContainerContent
{
public GridContainerContent(Drawable[][] drawables)
{
_ = new ArrayWrapper<Drawable>[drawables.Length];
for (int i = 0; i < drawables.Length; i++)
{
_[i] = new ArrayWrapper<Drawable> { _ = new Drawable[drawables[i].Length] };
for (int j = 0; j < drawables[i].Length; j++)
{
_[i][j] = drawables[i][j];
}
}
}
public ArrayWrapper<Drawable>[] _ { get; set; }
public ArrayWrapper<Drawable> this[int index]
{
get => _[index];
set => _[index] = value;
}
public class ArrayWrapper<T>
{
public T[] _ { get; set; }
public T this[int index]
{
get => _[index];
set => _[index] = value;
}
}
}
}
|
mit
|
C#
|
e9cb3337b31e39372f3905405366d45d3372bded
|
Fix 1x1 white pixel appearing in the centre of hitcircles on default skin
|
EVAST9919/osu,2yangk23/osu,peppy/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,johnneijzen/osu,NeoAdonis/osu,EVAST9919/osu,smoogipoo/osu,peppy/osu,ppy/osu,smoogipooo/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,johnneijzen/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu-new
|
osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs
|
osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
using osu.Game.Graphics;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
public class NumberPiece : Container
{
private readonly SkinnableSpriteText number;
public string Text
{
get => number.Text;
set => number.Text = value;
}
public NumberPiece()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Children = new Drawable[]
{
new Container
{
Masking = true,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Radius = 60,
Colour = Color4.White.Opacity(0.5f),
},
},
number = new SkinnableSpriteText(new OsuSkinComponent(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText
{
Font = OsuFont.Numeric.With(size: 40),
UseFullGlyphHeight = false,
}, confineMode: ConfineMode.NoScaling)
{
Text = @"1"
}
};
}
}
}
|
// 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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
public class NumberPiece : Container
{
private readonly SkinnableSpriteText number;
public string Text
{
get => number.Text;
set => number.Text = value;
}
public NumberPiece()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Children = new Drawable[]
{
new CircularContainer
{
Masking = true,
Origin = Anchor.Centre,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Radius = 60,
Colour = Color4.White.Opacity(0.5f),
},
Child = new Box()
},
number = new SkinnableSpriteText(new OsuSkinComponent(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText
{
Font = OsuFont.Numeric.With(size: 40),
UseFullGlyphHeight = false,
}, confineMode: ConfineMode.NoScaling)
{
Text = @"1"
}
};
}
}
}
|
mit
|
C#
|
4b90a27ea0348be486b6258944d3060e85533c19
|
fix user hashcode
|
Iwuh/Wycademy
|
WycademyV2/src/WycademyV2/Commands/Utilities/UserEqualityComparer.cs
|
WycademyV2/src/WycademyV2/Commands/Utilities/UserEqualityComparer.cs
|
using Discord;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace WycademyV2.Commands.Utilities
{
public class UserEqualityComparer : IEqualityComparer<IUser>
{
public bool Equals(IUser x, IUser y)
{
return x.Id == y.Id;
}
public int GetHashCode(IUser obj)
{
return obj.Id.GetHashCode();
}
}
}
|
using Discord;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace WycademyV2.Commands.Utilities
{
public class UserEqualityComparer : IEqualityComparer<IUser>
{
public bool Equals(IUser x, IUser y)
{
return x.Id == y.Id;
}
public int GetHashCode(IUser obj)
{
return obj.GetHashCode();
}
}
}
|
mit
|
C#
|
b2f1d0b3e60ff47f1d82b3cad76b6c83a33aa9f0
|
Change class Terminal to be abstract
|
HaiTo/lury,lury-lang/lury,nokok/lury
|
src/Lury/Compiling/Elements/Terminal.cs
|
src/Lury/Compiling/Elements/Terminal.cs
|
//
// Terminal.cs
//
// Author:
// Tomona Nanase <nanase@users.noreply.github.com>
//
// The MIT License (MIT)
//
// Copyright (c) 2014-2015 Tomona Nanase
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Lury.Compiling.Elements
{
abstract class Terminal : Element
{
public Lexer.Token Token { get; private set; }
public Terminal(object token)
: this((Lexer.Token)token)
{
}
public Terminal(Lexer.Token token)
{
this.Token = token;
}
public override string ToString()
{
return this.Token.Text;
}
}
}
|
//
// Terminal.cs
//
// Author:
// Tomona Nanase <nanase@users.noreply.github.com>
//
// The MIT License (MIT)
//
// Copyright (c) 2014-2015 Tomona Nanase
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Lury.Compiling.Elements
{
class Terminal
{
public Lexer.Token Token { get; private set; }
public Terminal(object token)
: this((Lexer.Token)token)
{
}
public Terminal(Lexer.Token token)
{
this.Token = token;
}
public override string ToString()
{
return this.Token.Text;
}
}
}
|
mit
|
C#
|
d667d4eb93e22d1f76c3d712cdfe45ceef9fff1d
|
Fix bug with edit/view non-domain users with enabled domain integration
|
KiritoStudio/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,crowar/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,hakim89/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,lkho/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,PGM-NipponSysits/IIS.Git-Connector,dunderburken/Bonobo-Git-Server,crowar/Bonobo-Git-Server,larshg/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,RedX2501/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,snoopydo/Bonobo-Git-Server,crowar/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,PGM-NipponSysits/IIS.Git-Connector,dunderburken/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,willdean/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,padremortius/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,larshg/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,lkho/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,dunderburken/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,lkho/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,larshg/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,willdean/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,willdean/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,willdean/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,hakim89/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,crowar/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,gencer/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,gencer/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,forgetz/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,gencer/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,gencer/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,snoopydo/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,lkho/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,larshg/Bonobo-Git-Server,willdean/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,crowar/Bonobo-Git-Server,crowar/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server
|
Bonobo.Git.Server/UsernameUrl.cs
|
Bonobo.Git.Server/UsernameUrl.cs
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
namespace Bonobo.Git.Server
{
public class UsernameUrl
{
//to allow support for email addresses as user names, only encode/decode user name if it is not an email address
private static Regex _isEmailRegEx = new Regex(
@"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$",
RegexOptions.Compiled);
public static string Encode(string username)
{
var nameParts = username.Split('\\');
if ( nameParts.Count() == 2 && !_isEmailRegEx.IsMatch(username) )
{
return nameParts[1] + "@" + nameParts[0];
}
return username;
}
public static string Decode(string username)
{
var nameParts = username.Split('@');
if ( (nameParts.Count() == 2) && (!_isEmailRegEx.IsMatch(username) ||
(String.Equals(ConfigurationManager.AppSettings["ActiveDirectoryIntegration"], "true", StringComparison.InvariantCultureIgnoreCase))))
{
return nameParts[1] + "\\" + nameParts[0];
}
return username;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
namespace Bonobo.Git.Server
{
public class UsernameUrl
{
//to allow support for email addresses as user names, only encode/decode user name if it is not an email address
private static Regex _isEmailRegEx = new Regex(
@"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$",
RegexOptions.Compiled);
public static string Encode(string username)
{
var nameParts = username.Split('\\');
if ( nameParts.Count() == 2 && !_isEmailRegEx.IsMatch(username) )
{
return nameParts[1] + "@" + nameParts[0];
}
return username;
}
public static string Decode(string username)
{
var nameParts = username.Split('@');
if ( (nameParts.Count() == 2 && !_isEmailRegEx.IsMatch(username) ) ||
String.Equals(ConfigurationManager.AppSettings["ActiveDirectoryIntegration"], "true", StringComparison.InvariantCultureIgnoreCase))
{
return nameParts[1] + "\\" + nameParts[0];
}
return username;
}
}
}
|
mit
|
C#
|
588763936fa7e512d2aa4f1469494cc9021d58c6
|
Add CreateFlow to interface
|
bcemmett/SurveyMonkeyApi
|
SurveyMonkey/ISurveyMonkeyApi.cs
|
SurveyMonkey/ISurveyMonkeyApi.cs
|
using System.Collections.Generic;
namespace SurveyMonkey
{
public interface ISurveyMonkeyApi
{
int RequestsMade { get; }
int QuotaAllotted { get; }
int QuotaUsed { get; }
//Endpoints
List<Survey> GetSurveyList();
List<Survey> GetSurveyList(GetSurveyListSettings settings);
List<Survey> GetSurveyList(int page);
List<Survey> GetSurveyList(int page, GetSurveyListSettings settings);
List<Survey> GetSurveyList(int page, int pageSize);
List<Survey> GetSurveyList(int page, int pageSize, GetSurveyListSettings settings);
Survey GetSurveyDetails(long surveyId);
List<Collector> GetCollectorList(long surveyId);
List<Collector> GetCollectorList(long surveyId, GetCollectorListSettings settings);
List<Collector> GetCollectorList(long surveyId, int page);
List<Collector> GetCollectorList(long surveyId, int page, GetCollectorListSettings settings);
List<Collector> GetCollectorList(long surveyId, int page, int pageSize);
List<Collector> GetCollectorList(long surveyId, int page, int pageSize, GetCollectorListSettings settings);
List<Respondent> GetRespondentList(long surveyId);
List<Respondent> GetRespondentList(long surveyId, GetRespondentListSettings settings);
List<Respondent> GetRespondentList(long surveyId, int page);
List<Respondent> GetRespondentList(long surveyId, int page, GetRespondentListSettings settings);
List<Respondent> GetRespondentList(long surveyId, int page, int pageSize);
List<Respondent> GetRespondentList(long surveyId, int page, int pageSize, GetRespondentListSettings settings);
List<Response> GetResponses(long surveyId, List<long> respondents);
Collector GetResponseCounts(long collectorId);
UserDetails GetUserDetails();
List<Template> GetTemplateList();
List<Template> GetTemplateList(GetTemplateListSettings settings);
List<Template> GetTemplateList(int page);
List<Template> GetTemplateList(int page, GetTemplateListSettings settings);
List<Template> GetTemplateList(int page, int pageSize);
List<Template> GetTemplateList(int page, int pageSize, GetTemplateListSettings settings);
CreateRecipientsResponse CreateRecipients(long collectorId, long emailMessageId, List<Recipient> recipients);
SendFlowResponse SendFlow(long surveyId, SendFlowSettings settings);
CreateFlowResponse CreateFlow(long surveyId, CreateFlowSettings settings);
Collector CreateCollector(long surveyId);
Collector CreateCollector(long surveyId, CreateCollectorSettings settings);
//Data processing
void FillMissingSurveyInformation(List<Survey> surveys);
void FillMissingSurveyInformation(Survey survey);
}
}
|
using System.Collections.Generic;
namespace SurveyMonkey
{
public interface ISurveyMonkeyApi
{
int RequestsMade { get; }
int QuotaAllotted { get; }
int QuotaUsed { get; }
//Endpoints
List<Survey> GetSurveyList();
List<Survey> GetSurveyList(GetSurveyListSettings settings);
List<Survey> GetSurveyList(int page);
List<Survey> GetSurveyList(int page, GetSurveyListSettings settings);
List<Survey> GetSurveyList(int page, int pageSize);
List<Survey> GetSurveyList(int page, int pageSize, GetSurveyListSettings settings);
Survey GetSurveyDetails(long surveyId);
List<Collector> GetCollectorList(long surveyId);
List<Collector> GetCollectorList(long surveyId, GetCollectorListSettings settings);
List<Collector> GetCollectorList(long surveyId, int page);
List<Collector> GetCollectorList(long surveyId, int page, GetCollectorListSettings settings);
List<Collector> GetCollectorList(long surveyId, int page, int pageSize);
List<Collector> GetCollectorList(long surveyId, int page, int pageSize, GetCollectorListSettings settings);
List<Respondent> GetRespondentList(long surveyId);
List<Respondent> GetRespondentList(long surveyId, GetRespondentListSettings settings);
List<Respondent> GetRespondentList(long surveyId, int page);
List<Respondent> GetRespondentList(long surveyId, int page, GetRespondentListSettings settings);
List<Respondent> GetRespondentList(long surveyId, int page, int pageSize);
List<Respondent> GetRespondentList(long surveyId, int page, int pageSize, GetRespondentListSettings settings);
List<Response> GetResponses(long surveyId, List<long> respondents);
Collector GetResponseCounts(long collectorId);
UserDetails GetUserDetails();
List<Template> GetTemplateList();
List<Template> GetTemplateList(GetTemplateListSettings settings);
List<Template> GetTemplateList(int page);
List<Template> GetTemplateList(int page, GetTemplateListSettings settings);
List<Template> GetTemplateList(int page, int pageSize);
List<Template> GetTemplateList(int page, int pageSize, GetTemplateListSettings settings);
CreateRecipientsResponse CreateRecipients(long collectorId, long emailMessageId, List<Recipient> recipients);
SendFlowResponse SendFlow(long surveyId, SendFlowSettings settings);
Collector CreateCollector(long surveyId);
Collector CreateCollector(long surveyId, CreateCollectorSettings settings);
//Data processing
void FillMissingSurveyInformation(List<Survey> surveys);
void FillMissingSurveyInformation(Survey survey);
}
}
|
mit
|
C#
|
31a630141873bc1b01211e5692a3314767aa2710
|
Make word available
|
gawronsk/triedictive-text
|
TrieExperimentPlatform/TrieExperimentPlatform/TrieExperiment.cs
|
TrieExperimentPlatform/TrieExperimentPlatform/TrieExperiment.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TrieExperimentPlatform
{
class TrieExperiment
{
static void Main(string[] args)
{
string[] lines = System.IO.File.ReadAllLines(@"..\..\Data\count_1w_small.txt");
Console.WriteLine("Read {0} lines from file", lines.Length);
Stopwatch s = Stopwatch.StartNew();
// build trie
foreach(var line in lines)
{
var word = line.Split('\t').FirstOrDefault();
if (word != null)
{
// add to trie
}
}
s.Stop();
Console.WriteLine("Elapsed Time Building Tree: {0} ms", s.ElapsedMilliseconds);
s = Stopwatch.StartNew();
//run experiment
s.Stop();
Console.WriteLine("Elapsed Time Running Experiment: {0} ms", s.ElapsedMilliseconds);
Console.Read();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TrieExperimentPlatform
{
class TrieExperiment
{
static void Main(string[] args)
{
string[] lines = System.IO.File.ReadAllLines(@"..\..\Data\count_1w_small.txt");
Console.WriteLine("Read {0} lines from file", lines.Length);
Stopwatch s = Stopwatch.StartNew();
// build trie
foreach(var line in lines)
{
// add to trie
}
s.Stop();
Console.WriteLine("Elapsed Time Building Tree: {0} ms", s.ElapsedMilliseconds);
s = Stopwatch.StartNew();
//run experiment
s.Stop();
Console.WriteLine("Elapsed Time Running Experiment: {0} ms", s.ElapsedMilliseconds);
Console.Read();
}
}
}
|
unlicense
|
C#
|
10979673c39fd7d4e28fdf1de85bf6fdea4109e9
|
complete Nancy sample for net46
|
lvermeulen/Nanophone
|
samples/SampleService.Nancy.Hosting.Self.Net46/Program.cs
|
samples/SampleService.Nancy.Hosting.Self.Net46/Program.cs
|
using System;
using System.Collections.Generic;
using Nancy.Hosting.Self;
using Nanophone.Core;
using Nanophone.RegistryHost.ConsulRegistry;
using Nanophone.RegistryTenant.Nancy;
namespace SampleService.Nancy.Hosting.Self.Net46
{
class Program
{
static void Main()
{
const int PORT = 8899;
var uri = new Uri($"http://localhost:{PORT}/");
using (var nancyHost = new NancyHost(uri))
{
nancyHost.Start();
var consulRegistryHost = new ConsulRegistryHost();
var serviceRegistry = new ServiceRegistry(consulRegistryHost);
serviceRegistry.AddTenant(new NancyRegistryTenant(uri), "price", "1.3", keyValuePairs: new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("key", "value") })
.Wait();
Console.WriteLine($"Now listening on {uri}/price. Press enter to stop");
Console.ReadKey();
}
}
}
}
|
using System;
using Nancy.Hosting.Self;
using Nanophone.Core;
using Nanophone.RegistryHost.ConsulRegistry;
using Nanophone.RegistryTenant.Nancy;
namespace SampleService.Nancy.Hosting.Self.Net46
{
class Program
{
static void Main()
{
const int PORT = 8899;
var uri = new Uri($"http://localhost:{PORT}/");
using (var nancyHost = new NancyHost(uri))
{
nancyHost.Start();
//var consulRegistryHost = new ConsulRegistryHost();
//var serviceRegistry = new ServiceRegistry(consulRegistryHost);
//serviceRegistry.AddTenant(new NancyRegistryTenant(uri), "orders", "1.3")
// .Wait();
Console.WriteLine($"Now listening on {uri}/price. Press enter to stop");
Console.ReadKey();
}
}
}
}
|
mit
|
C#
|
34b6e6ad789d230763cfa3b6779cd5bb2156c1f6
|
Remove content negotiation project
|
JosephWoodward/GlobalExceptionHandlerDotNet,JosephWoodward/GlobalExceptionHandlerDotNet
|
src/GlobalExceptionHandler/ContentNegotiation/EmptyActionContext.cs
|
src/GlobalExceptionHandler/ContentNegotiation/EmptyActionContext.cs
|
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Routing;
namespace GlobalExceptionHandler.ContentNegotiation.Mvc
{
internal class EmptyActionContext : ActionContext
{
public EmptyActionContext(HttpContext httpContext) : base(httpContext, new RouteData(), new ActionDescriptor())
{
}
}
}
|
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Routing;
namespace GlobalExceptionHandler.ContentNegotiation.Mvc
{
internal class EmptyActionContext : ActionContext
{
public EmptyActionContext(HttpContext httpContext) : base(httpContext, new RouteData(), new ActionDescriptor())
{
}
}
}
|
mit
|
C#
|
9722629561260e9507da9ae44c7cc218baa01878
|
Fix telephone null exception
|
MCLD/greatreadingadventure,MCLD/greatreadingadventure,MCLD/greatreadingadventure,MCLD/greatreadingadventure,MCLD/greatreadingadventure
|
src/GRA.Controllers/ViewModel/ParticipatingLibraries/ParticipatingLibrariesViewModel.cs
|
src/GRA.Controllers/ViewModel/ParticipatingLibraries/ParticipatingLibrariesViewModel.cs
|
using System.Collections.Generic;
namespace GRA.Controllers.ViewModel.ParticipatingBranches
{
public class ParticipatingLibrariesViewModel
{
public IEnumerable<Domain.Model.System> Systems { get; set; }
public static string FormatPhoneAddress(Domain.Model.Branch branch)
{
var sb = new System.Text.StringBuilder();
if (branch != null &&
(!string.IsNullOrEmpty(branch.Telephone) || !string.IsNullOrEmpty(branch.Address)))
{
if (branch.Telephone?.Length > 0)
{
sb.Append("<strong>").Append(branch.Telephone).Append("</strong> - ");
}
sb.Append(branch.Address?.Trim());
}
return sb.Length > 0 ? sb.ToString() : null;
}
}
}
|
using System.Collections.Generic;
namespace GRA.Controllers.ViewModel.ParticipatingBranches
{
public class ParticipatingLibrariesViewModel
{
public IEnumerable<Domain.Model.System> Systems { get; set; }
public static string FormatPhoneAddress(Domain.Model.Branch branch)
{
var sb = new System.Text.StringBuilder();
if (branch != null &&
(!string.IsNullOrEmpty(branch.Telephone) || !string.IsNullOrEmpty(branch.Address)))
{
if (branch.Telephone.Length > 0)
{
sb.Append("<strong>").Append(branch.Telephone).Append("</strong> - ");
}
sb.Append(branch.Address?.Trim());
}
return sb.Length > 0 ? sb.ToString() : null;
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.