commit
stringlengths 40
40
| old_file
stringlengths 4
237
| new_file
stringlengths 4
237
| old_contents
stringlengths 1
4.24k
| new_contents
stringlengths 1
4.87k
| subject
stringlengths 15
778
| message
stringlengths 15
8.75k
| lang
stringclasses 266
values | license
stringclasses 13
values | repos
stringlengths 5
127k
|
|---|---|---|---|---|---|---|---|---|---|
2263b65f9d92c0e7e6d4573e95ab7a83156a720c
|
samples/Samples.AspNetCore/Startup.cs
|
samples/Samples.AspNetCore/Startup.cs
|
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Samples.AspNetCore
{
public class Startup
{
public Startup(IConfiguration configuration, IHostingEnvironment env)
{
Configuration = configuration;
HostingEnvironment = env;
}
public IConfiguration Configuration { get; }
public IHostingEnvironment HostingEnvironment { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
// Make IOptions<ExceptionalSettings> available for injection everywhere
services.AddExceptional(Configuration.GetSection("Exceptional"), settings =>
{
//settings.ApplicationName = "Samples.AspNetCore";
settings.UseExceptionalPageOnThrow = HostingEnvironment.IsDevelopment();
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
// Boilerplate we're no longer using with Exceptional
//if (env.IsDevelopment())
//{
// app.UseDeveloperExceptionPage();
// app.UseBrowserLink();
//}
//else
//{
// app.UseExceptionHandler("/Home/Error");
//}
app.UseExceptional();
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}
|
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Samples.AspNetCore
{
public class Startup
{
public Startup(IConfiguration configuration, IHostingEnvironment env)
{
Configuration = configuration;
HostingEnvironment = env;
}
public IConfiguration Configuration { get; }
public IHostingEnvironment HostingEnvironment { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
// Make IOptions<ExceptionalSettings> available for injection everywhere
services.AddExceptional(Configuration.GetSection("Exceptional"), settings =>
{
//settings.DefaultStore.ApplicationName = "Samples.AspNetCore";
settings.UseExceptionalPageOnThrow = HostingEnvironment.IsDevelopment();
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
// Boilerplate we're no longer using with Exceptional
//if (env.IsDevelopment())
//{
// app.UseDeveloperExceptionPage();
// app.UseBrowserLink();
//}
//else
//{
// app.UseExceptionHandler("/Home/Error");
//}
app.UseExceptional();
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}
|
Update ASP.NET Core sample code to match actual
|
Update ASP.NET Core sample code to match actual
|
C#
|
apache-2.0
|
NickCraver/StackExchange.Exceptional,NickCraver/StackExchange.Exceptional
|
308480bfdc39634cc715989abb312edaf8f84c4b
|
Assets/GLTF/Scripts/GLTFComponent.cs
|
Assets/GLTF/Scripts/GLTFComponent.cs
|
using System;
using System.Collections;
using UnityEngine;
using System.Threading;
using UnityEngine.Networking;
namespace GLTF {
class GLTFComponent : MonoBehaviour
{
public string Url;
public Shader Shader;
public bool Multithreaded = true;
IEnumerator Start()
{
var loader = new GLTFLoader(Url, Shader, gameObject.transform);
loader.Multithreaded = Multithreaded;
yield return loader.Load();
IntegrationTest.Pass();
}
}
}
|
using System;
using System.Collections;
using UnityEngine;
using System.Threading;
using UnityEngine.Networking;
namespace GLTF {
class GLTFComponent : MonoBehaviour
{
public string Url;
public Shader Shader;
public bool Multithreaded = true;
IEnumerator Start()
{
var loader = new GLTFLoader(Url, Shader, gameObject.transform);
loader.Multithreaded = Multithreaded;
yield return loader.Load();
}
}
}
|
Remove stray integration test call.
|
Remove stray integration test call.
|
C#
|
mit
|
AltspaceVR/UnityGLTF,robertlong/UnityGLTFLoader
|
14473b545889539151d7cf5d8c2a58ade870af2d
|
src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs
|
src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.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;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Session;
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Extension methods for adding session services to the DI container.
/// </summary>
public static class SessionServiceCollectionExtensions
{
/// <summary>
/// Adds services required for application session state.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
public static void AddSession(this IServiceCollection services)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
services.AddTransient<ISessionStore, DistributedSessionStore>();
}
/// <summary>
/// Adds services required for application session state.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
/// <param name="configure">The session options to configure the middleware with.</param>
public static void AddSession(this IServiceCollection services, Action<SessionOptions> configure)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (configure == null)
{
throw new ArgumentNullException(nameof(configure));
}
services.Configure(configure);
services.AddSession();
}
}
}
|
// 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;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Session;
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Extension methods for adding session services to the DI container.
/// </summary>
public static class SessionServiceCollectionExtensions
{
/// <summary>
/// Adds services required for application session state.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
/// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns>
public static IServiceCollection AddSession(this IServiceCollection services)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
services.AddTransient<ISessionStore, DistributedSessionStore>();
return services;
}
/// <summary>
/// Adds services required for application session state.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
/// <param name="configure">The session options to configure the middleware with.</param>
/// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns>
public static IServiceCollection AddSession(this IServiceCollection services, Action<SessionOptions> configure)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (configure == null)
{
throw new ArgumentNullException(nameof(configure));
}
services.Configure(configure);
services.AddSession();
return services;
}
}
}
|
Return IServiceCollection from AddSession extension methods
|
Return IServiceCollection from AddSession extension methods
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
87959a59d980286daf6c082ef3edda8494e94bf6
|
osu.Game/Online/Chat/ChannelType.cs
|
osu.Game/Online/Chat/ChannelType.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.Game.Online.Chat
{
public enum ChannelType
{
Public,
Private,
Multiplayer,
Spectator,
Temporary,
PM,
Group,
System,
}
}
|
// 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.Game.Online.Chat
{
public enum ChannelType
{
Public,
Private,
Multiplayer,
Spectator,
Temporary,
PM,
Group,
System,
Announce,
}
}
|
Add missing "announce" channel type
|
Add missing "announce" channel type
Of note, this doesn't mean the channels will display, but it does fix
parsing errors which cause the whole chat display to fail.
|
C#
|
mit
|
peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu,ppy/osu,ppy/osu
|
81ec54e7cf3abcee0fb7d44b9cf4c2e5f68414a4
|
src/Agent/LogMessageSeverity.cs
|
src/Agent/LogMessageSeverity.cs
|
using System;
using Microsoft.Extensions.Logging;
namespace Gibraltar.Agent
{
/// <summary>
/// This enumerates the severity levels used by Loupe log messages.
/// </summary>
/// <remarks>The values for these levels are chosen to directly map to the TraceEventType enum
/// for the five levels we support. These also can be mapped from Log4Net event levels,
/// with slight name changes for Fatal->Critical and for Debug->Verbose.</remarks>
[Flags]
public enum LogMessageSeverity
{
/// <summary>
/// The severity level is uninitialized and thus unknown.
/// </summary>
None = 0, // FxCop demands we have a defined 0.
/// <summary>
/// Fatal error or application crash.
/// </summary>
Critical = LogLevel.Critical,
/// <summary>
/// Recoverable error.
/// </summary>
Error = LogLevel.Error,
/// <summary>
/// Noncritical problem.
/// </summary>
Warning = LogLevel.Warning,
/// <summary>
/// Informational message.
/// </summary>
Information = LogLevel.Information,
/// <summary>
/// Debugging trace.
/// </summary>
Verbose = LogLevel.Debug,
}
}
|
using System;
using Microsoft.Extensions.Logging;
namespace Gibraltar.Agent
{
/// <summary>
/// This enumerates the severity levels used by Loupe log messages.
/// </summary>
/// <remarks>The values for these levels are chosen to directly map to the TraceEventType enum
/// for the five levels we support. These also can be mapped from Log4Net event levels,
/// with slight name changes for Fatal->Critical and for Debug->Verbose.</remarks>
[Flags]
public enum LogMessageSeverity
{
/// <summary>
/// The severity level is uninitialized and thus unknown.
/// </summary>
None = 0, // FxCop demands we have a defined 0.
/// <summary>
/// Fatal error or application crash.
/// </summary>
Critical = Loupe.Extensibility.Data.LogMessageSeverity.Critical,
/// <summary>
/// Recoverable error.
/// </summary>
Error = Loupe.Extensibility.Data.LogMessageSeverity.Error,
/// <summary>
/// Noncritical problem.
/// </summary>
Warning = Loupe.Extensibility.Data.LogMessageSeverity.Warning,
/// <summary>
/// Informational message.
/// </summary>
Information = Loupe.Extensibility.Data.LogMessageSeverity.Information,
/// <summary>
/// Debugging trace.
/// </summary>
Verbose = Loupe.Extensibility.Data.LogMessageSeverity.Verbose,
}
}
|
Correct second copy of severity mappings to be compatible with Loupe.
|
Correct second copy of severity mappings to be compatible with Loupe.
|
C#
|
mit
|
GibraltarSoftware/Loupe.Agent.Core,GibraltarSoftware/Loupe.Agent.Core,GibraltarSoftware/Loupe.Agent.Core
|
186faafdfd1c33ef4bf131476da8870e887cb00a
|
osu.Framework.Tests/Visual/Drawables/TestSceneSynchronizationContext.cs
|
osu.Framework.Tests/Visual/Drawables/TestSceneSynchronizationContext.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osuTK;
namespace osu.Framework.Tests.Visual.Drawables
{
public class TestSceneSynchronizationContext : FrameworkTestScene
{
private AsyncPerformingBox box;
[Test]
public void TestAsyncPerformingBox()
{
AddStep("add box", () => Child = box = new AsyncPerformingBox());
AddAssert("not spun", () => box.Rotation == 0);
AddStep("trigger", () => box.Trigger());
AddUntilStep("has spun", () => box.Rotation == 180);
}
public class AsyncPerformingBox : Box
{
private readonly SemaphoreSlim waiter = new SemaphoreSlim(0);
public AsyncPerformingBox()
{
Size = new Vector2(100);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
protected override async void LoadComplete()
{
base.LoadComplete();
await waiter.WaitAsync().ConfigureAwait(true);
this.RotateTo(180, 500);
}
public void Trigger()
{
waiter.Release();
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osuTK;
namespace osu.Framework.Tests.Visual.Drawables
{
public class TestSceneSynchronizationContext : FrameworkTestScene
{
private AsyncPerformingBox box;
[Test]
public void TestAsyncPerformingBox()
{
AddStep("add box", () => Child = box = new AsyncPerformingBox());
AddAssert("not spun", () => box.Rotation == 0);
AddStep("trigger", () => box.Trigger());
AddUntilStep("has spun", () => box.Rotation == 180);
}
[Test]
public void TestUsingLocalScheduler()
{
AddStep("add box", () => Child = box = new AsyncPerformingBox());
AddAssert("scheduler null", () => box.Scheduler == null);
AddStep("trigger", () => box.Trigger());
AddUntilStep("scheduler non-null", () => box.Scheduler != null);
}
public class AsyncPerformingBox : Box
{
private readonly SemaphoreSlim waiter = new SemaphoreSlim(0);
public AsyncPerformingBox()
{
Size = new Vector2(100);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
protected override async void LoadComplete()
{
base.LoadComplete();
await waiter.WaitAsync().ConfigureAwait(true);
this.RotateTo(180, 500);
}
public void Trigger()
{
waiter.Release();
}
}
}
}
|
Add test of scheduler usage
|
Add test of scheduler usage
|
C#
|
mit
|
peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework
|
00e50946e29fc21f99585c144f9864e6ad5af4ef
|
Eluant/LuaValueExtensions.cs
|
Eluant/LuaValueExtensions.cs
|
using System;
namespace Eluant
{
public static class LuaValueExtensions
{
public static bool IsNil(this LuaValue self)
{
return self == null || self == LuaNil.Instance;
}
}
}
|
using System;
using System.Collections.Generic;
namespace Eluant
{
public static class LuaValueExtensions
{
public static bool IsNil(this LuaValue self)
{
return self == null || self == LuaNil.Instance;
}
public static IEnumerable<LuaValue> EnumerateArray(this LuaTable self)
{
if (self == null) { throw new ArgumentNullException("self"); }
return CreateEnumerateArrayEnumerable(self);
}
private static IEnumerable<LuaValue> CreateEnumerateArrayEnumerable(LuaTable self)
{
// By convention, the 'n' field refers to the array length, if present.
using (var n = self["n"]) {
var num = n as LuaNumber;
if (num != null) {
var length = (int)num.Value;
for (int i = 1; i <= length; ++i) {
yield return self[i];
}
yield break;
}
}
// If no 'n' then stop at the first nil element.
for (int i = 1; ; ++i) {
var value = self[i];
if (value.IsNil()) {
yield break;
}
yield return value;
}
}
}
}
|
Add EnumerateArray() extension for tables
|
Add EnumerateArray() extension for tables
|
C#
|
mit
|
OpenRA/Eluant,cdhowie/Eluant,WFoundation/Eluant
|
1d799ff1f86396eb59154a17f3fe2353aa09d791
|
Mapsui/Layers/MemoryLayer.cs
|
Mapsui/Layers/MemoryLayer.cs
|
using Mapsui.Fetcher;
using Mapsui.Geometries;
using Mapsui.Providers;
using System.Collections.Generic;
using System.Threading.Tasks;
using Mapsui.Styles;
namespace Mapsui.Layers
{
public class MemoryLayer : BaseLayer
{
public IProvider DataSource { get; set; }
public override IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
{
var biggerBox = box.Grow(SymbolStyle.DefaultWidth * 2 * resolution, SymbolStyle.DefaultHeight * 2 * resolution);
return DataSource.GetFeaturesInView(biggerBox, resolution);
}
public override BoundingBox Envelope => DataSource?.GetExtents();
public override void AbortFetch()
{
// do nothing. This is not an async layer
}
public override void ViewChanged(bool majorChange, BoundingBox extent, double resolution)
{
//The MemoryLayer always has it's data ready so can fire a DataChanged event immediately so that listeners can act on it.
Task.Run(() => OnDataChanged(new DataChangedEventArgs()));
}
public override void ClearCache()
{
// do nothing. This is not an async layer
}
}
}
|
using Mapsui.Fetcher;
using Mapsui.Geometries;
using Mapsui.Providers;
using System.Collections.Generic;
using System.Threading.Tasks;
using Mapsui.Styles;
namespace Mapsui.Layers
{
public class MemoryLayer : BaseLayer
{
public IProvider DataSource { get; set; }
public override IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
{
// Safeguard in case BoundingBox is null, most likely due to no features in layer
if (box == null) { return new List<IFeature>(); }
var biggerBox = box.Grow(SymbolStyle.DefaultWidth * 2 * resolution, SymbolStyle.DefaultHeight * 2 * resolution);
return DataSource.GetFeaturesInView(biggerBox, resolution);
}
public override BoundingBox Envelope => DataSource?.GetExtents();
public override void AbortFetch()
{
// do nothing. This is not an async layer
}
public override void ViewChanged(bool majorChange, BoundingBox extent, double resolution)
{
//The MemoryLayer always has it's data ready so can fire a DataChanged event immediately so that listeners can act on it.
Task.Run(() => OnDataChanged(new DataChangedEventArgs()));
}
public override void ClearCache()
{
// do nothing. This is not an async layer
}
}
}
|
Fix NullException ocurring in GetFeaturesInView() when BoundingBox is null
|
Fix NullException ocurring in GetFeaturesInView() when BoundingBox is null
This can happen if no features have been added to a layer, since MemoryProvider.GetExtents() will not find any feature to create a BoundingBox, and return null.
|
C#
|
mit
|
charlenni/Mapsui,charlenni/Mapsui,tebben/Mapsui,pauldendulk/Mapsui
|
59df9468c0c3ac4cc333b2f1e9f5aa33b2548da9
|
ACTPlugin.cs
|
ACTPlugin.cs
|
using Advanced_Combat_Tracker;
using CefSharp;
using CefSharp.Wpf;
using System;
using System.Windows.Forms;
namespace Cactbot
{
public class ACTPlugin : IActPluginV1
{
SettingsTab settingsTab = new SettingsTab();
BrowserWindow browserWindow;
#region IActPluginV1 Members
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
{
settingsTab.Initialize(pluginStatusText);
browserWindow = new BrowserWindow();
browserWindow.ShowInTaskbar = false;
browserWindow.BrowserControl.CreationHandlers += OnBrowserCreated;
browserWindow.Show();
pluginScreenSpace.Controls.Add(settingsTab);
}
public void DeInitPlugin()
{
browserWindow.Hide();
settingsTab.Shutdown();
// FIXME: This needs to be called from the right thread, so it can't happen automatically.
// However, calling it here means the plugin can never be reinitialized, oops.
Cef.Shutdown();
}
#endregion
private void OnBrowserCreated(object sender, IWpfWebBrowser browser)
{
browser.RegisterJsObject("act", new BrowserBindings());
// FIXME: Make it possible to create more than one window.
// Tie loading html to the browser window creation and bindings to the
// browser creation.
browser.Load(settingsTab.HTMLFile());
browser.ShowDevTools();
}
}
}
|
using Advanced_Combat_Tracker;
using CefSharp;
using CefSharp.Wpf;
using System;
using System.Windows.Forms;
namespace Cactbot
{
public class ACTPlugin : IActPluginV1
{
SettingsTab settingsTab = new SettingsTab();
BrowserWindow browserWindow;
#region IActPluginV1 Members
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
{
settingsTab.Initialize(pluginStatusText);
browserWindow = new BrowserWindow();
browserWindow.ShowInTaskbar = false;
browserWindow.BrowserControl.CreationHandlers += OnBrowserCreated;
browserWindow.Show();
pluginScreenSpace.Controls.Add(settingsTab);
Application.ApplicationExit += OnACTShutdown;
}
public void DeInitPlugin()
{
browserWindow.Hide();
settingsTab.Shutdown();
}
#endregion
private void OnBrowserCreated(object sender, IWpfWebBrowser browser)
{
browser.RegisterJsObject("act", new BrowserBindings());
// FIXME: Make it possible to create more than one window.
// Tie loading html to the browser window creation and bindings to the
// browser creation.
browser.Load(settingsTab.HTMLFile());
browser.ShowDevTools();
}
private void OnACTShutdown(object sender, EventArgs args)
{
// Cef has to be manually shutdown on this thread, but can only be
// shutdown once.
Cef.Shutdown();
}
}
}
|
Allow cactbot to be restarted
|
Allow cactbot to be restarted
|
C#
|
apache-2.0
|
quisquous/cactbot,quisquous/cactbot,sqt/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot,quisquous/cactbot,sqt/cactbot,quisquous/cactbot,sqt/cactbot
|
d25849c3859765d7caf99dc48cfdcdcd7758f5e6
|
src/Carrot/Messages/ConsumedMessageBase.cs
|
src/Carrot/Messages/ConsumedMessageBase.cs
|
using System;
using System.Threading.Tasks;
using Carrot.Configuration;
using Carrot.Extensions;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
namespace Carrot.Messages
{
public abstract class ConsumedMessageBase
{
protected readonly BasicDeliverEventArgs Args;
protected ConsumedMessageBase(BasicDeliverEventArgs args)
{
Args = args;
}
internal abstract Object Content { get; }
internal abstract Task<AggregateConsumingResult> ConsumeAsync(SubscriptionConfiguration configuration);
internal ConsumedMessage<TMessage> As<TMessage>() where TMessage : class
{
var content = Content as TMessage;
if (content == null)
throw new InvalidCastException(String.Format("cannot cast '{0}' to '{1}'",
Content.GetType(),
typeof(TMessage)));
return new ConsumedMessage<TMessage>(content, HeaderCollection.Parse(Args));
}
internal abstract Boolean Match(Type type);
internal void Acknowledge(IModel model)
{
model.BasicAck(Args.DeliveryTag, false);
}
internal void Requeue(IModel model)
{
model.BasicNack(Args.DeliveryTag, false, true);
}
internal void ForwardTo(IModel model, Func<String, String> exchangeNameBuilder)
{
var exchange = Exchange.DurableDirect(exchangeNameBuilder(Args.Exchange));
exchange.Declare(model);
var properties = Args.BasicProperties.Copy();
properties.Persistent = true;
model.BasicPublish(exchange.Name,
String.Empty,
properties,
Args.Body);
}
}
}
|
using System;
using System.Threading.Tasks;
using Carrot.Configuration;
using Carrot.Extensions;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
namespace Carrot.Messages
{
public abstract class ConsumedMessageBase
{
protected readonly BasicDeliverEventArgs Args;
protected ConsumedMessageBase(BasicDeliverEventArgs args)
{
Args = args;
}
internal abstract Object Content { get; }
internal abstract Task<AggregateConsumingResult> ConsumeAsync(SubscriptionConfiguration configuration);
internal ConsumedMessage<TMessage> As<TMessage>() where TMessage : class
{
var content = Content as TMessage;
if (content == null)
throw new InvalidCastException(String.Format("cannot cast '{0}' to '{1}'",
Content.GetType(),
typeof(TMessage)));
return new ConsumedMessage<TMessage>(content, HeaderCollection.Parse(Args));
}
internal abstract Boolean Match(Type type);
internal void Acknowledge(IModel model)
{
model.BasicAck(Args.DeliveryTag, false);
}
internal void Requeue(IModel model)
{
model.BasicNack(Args.DeliveryTag, false, true);
}
internal void ForwardTo(IModel model, Func<String, String> exchangeNameBuilder)
{
var exchange = Exchange.Direct(exchangeNameBuilder(Args.Exchange)).Durable();
exchange.Declare(model);
var properties = Args.BasicProperties.Copy();
properties.Persistent = true;
model.BasicPublish(exchange.Name,
String.Empty,
properties,
Args.Body);
}
}
}
|
Use new API to build durable Exchange
|
Use new API to build durable Exchange
|
C#
|
mit
|
lsfera/Carrot,naighes/Carrot
|
068996678bda9c7b2611f3379808091d519f96a5
|
Editor/LoggerWindow.cs
|
Editor/LoggerWindow.cs
|
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
namespace mLogger {
public class LoggerWindow : EditorWindow {
private Logger loggerInstance;
public Logger LoggerInstance {
get {
if (loggerInstance == null) {
loggerInstance = FindObjectOfType<Logger>();
if (loggerInstance == null) {
GameObject loggerGO = new GameObject();
loggerGO.AddComponent<Logger>();
loggerInstance = loggerGO.GetComponent<Logger>();
}
}
return loggerInstance;
}
}
[MenuItem("Debug/Logger")]
public static void Init() {
LoggerWindow window =
(LoggerWindow)EditorWindow.GetWindow(typeof(LoggerWindow));
window.title = "Logger";
window.minSize = new Vector2(100f, 60f);
}
private void OnGUI() {
EditorGUILayout.BeginHorizontal();
// Draw Start/Stop button.
LoggerInstance.LoggingEnabled =
InspectorControls.DrawStartStopButton(
LoggerInstance.LoggingEnabled,
LoggerInstance.EnableOnPlay,
null,
() => LoggerInstance.LogWriter.Add("[PAUSE]", true),
() => LoggerInstance.LogWriter.WriteAll(
LoggerInstance.FilePath,
false));
// Draw -> button.
if (GUILayout.Button("->", GUILayout.Width(30))) {
EditorGUIUtility.PingObject(LoggerInstance);
Selection.activeGameObject = LoggerInstance.gameObject;
}
EditorGUILayout.EndHorizontal();
Repaint();
}
}
}
|
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
namespace mLogger {
public class LoggerWindow : EditorWindow {
private Logger loggerInstance;
public Logger LoggerInstance {
get {
if (loggerInstance == null) {
loggerInstance = FindObjectOfType<Logger>();
if (loggerInstance == null) {
GameObject loggerGO = new GameObject();
loggerGO.AddComponent<Logger>();
loggerInstance = loggerGO.GetComponent<Logger>();
}
}
return loggerInstance;
}
}
[MenuItem("Window/mLogger")]
public static void Init() {
LoggerWindow window =
(LoggerWindow)EditorWindow.GetWindow(typeof(LoggerWindow));
window.title = "Logger";
window.minSize = new Vector2(100f, 60f);
}
private void OnGUI() {
EditorGUILayout.BeginHorizontal();
// Draw Start/Stop button.
LoggerInstance.LoggingEnabled =
InspectorControls.DrawStartStopButton(
LoggerInstance.LoggingEnabled,
LoggerInstance.EnableOnPlay,
null,
() => LoggerInstance.LogWriter.Add("[PAUSE]", true),
() => LoggerInstance.LogWriter.WriteAll(
LoggerInstance.FilePath,
false));
// Draw -> button.
if (GUILayout.Button("->", GUILayout.Width(30))) {
EditorGUIUtility.PingObject(LoggerInstance);
Selection.activeGameObject = LoggerInstance.gameObject;
}
EditorGUILayout.EndHorizontal();
Repaint();
}
}
}
|
Add mLogger to Unity Window menu
|
Add mLogger to Unity Window menu
|
C#
|
mit
|
bartlomiejwolk/FileLogger
|
8cd957784e820f039ca13ccb13019a3a24c2847b
|
Yeamul.Test/Program.cs
|
Yeamul.Test/Program.cs
|
using System;
namespace Yeamul.Test {
class Program {
static void Main(string[] args) {
Node nn = Node.Null;
Console.WriteLine(nn);
Node nbt = true;
Console.WriteLine(nbt);
Node nbf = false;
Console.WriteLine(nbf);
Node n16 = short.MinValue;
Console.WriteLine(n16);
Node n32 = int.MinValue;
Console.WriteLine(n32);
Node n64 = long.MinValue;
Console.WriteLine(n64);
Node nu16 = ushort.MaxValue;
Console.WriteLine(nu16);
Node nu32 = uint.MaxValue;
Console.WriteLine(nu32);
Node nu64 = ulong.MaxValue;
Console.WriteLine(nu64);
Node nf = 1.2f;
Console.WriteLine(nf);
Node nd = Math.PI;
Console.WriteLine(nd);
Node nm = 1.2345678901234567890m;
Console.WriteLine(nm);
Node ng = Guid.NewGuid();
Console.WriteLine(ng);
Node ns = "derp";
Console.WriteLine(ns);
Console.ReadKey();
}
}
}
|
using System;
namespace Yeamul.Test {
class Program {
static void Main() {
Node nn = Node.Null;
Console.WriteLine(nn);
Node nbt = true;
Console.WriteLine(nbt);
Node nbf = false;
Console.WriteLine(nbf);
Node n16 = short.MinValue;
Console.WriteLine(n16);
Node n32 = int.MinValue;
Console.WriteLine(n32);
Node n64 = long.MinValue;
Console.WriteLine(n64);
Node nu16 = ushort.MaxValue;
Console.WriteLine(nu16);
Node nu32 = uint.MaxValue;
Console.WriteLine(nu32);
Node nu64 = ulong.MaxValue;
Console.WriteLine(nu64);
Node nf = 1.2f;
Console.WriteLine(nf);
Node nd = Math.PI;
Console.WriteLine(nd);
Node nm = 1.2345678901234567890m;
Console.WriteLine(nm);
Node ng = Guid.NewGuid();
Console.WriteLine(ng);
Node ns = "derp";
Console.WriteLine(ns);
Console.ReadKey();
}
}
}
|
Remove Main()'s unused args parameter
|
Remove Main()'s unused args parameter
|
C#
|
mit
|
OlsonDev/YeamulNet
|
fa2754cb07cb110910378f76cd9aaac7539d4eff
|
LivrariaTest/AutorTest.cs
|
LivrariaTest/AutorTest.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace LivrariaTest
{
[TestClass]
public class AutorTest
{
[TestMethod]
public void TestMethod1()
{
Assert.AreEqual(true, true);
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Livraria;
namespace LivrariaTest
{
[TestClass]
public class AutorTest
{
[TestMethod]
public void TestProperties()
{
Autor autor = new Autor();
autor.CodAutor = 999;
autor.Nome = "George R. R. Martin";
autor.Cpf = "012.345.678.90";
autor.DtNascimento = new DateTime(1948, 9, 20);
Assert.AreEqual(autor.CodAutor, 999);
Assert.AreEqual(autor.Nome, "George R. R. Martin");
Assert.AreEqual(autor.Cpf, "012.345.678.90");
Assert.AreEqual<DateTime>(autor.DtNascimento, new DateTime(1948, 9, 20));
}
}
}
|
Add test for autor properties
|
Add test for autor properties
|
C#
|
mit
|
paulodiovani/feevale-cs-livraria-2015
|
3b688c702c5cfd82b4c1e0a5b968d0aac844113e
|
osu.Game/Screens/Multi/Components/DisableableTabControl.cs
|
osu.Game/Screens/Multi/Components/DisableableTabControl.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
namespace osu.Game.Screens.Multi.Components
{
public abstract class DisableableTabControl<T> : TabControl<T>
{
public readonly BindableBool ReadOnly = new BindableBool();
protected override void AddTabItem(TabItem<T> tab, bool addToDropdown = true)
{
if (tab is DisableableTabItem<T> disableable)
disableable.ReadOnly.BindTo(ReadOnly);
base.AddTabItem(tab, addToDropdown);
}
protected abstract class DisableableTabItem<T> : TabItem<T>
{
public readonly BindableBool ReadOnly = new BindableBool();
protected DisableableTabItem(T value)
: base(value)
{
ReadOnly.BindValueChanged(updateReadOnly);
}
private void updateReadOnly(bool readOnly)
{
Alpha = readOnly ? 0.2f : 1;
}
protected override bool OnClick(ClickEvent e)
{
if (ReadOnly)
return true;
return base.OnClick(e);
}
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osuTK.Graphics;
namespace osu.Game.Screens.Multi.Components
{
public abstract class DisableableTabControl<T> : TabControl<T>
{
public readonly BindableBool ReadOnly = new BindableBool();
protected override void AddTabItem(TabItem<T> tab, bool addToDropdown = true)
{
if (tab is DisableableTabItem<T> disableable)
disableable.ReadOnly.BindTo(ReadOnly);
base.AddTabItem(tab, addToDropdown);
}
protected abstract class DisableableTabItem<T> : TabItem<T>
{
public readonly BindableBool ReadOnly = new BindableBool();
protected DisableableTabItem(T value)
: base(value)
{
ReadOnly.BindValueChanged(updateReadOnly);
}
private void updateReadOnly(bool readOnly)
{
Colour = readOnly ? Color4.Gray : Color4.White;
}
protected override bool OnClick(ClickEvent e)
{
if (ReadOnly)
return true;
return base.OnClick(e);
}
}
}
}
|
Use graying rather than alpha
|
Use graying rather than alpha
|
C#
|
mit
|
NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,smoogipooo/osu,naoey/osu,DrabWeb/osu,naoey/osu,peppy/osu,johnneijzen/osu,ppy/osu,smoogipoo/osu,DrabWeb/osu,smoogipoo/osu,peppy/osu-new,ZLima12/osu,2yangk23/osu,DrabWeb/osu,ppy/osu,2yangk23/osu,peppy/osu,UselessToucan/osu,naoey/osu,ppy/osu,EVAST9919/osu,NeoAdonis/osu,ZLima12/osu,EVAST9919/osu,peppy/osu,johnneijzen/osu
|
e456828f656dd7078550f6d6ece140f397d3ed2d
|
OpenTkApp/Program.cs
|
OpenTkApp/Program.cs
|
using System;
namespace OpenTkApp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
|
using System;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Input;
namespace OpenTkApp
{
class Game : GameWindow
{
public Game()
: base(800, 600, GraphicsMode.Default, "OpenTK Quick Start Sample")
{
VSync = VSyncMode.On;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
GL.ClearColor(0.1f, 0.2f, 0.5f, 0.0f);
GL.Enable(EnableCap.DepthTest);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
GL.Viewport(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);
Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView((float)Math.PI / 4, Width / (float)Height, 1.0f, 64.0f);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadMatrix(ref projection);
}
protected override void OnUpdateFrame(FrameEventArgs e)
{
base.OnUpdateFrame(e);
if (Keyboard[Key.Escape])
Exit();
}
protected override void OnRenderFrame(FrameEventArgs e)
{
base.OnRenderFrame(e);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY);
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadMatrix(ref modelview);
GL.Begin(BeginMode.Triangles);
GL.Color3(1.0f, 1.0f, 0.0f); GL.Vertex3(-1.0f, -1.0f, 4.0f);
GL.Color3(1.0f, 0.0f, 0.0f); GL.Vertex3(1.0f, -1.0f, 4.0f);
GL.Color3(0.2f, 0.9f, 1.0f); GL.Vertex3(0.0f, 1.0f, 4.0f);
GL.End();
SwapBuffers();
}
}
class Program
{
[STAThread]
static void Main(string[] args)
{
using (Game game = new Game())
{
game.Run(30.0);
}
}
}
}
|
Use OpenTK triangle sample in OpenTkApp project
|
Use OpenTK triangle sample in OpenTkApp project
|
C#
|
unlicense
|
PhilboBaggins/ci-experiments-dotnetcore,PhilboBaggins/ci-experiments-dotnetcore
|
27d96a08c1ef25a9a27f3571e280d22bdd89d18a
|
src/WinApiNet/Properties/AssemblyInfo.cs
|
src/WinApiNet/Properties/AssemblyInfo.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="WinAPI.NET">
// Copyright (c) Marek Dzikiewicz, All Rights Reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
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("WinApiNet")]
[assembly: AssemblyDescription("")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("01efe7d3-2f81-420a-9ba7-290c1d5554e4")]
// Assembly is CLS-compliant
[assembly: CLSCompliant(true)]
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="WinAPI.NET">
// Copyright (c) Marek Dzikiewicz, All Rights Reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
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("WinApiNet")]
[assembly: AssemblyDescription("")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("01efe7d3-2f81-420a-9ba7-290c1d5554e4")]
// Assembly is not CLS-compliant
[assembly: CLSCompliant(false)]
|
Mark WinApiNet assembly as not CLS-compliant
|
Mark WinApiNet assembly as not CLS-compliant
|
C#
|
mit
|
MpDzik/winapinet,MpDzik/winapinet
|
c38508e9bf4d04bb7aa4af57313659d3738b8138
|
FubarDev.WebDavServer.FileSystem.DotNet/DotNetFileSystem.cs
|
FubarDev.WebDavServer.FileSystem.DotNet/DotNetFileSystem.cs
|
// <copyright file="DotNetFileSystem.cs" company="Fubar Development Junker">
// Copyright (c) Fubar Development Junker. All rights reserved.
// </copyright>
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using FubarDev.WebDavServer.Props.Store;
using Microsoft.VisualStudio.Threading;
namespace FubarDev.WebDavServer.FileSystem.DotNet
{
public class DotNetFileSystem : ILocalFileSystem
{
private readonly PathTraversalEngine _pathTraversalEngine;
public DotNetFileSystem(DotNetFileSystemOptions options, string rootFolder, PathTraversalEngine pathTraversalEngine, IPropertyStoreFactory propertyStoreFactory = null)
{
RootDirectoryPath = rootFolder;
_pathTraversalEngine = pathTraversalEngine;
var rootDir = new DotNetDirectory(this, null, new DirectoryInfo(rootFolder), new Uri(string.Empty, UriKind.Relative));
Root = new AsyncLazy<ICollection>(() => Task.FromResult<ICollection>(rootDir));
Options = options;
PropertyStore = propertyStoreFactory?.Create(this);
}
public string RootDirectoryPath { get; }
public AsyncLazy<ICollection> Root { get; }
public DotNetFileSystemOptions Options { get; }
public IPropertyStore PropertyStore { get; }
public Task<SelectionResult> SelectAsync(string path, CancellationToken ct)
{
return _pathTraversalEngine.TraverseAsync(this, path, ct);
}
}
}
|
// <copyright file="DotNetFileSystem.cs" company="Fubar Development Junker">
// Copyright (c) Fubar Development Junker. All rights reserved.
// </copyright>
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using FubarDev.WebDavServer.Props.Store;
using Microsoft.VisualStudio.Threading;
namespace FubarDev.WebDavServer.FileSystem.DotNet
{
public class DotNetFileSystem : ILocalFileSystem
{
private readonly PathTraversalEngine _pathTraversalEngine;
public DotNetFileSystem(DotNetFileSystemOptions options, string rootFolder, PathTraversalEngine pathTraversalEngine, IPropertyStoreFactory propertyStoreFactory = null)
{
RootDirectoryPath = rootFolder;
_pathTraversalEngine = pathTraversalEngine;
Options = options;
PropertyStore = propertyStoreFactory?.Create(this);
var rootDir = new DotNetDirectory(this, null, new DirectoryInfo(rootFolder), new Uri(string.Empty, UriKind.Relative));
Root = new AsyncLazy<ICollection>(() => Task.FromResult<ICollection>(rootDir));
}
public string RootDirectoryPath { get; }
public AsyncLazy<ICollection> Root { get; }
public DotNetFileSystemOptions Options { get; }
public IPropertyStore PropertyStore { get; }
public Task<SelectionResult> SelectAsync(string path, CancellationToken ct)
{
return _pathTraversalEngine.TraverseAsync(this, path, ct);
}
}
}
|
Set property store before creating the root collection to make the property store available for some internal file hiding logic
|
Set property store before creating the root collection to make the property store available for some internal file hiding logic
|
C#
|
mit
|
FubarDevelopment/WebDavServer,FubarDevelopment/WebDavServer,FubarDevelopment/WebDavServer
|
9af939b1416e56b931aaf542885aa2d064a6bf3d
|
PrimusFlex.Web/Areas/Admin/ViewModels/Employees/CreateEmployeeViewModel.cs
|
PrimusFlex.Web/Areas/Admin/ViewModels/Employees/CreateEmployeeViewModel.cs
|
namespace PrimusFlex.Web.Areas.Admin.ViewModels.Employees
{
using System.ComponentModel.DataAnnotations;
using Infrastructure.Mapping;
using Data.Models.Types;
using Data.Models;
public class CreateEmployeeViewModel : IMapFrom<Employee>, IMapTo<Employee>
{
[Required]
[StringLength(60, MinimumLength = 3)]
public string Name { get; set; }
[Required]
public string Email { get; set; }
[Required]
public string Password { get; set; }
[Required]
public string ConfirmPassword { get; set; }
public string PhoneNumber { get; set; }
// Bank details
[Required]
public BankName BankName { get; set; }
[Required]
public string SortCode { get; set; }
[Required]
public string Account { get; set; }
}
}
|
namespace PrimusFlex.Web.Areas.Admin.ViewModels.Employees
{
using System.ComponentModel.DataAnnotations;
using Infrastructure.Mapping;
using Data.Models.Types;
using Data.Models;
public class CreateEmployeeViewModel : IMapFrom<Employee>, IMapTo<Employee>
{
[Required]
[StringLength(60, MinimumLength = 3)]
public string Name { get; set; }
[Required]
public string Email { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
public string PhoneNumber { get; set; }
// Bank details
[Required]
public BankName BankName { get; set; }
[Required]
public string SortCode { get; set; }
[Required]
public string Account { get; set; }
}
}
|
Add attribute for checking if password and conformation password match
|
Add attribute for checking if password and conformation password match
|
C#
|
mit
|
ahmedmatem/primus-flex,ahmedmatem/primus-flex,ahmedmatem/primus-flex
|
1e6d1bffcdc0d63966a26bf05aaa48436a861d07
|
Sharper.C.Function/Data/FunctionModule.cs
|
Sharper.C.Function/Data/FunctionModule.cs
|
using System;
namespace Sharper.C.Data
{
using static UnitModule;
public static class FunctionModule
{
public static Func<A, B> Fun<A, B>(Func<A, B> f)
=>
f;
public static Func<A, Unit> Fun<A>(Action<A> f)
=>
ToFunc(f);
public static Action<A> Act<A>(Action<A> f)
=>
f;
public static A Id<A>(A a)
=>
a;
public static Func<B, A> Const<A, B>(A a)
=>
b => a;
public static Func<B, A, C> Flip<A, B, C>(Func<A, B, C> f)
=>
(b, a) => f(a, b);
public static Func<A, C> Compose<A, B, C>(this Func<B, C> f, Func<A, B> g)
=>
a => f(g(a));
public static Func<A, C> Then<A, B, C>(this Func<A, B> f, Func<B, C> g)
=>
a => g(f(a));
public static Func<A, Func<B, C>> Curry<A, B, C>(Func<A, B, C> f)
=>
a => b => f(a, b);
public static Func<A, B, C> Uncurry<A, B, C>(Func<A, Func<B, C>> f)
=>
(a, b) => f(a)(b);
}
}
|
using System;
namespace Sharper.C.Data
{
using static UnitModule;
public static class FunctionModule
{
public static Func<A, B> Fun<A, B>(Func<A, B> f)
=>
f;
public static Func<A, Unit> Fun<A>(Action<A> f)
=>
ToFunc(f);
public static Action<A> Act<A>(Action<A> f)
=>
f;
public static A Id<A>(A a)
=>
a;
public static Func<B, A> Const<A, B>(A a)
=>
b => a;
public static Func<B, A, C> Flip<A, B, C>(Func<A, B, C> f)
=>
(b, a) => f(a, b);
public static Func<A, C> Compose<A, B, C>(Func<B, C> f, Func<A, B> g)
=>
a => f(g(a));
public static Func<A, C> Then<A, B, C>(this Func<A, B> f, Func<B, C> g)
=>
a => g(f(a));
public static Func<A, Func<B, C>> Curry<A, B, C>(Func<A, B, C> f)
=>
a => b => f(a, b);
public static Func<A, B, C> Uncurry<A, B, C>(Func<A, Func<B, C>> f)
=>
(a, b) => f(a)(b);
}
}
|
Make Compose a non-extension method
|
Make Compose a non-extension method
|
C#
|
mit
|
sharper-library/Sharper.C.Function
|
3716e857852a0990b3e482b3a709b4545a5d58c1
|
Siftables/MainWindow.xaml.cs
|
Siftables/MainWindow.xaml.cs
|
namespace Siftables
{
public partial class MainWindowView
{
public MainWindowView()
{
InitializeComponent();
DoAllOfTheThings();
}
}
}
|
namespace Siftables
{
public partial class MainWindowView
{
public MainWindowView()
{
InitializeComponent();
}
}
}
|
Fix build issues for TeamCity.
|
Fix build issues for TeamCity.
Signed-off-by: Alexander J Mullans <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexmullans.com>
|
C#
|
bsd-2-clause
|
alexmullans/Siftables-Emulator
|
28c5f5af8c11434d36ed3677f4ba80ac22a1ab0d
|
src/Sceneject.Autofac/AutofacServiceAdapter.cs
|
src/Sceneject.Autofac/AutofacServiceAdapter.cs
|
using Autofac;
using SceneJect.Autofac;
using SceneJect.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace SceneJect.Autofac
{
public class AutofacServiceAdapter : ContainerServiceProvider, IResolver, IServiceRegister
{
private readonly AutofacRegisterationStrat registerationStrat = new AutofacRegisterationStrat(new ContainerBuilder());
public override IServiceRegister Registry { get { return registerationStrat; } }
private IResolver resolver = null;
public override IResolver Resolver { get { return GenerateResolver(); } }
private readonly object syncObj = new object();
private IResolver GenerateResolver()
{
if(resolver == null)
{
//double check locking
lock(syncObj)
if (resolver == null)
resolver = new AutofacResolverStrat(registerationStrat.Build());
}
return resolver;
}
}
}
|
using Autofac;
using SceneJect.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace SceneJect.Autofac
{
public class AutofacServiceAdapter : ContainerServiceProvider, IResolver, IServiceRegister
{
private readonly AutofacRegisterationStrat registerationStrat = new AutofacRegisterationStrat(new ContainerBuilder());
public override IServiceRegister Registry { get { return registerationStrat; } }
private IResolver resolver = null;
public override IResolver Resolver { get { return GenerateResolver(); } }
private readonly object syncObj = new object();
private IResolver GenerateResolver()
{
if(resolver == null)
{
//double check locking
lock(syncObj)
if (resolver == null)
resolver = new AutofacResolverStrat(registerationStrat.Build());
}
return resolver;
}
}
}
|
Fix travis/mono by remove SUO
|
Fix travis/mono by remove SUO
|
C#
|
mit
|
HelloKitty/SceneJect,HelloKitty/SceneJect
|
b69868394719acefc18df55d43e1858fa9822e12
|
src/UserInputMacro/ScriptExecuter.cs
|
src/UserInputMacro/ScriptExecuter.cs
|
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.CodeAnalysis.CSharp.Scripting;
namespace UserInputMacro
{
static class ScriptExecuter
{
public static async Task ExecuteAsync( string scriptPath )
{
using( var hook = new UserInputHook() ) {
HookSetting( hook );
var script = CSharpScript.Create( File.ReadAllText( scriptPath ), ScriptOptions.Default, typeof( MacroScript ) );
await script.RunAsync( new MacroScript() );
}
}
private static void LoggingMouseMacro( MouseHookStruct mouseHookStr, int mouseEvent )
{
if( CommonUtil.CheckMode( ModeKind.CreateLog ) ) {
Logger.WriteMouseEvent( mouseHookStr, ( MouseHookEvent ) mouseEvent );
}
}
private static void LoggingKeyMacro( KeyHookStruct keyHookStr, int keyEvent )
{
if( CommonUtil.CheckMode( ModeKind.CreateLog ) ) {
Logger.WriteKeyEventAsync( keyHookStr, ( KeyHookEvent ) keyEvent ).Wait();
}
}
private static void HookSetting( UserInputHook hook )
{
hook.MouseHook = LoggingMouseMacro;
hook.KeyHook = LoggingKeyMacro;
hook.HookErrorProc = CommonUtil.HandleException;
hook.RegisterKeyHook();
hook.RegisterMouseHook();
}
}
}
|
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.CodeAnalysis.CSharp.Scripting;
namespace UserInputMacro
{
static class ScriptExecuter
{
public static async Task ExecuteAsync( string scriptPath )
{
using( var hook = new UserInputHook() ) {
HookSetting( hook );
var script = CSharpScript.Create( File.ReadAllText( scriptPath ), ScriptOptions.Default, typeof( MacroScript ) );
await script.RunAsync( new MacroScript() );
}
}
private static void LoggingMouseMacro( MouseHookStruct mouseHookStr, int mouseEvent )
{
if( CommonUtil.CheckMode( ModeKind.CreateLog ) ) {
Logger.WriteMouseEvent( mouseHookStr, ( MouseHookEvent ) mouseEvent );
}
}
private static void LoggingKeyMacro( KeyHookStruct keyHookStr, int keyEvent )
{
if( CommonUtil.CheckMode( ModeKind.CreateLog ) ) {
Logger.WriteKeyEvent( keyHookStr, ( KeyHookEvent ) keyEvent );
}
}
private static void HookSetting( UserInputHook hook )
{
hook.MouseHook = LoggingMouseMacro;
hook.KeyHook = LoggingKeyMacro;
hook.HookErrorProc = CommonUtil.HandleException;
hook.RegisterKeyHook();
hook.RegisterMouseHook();
}
}
}
|
Correct in order not to use "Wait" method for synchronized method
|
Correct in order not to use "Wait" method for synchronized method
|
C#
|
mit
|
hukatama024e/MacroRecoderCsScript,hukatama024e/UserInputMacro
|
050579cc24a7d193ad9929784a2cdab567b16487
|
ElectronicCash/ActorName.cs
|
ElectronicCash/ActorName.cs
|
namespace ElectronicCash
{
public struct ActorName
{
private readonly string _firstName;
private readonly string _middleName;
private readonly string _lastName;
private readonly string _title;
private readonly string _entityName;
public ActorName(string firstName, string middleName, string lastName, string title)
{
_firstName = firstName;
_middleName = middleName;
_lastName = lastName;
_title = title;
_entityName = null;
}
public ActorName(string entityName)
{
_firstName = null;
_middleName = null;
_lastName = null;
_title = null;
_entityName = entityName;
}
public string FirstName => _firstName;
public string MiddleName => _middleName;
public string LastName => _lastName;
public string Title => _title;
public string EntityName => _entityName;
}
}
|
using System;
namespace ElectronicCash
{
public struct ActorName
{
private readonly string _firstName;
private readonly string _middleName;
private readonly string _lastName;
private readonly string _title;
private readonly string _entityName;
public ActorName(string firstName, string middleName, string lastName, string title)
{
if (string.IsNullOrEmpty(firstName))
{
throw new ArgumentException("First name must not be empty");
}
if (string.IsNullOrEmpty(middleName))
{
throw new ArgumentException("Middle name must not be empty");
}
if (string.IsNullOrEmpty(lastName))
{
throw new ArgumentException("Last name must not be empty");
}
_firstName = firstName;
_middleName = middleName;
_lastName = lastName;
_title = title;
_entityName = null;
}
public ActorName(string entityName)
{
if (string.IsNullOrEmpty(entityName))
{
throw new ArgumentException("Entity name must be provided");
}
_firstName = null;
_middleName = null;
_lastName = null;
_title = null;
_entityName = entityName;
}
public string FirstName => _firstName;
public string MiddleName => _middleName;
public string LastName => _lastName;
public string Title => _title;
public string EntityName => _entityName;
}
}
|
Validate data in the ctors
|
Validate data in the ctors
|
C#
|
mit
|
0culus/ElectronicCash
|
b3ca342e16f4515a19271db71091de84cd153491
|
Modules/AppBrix.Time/ITimeService.cs
|
Modules/AppBrix.Time/ITimeService.cs
|
// Copyright (c) MarinAtanasov. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the project root for license information.
//
using System;
namespace AppBrix.Time
{
/// <summary>
/// Service which operates with <see cref="DateTime"/>.
/// </summary>
public interface ITimeService
{
/// <summary>
/// Gets the current time.
/// This should be used instead of DateTime.Now or DateTime.UtcNow.
/// </summary>
/// <returns></returns>
DateTime GetTime();
/// <summary>
/// Converts the specified time to the configured application time kind.
/// </summary>
/// <param name="time">The specified time.</param>
/// <returns>The converted time.</returns>
DateTime ToAppTime(DateTime time);
/// <summary>
/// Converts a given <see cref="DateTime"/> to a predefined <see cref="string"/> representation.
/// </summary>
/// <param name="time">The time.</param>
/// <returns>The string representation of the time.</returns>
string ToString(DateTime time);
/// <summary>
/// Converts a given <see cref="string"/> to a <see cref="DateTime"/> in a system time kind.
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
DateTime ToDateTime(string time);
}
}
|
// Copyright (c) MarinAtanasov. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the project root for license information.
//
using System;
namespace AppBrix.Time
{
/// <summary>
/// Service which operates with <see cref="DateTime"/>.
/// </summary>
public interface ITimeService
{
/// <summary>
/// Gets the current time.
/// This should be used instead of <see cref="DateTime.Now"/> or <see cref="DateTime.UtcNow"/>.
/// </summary>
/// <returns>The current date and time.</returns>
DateTime GetTime();
/// <summary>
/// Converts the specified time to the configured application <see cref="DateTimeKind"/>.
/// </summary>
/// <param name="time">The specified time.</param>
/// <returns>The converted time.</returns>
DateTime ToAppTime(DateTime time);
/// <summary>
/// Converts a given <see cref="DateTime"/> to a predefined <see cref="string"/> representation.
/// </summary>
/// <param name="time">The time.</param>
/// <returns>The string representation of the time.</returns>
string ToString(DateTime time);
/// <summary>
/// Converts a given <see cref="string"/> to a <see cref="DateTime"/> in the configured <see cref="DateTimeKind"/>.
/// </summary>
/// <param name="time">The date and time in string representation.</param>
/// <returns>The date and time.</returns>
DateTime ToDateTime(string time);
}
}
|
Improve time service interface documentation
|
Improve time service interface documentation
|
C#
|
mit
|
MarinAtanasov/AppBrix,MarinAtanasov/AppBrix.NetCore
|
e4a456832f61c0a00209c92b7ec95fc464590524
|
Kyru/Core/Config.cs
|
Kyru/Core/Config.cs
|
using System;
using System.IO;
namespace Kyru.Core
{
internal sealed class Config
{
internal string storeDirectory;
internal Config()
{
storeDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Kyru", "objects");
}
}
}
|
using System;
using System.IO;
namespace Kyru.Core
{
internal sealed class Config
{
internal string storeDirectory;
internal Config()
{
storeDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Kyru", "objects");
}
}
}
|
Fix to make path independant to the version
|
Fix to make path independant to the version
|
C#
|
bsd-3-clause
|
zr40/kyru-dotnet,zr40/kyru-dotnet
|
867c6e85e4cc7290d625f77299d707fa3646eece
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyTitle("Autofac.Extras.Tests.CommonServiceLocator")]
[assembly: AssemblyDescription("")]
|
using System.Reflection;
[assembly: AssemblyTitle("Autofac.Extras.Tests.CommonServiceLocator")]
|
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
|
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
|
C#
|
mit
|
autofac/Autofac.Extras.CommonServiceLocator
|
27b0266d25e5f68288909f7145c44e6f6daab76b
|
bs4/Links.cs
|
bs4/Links.cs
|
using ToSic.Razor.Blade;
// todo: change to use Get
public class Links : Custom.Hybrid.Code12
{
// Returns a safe url to a post details page
public dynamic LinkToDetailsPage(dynamic post) {
var detailsPageTabId = Text.Has(Settings.DetailsPage)
? int.Parse((AsEntity(App.Settings).GetBestValue("DetailsPage")).Split(':')[1])
: CmsContext.Page.Id;
return Link.To(pageId: detailsPageTabId, parameters: "details=" + post.UrlKey);
}
}
|
using ToSic.Razor.Blade;
public class Links : Custom.Hybrid.Code12
{
/// <Summary>
/// Returns a safe url to a post details page
/// </Summary>
public dynamic LinkToDetailsPage(dynamic post) {
return Link.To(pageId: DetailsPageId, parameters: "details=" + post.UrlKey);
}
/// <Summary>
/// Get / cache the page which will show the details of a post
/// </Summary>
private int DetailsPageId
{
get
{
if (_detailsPageId != 0) return _detailsPageId;
if (Text.Has(Settings.DetailsPage))
_detailsPageId = int.Parse((App.Settings.Get("DetailsPage", convertLinks: false)).Split(':')[1]);
else
_detailsPageId = CmsContext.Page.Id;
return _detailsPageId;
}
}
private int _detailsPageId;
}
|
Improve how the link is made and page is cached
|
Improve how the link is made and page is cached
|
C#
|
mit
|
2sic/app-blog,2sic/app-blog,2sic/app-blog
|
e28c33d8be6e8d66c2505cfa5a84c67aaa21fb58
|
shared/AppSettingsHelper.csx
|
shared/AppSettingsHelper.csx
|
#load "LogHelper.csx"
#load "FunctionNameHelper.csx"
using System.Configuration;
public static class AppSettingsHelper
{
public static string GetAppSetting(string SettingName, bool LogValue = true )
{
string SettingValue = "";
string methodName = this.GetType().FullName;
try
{
SettingValue = ConfigurationManager.AppSettings[SettingName].ToString();
if ((!String.IsNullOrEmpty(SettingValue)) && LogValue)
{
LogHelper.Info($"{FunctionnameHelper} {GetFunctionName()} {methodName} Retreived AppSetting {SettingName} with a value of {SettingValue}");
}
else if((!String.IsNullOrEmpty(SettingValue)) && !LogValue)
{
LogHelper.Info($"{FunctionnameHelper} {methodName} Retreived AppSetting {SettingName} but logging value was turned off");
}
else if(!String.IsNullOrEmpty(SettingValue))
{
LogHelper.Info($"{FunctionnameHelper} {methodName} AppSetting {SettingName} was null or empty");
}
}
catch (ConfigurationErrorsException ex)
{
LogHelper.Error($"{FunctionnameHelper} {methodName} Unable to find AppSetting {SettingName} with exception of {ex.Message}");
}
catch (System.Exception ex)
{
LogHelper.Error($"{FunctionnameHelper} {methodName} Looking for AppSetting {SettingName} caused an exception of {ex.Message}");
}
return SettingValue;
}
}
|
#load "LogHelper.csx"
#load "FunctionNameHelper.csx"
using System.Configuration;
public static class AppSettingsHelper
{
public static string GetAppSetting(string SettingName, bool LogValue = true )
{
string SettingValue = "";
string methodName = this.GetType().FullName;
try
{
SettingValue = ConfigurationManager.AppSettings[SettingName].ToString();
if ((!String.IsNullOrEmpty(SettingValue)) && LogValue)
{
LogHelper.Info($"{FunctionnameHelper.GetFunctionName()} {GetFunctionName()} {methodName} Retreived AppSetting {SettingName} with a value of {SettingValue}");
}
else if((!String.IsNullOrEmpty(SettingValue)) && !LogValue)
{
LogHelper.Info($"{FunctionnameHelper.GetFunctionName()} {methodName} Retreived AppSetting {SettingName} but logging value was turned off");
}
else if(!String.IsNullOrEmpty(SettingValue))
{
LogHelper.Info($"{FunctionnameHelper.GetFunctionName()} {methodName} AppSetting {SettingName} was null or empty");
}
}
catch (ConfigurationErrorsException ex)
{
LogHelper.Error($"{FunctionnameHelper.GetFunctionName()} {methodName} Unable to find AppSetting {SettingName} with exception of {ex.Message}");
}
catch (System.Exception ex)
{
LogHelper.Error($"{FunctionnameHelper.GetFunctionName()} {methodName} Looking for AppSetting {SettingName} caused an exception of {ex.Message}");
}
return SettingValue;
}
}
|
Use the correct call to FunctionNameHelper
|
Use the correct call to FunctionNameHelper
|
C#
|
mit
|
USDXStartups/CalendarHelper
|
f80d1016394c2240912ad47b7b14ecc8f1d709ff
|
AutoLegality/AutoLegality.Designer.cs
|
AutoLegality/AutoLegality.Designer.cs
|
namespace PKHeX.WinForms
{
partial class Main
{
public System.Windows.Forms.ToolStripMenuItem EnableAutoLegality(System.ComponentModel.ComponentResourceManager resources)
{
this.Menu_ShowdownImportPKMModded = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_ShowdownImportPKMModded.Image = ((System.Drawing.Image)(resources.GetObject("Menu_ShowdownImportPKM.Image")));
this.Menu_ShowdownImportPKMModded.Name = "Menu_ShowdownImportPKMModded";
this.Menu_ShowdownImportPKMModded.Size = new System.Drawing.Size(231, 22);
this.Menu_ShowdownImportPKMModded.Text = "Modded Showdown Import";
this.Menu_ShowdownImportPKMModded.Click += new System.EventHandler(this.ClickShowdownImportPKMModded);
return this.Menu_ShowdownImportPKMModded;
}
private System.Windows.Forms.ToolStripMenuItem Menu_ShowdownImportPKMModded;
}
}
|
namespace PKHeX.WinForms
{
partial class Main
{
public System.Windows.Forms.ToolStripMenuItem EnableAutoLegality(System.ComponentModel.ComponentResourceManager resources)
{
this.Menu_ShowdownImportPKMModded = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_ShowdownImportPKMModded.Image = ((System.Drawing.Image)(resources.GetObject("Menu_ShowdownImportPKM.Image")));
this.Menu_ShowdownImportPKMModded.Name = "Menu_ShowdownImportPKMModded";
this.Menu_ShowdownImportPKMModded.Size = new System.Drawing.Size(231, 22);
this.Menu_ShowdownImportPKMModded.Text = "Import with Auto-Legality Mod";
this.Menu_ShowdownImportPKMModded.Click += new System.EventHandler(this.ClickShowdownImportPKMModded);
return this.Menu_ShowdownImportPKMModded;
}
private System.Windows.Forms.ToolStripMenuItem Menu_ShowdownImportPKMModded;
}
}
|
Change aliasing of Modded Showdown Import
|
Change aliasing of Modded Showdown Import
New Alias: Import with Auto-Legality Mod
|
C#
|
mit
|
architdate/PKHeX-Auto-Legality-Mod,architdate/PKHeX-Auto-Legality-Mod
|
038ff618c24c042b604b7326c1de200cd6ca7db6
|
test/Sleet.AmazonS3.Tests/AmazonS3FileSystemTests.cs
|
test/Sleet.AmazonS3.Tests/AmazonS3FileSystemTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using FluentAssertions;
using NuGet.Test.Helpers;
using Sleet.Test.Common;
namespace Sleet.AmazonS3.Tests
{
public class AmazonS3FileSystemTests
{
[EnvVarExistsFact(AmazonS3TestContext.EnvAccessKeyId)]
public async Task GivenAS3AccountVerifyBucketOperations()
{
using (var testContext = new AmazonS3TestContext())
{
testContext.CreateBucketOnInit = false;
await testContext.InitAsync();
// Verify at the start
(await testContext.FileSystem.HasBucket(testContext.Logger, CancellationToken.None)).Should().BeFalse();
(await testContext.FileSystem.Validate(testContext.Logger, CancellationToken.None)).Should().BeFalse();
// Create
await testContext.FileSystem.CreateBucket(testContext.Logger, CancellationToken.None);
(await testContext.FileSystem.HasBucket(testContext.Logger, CancellationToken.None)).Should().BeTrue();
(await testContext.FileSystem.Validate(testContext.Logger, CancellationToken.None)).Should().BeTrue();
// Delete
await testContext.FileSystem.DeleteBucket(testContext.Logger, CancellationToken.None);
(await testContext.FileSystem.HasBucket(testContext.Logger, CancellationToken.None)).Should().BeFalse();
(await testContext.FileSystem.Validate(testContext.Logger, CancellationToken.None)).Should().BeFalse();
await testContext.CleanupAsync();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using FluentAssertions;
using NuGet.Test.Helpers;
using Sleet.Test.Common;
namespace Sleet.AmazonS3.Tests
{
public class AmazonS3FileSystemTests
{
[EnvVarExistsFact(AmazonS3TestContext.EnvAccessKeyId)]
public async Task GivenAS3AccountVerifyBucketOperations()
{
using (var testContext = new AmazonS3TestContext())
{
testContext.CreateBucketOnInit = false;
await testContext.InitAsync();
// Verify at the start
(await testContext.FileSystem.HasBucket(testContext.Logger, CancellationToken.None)).Should().BeFalse();
(await testContext.FileSystem.Validate(testContext.Logger, CancellationToken.None)).Should().BeFalse();
// Create
await testContext.FileSystem.CreateBucket(testContext.Logger, CancellationToken.None);
(await testContext.FileSystem.HasBucket(testContext.Logger, CancellationToken.None)).Should().BeTrue();
(await testContext.FileSystem.Validate(testContext.Logger, CancellationToken.None)).Should().BeTrue();
await testContext.CleanupAsync();
}
}
}
}
|
Fix S3 create bucket test
|
Fix S3 create bucket test
|
C#
|
mit
|
emgarten/Sleet,emgarten/Sleet
|
dc6a79a481af4d2c5a3c6b90b6ca92b6b40ec2c7
|
ViewModels/PostBodyEditorViewModel.cs
|
ViewModels/PostBodyEditorViewModel.cs
|
using NGM.Forum.Models;
namespace NGM.Forum.ViewModels {
public class PostBodyEditorViewModel {
public PostPart PostPart { get; set; }
public string Text {
get { return PostPart.Record.Text; }
set { PostPart.Record.Text = value; }
}
public string Format {
get { return PostPart.Record.Format; }
set { PostPart.Record.Format = value; }
}
public string EditorFlavor { get; set; }
}
}
|
using NGM.Forum.Models;
namespace NGM.Forum.ViewModels {
public class PostBodyEditorViewModel {
public PostPart PostPart { get; set; }
public string Text {
get { return PostPart.Record.Text; }
set { PostPart.Record.Text = string.IsNullOrWhiteSpace(value) ? value : value.TrimEnd(); }
}
public string Format {
get { return PostPart.Record.Format; }
set { PostPart.Record.Format = value; }
}
public string EditorFlavor { get; set; }
}
}
|
Trim end of post on Save. Incase someone hits enter loads and then blows the size of the page. This will stop that.
|
Trim end of post on Save. Incase someone hits enter loads and then blows the size of the page. This will stop that.
|
C#
|
bsd-3-clause
|
Jetski5822/NGM.Forum
|
4b9d0941a46b41b7831fa12e81eefec4c9235ba0
|
src/Umbraco.Web/Net/AspNetHttpContextAccessor.cs
|
src/Umbraco.Web/Net/AspNetHttpContextAccessor.cs
|
using System;
using System.Web;
namespace Umbraco.Web
{
internal class AspNetHttpContextAccessor : IHttpContextAccessor
{
public HttpContextBase HttpContext
{
get
{
return new HttpContextWrapper(System.Web.HttpContext.Current);
}
set
{
throw new NotSupportedException();
}
}
}
}
|
using System;
using System.Web;
namespace Umbraco.Web
{
internal class AspNetHttpContextAccessor : IHttpContextAccessor
{
public HttpContextBase HttpContext
{
get
{
var httpContext = System.Web.HttpContext.Current;
return httpContext is null ? null : new HttpContextWrapper(httpContext);
}
set
{
throw new NotSupportedException();
}
}
}
}
|
Fix if httpContext is null we cannot wrap it
|
Fix if httpContext is null we cannot wrap it
|
C#
|
mit
|
robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS
|
916f79ea864cb099b2b5ee3a7bf2e5888344021d
|
ADWS/Models/UserInfoResponse.cs
|
ADWS/Models/UserInfoResponse.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
namespace ADWS.Models
{
[DataContract]
public class UserInfoResponse
{
[DataMember]
public string Title { set; get; }
[DataMember]
public string DisplayName { set; get; }
[DataMember]
public string FirstName { set; get; }
[DataMember]
public string LastName { set; get; }
[DataMember]
public string SamAccountName { set; get; }
[DataMember]
public string Upn { set; get; }
[DataMember]
public string EmailAddress { set; get; }
[DataMember]
public string EmployeeId { set; get; }
[DataMember]
public string Department { set; get; }
[DataMember]
public string BusinessPhone { get; set; }
[DataMember]
public string Telephone { get; set; }
[DataMember]
public string SipAccount { set; get; }
[DataMember]
public string PrimaryHomeServerDn { get; set; }
[DataMember]
public string PoolName { set; get; }
[DataMember]
public string PhysicalDeliveryOfficeName { set; get; }
[DataMember]
public string OtherTelphone { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
namespace ADWS.Models
{
[DataContract]
public class UserInfoResponse
{
[DataMember]
public string Title { set; get; }
[DataMember]
public string DisplayName { set; get; }
[DataMember]
public string FirstName { set; get; }
[DataMember]
public string LastName { set; get; }
[DataMember]
public string SamAccountName { set; get; }
[DataMember]
public string Upn { set; get; }
[DataMember]
public string EmailAddress { set; get; }
[DataMember]
public string EmployeeId { set; get; }
[DataMember]
public string Department { set; get; }
[DataMember]
public string BusinessPhone { get; set; }
[DataMember]
public string Telephone { get; set; }
[DataMember]
public string SipAccount { set; get; }
[DataMember]
public string PrimaryHomeServerDn { get; set; }
[DataMember]
public string PoolName { set; get; }
[DataMember]
public string PhysicalDeliveryOfficeName { set; get; }
[DataMember]
public string OtherTelphone { get; set; }
[DataMember]
public string Message { get; set; }
}
}
|
Add message inside this class to convey exception
|
Add message inside this class to convey exception
|
C#
|
apache-2.0
|
sghaida/ADWS
|
9b0f302db8afd9a853bf3ce749ac7967efef5d02
|
src/SFA.DAS.EmployerUsers.RegistrationTidyUpJob/RegistrationManagement/RegistrationManager.cs
|
src/SFA.DAS.EmployerUsers.RegistrationTidyUpJob/RegistrationManagement/RegistrationManager.cs
|
using System;
using System.Threading.Tasks;
using MediatR;
using NLog;
using SFA.DAS.EmployerUsers.Application.Commands.DeleteUser;
using SFA.DAS.EmployerUsers.Application.Queries.GetUsersWithExpiredRegistrations;
namespace SFA.DAS.EmployerUsers.RegistrationTidyUpJob.RegistrationManagement
{
public class RegistrationManager
{
private readonly IMediator _mediator;
private readonly ILogger _logger;
public RegistrationManager(IMediator mediator, ILogger logger)
{
_mediator = mediator;
_logger = logger;
}
public async Task RemoveExpiredRegistrations()
{
_logger.Info("Starting deletion of expired registrations");
try
{
var users = await _mediator.SendAsync(new GetUsersWithExpiredRegistrationsQuery());
_logger.Info($"Found {users.Length} users with expired registrations");
foreach (var user in users)
{
_logger.Info($"Deleting user with email '{user.Email}' (id: '{user.Id}')");
await _mediator.SendAsync(new DeleteUserCommand
{
User = user
});
}
}
catch (Exception ex)
{
_logger.Error(ex);
throw;
}
_logger.Info("Finished deletion of expired registrations");
}
}
}
|
using System;
using System.Threading.Tasks;
using MediatR;
using Microsoft.Azure;
using NLog;
using SFA.DAS.EmployerUsers.Application.Commands.DeleteUser;
using SFA.DAS.EmployerUsers.Application.Queries.GetUsersWithExpiredRegistrations;
namespace SFA.DAS.EmployerUsers.RegistrationTidyUpJob.RegistrationManagement
{
public class RegistrationManager
{
private readonly IMediator _mediator;
private readonly ILogger _logger;
public RegistrationManager(IMediator mediator, ILogger logger)
{
_mediator = mediator;
_logger = logger;
}
public async Task RemoveExpiredRegistrations()
{
_logger.Info("Starting deletion of expired registrations");
_logger.Info($"AuditApiBaseUrl: {CloudConfigurationManager.GetSetting("AuditApiBaseUrl")}");
try
{
var users = await _mediator.SendAsync(new GetUsersWithExpiredRegistrationsQuery());
_logger.Info($"Found {users.Length} users with expired registrations");
foreach (var user in users)
{
_logger.Info($"Deleting user with email '{user.Email}' (id: '{user.Id}')");
await _mediator.SendAsync(new DeleteUserCommand
{
User = user
});
}
}
catch (Exception ex)
{
_logger.Error(ex);
throw;
}
_logger.Info("Finished deletion of expired registrations");
}
}
}
|
Add log for audit api
|
Add log for audit api
|
C#
|
mit
|
SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers
|
316c9783751e60545c155a8201c953b496957511
|
server/Startup.cs
|
server/Startup.cs
|
using System;
using System.IO;
using hutel.Filters;
using hutel.Middleware;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace server
{
public class Startup
{
private const string _envUseBasicAuth = "HUTEL_USE_BASIC_AUTH";
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services
.AddMvc()
.AddJsonOptions(opt =>
{
opt.SerializerSettings.DateParseHandling = DateParseHandling.None;
});
services.AddScoped<ValidateModelStateAttribute>();
services.AddMemoryCache();
}
// 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(LogLevel.Trace);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
if (Environment.GetEnvironmentVariable(_envUseBasicAuth) == "1")
{
app.UseBasicAuthMiddleware();
}
app.UseRedirectToHttpsMiddleware();
app.UseMvc();
app.UseStaticFiles();
}
}
}
|
using System;
using System.IO;
using hutel.Filters;
using hutel.Middleware;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace server
{
public class Startup
{
private const string _envUseBasicAuth = "HUTEL_USE_BASIC_AUTH";
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services
.AddMvc()
.AddJsonOptions(opt =>
{
opt.SerializerSettings.DateParseHandling = DateParseHandling.None;
});
services.AddScoped<ValidateModelStateAttribute>();
services.AddMemoryCache();
}
// 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(LogLevel.Trace);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRedirectToHttpsMiddleware();
if (Environment.GetEnvironmentVariable(_envUseBasicAuth) == "1")
{
app.UseBasicAuthMiddleware();
}
app.UseMvc();
app.UseStaticFiles();
}
}
}
|
Move https redirection above basic auth
|
Move https redirection above basic auth
|
C#
|
apache-2.0
|
demyanenko/hutel,demyanenko/hutel,demyanenko/hutel
|
74fa9dba58babe0d70076da50811e4b3f1ba0e9f
|
RailPhase.Demo/Program.cs
|
RailPhase.Demo/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RailPhase.Demo
{
class Program
{
static void Main(string[] args)
{
// Create a simple web app and serve content on to URLs.
var app = new App();
// Define the URL patterns to respond to incoming requests.
// Any request that does not match one of these patterns will
// be served by app.NotFoundView, which defaults to a simple
// 404 message.
// Easiest way to respond to a request: return a string
app.AddStringView("^/$", (request) => "Hello World");
// More complex response, see below
app.AddStringView("^/info$", InfoView);
// Start listening for HTTP requests. Default port is 8080.
// This method does never return!
app.RunHttpServer();
// Now you should be able to visit me in your browser on http://localhost:8080
}
/// <summary>
/// A view that generates a simple request info page
/// </summary>
static string InfoView(RailPhase.Context context)
{
// Get the template for the info page.
var render = Template.FromFile("InfoTemplate.html");
// Pass the HttpRequest as the template context, because we want
// to display information about the request. Normally, we would
// pass some custom object here, containing the information we
// want to display.
return render(null, context);
}
}
public class DemoData
{
public string Heading;
public string Username;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RailPhase.Demo
{
class Program
{
static void Main(string[] args)
{
// Create a simple web app and serve content on to URLs.
var app = new App();
// Define the URL patterns to respond to incoming requests.
// Any request that does not match one of these patterns will
// be served by app.NotFoundView, which defaults to a simple
// 404 message.
// Easiest way to respond to a request: return a string
app.AddStringView("^/$", (request) => "Hello World");
// More complex response, see below
app.AddStringView("^/info$", InfoView);
// Start listening for HTTP requests. Default port is 8080.
// This method does never return!
app.RunHttpServer("http://localhost:18080/");
// Now you should be able to visit me in your browser on http://localhost:18080/
}
/// <summary>
/// A view that generates a simple request info page
/// </summary>
static string InfoView(RailPhase.Context context)
{
// Get the template for the info page.
var render = Template.FromFile("InfoTemplate.html");
// Pass the HttpRequest as the template context, because we want
// to display information about the request. Normally, we would
// pass some custom object here, containing the information we
// want to display.
return render(null, context);
}
}
public class DemoData
{
public string Heading;
public string Username;
}
}
|
Use port for demo application that doesn't need privileges
|
Use port for demo application that doesn't need privileges
|
C#
|
mit
|
RailPhase/RailPhase,LukasBoersma/Web2Sharp,RailPhase/RailPhase,LukasBoersma/Web2Sharp,LukasBoersma/RailPhase,LukasBoersma/RailPhase
|
6a2a3e10d5c1bac248b55916e15e64bb57ee5749
|
Core/CasperException.cs
|
Core/CasperException.cs
|
using System;
namespace Casper {
public class CasperException : Exception {
public const int EXIT_CODE_COMPILATION_ERROR = 1;
public const int EXIT_CODE_MISSING_TASK = 2;
public const int EXIT_CODE_CONFIGURATION_ERROR = 3;
public const int EXIT_CODE_TASK_FAILED = 4;
public const int EXIT_CODE_UNHANDLED_EXCEPTION = 255;
private readonly int exitCode;
public CasperException(int exitCode, string message, params object[] args)
: base(string.Format(message, args)) {
this.exitCode = exitCode;
}
public CasperException(int exitCode, Exception innerException)
: base(innerException.Message, innerException) {
this.exitCode = exitCode;
}
public int ExitCode {
get {
return exitCode;
}
}
}
}
|
using System;
namespace Casper {
public class CasperException : Exception {
public const int EXIT_CODE_COMPILATION_ERROR = 1;
public const int EXIT_CODE_MISSING_TASK = 2;
public const int EXIT_CODE_CONFIGURATION_ERROR = 3;
public const int EXIT_CODE_TASK_FAILED = 4;
public const int EXIT_CODE_UNHANDLED_EXCEPTION = 255;
private readonly int exitCode;
public CasperException(int exitCode, string message)
: base(message) {
this.exitCode = exitCode;
}
public CasperException(int exitCode, string message, params object[] args)
: this(exitCode, string.Format(message, args)) {
}
public CasperException(int exitCode, Exception innerException)
: base(innerException.Message, innerException) {
this.exitCode = exitCode;
}
public int ExitCode {
get {
return exitCode;
}
}
}
}
|
Fix formatting exception when script compilation fails with certain error messages
|
Fix formatting exception when script compilation fails with certain error messages
|
C#
|
mit
|
eatdrinksleepcode/casper,eatdrinksleepcode/casper
|
b05a3bf0ed21a6fd25807f34c69987ead0cee9b0
|
src/Dotnet.Microservice/Health/Checks/RavenDbHealthCheck.cs
|
src/Dotnet.Microservice/Health/Checks/RavenDbHealthCheck.cs
|
using Raven.Abstractions.Data;
using System;
namespace Dotnet.Microservice.Health.Checks
{
public class RavenDbHealthCheck
{
public static HealthResponse CheckHealth(string connectionString)
{
try
{
ConnectionStringParser<RavenConnectionStringOptions> parser = ConnectionStringParser<RavenConnectionStringOptions>.FromConnectionString(connectionString);
parser.Parse();
var store = new Raven.Client.Document.DocumentStore
{
Url = parser.ConnectionStringOptions.Url,
DefaultDatabase = parser.ConnectionStringOptions.DefaultDatabase
};
store.Initialize();
return HealthResponse.Healthy(new { server = store.Url, database = store.DefaultDatabase });
}
catch (Exception ex)
{
return HealthResponse.Unhealthy(ex);
}
}
}
}
|
using Raven.Abstractions.Data;
using System;
namespace Dotnet.Microservice.Health.Checks
{
public class RavenDbHealthCheck
{
public static HealthResponse CheckHealth(string connectionString)
{
try
{
ConnectionStringParser<RavenConnectionStringOptions> parser = ConnectionStringParser<RavenConnectionStringOptions>.FromConnectionString(connectionString);
parser.Parse();
var store = new Raven.Client.Document.DocumentStore
{
Url = parser.ConnectionStringOptions.Url,
DefaultDatabase = parser.ConnectionStringOptions.DefaultDatabase
};
store.Initialize();
// Client doesn't seem to throw an exception until we try to do something so let's just do something simple and get the build number of the server.
var build = store.DatabaseCommands.GlobalAdmin.GetBuildNumber();
// Dispose the store object
store.Dispose();
return HealthResponse.Healthy(new { server = store.Url, database = store.DefaultDatabase, serverBuild = build.BuildVersion });
}
catch (Exception ex)
{
return HealthResponse.Unhealthy(ex);
}
}
}
}
|
Make the client request the RavenDB server version. If we don't do this the client doesn't appear to raise an exception in the case of a dead server so the health check will still return healthy.
|
Make the client request the RavenDB server version. If we don't do this the client doesn't appear to raise an exception in the case of a dead server so the health check will still return healthy.
|
C#
|
isc
|
lynxx131/dotnet.microservice
|
660cb7714eea0f1fe8e33952ea1502544ad26713
|
src/GraphQL/Types/InputObjectGraphType.cs
|
src/GraphQL/Types/InputObjectGraphType.cs
|
using System;
namespace GraphQL.Types
{
public interface IInputObjectGraphType : IComplexGraphType
{
}
public class InputObjectGraphType : InputObjectGraphType<object>
{
}
public class InputObjectGraphType<TSourceType> : ComplexGraphType<TSourceType>, IInputObjectGraphType
{
public override FieldType AddField(FieldType fieldType)
{
if(fieldType.Type == typeof(ObjectGraphType))
{
throw new ArgumentException(nameof(fieldType.Type),
"InputObjectGraphType cannot have fields containing a ObjectGraphType.");
}
return base.AddField(fieldType);
}
}
}
|
using System;
namespace GraphQL.Types
{
public interface IInputObjectGraphType : IComplexGraphType
{
}
public class InputObjectGraphType : InputObjectGraphType<object>
{
}
public class InputObjectGraphType<TSourceType> : ComplexGraphType<TSourceType>, IInputObjectGraphType
{
public override FieldType AddField(FieldType fieldType)
{
if(fieldType.Type == typeof(ObjectGraphType))
{
throw new ArgumentException("InputObjectGraphType cannot have fields containing a ObjectGraphType.", nameof(fieldType.Type));
}
return base.AddField(fieldType);
}
}
}
|
Fix argument name param order
|
Fix argument name param order
|
C#
|
mit
|
graphql-dotnet/graphql-dotnet,joemcbride/graphql-dotnet,graphql-dotnet/graphql-dotnet,joemcbride/graphql-dotnet,graphql-dotnet/graphql-dotnet
|
6cad2257793e884a6776312697e648eadedec443
|
Battery-Commander.Web/Jobs/SqliteBackupJob.cs
|
Battery-Commander.Web/Jobs/SqliteBackupJob.cs
|
using FluentEmail.Core;
using FluentScheduler;
using System;
namespace BatteryCommander.Web.Jobs
{
public class SqliteBackupJob : IJob
{
private const String Recipient = "mattgwagner+backup@gmail.com"; // TODO Make this configurable
private readonly IFluentEmail emailSvc;
public SqliteBackupJob(IFluentEmail emailSvc)
{
this.emailSvc = emailSvc;
}
public virtual void Execute()
{
emailSvc
.To(Recipient)
.Subject("Nightly Db Backup")
.Body("Please find the nightly database backup attached.")
.Attach(new FluentEmail.Core.Models.Attachment
{
ContentType = "application/octet-stream",
Filename = "Data.db",
Data = System.IO.File.OpenRead("Data.db")
})
.Send();
}
}
}
|
using FluentEmail.Core;
using FluentScheduler;
using System;
namespace BatteryCommander.Web.Jobs
{
public class SqliteBackupJob : IJob
{
private const String Recipient = "Backups@RedLeg.app";
private readonly IFluentEmail emailSvc;
public SqliteBackupJob(IFluentEmail emailSvc)
{
this.emailSvc = emailSvc;
}
public virtual void Execute()
{
emailSvc
.To(Recipient)
.Subject("Nightly Db Backup")
.Body("Please find the nightly database backup attached.")
.Attach(new FluentEmail.Core.Models.Attachment
{
ContentType = "application/octet-stream",
Filename = "Data.db",
Data = System.IO.File.OpenRead("Data.db")
})
.Send();
}
}
}
|
Switch to new backup email recipient
|
Switch to new backup email recipient
|
C#
|
mit
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
5f4b013d3ff4234c836e6a7ef39936d32815096a
|
LINQToTTree/LINQToTTreeLib/Variables/VarSimple.cs
|
LINQToTTree/LINQToTTreeLib/Variables/VarSimple.cs
|
using System;
using LinqToTTreeInterfacesLib;
using LINQToTTreeLib.Utils;
namespace LINQToTTreeLib.Variables
{
/// <summary>
/// A simple variable (like int, etc.).
/// </summary>
public class VarSimple : IVariable
{
public string VariableName { get; private set; }
public string RawValue { get; private set; }
public Type Type { get; private set; }
public VarSimple(System.Type type)
{
if (type == null)
throw new ArgumentNullException("Must have a good type!");
Type = type;
VariableName = type.CreateUniqueVariableName();
RawValue = VariableName;
Declare = false;
}
public IValue InitialValue { get; set; }
/// <summary>
/// Get/Set if this variable needs to be declared.
/// </summary>
public bool Declare { get; set; }
/// <summary>
/// TO help with debugging...
/// </summary>
/// <returns></returns>
public override string ToString()
{
return VariableName + " = (" + Type.Name + ") " + RawValue;
}
public void RenameRawValue(string oldname, string newname)
{
if (InitialValue != null)
InitialValue.RenameRawValue(oldname, newname);
if (RawValue == oldname)
{
RawValue = newname;
VariableName = newname;
}
}
}
}
|
using System;
using LinqToTTreeInterfacesLib;
using LINQToTTreeLib.Utils;
namespace LINQToTTreeLib.Variables
{
/// <summary>
/// A simple variable (like int, etc.).
/// </summary>
public class VarSimple : IVariable
{
public string VariableName { get; private set; }
public string RawValue { get; private set; }
public Type Type { get; private set; }
public VarSimple(System.Type type)
{
if (type == null)
throw new ArgumentNullException("Must have a good type!");
Type = type;
VariableName = type.CreateUniqueVariableName();
RawValue = VariableName;
Declare = false;
}
public IValue InitialValue { get; set; }
/// <summary>
/// Get/Set if this variable needs to be declared.
/// </summary>
public bool Declare { get; set; }
/// <summary>
/// TO help with debugging...
/// </summary>
/// <returns></returns>
public override string ToString()
{
var s = string.Format("{0} {1}", Type.Name, VariableName);
if (InitialValue != null)
s = string.Format("{0} = {1}", s, InitialValue.RawValue);
return s;
}
public void RenameRawValue(string oldname, string newname)
{
if (InitialValue != null)
InitialValue.RenameRawValue(oldname, newname);
if (RawValue == oldname)
{
RawValue = newname;
VariableName = newname;
}
}
}
}
|
Fix up how we generate debugging info for var simple.
|
Fix up how we generate debugging info for var simple.
|
C#
|
lgpl-2.1
|
gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT
|
650aac06335a8dffabb4321ee62a1a498febc438
|
Assets/Editor/MicrogameCollectionEditor.cs
|
Assets/Editor/MicrogameCollectionEditor.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(MicrogameCollection))]
public class MicrogameCollectionEditor : Editor
{
public override void OnInspectorGUI()
{
MicrogameCollection collection = (MicrogameCollection)target;
if (GUILayout.Button("Update Microgames"))
{
collection.updateMicrogames();
EditorUtility.SetDirty(collection);
}
DrawDefaultInspector();
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(MicrogameCollection))]
public class MicrogameCollectionEditor : Editor
{
public override void OnInspectorGUI()
{
MicrogameCollection collection = (MicrogameCollection)target;
if (GUILayout.Button("Update Microgames"))
{
collection.updateMicrogames();
EditorUtility.SetDirty(collection);
}
if (GUILayout.Button("Update Build Path"))
{
collection.updateBuildPath();
EditorUtility.SetDirty(collection);
}
DrawDefaultInspector();
}
}
|
Add editor button to update build path
|
Add editor button to update build path
|
C#
|
mit
|
Barleytree/NitoriWare,NitorInc/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare
|
5e4717cedcf366f03c0499c64b9f05d7cc409e0c
|
DynamixelServo.Quadruped/MathExtensions.cs
|
DynamixelServo.Quadruped/MathExtensions.cs
|
using System;
namespace DynamixelServo.Quadruped
{
static class MathExtensions
{
public static double RadToDegree(this double angle)
{
return angle * (180.0 / Math.PI);
}
public static float RadToDegree(this float angle)
{
return angle * (180f / (float)Math.PI);
}
public static double DegreeToRad(this double angle)
{
return Math.PI * angle / 180.0;
}
public static float DegreeToRad(this float angle)
{
return (float)Math.PI * angle / 180f;
}
public static double ToPower(this double number, double powerOf)
{
return Math.Pow(number, powerOf);
}
}
}
|
using System;
namespace DynamixelServo.Quadruped
{
static class MathExtensions
{
public static double RadToDegree(this double angle)
{
return angle * (180.0 / Math.PI);
}
public static float RadToDegree(this float angle)
{
return angle * (180f / (float)Math.PI);
}
public static double DegreeToRad(this double angle)
{
return Math.PI * angle / 180.0;
}
public static float DegreeToRad(this float angle)
{
return (float)Math.PI * angle / 180f;
}
public static double ToPower(this double number, double powerOf)
{
return Math.Pow(number, powerOf);
}
public static float Square(this float number)
{
return number * number;
}
}
}
|
Add square extension method to floats
|
Add square extension method to floats
|
C#
|
apache-2.0
|
dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo
|
42eefec1cb19382bf6952f725b73bf7f36c85037
|
Source/JabbR.Eto/Actions/AddServer.cs
|
Source/JabbR.Eto/Actions/AddServer.cs
|
using System;
using Eto.Forms;
using JabbR.Eto.Interface.Dialogs;
using JabbR.Eto.Model.JabbR;
using System.Diagnostics;
namespace JabbR.Eto.Actions
{
public class AddServer : ButtonAction
{
public const string ActionID = "AddServer";
public bool AutoConnect { get; set; }
public AddServer ()
{
this.ID = ActionID;
this.MenuText = "Add Server...";
}
protected override void OnActivated (EventArgs e)
{
base.OnActivated (e);
var server = new JabbRServer { Name = "JabbR.net", Address = "http://jabbr.net", JanrainAppName = "jabbr" };
using (var dialog = new ServerDialog(server, true, true)) {
dialog.DisplayMode = DialogDisplayMode.Attached;
var ret = dialog.ShowDialog (Application.Instance.MainForm);
if (ret == DialogResult.Ok) {
Debug.WriteLine ("Added Server, Name: {0}", server.Name);
var config = JabbRApplication.Instance.Configuration;
config.AddServer (server);
JabbRApplication.Instance.SaveConfiguration ();
if (AutoConnect) {
Application.Instance.AsyncInvoke(delegate {
server.Connect ();
});
}
}
}
}
}
}
|
using System;
using Eto.Forms;
using JabbR.Eto.Interface.Dialogs;
using JabbR.Eto.Model.JabbR;
using System.Diagnostics;
namespace JabbR.Eto.Actions
{
public class AddServer : ButtonAction
{
public const string ActionID = "AddServer";
public bool AutoConnect { get; set; }
public AddServer ()
{
this.ID = ActionID;
this.MenuText = "Add Server...";
}
protected override void OnActivated (EventArgs e)
{
base.OnActivated (e);
var server = new JabbRServer { Name = "JabbR.net", Address = "https://jabbr.net", JanrainAppName = "jabbr" };
using (var dialog = new ServerDialog(server, true, true)) {
dialog.DisplayMode = DialogDisplayMode.Attached;
var ret = dialog.ShowDialog (Application.Instance.MainForm);
if (ret == DialogResult.Ok) {
Debug.WriteLine ("Added Server, Name: {0}", server.Name);
var config = JabbRApplication.Instance.Configuration;
config.AddServer (server);
JabbRApplication.Instance.SaveConfiguration ();
if (AutoConnect) {
Application.Instance.AsyncInvoke(delegate {
server.Connect ();
});
}
}
}
}
}
}
|
Use https by default for new servers
|
Use https by default for new servers
|
C#
|
mit
|
cwensley/JabbR.Eto,cwensley/JabbR.Eto,JabbR/JabbR.Desktop,cwensley/JabbR.Eto,JabbR/JabbR.Desktop,JabbR/JabbR.Desktop
|
3d1e15a4e159d23c71a9d94211de31323f6ef0f2
|
Cheer/Views/Organization.cshtml
|
Cheer/Views/Organization.cshtml
|
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "_Layout.cshtml";
}
@{ Html.RenderPartial("PageHeading"); }
<div class="row">
<div class="small-12 large-12 columns">
@{
var members = Umbraco.TypedContentAtXPath("//OrganizationMember")
.Where(m => m.GetPropertyValue<string>("Position") != "Coach");
}
<ul class="small-block-grid-2 medium-block-grid-4 large-block-grid-4">
@foreach (var item in members)
{
<li>
<div class="panel-box">
<div class="row">
<div class="large-12 columns">
@if (item.HasValue("ProfilePhoto"))
{
<div class="img-container ratio-2-3">
<img src="@item.GetPropertyValue("ProfilePhoto")" />
</div>
}
<h5 class="text-center">
@item.GetPropertyValue("FirstName") @item.GetPropertyValue("LastName")
</h5>
@if (item.HasValue("HomeTown"))
{
<p class="text-center">@item.GetPropertyValue("HomeTown")</p>
}
</div>
</div>
</div>
</li>
}
</ul>
</div>
</div>
|
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "_Layout.cshtml";
}
@{ Html.RenderPartial("PageHeading"); }
<div class="row">
<div class="small-12 large-12 columns">
@{
var members = Umbraco.TypedContentAtXPath("//OrganizationMember")
.Where(m => m.GetPropertyValue<string>("Position") != "Coach")
.OrderBy(m => m.GetPropertyValue("LastName"))
.ThenBy(m => m.GetPropertyValue("FirstName"));
}
<ul class="small-block-grid-2 medium-block-grid-4 large-block-grid-4">
@foreach (var item in members)
{
<li>
<div class="panel-box">
<div class="row">
<div class="large-12 columns">
@if (item.HasValue("ProfilePhoto"))
{
<div class="img-container ratio-2-3">
<img src="@item.GetPropertyValue("ProfilePhoto")" />
</div>
}
<h5 class="text-center">
@item.GetPropertyValue("FirstName") @item.GetPropertyValue("LastName")
</h5>
@if (item.HasValue("HomeTown"))
{
<p class="text-center">@item.GetPropertyValue("HomeTown")</p>
}
</div>
</div>
</div>
</li>
}
</ul>
</div>
</div>
|
Order organization members by name.
|
Order organization members by name.
|
C#
|
mit
|
chrisjsherm/OrganizationCMS,chrisjsherm/OrganizationCMS,chrisjsherm/OrganizationCMS
|
bd0c9a3d586107e41dc06ce829d78b910ef9162a
|
Source/Eto.Platform.iOS/EtoAppDelegate.cs
|
Source/Eto.Platform.iOS/EtoAppDelegate.cs
|
using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using Eto.Platform.iOS.Forms;
using Eto.Forms;
namespace Eto.Platform.iOS
{
[MonoTouch.Foundation.Register("EtoAppDelegate")]
public class EtoAppDelegate : UIApplicationDelegate
{
public EtoAppDelegate ()
{
}
public override bool WillFinishLaunching (UIApplication application, NSDictionary launchOptions)
{
ApplicationHandler.Instance.Initialize(this);
return true;
}
}
}
|
using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using Eto.Platform.iOS.Forms;
using Eto.Forms;
namespace Eto.Platform.iOS
{
[MonoTouch.Foundation.Register("EtoAppDelegate")]
public class EtoAppDelegate : UIApplicationDelegate
{
public EtoAppDelegate ()
{
}
public override bool FinishedLaunching (UIApplication application, NSDictionary launcOptions)
{
ApplicationHandler.Instance.Initialize(this);
return true;
}
}
}
|
Fix running on < iOS 6.0
|
iOS: Fix running on < iOS 6.0
|
C#
|
bsd-3-clause
|
PowerOfCode/Eto,l8s/Eto,l8s/Eto,PowerOfCode/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,l8s/Eto
|
84e6895f77cef2044d59dbe53e1aafa0f41045c2
|
SurveyMonkey/Containers/QuestionDisplayOptionsCustomOptions.cs
|
SurveyMonkey/Containers/QuestionDisplayOptionsCustomOptions.cs
|
using Newtonsoft.Json;
namespace SurveyMonkey.Containers
{
[JsonConverter(typeof(TolerantJsonConverter))]
public class QuestionDisplayOptionsCustomOptions
{
}
}
|
using Newtonsoft.Json;
using System.Collections.Generic;
namespace SurveyMonkey.Containers
{
[JsonConverter(typeof(TolerantJsonConverter))]
public class QuestionDisplayOptionsCustomOptions
{
public List<string> OptionSet { get; set; }
public int StartingPosition { get; set; }
public int StepSize { get; set; }
}
}
|
Add custom display option props based on sliders
|
Add custom display option props based on sliders
|
C#
|
mit
|
bcemmett/SurveyMonkeyApi-v3,davek17/SurveyMonkeyApi-v3
|
4f9fdc883e9d0087583e48d53dde2804c8d56ebd
|
Presentation.Web/Global.asax.cs
|
Presentation.Web/Global.asax.cs
|
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
namespace Presentation.Web
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
// Turns off self reference looping when serializing models in API controlllers
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
// Support polymorphism in web api JSON output
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.TypeNameHandling = TypeNameHandling.Auto;
// Set JSON serialization in WEB API to use camelCase (javascript) instead of PascalCase (C#)
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
//Format datetime correctly. From: http://stackoverflow.com/questions/20143739/date-format-in-mvc-4-api-controller
var dateTimeConverter = new IsoDateTimeConverter
{
DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
};
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings
.Converters.Add(dateTimeConverter);
}
}
}
|
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Presentation.Web
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
// Turns off self reference looping when serializing models in API controlllers
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
// Support polymorphism in web api JSON output
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.TypeNameHandling = TypeNameHandling.Auto;
// Set JSON serialization in WEB API to use camelCase (javascript) instead of PascalCase (C#)
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
// Convert all dates to UTC
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
}
}
}
|
Convert all dates to UTC time
|
Convert all dates to UTC time
|
C#
|
mpl-2.0
|
os2kitos/kitos,miracle-as/kitos,os2kitos/kitos,os2kitos/kitos,miracle-as/kitos,os2kitos/kitos,miracle-as/kitos,miracle-as/kitos
|
329868e99ec7455455bae11dfd7246cd0a4fafe3
|
BmpListener/Bgp/ASPathSegment.cs
|
BmpListener/Bgp/ASPathSegment.cs
|
namespace BmpListener.Bgp
{
public class ASPathSegment
{
public ASPathSegment(Type type, int[] asns)
{
SegmentType = Type;
ASNs = asns;
}
public enum Type
{
AS_SET = 1,
AS_SEQUENCE,
AS_CONFED_SEQUENCE,
AS_CONFED_SET
}
public Type SegmentType { get; set; }
public int[] ASNs { get; set; }
}
}
|
using System.Collections.Generic;
namespace BmpListener.Bgp
{
public class ASPathSegment
{
public ASPathSegment(Type type, IList<int> asns)
{
SegmentType = type;
ASNs = asns;
}
public enum Type
{
AS_SET = 1,
AS_SEQUENCE,
AS_CONFED_SEQUENCE,
AS_CONFED_SET
}
public Type SegmentType { get; set; }
public IList<int> ASNs { get; set; }
}
}
|
Change ASN int array to IList
|
Change ASN int array to IList
|
C#
|
mit
|
mstrother/BmpListener
|
59fb6ac9b9644effe3503de5d46ba00d7719cfdd
|
SurveyMonkey/Properties/AssemblyInfo.cs
|
SurveyMonkey/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("SurveyMonkeyApi")]
[assembly: AssemblyDescription("Library for accessing v2 of the Survey Monkey Api")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SurveyMonkeyApi")]
[assembly: AssemblyCopyright("Copyright © Ben Emmett")]
[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("da9e0373-83cd-4deb-87a5-62b313be61ec")]
// 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.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SurveyMonkeyApi")]
[assembly: AssemblyDescription("Library for accessing v2 of the Survey Monkey Api")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SurveyMonkeyApi")]
[assembly: AssemblyCopyright("Copyright © Ben Emmett")]
[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("da9e0373-83cd-4deb-87a5-62b313be61ec")]
// 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.2.2.0")]
[assembly: AssemblyFileVersion("1.2.2.0")]
|
Bump assembly info for 1.2.2 release
|
Bump assembly info for 1.2.2 release
|
C#
|
mit
|
NellyHaglund/SurveyMonkeyApi,bcemmett/SurveyMonkeyApi
|
99bd9a2bf8a0bb0f0f4897defceaa326e851b5a9
|
Assets/MixedRealityToolkit.SDK/Inspectors/Input/Handlers/MixedRealityControllerVisualizerInspector.cs
|
Assets/MixedRealityToolkit.SDK/Inspectors/Input/Handlers/MixedRealityControllerVisualizerInspector.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEditor;
namespace Microsoft.MixedReality.Toolkit.Input.Editor
{
[CustomEditor(typeof(MixedRealityControllerVisualizer))]
public class MixedRealityControllerVisualizerInspector : ControllerPoseSynchronizerInspector { }
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEditor;
namespace Microsoft.MixedReality.Toolkit.Input.Editor
{
[CustomEditor(typeof(MixedRealityControllerVisualizer), true)]
public class MixedRealityControllerVisualizerInspector : ControllerPoseSynchronizerInspector { }
}
|
Use inspector for child classes
|
Use inspector for child classes
|
C#
|
mit
|
DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
|
59938835d439bbfb3b19b8240bcf310f8dfd7eb9
|
T4MVCHostMvcApp/App_Start/BundleConfig.cs
|
T4MVCHostMvcApp/App_Start/BundleConfig.cs
|
using System.Diagnostics.CodeAnalysis;
using System.Web.Optimization;
namespace T4MVCHostMvcApp.App_Start
{
public static class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")]
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new StyleBundle(Links.Bundles.Content.Styles).Include(
Links.Bundles.Content.Assets.Site_css
));
}
}
}
namespace Links
{
public static partial class Bundles
{
public static partial class Content
{
public const string Styles = "~/content/styles";
}
}
}
|
using System.Diagnostics.CodeAnalysis;
using System.Web.Optimization;
namespace T4MVCHostMvcApp.App_Start
{
public static class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")]
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle(Links.Bundles.Scripts.jquery).Include("~/scripts/jquery-{version}.js"));
bundles.Add(new StyleBundle(Links.Bundles.Styles.bootstrap).Include("~/styles/bootstrap*.css"));
bundles.Add(new StyleBundle(Links.Bundles.Styles.common).Include(Links.Bundles.Content.Assets.Site_css));
}
}
}
namespace Links
{
public static partial class Bundles
{
public static partial class Scripts
{
public static readonly string jquery = "~/scripts/jquery";
public static readonly string jqueryui = "~/scripts/jqueryui";
}
public static partial class Styles
{
public static readonly string bootstrap = "~/styles/boostrap";
public static readonly string theme = "~/styles/theme";
public static readonly string common = "~/styles/common";
}
}
}
|
Update bundle config to match exampe in wiki page
|
Update bundle config to match exampe in wiki page
|
C#
|
apache-2.0
|
M1chaelTran/T4MVC,jkonecki/T4MVC,payini/T4MVC,T4MVC/T4MVC,scott-xu/T4MVC,jkonecki/T4MVC,scott-xu/T4MVC,payini/T4MVC,T4MVC/T4MVC,M1chaelTran/T4MVC
|
81b922ecb73f3c8dda8a08a4826eb4985d4eac9d
|
slang/Lexing/Trees/Nodes/Transitions.cs
|
slang/Lexing/Trees/Nodes/Transitions.cs
|
using System.Collections.Generic;
namespace slang.Lexing.Trees.Nodes
{
public class Transitions : Dictionary<char,Node>
{
}
}
|
using System.Collections.Generic;
namespace slang.Lexing.Trees.Nodes
{
public class Transitions : Dictionary<Character,Transition>
{
}
}
|
Use character class as transition key
|
Use character class as transition key
|
C#
|
mit
|
jagrem/slang,jagrem/slang,jagrem/slang
|
0dc62903399db2dc21a4f1d78c4dae14cf9b3b85
|
src/SmugMugModel.v2/Types/SiteEntity.cs
|
src/SmugMugModel.v2/Types/SiteEntity.cs
|
// Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using SmugMug.v2.Authentication;
using System.Threading.Tasks;
namespace SmugMug.v2.Types
{
public class SiteEntity : SmugMugEntity
{
public SiteEntity(OAuthToken token)
{
_oauthToken = token;
}
public async Task<UserEntity> GetAuthenticatedUserAsync()
{
// !authuser
string requestUri = string.Format("{0}!authuser", SmugMug.v2.Constants.Addresses.SmugMugApi);
return await RetrieveEntityAsync<UserEntity>(requestUri);
}
public async Task<UserEntity[]> SearchForUser(string query)
{
// api/v2/user!search?q=
string requestUri = string.Format("{0}/user!search?q={1}", SmugMug.v2.Constants.Addresses.SmugMugApi, query);
return await RetrieveEntityArrayAsync<UserEntity>(requestUri);
}
}
}
|
// Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using SmugMug.v2.Authentication;
using System.Threading.Tasks;
namespace SmugMug.v2.Types
{
public class SiteEntity : SmugMugEntity
{
public SiteEntity(OAuthToken token)
{
_oauthToken = token;
}
public async Task<UserEntity> GetAuthenticatedUserAsync()
{
// !authuser
string requestUri = string.Format("{0}!authuser", SmugMug.v2.Constants.Addresses.SmugMugApi);
return await RetrieveEntityAsync<UserEntity>(requestUri);
}
public async Task<CatalogVendorEntity[]> GetVendors()
{
// /catalog!vendors
string requestUri = string.Format("{0}/catalog!vendors", SmugMug.v2.Constants.Addresses.SmugMugApi);
return await RetrieveEntityArrayAsync<CatalogVendorEntity>(requestUri);
}
public async Task<UserEntity[]> SearchForUser(string query)
{
// api/v2/user!search?q=
string requestUri = string.Format("{0}/user!search?q={1}", SmugMug.v2.Constants.Addresses.SmugMugApi, query);
return await RetrieveEntityArrayAsync<UserEntity>(requestUri);
}
}
}
|
Add a way to get the vendors from the Site entity.
|
Add a way to get the vendors from the Site entity.
|
C#
|
mit
|
AlexGhiondea/SmugMug.NET
|
13209028425ad8887ea29600a13c037d9c0b7060
|
src/System.Waf/Samples/BookLibrary/BookLibrary.Library.Applications.Test/Services/MockDBContextService.cs
|
src/System.Waf/Samples/BookLibrary/BookLibrary.Library.Applications.Test/Services/MockDBContextService.cs
|
using System.ComponentModel.Composition;
using Microsoft.EntityFrameworkCore;
using Waf.BookLibrary.Library.Applications.Data;
using Waf.BookLibrary.Library.Applications.Services;
using Waf.BookLibrary.Library.Domain;
namespace Test.BookLibrary.Library.Applications.Services
{
[Export, Export(typeof(IDBContextService))]
public class MockDBContextService : IDBContextService
{
public DbContext GetBookLibraryContext(out string dataSourcePath)
{
dataSourcePath = @"C:\Test.db";
var options = new DbContextOptionsBuilder<BookLibraryContext>().UseInMemoryDatabase(databaseName: "TestDatabase").Options;
var context = new BookLibraryContext(options, modelBuilder =>
{
modelBuilder.Entity<Book>().Ignore(x => x.Errors).Ignore(x => x.HasErrors);
modelBuilder.Entity<Person>().Ignore(x => x.Errors).Ignore(x => x.HasErrors);
});
return context;
}
}
}
|
using System.ComponentModel.Composition;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage;
using Waf.BookLibrary.Library.Applications.Data;
using Waf.BookLibrary.Library.Applications.Services;
using Waf.BookLibrary.Library.Domain;
namespace Test.BookLibrary.Library.Applications.Services
{
[Export, Export(typeof(IDBContextService))]
public class MockDBContextService : IDBContextService
{
public DbContext GetBookLibraryContext(out string dataSourcePath)
{
dataSourcePath = @"C:\Test.db";
var options = new DbContextOptionsBuilder<BookLibraryContext>().UseInMemoryDatabase(databaseName: "TestDatabase",
databaseRoot: new InMemoryDatabaseRoot()).Options;
var context = new BookLibraryContext(options, modelBuilder =>
{
modelBuilder.Entity<Book>().Ignore(x => x.Errors).Ignore(x => x.HasErrors);
modelBuilder.Entity<Person>().Ignore(x => x.Errors).Ignore(x => x.HasErrors);
});
return context;
}
}
}
|
Fix InMemory context for unit tests
|
BookLib: Fix InMemory context for unit tests
|
C#
|
mit
|
jbe2277/waf
|
9cb9ef5c563316df57f7a49400359463ead3f49b
|
osu.Game/Overlays/Settings/SettingsEnumDropdown.cs
|
osu.Game/Overlays/Settings/SettingsEnumDropdown.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsEnumDropdown<T> : SettingsDropdown<T>
where T : struct, Enum
{
protected override OsuDropdown<T> CreateDropdown() => new DropdownControl();
protected new class DropdownControl : OsuEnumDropdown<T>
{
public DropdownControl()
{
Margin = new MarginPadding { Top = 5 };
RelativeSizeAxes = Axes.X;
}
protected override DropdownMenu CreateMenu() => base.CreateMenu().With(m => m.MaxHeight = 200);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsEnumDropdown<T> : SettingsDropdown<T>
where T : struct, Enum
{
protected override OsuDropdown<T> CreateDropdown() => new DropdownControl();
protected new class DropdownControl : OsuEnumDropdown<T>
{
protected virtual int MenuMaxHeight => 200;
public DropdownControl()
{
Margin = new MarginPadding { Top = 5 };
RelativeSizeAxes = Axes.X;
}
protected override DropdownMenu CreateMenu() => base.CreateMenu().With(m => m.MaxHeight = MenuMaxHeight);
}
}
}
|
Refactor the menu's max height to be a property
|
Refactor the menu's max height to be a property
|
C#
|
mit
|
ppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,ppy/osu,peppy/osu-new,smoogipoo/osu,NeoAdonis/osu
|
01ab6e0572b195a9acc796085dd6a2c3b677d7d9
|
HealthBarGUI.cs
|
HealthBarGUI.cs
|
// Copyright (c) 2015 Bartlomiej Wolk (bartlomiejwolk@gmail.com)
//
// This file is part of the HealthBar extension for Unity. Licensed under the
// MIT license. See LICENSE file in the project root folder. Based on HealthBar
// component made by Zero3Growlithe (zero3growlithe@gmail.com).
using UnityEngine;
namespace HealthBarEx {
[System.Serializable]
// todo encapsulate fields
public class HealthBarGUI {
public Color addedHealth;
[HideInInspector]
public float alpha;
public float animationSpeed = 3f;
public Color availableHealth;
public Color displayedValue;
public bool displayValue = true;
public Color drainedHealth;
public int height = 30;
public Vector2 offset = new Vector2(0, 30);
public PositionModes positionMode;
public GUIStyle textStyle;
public Texture texture;
public float transitionDelay = 3f;
public float transitionSpeed = 5f;
public Vector2 valueOffset = new Vector2(0, 30);
public float visibility = 1;
public int width = 100;
public enum PositionModes {
Fixed,
Center
};
}
}
|
// Copyright (c) 2015 Bartlomiej Wolk (bartlomiejwolk@gmail.com)
//
// This file is part of the HealthBar extension for Unity. Licensed under the
// MIT license. See LICENSE file in the project root folder. Based on HealthBar
// component made by Zero3Growlithe (zero3growlithe@gmail.com).
using UnityEngine;
namespace HealthBarEx {
[System.Serializable]
// todo encapsulate fields
public class HealthBarGUI {
[HideInInspector]
public float alpha;
public bool displayValue = true;
public PositionModes positionMode;
public Texture texture;
public Color addedHealth;
public Color availableHealth;
public Color displayedValue;
public Color drainedHealth;
public float animationSpeed = 3f;
public float transitionSpeed = 5f;
public float transitionDelay = 3f;
public float visibility = 1;
public int width = 100;
public int height = 30;
public Vector2 offset = new Vector2(0, 30);
public Vector2 valueOffset = new Vector2(0, 30);
public GUIStyle textStyle;
public enum PositionModes {
Fixed,
Center
};
}
}
|
Reorder fields in the inspector
|
Reorder fields in the inspector
|
C#
|
mit
|
bartlomiejwolk/HealthBar
|
45571fd2475781a2d04bc4cd90cc43be4717a887
|
test/Grobid.PdfToXml.Test/TokenBlockFactoryTest.cs
|
test/Grobid.PdfToXml.Test/TokenBlockFactoryTest.cs
|
using System;
using FluentAssertions;
using Xunit;
namespace Grobid.PdfToXml.Test
{
public class TokenBlockFactoryTest
{
[Fact]
public void TestA()
{
var stub = new TextRenderInfoStub();
var testSubject = new TokenBlockFactory(100, 100);
Action test = () => testSubject.Create(stub);
test.ShouldThrow<NullReferenceException>("I am still implementing the code.");
}
}
}
|
using System;
using FluentAssertions;
using iTextSharp.text.pdf.parser;
using Xunit;
namespace Grobid.PdfToXml.Test
{
public class TokenBlockFactoryTest
{
[Fact]
public void FactoryShouldNormalizeUnicodeStrings()
{
var stub = new TextRenderInfoStub
{
AscentLine = new LineSegment(new Vector(0, 0, 0), new Vector(1, 1, 1)),
Baseline = new LineSegment(new Vector(0, 0, 0), new Vector(1, 1, 1)),
DescentLine = new LineSegment(new Vector(0, 0, 0), new Vector(1, 1, 1)),
PostscriptFontName = "CHUFSU+NimbusRomNo9L-Medi",
Text = "abcd\u0065\u0301fgh",
};
var testSubject = new TokenBlockFactory(100, 100);
var tokenBlock = testSubject.Create(stub);
stub.Text.ToCharArray().Should().HaveCount(9);
tokenBlock.Text.ToCharArray().Should().HaveCount(8);
}
}
}
|
Write test to ensure characters are normalized.
|
Write test to ensure characters are normalized.
|
C#
|
apache-2.0
|
boumenot/Grobid.NET
|
c420d3d29b5010dec9203479b6f647ed26ff5876
|
aspnet/4-auth/Controllers/SessionController.cs
|
aspnet/4-auth/Controllers/SessionController.cs
|
// Copyright(c) 2016 Google 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.Web;
using System.Web.Mvc;
using Microsoft.Owin.Security;
namespace GoogleCloudSamples.Controllers
{
// [START login]
public class SessionController : Controller
{
public ActionResult Login()
{
// Redirect to the Google OAuth 2.0 user consent screen
HttpContext.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties { RedirectUri = "/" },
"Google"
);
return new HttpUnauthorizedResult();
}
// ...
// [END login]
// [START logout]
public ActionResult Logout()
{
Request.GetOwinContext().Authentication.SignOut();
return Redirect("/");
}
// [END logout]
}
}
|
// Copyright(c) 2016 Google 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.Web;
using System.Web.Mvc;
using Microsoft.Owin.Security;
namespace GoogleCloudSamples.Controllers
{
// [START login]
public class SessionController : Controller
{
public void Login()
{
// Redirect to the Google OAuth 2.0 user consent screen
HttpContext.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties { RedirectUri = "/" },
"Google"
);
}
// ...
// [END login]
// [START logout]
public ActionResult Logout()
{
Request.GetOwinContext().Authentication.SignOut();
return Redirect("/");
}
// [END logout]
}
}
|
Simplify Login() action - no explicit return necessary
|
Simplify Login() action - no explicit return necessary
|
C#
|
apache-2.0
|
GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet
|
81280dfd257fe482e0baeab20c828849b26837a8
|
osu.Game/Screens/Edit/Setup/ColoursSection.cs
|
osu.Game/Screens/Edit/Setup/ColoursSection.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Skinning;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Setup
{
internal class ColoursSection : SetupSection
{
public override LocalisableString Title => "Colours";
private LabelledColourPalette comboColours;
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
comboColours = new LabelledColourPalette
{
Label = "Hitcircle / Slider Combos",
FixedLabelWidth = LABEL_WIDTH,
ColourNamePrefix = "Combo"
}
};
var colours = Beatmap.BeatmapSkin?.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value;
if (colours != null)
comboColours.Colours.AddRange(colours.Select(c => (Colour4)c));
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Screens.Edit.Setup
{
internal class ColoursSection : SetupSection
{
public override LocalisableString Title => "Colours";
private LabelledColourPalette comboColours;
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
comboColours = new LabelledColourPalette
{
Label = "Hitcircle / Slider Combos",
FixedLabelWidth = LABEL_WIDTH,
ColourNamePrefix = "Combo"
}
};
if (Beatmap.BeatmapSkin != null)
comboColours.Colours.BindTo(Beatmap.BeatmapSkin.ComboColours);
}
}
}
|
Use editable skin structure in combo colour picker
|
Use editable skin structure in combo colour picker
|
C#
|
mit
|
peppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,smoogipooo/osu,peppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,ppy/osu
|
2fdfe5e667b92664f6e8a7d16d60871d450150ec
|
commercetools.NET/Carts/CustomLineItemDraft.cs
|
commercetools.NET/Carts/CustomLineItemDraft.cs
|
using System.Collections.Generic;
using commercetools.Common;
using commercetools.CustomFields;
using Newtonsoft.Json;
namespace commercetools.Carts
{
/// <summary>
/// API representation for creating a new CustomLineItem.
/// </summary>
/// <see href="http://dev.commercetools.com/http-api-projects-carts.html#customlineitemdraft"/>
public class CustomLineItemDraft
{
#region Properties
[JsonProperty(PropertyName = "name")]
public LocalizedString Name { get; set; }
[JsonProperty(PropertyName = "quantity")]
public int? Quantity { get; set; }
[JsonProperty(PropertyName = "money")]
public Money Money { get; set; }
[JsonProperty(PropertyName = "slug")]
public string Slug { get; set; }
[JsonProperty(PropertyName = "taxCategory")]
public Reference TaxCategory { get; set; }
[JsonProperty(PropertyName = "custom")]
public List<CustomFieldsDraft> Custom { get; set; }
#endregion
#region Constructors
/// <summary>
/// Constructor.
/// </summary>
public CustomLineItemDraft(LocalizedString name)
{
this.Name = name;
}
#endregion
}
}
|
using System.Collections.Generic;
using commercetools.Common;
using commercetools.CustomFields;
using Newtonsoft.Json;
namespace commercetools.Carts
{
/// <summary>
/// API representation for creating a new CustomLineItem.
/// </summary>
/// <see href="http://dev.commercetools.com/http-api-projects-carts.html#customlineitemdraft"/>
public class CustomLineItemDraft
{
#region Properties
[JsonProperty(PropertyName = "name")]
public LocalizedString Name { get; set; }
[JsonProperty(PropertyName = "quantity")]
public int? Quantity { get; set; }
[JsonProperty(PropertyName = "money")]
public Money Money { get; set; }
[JsonProperty(PropertyName = "slug")]
public string Slug { get; set; }
[JsonProperty(PropertyName = "taxCategory")]
public Reference TaxCategory { get; set; }
[JsonProperty(PropertyName = "custom")]
public CustomFieldsDraft Custom { get; set; }
#endregion
#region Constructors
/// <summary>
/// Constructor.
/// </summary>
public CustomLineItemDraft(LocalizedString name)
{
this.Name = name;
}
#endregion
}
}
|
Update Custom field to the correct POCO representation
|
Update Custom field to the correct POCO representation
|
C#
|
mit
|
commercetools/commercetools-dotnet-sdk
|
114c71592c87809626beb354c73a6e3ef32a7ed1
|
src/Cronofy/ICronofyUserInfoClient.cs
|
src/Cronofy/ICronofyUserInfoClient.cs
|
namespace Cronofy
{
using System;
/// <summary>
/// Interface for a Cronofy client base that manages the
/// access token and any shared client methods.
/// </summary>
public interface ICronofyUserInfoClient
{
/// <summary>
/// Gets the user info belonging to the account.
/// </summary>
/// <returns>The account's user info.</returns>
/// <exception cref="ArgumentException">
/// Thrown if <paramref name="request"/> is null.
/// </exception>
/// <exception cref="CronofyException">
/// Thrown if an error is encountered whilst making the request.
/// </exception>
UserInfo GetUserInfo();
}
}
|
namespace Cronofy
{
using System;
/// <summary>
/// Interface for a Cronofy client base that manages the
/// access token and any shared client methods.
/// </summary>
public interface ICronofyUserInfoClient
{
/// <summary>
/// Gets the user info belonging to the account.
/// </summary>
/// <returns>The account's user info.</returns>
/// <exception cref="CronofyException">
/// Thrown if an error is encountered whilst making the request.
/// </exception>
UserInfo GetUserInfo();
}
}
|
Remove unnecessary argument exception documentation on user info
|
Remove unnecessary argument exception documentation on user info
|
C#
|
mit
|
cronofy/cronofy-csharp
|
a6e95b8677825a9dde286e47da608ee26d5e79ad
|
src/MyParcelApi.Net/Models/Carrier.cs
|
src/MyParcelApi.Net/Models/Carrier.cs
|
namespace MyParcelApi.Net.Models
{
public enum Carrier
{
PostNl = 1,
BPost = 2
}
}
|
namespace MyParcelApi.Net.Models
{
public enum Carrier
{
None = 0,
PostNl = 1,
BPost = 2
}
}
|
Improve when there is no carrier
|
Improve when there is no carrier
|
C#
|
mit
|
janssenr/MyParcelApi.Net
|
a6f151dd9e8300d8c6153beddf4883af76f4f678
|
Assets/Scripts/ShotControl.cs
|
Assets/Scripts/ShotControl.cs
|
using UnityEngine;
using System.Collections;
public class ShotControl : MonoBehaviour {
public float speed = 0.2f;
private bool inBlock;
private int life = 3;
void Start () {
}
void Update () {
// Old position
Vector3 position = transform.position;
// Move
transform.Translate(Vector3.up * speed);
// Check for collision
Collider2D collider = Physics2D.OverlapCircle(transform.position, 0.1f);
if (collider) {
if (collider.name == "ArenaBlock") {
if (!inBlock) {
// Reduce life
if (--life == 0) {
Destroy(gameObject);
return;
}
// Find vector to block center (normalized for stretched blocks)
Vector3 v = collider.transform.position - position;
v.x /= collider.transform.localScale.x;
v.y /= collider.transform.localScale.y;
Vector3 forward = transform.up;
if (Mathf.Abs(v.x) < Mathf.Abs(v.y)) {
forward.y = -forward.y; // bounce vertically
} else {
forward.x = -forward.x; // bounce horizontally
}
transform.up = forward;
}
inBlock = true;
}
} else {
inBlock = false;
}
}
}
|
using UnityEngine;
using System.Collections;
public class ShotControl : MonoBehaviour {
public float speed = 0.2f;
private bool inBlock;
private int life = 3;
void Start () {
}
void Update () {
// Old position
Vector3 position = transform.position;
// Move
transform.Translate(Vector3.up * speed);
// Check for out of bounds
if (100f <= Mathf.Abs(transform.position.magnitude)) {
Destroy(gameObject);
return;
}
// Check for collision
Collider2D collider = Physics2D.OverlapCircle(transform.position, 0.15f);
if (collider) {
if (collider.name == "ArenaBlock") {
if (!inBlock) {
// Reduce life
if (--life == 0) {
Destroy(gameObject);
return;
}
// Find vector to block center (normalized for stretched blocks)
Vector3 v = collider.transform.position - position;
v.x /= collider.transform.localScale.x;
v.y /= collider.transform.localScale.y;
Vector3 forward = transform.up;
if (Mathf.Abs(v.x) < Mathf.Abs(v.y)) {
forward.y = -forward.y; // bounce vertically
} else {
forward.x = -forward.x; // bounce horizontally
}
transform.up = forward;
}
inBlock = true;
}
} else {
inBlock = false;
}
}
}
|
Check for shots going out of bounds and kill them
|
Check for shots going out of bounds and kill them
|
C#
|
apache-2.0
|
mlepage/karmbat
|
5f05f95c45b3b36f10140a7307d4548396ab49d3
|
WootzJs.Mvc/StyleExtensions.cs
|
WootzJs.Mvc/StyleExtensions.cs
|
using WootzJs.Mvc.Views;
using WootzJs.Mvc.Views.Css;
namespace WootzJs.Mvc
{
public static class StyleExtensions
{
public static T WithBold<T>(this T control) where T : Control
{
control.Style.Font.Weight = new CssFontWeight(CssFontWeightType.Bold);
return control;
}
}
}
|
using WootzJs.Mvc.Views;
using WootzJs.Mvc.Views.Css;
namespace WootzJs.Mvc
{
public static class StyleExtensions
{
public static T WithBold<T>(this T control) where T : Control
{
control.Style.Font.Weight = new CssFontWeight(CssFontWeightType.Bold);
return control;
}
public static T WithPadding<T>(this T control, CssPadding padding) where T : Control
{
control.Style.Padding = padding;
return control;
}
}
}
|
Add more style extension methods
|
Add more style extension methods
|
C#
|
mit
|
kswoll/WootzJs,x335/WootzJs,x335/WootzJs,x335/WootzJs,kswoll/WootzJs,kswoll/WootzJs
|
b8b17f0999a1cc2e757a33f57ad3c3f6edd82609
|
MultiMiner.MobileMiner.Api/ApiContext.cs
|
MultiMiner.MobileMiner.Api/ApiContext.cs
|
using System.Net;
using System.Web.Script.Serialization;
namespace MultiMiner.MobileMiner.Api
{
public class ApiContext
{
static public void SubmitMiningStatistics(string url, MiningStatistics miningStatistics)
{
string fullUrl = url + "/api/MiningStatisticsInput";
using (WebClient client = new WebClient())
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
string jsonData = serializer.Serialize(miningStatistics);
client.Headers[HttpRequestHeader.ContentType] = "application/json";
client.UploadString(fullUrl, jsonData);
}
}
}
}
|
using System.Net;
using System.Web.Script.Serialization;
namespace MultiMiner.MobileMiner.Api
{
public class ApiContext
{
static public void SubmitMiningStatistics(string url, MiningStatistics miningStatistics)
{
if (!url.EndsWith("/"))
url = url + "/";
string fullUrl = url + "api/MiningStatisticsInput";
using (WebClient client = new WebClient())
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
string jsonData = serializer.Serialize(miningStatistics);
client.Headers[HttpRequestHeader.ContentType] = "application/json";
client.UploadString(fullUrl, jsonData);
}
}
}
}
|
Handle URL's with or without a / suffix
|
Handle URL's with or without a / suffix
|
C#
|
mit
|
IWBWbiz/MultiMiner,IWBWbiz/MultiMiner,nwoolls/MultiMiner,nwoolls/MultiMiner
|
74a5b9a7d3bd51eadb3372dd1ca002335fe400db
|
setup.cake
|
setup.cake
|
#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Cake.Hg",
repositoryOwner: "cake-contrib",
repositoryName: "Cake.Hg",
appVeyorAccountName: "cakecontrib",
solutionFilePath: "./src/Cake.Hg.sln",
shouldRunCodecov: false,
wyamSourceFiles: "../../src/**/{!bin,!obj,!packages,!*Tests,}/**/*.cs");
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
dupFinderExcludePattern: new string[] {
BuildParameters.RootDirectoryPath + "/src/Cake.HgTests/**/*.cs",
BuildParameters.RootDirectoryPath + "/src/Cake.Hg/**/*.AssemblyInfo.cs"
});
Build.Run();
|
#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Cake.Hg",
repositoryOwner: "cake-contrib",
repositoryName: "Cake.Hg",
appVeyorAccountName: "cakecontrib",
solutionFilePath: "./src/Cake.Hg.sln",
shouldRunCodecov: false,
shouldRunDupFinder: false,
wyamSourceFiles: "../../src/**/{!bin,!obj,!packages,!*Tests,}/**/*.cs");
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
dupFinderExcludePattern: new string[] {
BuildParameters.RootDirectoryPath + "/src/Cake.HgTests/**/*.cs",
BuildParameters.RootDirectoryPath + "/src/Cake.Hg/**/*.AssemblyInfo.cs"
});
Build.Run();
|
Disable dupfinder because of Hg.Net
|
Disable dupfinder because of Hg.Net
|
C#
|
mit
|
vCipher/Cake.Hg
|
4610d8592feded4b7ea030bc7f5800695b4e3267
|
Properties/AssemblyInfo.cs
|
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("MowChat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MowChat")]
[assembly: AssemblyCopyright("Copyright © 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("17fb5df9-452a-423d-925e-7b98ab9a5b02")]
// 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("MowChat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MowChat")]
[assembly: AssemblyCopyright("Copyright © 2013-2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("17fb5df9-452a-423d-925e-7b98ab9a5b02")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Increase version number & add 2014 copyright
|
Increase version number & add 2014 copyright
|
C#
|
mit
|
MaartenStaa/mow-chat,MaartenStaa/mow-chat
|
b664fc2a65dc1cc95e24c56e6393a1375c29d983
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Extras.DomainServices")]
[assembly: AssemblyDescription("Autofac Integration for RIA Services")]
[assembly: ComVisible(false)]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Extras.DomainServices")]
[assembly: ComVisible(false)]
|
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
|
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
|
C#
|
mit
|
autofac/Autofac.Extras.DomainServices
|
87e8074cd267f9f8676fa7f7f5ecc18ae3a56029
|
osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs
|
osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Audio.Track;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Beatmaps
{
public partial class WorkingBeatmap
{
/// <summary>
/// A type of <see cref="TrackVirtual"/> which provides a valid length based on the <see cref="HitObject"/>s of an <see cref="IBeatmap"/>.
/// </summary>
protected class VirtualBeatmapTrack : TrackVirtual
{
private readonly IBeatmap beatmap;
public VirtualBeatmapTrack(IBeatmap beatmap)
{
this.beatmap = beatmap;
updateVirtualLength();
}
protected override void UpdateState()
{
updateVirtualLength();
base.UpdateState();
}
private void updateVirtualLength()
{
var lastObject = beatmap.HitObjects.LastOrDefault();
switch (lastObject)
{
case null:
Length = 1000;
break;
case IHasEndTime endTime:
Length = endTime.EndTime + 1000;
break;
default:
Length = lastObject.StartTime + 1000;
break;
}
}
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Audio.Track;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Beatmaps
{
public partial class WorkingBeatmap
{
/// <summary>
/// A type of <see cref="TrackVirtual"/> which provides a valid length based on the <see cref="HitObject"/>s of an <see cref="IBeatmap"/>.
/// </summary>
protected class VirtualBeatmapTrack : TrackVirtual
{
private const double excess_length = 1000;
private readonly IBeatmap beatmap;
public VirtualBeatmapTrack(IBeatmap beatmap)
{
this.beatmap = beatmap;
updateVirtualLength();
}
protected override void UpdateState()
{
updateVirtualLength();
base.UpdateState();
}
private void updateVirtualLength()
{
var lastObject = beatmap.HitObjects.LastOrDefault();
switch (lastObject)
{
case null:
Length = excess_length;
break;
case IHasEndTime endTime:
Length = endTime.EndTime + excess_length;
break;
default:
Length = lastObject.StartTime + excess_length;
break;
}
}
}
}
}
|
Use a const for excess length
|
Use a const for excess length
|
C#
|
mit
|
ZLima12/osu,naoey/osu,peppy/osu-new,UselessToucan/osu,EVAST9919/osu,ppy/osu,DrabWeb/osu,UselessToucan/osu,NeoAdonis/osu,naoey/osu,DrabWeb/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,naoey/osu,ppy/osu,johnneijzen/osu,ppy/osu,ZLima12/osu,johnneijzen/osu,2yangk23/osu,NeoAdonis/osu,DrabWeb/osu,smoogipooo/osu,peppy/osu,EVAST9919/osu,2yangk23/osu
|
a22e6cf46b2fd8833b7dc20600e54f0fba04daec
|
source/Nuke.Core/Tooling/ProcessExtensions.cs
|
source/Nuke.Core/Tooling/ProcessExtensions.cs
|
// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Nuke.Core.Utilities;
namespace Nuke.Core.Tooling
{
[PublicAPI]
[DebuggerStepThrough]
[DebuggerNonUserCode]
public static class ProcessExtensions
{
[AssertionMethod]
public static void AssertWaitForExit ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process)
{
ControlFlow.Assert(process != null && process.WaitForExit(), "process != null && process.WaitForExit()");
}
[AssertionMethod]
public static void AssertZeroExitCode ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process)
{
process.AssertWaitForExit();
ControlFlow.Assert(process.ExitCode == 0,
new[]
{
$"Process '{Path.GetFileName(process.StartInfo.FileName)}' exited with code {process.ExitCode}. Please verify the invocation:",
$"> {process.StartInfo.FileName.DoubleQuoteIfNeeded()} {process.StartInfo.Arguments}"
}.Join(EnvironmentInfo.NewLine));
}
public static IEnumerable<Output> EnsureOnlyStd (this IEnumerable<Output> output)
{
foreach (var o in output)
{
ControlFlow.Assert(o.Type == OutputType.Std, "o.Type == OutputType.Std");
yield return o;
}
}
}
}
|
// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Nuke.Core.Utilities;
namespace Nuke.Core.Tooling
{
[PublicAPI]
[DebuggerStepThrough]
[DebuggerNonUserCode]
public static class ProcessExtensions
{
[AssertionMethod]
public static void AssertWaitForExit ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process)
{
ControlFlow.Assert(process != null && process.WaitForExit(), "process != null && process.WaitForExit()");
}
[AssertionMethod]
public static void AssertZeroExitCode ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process)
{
process.AssertWaitForExit();
ControlFlow.Assert(process.ExitCode == 0,
$"Process '{Path.GetFileName(process.StartInfo.FileName)}' exited with code {process.ExitCode}. Please verify the invocation.");
}
public static IEnumerable<Output> EnsureOnlyStd (this IEnumerable<Output> output)
{
foreach (var o in output)
{
ControlFlow.Assert(o.Type == OutputType.Std, "o.Type == OutputType.Std");
yield return o;
}
}
}
}
|
Remove printing of invocation in case of non-zero exit code.
|
Remove printing of invocation in case of non-zero exit code.
|
C#
|
mit
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
a677091e838febe3c9ff0ea05548b9cd9587a542
|
Src/MvcPages/BrowserCamera/Storage/FileSystemScreenshotStorage.cs
|
Src/MvcPages/BrowserCamera/Storage/FileSystemScreenshotStorage.cs
|
using System;
using System.Drawing.Imaging;
using System.IO;
using Tellurium.MvcPages.Utils;
namespace Tellurium.MvcPages.BrowserCamera.Storage
{
public class FileSystemScreenshotStorage : IScreenshotStorage
{
private readonly string screenshotDirectoryPath;
public FileSystemScreenshotStorage(string screenshotDirectoryPath)
{
this.screenshotDirectoryPath = screenshotDirectoryPath;
}
public virtual void Persist(byte[] image, string screenshotName)
{
var screenshotPath = GetScreenshotPath(screenshotName);
image.ToBitmap().Save(screenshotPath, ImageFormat.Jpeg);
}
protected string GetScreenshotPath(string screenshotName)
{
if (string.IsNullOrWhiteSpace(screenshotDirectoryPath))
{
throw new ApplicationException("Screenshot directory path not defined");
}
if (string.IsNullOrWhiteSpace(screenshotName))
{
throw new ArgumentException("Screenshot name cannot be empty", nameof(screenshotName));
}
var fileName = $"{screenshotName}.jpg";
return Path.Combine(screenshotDirectoryPath, fileName);
}
}
}
|
using System;
using System.Drawing.Imaging;
using System.IO;
using Tellurium.MvcPages.Utils;
namespace Tellurium.MvcPages.BrowserCamera.Storage
{
public class FileSystemScreenshotStorage : IScreenshotStorage
{
private readonly string screenshotDirectoryPath;
public FileSystemScreenshotStorage(string screenshotDirectoryPath)
{
this.screenshotDirectoryPath = screenshotDirectoryPath;
}
public virtual void Persist(byte[] image, string screenshotName)
{
var screenshotPath = GetScreenshotPath(screenshotName);
image.ToBitmap().Save(screenshotPath, ImageFormat.Jpeg);
}
protected string GetScreenshotPath(string screenshotName)
{
if (string.IsNullOrWhiteSpace(screenshotDirectoryPath))
{
throw new ApplicationException("Screenshot directory path not defined");
}
if (string.IsNullOrWhiteSpace(screenshotName))
{
throw new ArgumentException("Screenshot name cannot be empty", nameof(screenshotName));
}
if (Directory.Exists(screenshotDirectoryPath) == false)
{
Directory.CreateDirectory(screenshotDirectoryPath);
}
var fileName = $"{screenshotName}.jpg";
return Path.Combine(screenshotDirectoryPath, fileName);
}
}
}
|
Create directory for error screenshot if it does not exist
|
Create directory for error screenshot if it does not exist
|
C#
|
mit
|
cezarypiatek/Tellurium,cezarypiatek/Tellurium,cezarypiatek/MaintainableSelenium,cezarypiatek/MaintainableSelenium,cezarypiatek/MaintainableSelenium,cezarypiatek/Tellurium
|
fb5d92bdc02f1ed2af73fc26bbee67be20a2bb99
|
src/Microsoft.AspNetCore.Mvc.Core/Internal/TaskCache.cs
|
src/Microsoft.AspNetCore.Mvc.Core/Internal/TaskCache.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.Threading.Tasks;
namespace Microsoft.AspNetCore.Mvc.Internal
{
public static class TaskCache
{
#if NET451
static readonly Task _completedTask = Task.FromResult(0);
#endif
/// <summary>Gets a task that's already been completed successfully.</summary>
/// <remarks>May not always return the same instance.</remarks>
public static Task CompletedTask
{
get
{
#if NET451
return _completedTask;
#else
return Task.CompletedTask;
#endif
}
}
}
}
|
// 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.Threading.Tasks;
namespace Microsoft.AspNetCore.Mvc.Internal
{
public static class TaskCache
{
/// <summary>
/// A <see cref="Task"/> that's already completed successfully.
/// </summary>
/// <remarks>
/// We're caching this in a static readonly field to make it more inlinable and avoid the volatile lookup done
/// by <c>Task.CompletedTask</c>.
/// </remarks>
#if NET451
public static readonly Task CompletedTask = Task.FromResult(0);
#else
public static readonly Task CompletedTask = Task.CompletedTask;
#endif
}
}
|
Change our cached task to a field
|
Change our cached task to a field
This makes it more inlinable and saves a volatile lookup on netstandard.
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
0369da1b3a05c57ea658b48fa0c02a00091fb190
|
tests/Magick.NET.Tests/ResourceLimitsTests/TheMaxMemoryRequest.cs
|
tests/Magick.NET.Tests/ResourceLimitsTests/TheMaxMemoryRequest.cs
|
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.
using ImageMagick;
using Xunit;
using Xunit.Sdk;
namespace Magick.NET.Tests
{
public partial class ResourceLimitsTests
{
[Collection(nameof(RunTestsSeparately))]
public class TheMaxMemoryRequest
{
[Fact]
public void ShouldHaveTheCorrectValue()
{
if (ResourceLimits.MaxMemoryRequest < 100000000U)
throw new XunitException("Invalid memory limit: " + ResourceLimits.MaxMemoryRequest);
}
[Fact]
public void ShouldReturnTheCorrectValueWhenChanged()
{
var oldMemory = ResourceLimits.MaxMemoryRequest;
var newMemory = (ulong)(ResourceLimits.MaxMemoryRequest * 0.9);
ResourceLimits.MaxMemoryRequest = newMemory;
Assert.Equal(newMemory, ResourceLimits.MaxMemoryRequest);
ResourceLimits.MaxMemoryRequest = oldMemory;
}
}
}
}
|
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.
using ImageMagick;
using Xunit;
using Xunit.Sdk;
namespace Magick.NET.Tests
{
public partial class ResourceLimitsTests
{
[Collection(nameof(RunTestsSeparately))]
public class TheMaxMemoryRequest
{
[Fact]
public void ShouldHaveTheCorrectValue()
{
if (ResourceLimits.MaxMemoryRequest < 100000000U)
throw new XunitException("Invalid memory limit: " + ResourceLimits.MaxMemoryRequest);
}
[Fact]
public void ShouldReturnTheCorrectValueWhenChanged()
{
var oldMemory = ResourceLimits.MaxMemoryRequest;
var newMemory = (ulong)(ResourceLimits.MaxMemoryRequest * 0.8);
ResourceLimits.MaxMemoryRequest = newMemory;
Assert.Equal(newMemory, ResourceLimits.MaxMemoryRequest);
ResourceLimits.MaxMemoryRequest = oldMemory;
}
}
}
}
|
Use different percentage in the unit test.
|
Use different percentage in the unit test.
|
C#
|
apache-2.0
|
dlemstra/Magick.NET,dlemstra/Magick.NET
|
c6eaba6efe0334aa9a612b5d8a116c67b89d9c34
|
State.cs
|
State.cs
|
using System.Collections.Generic;
namespace AttachToolbar
{
internal static class State
{
public static string ProcessName = "";
public static List<string> ProcessList = new List<string>();
public static EngineType EngineType = EngineType.Native;
public static bool IsAttached = false;
public static void Clear()
{
ProcessList.Clear();
EngineType = EngineType.Native;
IsAttached = false;
ProcessName = "";
}
}
}
|
using System.Collections.Generic;
namespace AttachToolbar
{
internal static class State
{
public static int ProcessIndex = -1;
public static List<string> ProcessList = new List<string>();
public static EngineType EngineType = EngineType.Native;
public static bool IsAttached = false;
public static string ProcessName
{
get
{
string processName = ProcessIndex >= 0
? ProcessList[ProcessIndex]
: "";
return processName;
}
set
{
ProcessIndex = ProcessList.IndexOf(value);
}
}
public static void Clear()
{
ProcessList.Clear();
EngineType = EngineType.Native;
IsAttached = false;
ProcessIndex = -1;
}
}
}
|
Add process index to state as primary key. Use process name as property
|
Add process index to state as primary key. Use process name as property
|
C#
|
mit
|
fareloz/AttachToolbar
|
2af63bf54c7e5c1aa0709a214b2f1b947ed7f4b4
|
src/BloomExe/Utils/MemoryUtils.cs
|
src/BloomExe/Utils/MemoryUtils.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bloom.Utils
{
class MemoryUtils
{
/// <summary>
/// A crude way of measuring when we might be short enough of memory to need a full reload.
/// </summary>
/// <returns></returns>
public static bool SystemIsShortOfMemory()
{
// A rather arbitrary limit of 750M...a bit more than Bloom typically uses for a large book
// before memory leaks start to mount up.
return GetPrivateBytes() > 750000000;
}
/// <summary>
/// Significance: This counter indicates the current number of bytes allocated to this process that cannot be shared with
/// other processes. This counter has been useful for identifying memory leaks.
/// </summary>
/// <remarks>We've had other versions of this method which, confusingly, returned results in KB. This one actually answers bytes.</remarks>
/// <returns></returns>
public static long GetPrivateBytes()
{
using (var perfCounter = new PerformanceCounter("Process", "Private Bytes",
Process.GetCurrentProcess().ProcessName))
{
return perfCounter.RawValue;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bloom.Utils
{
class MemoryUtils
{
/// <summary>
/// A crude way of measuring when we might be short enough of memory to need a full reload.
/// </summary>
/// <returns></returns>
public static bool SystemIsShortOfMemory()
{
// A rather arbitrary limit of 750M...a bit more than Bloom typically uses for a large book
// before memory leaks start to mount up. A larger value is wanted for 64-bit processes
// since they can start out above the 750M level.
var triggerLevel = Environment.Is64BitProcess ? 2000000000L : 750000000;
return GetPrivateBytes() > triggerLevel;
}
/// <summary>
/// Significance: This value indicates the current number of bytes allocated to this process that cannot be shared with
/// other processes. This value has been useful for identifying memory leaks.
/// </summary>
/// <remarks>We've had other versions of this method which, confusingly, returned results in KB. This one actually answers bytes.</remarks>
public static long GetPrivateBytes()
{
// Using a PerformanceCounter does not work on Linux and gains nothing on Windows.
// After using the PerformanceCounter once on Windows, it always returns the same
// value as getting it directly from the Process property.
using (var process = Process.GetCurrentProcess())
{
return process.PrivateMemorySize64;
}
}
}
}
|
Fix system memory check for Linux (20210323)
|
Fix system memory check for Linux (20210323)
|
C#
|
mit
|
gmartin7/myBloomFork,gmartin7/myBloomFork,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork
|
b87918def42cb623c3ce0435101d80302a0d7667
|
src/Narochno.Credstash/Internal/CredstashItem.cs
|
src/Narochno.Credstash/Internal/CredstashItem.cs
|
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
namespace Narochno.Credstash.Internal
{
public class CredstashItem
{
public const string DEFAULT_DIGEST = "SHA256";
public string Name { get; set; }
public string Version { get; set; }
public string Contents { get; set; }
public string Digest { get; set; }
public string Hmac { get; set; }
public string Key { get; set; }
public static CredstashItem From(Dictionary<string, AttributeValue> item)
{
return new CredstashItem
{
Name = item["name"].S,
Version = item["version"].S,
Contents = item["contents"].S,
Digest = item["digest"]?.S ?? DEFAULT_DIGEST,
Hmac = item["hmac"].S,
Key = item["key"].S,
};
}
}
}
|
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
namespace Narochno.Credstash.Internal
{
public class CredstashItem
{
public const string DEFAULT_DIGEST = "SHA256";
public string Name { get; set; }
public string Version { get; set; }
public string Contents { get; set; }
public string Digest { get; set; }
public string Hmac { get; set; }
public string Key { get; set; }
public static CredstashItem From(Dictionary<string, AttributeValue> item)
{
return new CredstashItem
{
Name = item["name"].S,
Version = item["version"].S,
Contents = item["contents"].S,
Digest = (item.ContainsKey("digest") ? item["digest"]?.S : null) ?? DEFAULT_DIGEST,
Hmac = item["hmac"].S,
Key = item["key"].S,
};
}
}
}
|
Update for Dict contains before null check
|
Update for Dict contains before null check
|
C#
|
apache-2.0
|
Narochno/Narochno.Credstash
|
cb264e95b7527044f159ea1a9e9c5f4875bf1db4
|
FileLogging.cs
|
FileLogging.cs
|
using System;
using System.Diagnostics;
using System.IO;
namespace PackageRunner
{
/// <summary>
/// </summary>
internal class FileLogging
{
private readonly string _file;
private static readonly object _lock = new object();
public FileLogging(string file)
{
_file = file;
}
public void AddLine(string text)
{
lock (_lock)
{
File.AppendAllText(_file, DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " " + text);
Debug.WriteLine(text);
}
}
/// <summary>
/// </summary>
public void AddLine(string format, params object[] args)
{
var text = string.Format(format, args);
this.AddLine(text);
}
}
}
|
using System;
using System.Diagnostics;
using System.IO;
namespace PackageRunner
{
/// <summary>
/// </summary>
internal class FileLogging
{
private readonly string _file;
private static readonly object _lock = new object();
public FileLogging(string file)
{
_file = file;
}
public void AddLine(string text)
{
lock (_lock)
{
File.AppendAllText(_file, DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " " + text + Environment.NewLine);
Debug.WriteLine(text);
}
}
/// <summary>
/// </summary>
public void AddLine(string format, params object[] args)
{
var text = string.Format(format, args);
this.AddLine(text);
}
}
}
|
Add new line for file logging
|
Add new line for file logging
|
C#
|
mit
|
pandell/PackageRunner
|
8d8349d27bce60508b2a4416b5a3e07ad8e3102b
|
Src/Dashboard/Program.cs
|
Src/Dashboard/Program.cs
|
using System;
using System.Threading;
using Topshelf;
namespace Tellurium.VisualAssertion.Dashboard
{
public class Program
{
public static void Main(string[] args)
{
#if DEBUG
using (var server = new WebServer())
{
server.Run(consoleMode:true);
Console.ReadKey();
}
#else
InstallDashboardService();
#endif
}
private static void InstallDashboardService()
{
HostFactory.Run(hostConfiguration =>
{
hostConfiguration.Service<WebServer>(wsc =>
{
wsc.ConstructUsing(() => new WebServer());
wsc.WhenStarted(server =>
{
server.Run();
});
wsc.WhenStopped(ws => ws.Dispose());
});
hostConfiguration.RunAsLocalSystem();
hostConfiguration.SetDescription("This is Tellurium Dashboard");
hostConfiguration.SetDisplayName("Tellurium Dashboard");
hostConfiguration.SetServiceName("TelluriumDashboard");
hostConfiguration.StartAutomatically();
});
}
}
}
|
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using Topshelf;
namespace Tellurium.VisualAssertion.Dashboard
{
public class Program
{
public static void Main(string[] args)
{
#if DEBUG
using (var server = new WebServer())
{
Console.SetOut(new DebugWriter());
server.Run(consoleMode:true);
Console.ReadKey();
}
#else
InstallDashboardService();
#endif
}
private static void InstallDashboardService()
{
HostFactory.Run(hostConfiguration =>
{
hostConfiguration.Service<WebServer>(wsc =>
{
wsc.ConstructUsing(() => new WebServer());
wsc.WhenStarted(server =>
{
server.Run();
});
wsc.WhenStopped(ws => ws.Dispose());
});
hostConfiguration.RunAsLocalSystem();
hostConfiguration.SetDescription("This is Tellurium Dashboard");
hostConfiguration.SetDisplayName("Tellurium Dashboard");
hostConfiguration.SetServiceName("TelluriumDashboard");
hostConfiguration.StartAutomatically();
});
}
}
public class DebugWriter : StringWriter
{
public override void WriteLine(string value)
{
Debug.WriteLine(value);
base.WriteLine(value);
}
}
}
|
Add Debug writer for diagnostic purpose
|
Add Debug writer for diagnostic purpose
|
C#
|
mit
|
cezarypiatek/MaintainableSelenium,cezarypiatek/MaintainableSelenium,cezarypiatek/Tellurium,cezarypiatek/Tellurium,cezarypiatek/Tellurium,cezarypiatek/MaintainableSelenium
|
95f28d916ddc6f460f2aa2bc1f04fd9275f0c0c0
|
BaskervilleWebsite/Baskerville.Models/DataModels/ProductCategory.cs
|
BaskervilleWebsite/Baskerville.Models/DataModels/ProductCategory.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Baskerville.Models.DataModels
{
public class ProductCategory
{
public ProductCategory()
{
this.Products = new HashSet<Product>();
this.Subcategories = new HashSet<ProductCategory>();
}
public int Id { get; set; }
public string NameBg { get; set; }
public string NameEn { get; set; }
public bool IsRemoved { get; set; }
public bool IsPrimary { get; set; }
public ICollection<Product> Products { get; set; }
public ICollection<ProductCategory> Subcategories { get; set; }
public int? PrimaryCategoryId { get; set; }
public ProductCategory PrimaryCategory { get; set; }
}
}
|
namespace Baskerville.Models.DataModels
{
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
public class ProductCategory
{
public ProductCategory()
{
this.Products = new HashSet<Product>();
this.Subcategories = new HashSet<ProductCategory>();
}
public int Id { get; set; }
[Required]
public string NameBg { get; set; }
[Required]
public string NameEn { get; set; }
public bool IsRemoved { get; set; }
public bool IsPrimary { get; set; }
public ICollection<Product> Products { get; set; }
public ICollection<ProductCategory> Subcategories { get; set; }
public int? PrimaryCategoryId { get; set; }
public ProductCategory PrimaryCategory { get; set; }
}
}
|
Add Db validation for ProductCategories model
|
Add Db validation for ProductCategories model
|
C#
|
apache-2.0
|
MarioZisov/Baskerville,MarioZisov/Baskerville,MarioZisov/Baskerville
|
62cf350f010cf42be020ae0a5db1d210fa945194
|
Core/Theraot/Threading/ThreadingHelper.extra.cs
|
Core/Theraot/Threading/ThreadingHelper.extra.cs
|
#if FAT
namespace Theraot.Threading
{
public static partial class ThreadingHelper
{
private static readonly RuntimeUniqueIdProdiver _threadIdProvider = new RuntimeUniqueIdProdiver();
// Leaked until AppDomain unload
private static readonly NoTrackingThreadLocal<RuntimeUniqueIdProdiver.UniqueId> _threadRuntimeUniqueId = new NoTrackingThreadLocal<RuntimeUniqueIdProdiver.UniqueId>(_threadIdProvider.GetNextId);
public static bool HasThreadUniqueId
{
get
{
return _threadRuntimeUniqueId.IsValueCreated;
}
}
public static RuntimeUniqueIdProdiver.UniqueId ThreadUniqueId
{
get
{
return _threadRuntimeUniqueId.Value;
}
}
}
}
#endif
|
#if FAT
namespace Theraot.Threading
{
public static partial class ThreadingHelper
{
// Leaked until AppDomain unload
private static readonly NoTrackingThreadLocal<RuntimeUniqueIdProdiver.UniqueId> _threadRuntimeUniqueId = new NoTrackingThreadLocal<RuntimeUniqueIdProdiver.UniqueId>(RuntimeUniqueIdProdiver.GetNextId);
public static bool HasThreadUniqueId
{
get
{
return _threadRuntimeUniqueId.IsValueCreated;
}
}
public static RuntimeUniqueIdProdiver.UniqueId ThreadUniqueId
{
get
{
return _threadRuntimeUniqueId.Value;
}
}
}
}
#endif
|
Fix - RuntimeUniqueIdProdiver is static
|
Fix - RuntimeUniqueIdProdiver is static
|
C#
|
mit
|
theraot/Theraot
|
7543b4fb93889fc704b6d200a9306ef91bccdedd
|
src/IdentityServer3.Contrib.RedisStores/Stores/RefreshTokenStore.cs
|
src/IdentityServer3.Contrib.RedisStores/Stores/RefreshTokenStore.cs
|
using IdentityServer3.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using IdentityServer3.Core.Models;
using IdentityServer3.Contrib.RedisStores.Models;
using StackExchange.Redis;
using IdentityServer3.Contrib.RedisStores.Converters;
namespace IdentityServer3.Contrib.RedisStores.Stores
{
/// <summary>
///
/// </summary>
public class RefreshTokenStore : RedisTransientStore<RefreshToken, RefreshTokenModel>
{
/// <summary>
///
/// </summary>
/// <param name="redis"></param>
/// <param name="options"></param>
public RefreshTokenStore(IDatabase redis, RedisOptions options) : base(redis, options, new RefreshTokenConverter())
{
}
/// <summary>
///
/// </summary>
/// <param name="redis"></param>
public RefreshTokenStore(IDatabase redis) : base(redis, new RefreshTokenConverter())
{
}
internal override string CollectionName => "refreshTokens";
internal override int GetTokenLifetime(RefreshToken token)
{
return token.LifeTime;
}
}
}
|
using IdentityServer3.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using IdentityServer3.Core.Models;
using IdentityServer3.Contrib.RedisStores.Models;
using StackExchange.Redis;
using IdentityServer3.Contrib.RedisStores.Converters;
namespace IdentityServer3.Contrib.RedisStores
{
/// <summary>
///
/// </summary>
public class RefreshTokenStore : RedisTransientStore<RefreshToken, RefreshTokenModel>, IRefreshTokenStore
{
/// <summary>
///
/// </summary>
/// <param name="redis"></param>
/// <param name="options"></param>
public RefreshTokenStore(IDatabase redis, RedisOptions options) : base(redis, options, new RefreshTokenConverter())
{
}
/// <summary>
///
/// </summary>
/// <param name="redis"></param>
public RefreshTokenStore(IDatabase redis) : base(redis, new RefreshTokenConverter())
{
}
internal override string CollectionName => "refreshTokens";
internal override int GetTokenLifetime(RefreshToken token)
{
return token.LifeTime;
}
}
}
|
Fix namespace and add inheritance
|
Fix namespace and add inheritance
|
C#
|
mit
|
mniak/IdentityServer3.Contrib.RedisStores
|
5b3e02eaac6add02774d8030c216e95d772f6bc7
|
EOLib/PacketHandlers/ConnectionPlayerHandler.cs
|
EOLib/PacketHandlers/ConnectionPlayerHandler.cs
|
using AutomaticTypeMapper;
using EOLib.Logger;
using EOLib.Net;
using EOLib.Net.Communication;
using EOLib.Net.Handlers;
using EOLib.Net.PacketProcessing;
namespace EOLib.PacketHandlers
{
/// <summary>
/// Handles incoming CONNECTION_PLAYER packets which are used for updating sequence numbers in the EO protocol
/// </summary>
[AutoMappedType]
public class ConnectionPlayerHandler : DefaultAsyncPacketHandler
{
private readonly IPacketProcessActions _packetProcessActions;
private readonly IPacketSendService _packetSendService;
private readonly ILoggerProvider _loggerProvider;
public override PacketFamily Family => PacketFamily.Connection;
public override PacketAction Action => PacketAction.Player;
public override bool CanHandle => true;
public ConnectionPlayerHandler(IPacketProcessActions packetProcessActions,
IPacketSendService packetSendService,
ILoggerProvider loggerProvider)
{
_packetProcessActions = packetProcessActions;
_packetSendService = packetSendService;
_loggerProvider = loggerProvider;
}
public override bool HandlePacket(IPacket packet)
{
var seq1 = packet.ReadShort();
var seq2 = packet.ReadChar();
_packetProcessActions.SetUpdatedBaseSequenceNumber(seq1, seq2);
var response = new PacketBuilder(PacketFamily.Connection, PacketAction.Ping).Build();
try
{
_packetSendService.SendPacket(response);
}
catch (NoDataSentException)
{
return false;
}
return true;
}
}
}
|
using AutomaticTypeMapper;
using EOLib.Logger;
using EOLib.Net;
using EOLib.Net.Communication;
using EOLib.Net.Handlers;
using EOLib.Net.PacketProcessing;
namespace EOLib.PacketHandlers
{
/// <summary>
/// Handles incoming CONNECTION_PLAYER packets which are used for updating sequence numbers in the EO protocol
/// </summary>
[AutoMappedType]
public class ConnectionPlayerHandler : DefaultAsyncPacketHandler
{
private readonly IPacketProcessActions _packetProcessActions;
private readonly IPacketSendService _packetSendService;
private readonly ILoggerProvider _loggerProvider;
public override PacketFamily Family => PacketFamily.Connection;
public override PacketAction Action => PacketAction.Player;
public override bool CanHandle => true;
public ConnectionPlayerHandler(IPacketProcessActions packetProcessActions,
IPacketSendService packetSendService,
ILoggerProvider loggerProvider)
{
_packetProcessActions = packetProcessActions;
_packetSendService = packetSendService;
_loggerProvider = loggerProvider;
}
public override bool HandlePacket(IPacket packet)
{
var seq1 = packet.ReadShort();
var seq2 = packet.ReadChar();
_packetProcessActions.SetUpdatedBaseSequenceNumber(seq1, seq2);
var response = new PacketBuilder(PacketFamily.Connection, PacketAction.Ping)
.AddString("k")
.Build();
try
{
_packetSendService.SendPacket(response);
}
catch (NoDataSentException)
{
return false;
}
return true;
}
}
}
|
Fix handling of CONNECTION_PLAYER when sending response to GameServer
|
Fix handling of CONNECTION_PLAYER when sending response to GameServer
|
C#
|
mit
|
ethanmoffat/EndlessClient
|
c8c77a465d3468cacbd81dc55fb4f46f975c2cba
|
gdRead.Data/Models/Post.cs
|
gdRead.Data/Models/Post.cs
|
using System;
namespace gdRead.Data.Models
{
public class Post
{
public int Id { get; set; }
public int FeedId { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public string Summary { get; set; }
public string Content { get; set; }
public DateTime PublishDate { get; set; }
public bool Read { get; set; }
public DateTime DateFetched { get;set; }
public Post()
{
DateFetched = DateTime.Now;
}
}
}
|
using System;
using DapperExtensions.Mapper;
namespace gdRead.Data.Models
{
public class Post
{
public int Id { get; set; }
public int FeedId { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public string Summary { get; set; }
public string Content { get; set; }
public DateTime PublishDate { get; set; }
public bool Read { get; set; }
public DateTime DateFetched { get;set; }
public Post()
{
DateFetched = DateTime.Now;
}
}
public class PostMapper : ClassMapper<Post>
{
public PostMapper()
{
Table("Post");
Map(m => m.Read).Ignore();
AutoMap();
}
}
}
|
Fix issue where Dapper was trying to insert Read into the post table where that column doesnt exist
|
Fix issue where Dapper was trying to insert Read into the post table where that column doesnt exist
|
C#
|
mit
|
gavdraper/gdRead,gavdraper/gdRead
|
cb5c6e2531d47151884300c5dd3d46e139867042
|
WalletWasabi.Gui/ManagedDialogs/ManagedFileChooserFilterViewModel.cs
|
WalletWasabi.Gui/ManagedDialogs/ManagedFileChooserFilterViewModel.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Gui.ManagedDialogs
{
internal class ManagedFileChooserFilterViewModel : ViewModelBase
{
private readonly string[] Extensions;
public string Name { get; }
public ManagedFileChooserFilterViewModel(FileDialogFilter filter)
{
Name = filter.Name;
if (filter.Extensions.Contains("*"))
{
return;
}
Extensions = filter.Extensions?.Select(e => "." + e.ToLowerInvariant()).ToArray();
}
public ManagedFileChooserFilterViewModel()
{
Name = "All files";
}
public bool Match(string filename)
{
if (Extensions is null)
{
return true;
}
foreach (var ext in Extensions)
{
if (filename.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase))
{
return true;
}
}
return false;
}
public override string ToString() => Name;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Gui.ManagedDialogs
{
internal class ManagedFileChooserFilterViewModel : ViewModelBase
{
private IEnumerable<string> Extensions { get; }
public string Name { get; }
public ManagedFileChooserFilterViewModel(FileDialogFilter filter)
{
Name = filter.Name;
if (filter.Extensions.Contains("*"))
{
return;
}
Extensions = filter.Extensions?.Select(e => "." + e.ToLowerInvariant());
}
public ManagedFileChooserFilterViewModel()
{
Name = "All files";
}
public bool Match(string filename)
{
if (Extensions is null)
{
return true;
}
foreach (var ext in Extensions)
{
if (filename.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase))
{
return true;
}
}
return false;
}
public override string ToString() => Name;
}
}
|
Replace string[] field by IEnumerable<string> property
|
Replace string[] field by IEnumerable<string> property
|
C#
|
mit
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
a3570e38720fcf3a1890466656c1f136e53ac669
|
Samples/BuildDependencyTestApp/Properties/AssemblyInfo.cs
|
Samples/BuildDependencyTestApp/Properties/AssemblyInfo.cs
|
// Copyright (c) 2015 Eberhard Beilharz
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("BuildDependencyTestApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("(c) 2014-2016 Eberhard Beilharz")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
// Copyright (c) 2015 Eberhard Beilharz
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("BuildDependencyTestApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("(c) 2014-2017 Eberhard Beilharz")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
|
Use GitVersion for test app
|
Use GitVersion for test app
|
C#
|
mit
|
ermshiperete/BuildDependency
|
23091ff4ffc8cbc3b53853912a8735c1faf94f5b
|
src/DotVVM.Framework/Compilation/Binding/DefaultExtensionsProvider.cs
|
src/DotVVM.Framework/Compilation/Binding/DefaultExtensionsProvider.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DotVVM.Framework.Compilation.Binding
{
public class DefaultExtensionsProvider : IExtensionsProvider
{
private readonly List<Type> typesLookup;
public DefaultExtensionsProvider()
{
typesLookup = new List<Type>();
AddTypeForExtensionsLookup(typeof(Enumerable));
}
protected void AddTypeForExtensionsLookup(Type type)
{
typesLookup.Add(typeof(Enumerable));
}
public virtual IEnumerable<MethodInfo> GetExtensionMethods()
{
foreach (var registeredType in typesLookup)
foreach (var method in registeredType.GetMethods(BindingFlags.Public | BindingFlags.Static))
yield return method;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DotVVM.Framework.Compilation.Binding
{
public class DefaultExtensionsProvider : IExtensionsProvider
{
private readonly List<Type> typesLookup;
public DefaultExtensionsProvider()
{
typesLookup = new List<Type>();
AddTypeForExtensionsLookup(typeof(Enumerable));
}
protected void AddTypeForExtensionsLookup(Type type)
{
typesLookup.Add(type);
}
public virtual IEnumerable<MethodInfo> GetExtensionMethods()
{
foreach (var registeredType in typesLookup)
foreach (var method in registeredType.GetMethods(BindingFlags.Public | BindingFlags.Static))
yield return method;
}
}
}
|
Fix issue when adding type to ExtensionsProvider
|
Fix issue when adding type to ExtensionsProvider
|
C#
|
apache-2.0
|
riganti/dotvvm,riganti/dotvvm,riganti/dotvvm,riganti/dotvvm
|
df5a781b1e31473f4baa8c558edc74172b0d1755
|
samples/cs/minigzip/Main.cs
|
samples/cs/minigzip/Main.cs
|
// project created on 11.11.2001 at 15:19
using System;
using System.IO;
using ICSharpCode.SharpZipLib.GZip;
class MainClass
{
public static void Main(string[] args)
{
if (args[0] == "-d") { // decompress
Stream s = new GZipInputStream(File.OpenRead(args[1]));
FileStream fs = File.Create(Path.GetFileNameWithoutExtension(args[1]));
int size = 2048;
byte[] writeData = new byte[2048];
while (true) {
size = s.Read(writeData, 0, size);
if (size > 0) {
fs.Write(writeData, 0, size);
} else {
break;
}
}
s.Close();
} else { // compress
Stream s = new GZipOutputStream(File.Create(args[0] + ".gz"));
FileStream fs = File.OpenRead(args[0]);
byte[] writeData = new byte[fs.Length];
fs.Read(writeData, 0, (int)fs.Length);
s.Write(writeData, 0, writeData.Length);
s.Close();
}
}
}
|
// project created on 11.11.2001 at 15:19
using System;
using System.IO;
using ICSharpCode.SharpZipLib.GZip;
class MainClass
{
public static void Main(string[] args)
{
if ( args.Length > 0 ) {
if ( args[0] == "-d" ) { // decompress
Stream s = new GZipInputStream(File.OpenRead(args[1]));
FileStream fs = File.Create(Path.GetFileNameWithoutExtension(args[1]));
int size = 2048;
byte[] writeData = new byte[2048];
while (true) {
size = s.Read(writeData, 0, size);
if (size > 0) {
fs.Write(writeData, 0, size);
} else {
break;
}
}
s.Close();
} else { // compress
Stream s = new GZipOutputStream(File.Create(args[0] + ".gz"));
FileStream fs = File.OpenRead(args[0]);
byte[] writeData = new byte[fs.Length];
fs.Read(writeData, 0, (int)fs.Length);
s.Write(writeData, 0, writeData.Length);
s.Close();
}
}
}
}
|
Stop exception when no argument sare suppplied to minigzip
|
Stop exception when no argument sare suppplied to minigzip
|
C#
|
mit
|
McNeight/SharpZipLib
|
1cea040c48466d64f5e637202df3cbb051d692ab
|
src/wrapper/Program.cs
|
src/wrapper/Program.cs
|
using System;
using System.IO;
using System.Reflection;
// ReSharper disable once CheckNamespace
internal static class Program
{
private static int Main(string[] args)
{
// Mono's XBuild uses assembly redirects to make sure it uses .NET 4.5 target binaries.
// We emulate it using our own assembly redirector.
AppDomain.CurrentDomain.AssemblyLoad += (sender, e) =>
{
var assemblyName = e.LoadedAssembly.GetName();
Console.WriteLine("Assembly load: {0}", assemblyName);
};
var mainAsm = Assembly.Load("citizenmp_server_updater");
mainAsm.GetType("Costura.AssemblyLoader")
.GetMethod("Attach")
.Invoke(null, null);
return (int) mainAsm.GetType("CitizenMP.Server.Installer.Program")
.GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Static)
.Invoke(null, new object[] {args});
}
}
|
using System;
using System.IO;
using System.Reflection;
// ReSharper disable once CheckNamespace
internal static class Program
{
private static int Main(string[] args)
{
var mainAsm = Assembly.Load("citizenmp_server_updater");
mainAsm.GetType("Costura.AssemblyLoader")
.GetMethod("Attach")
.Invoke(null, null);
return (int) mainAsm.GetType("CitizenMP.Server.Installer.Program")
.GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Static)
.Invoke(null, new object[] {args});
}
}
|
Remove assembly load debug lines.
|
Remove assembly load debug lines.
|
C#
|
mit
|
icedream/citizenmp-server-updater
|
ef220c14cdef4e4844b041795863bab7d76a1fef
|
SaurusConsole.Tests/MoveTests.cs
|
SaurusConsole.Tests/MoveTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SaurusConsole.OthelloAI;
namespace SaurusConsoleTests
{
[TestClass]
public class MoveTests
{
[TestMethod]
public void NotationConstuctorTest()
{
Move e4move = new Move("E4");
Assert.AreEqual("E4", e4move.ToString());
Move a1move = new Move("A1");
Assert.AreEqual("A1", a1move.ToString());
Move a8move = new Move("A8");
Assert.AreEqual("A8", a8move.ToString());
Move h1move = new Move("H1");
Assert.AreEqual("H1", h1move.ToString());
Move h8move = new Move("H8");
Assert.AreEqual("H8", h8move.ToString());
}
[TestMethod]
public void ToStringTest()
{
ulong h1Mask = 1;
Move h1Move = new Move(h1Mask);
Assert.AreEqual("H1", h1Move.ToString());
ulong e4Mask = 0x8000000;
Move e4Move = new Move(e4Mask);
Assert.AreEqual("E4", e4Move.ToString());
}
[TestMethod]
public void GetBitMaskTest()
{
ulong mask = 0b1000000000000;
Move move = new Move(mask);
Assert.AreEqual(mask, move.GetBitMask());
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SaurusConsole.OthelloAI;
namespace SaurusConsoleTests
{
[TestClass]
public class MoveTests
{
[TestMethod]
public void NotationConstuctorTest()
{
Move e4move = new Move("E4");
Assert.AreEqual("E4", e4move.ToString());
Move a1move = new Move("A1");
Assert.AreEqual("A1", a1move.ToString());
Move a8move = new Move("A8");
Assert.AreEqual("A8", a8move.ToString());
Move h1move = new Move("H1");
Assert.AreEqual("H1", h1move.ToString());
Move h8move = new Move("H8");
Assert.AreEqual("H8", h8move.ToString());
Assert.Fail();
}
[TestMethod]
public void ToStringTest()
{
ulong h1Mask = 1;
Move h1Move = new Move(h1Mask);
Assert.AreEqual("H1", h1Move.ToString());
ulong e4Mask = 0x8000000;
Move e4Move = new Move(e4Mask);
Assert.AreEqual("E4", e4Move.ToString());
}
[TestMethod]
public void GetBitMaskTest()
{
ulong mask = 0b1000000000000;
Move move = new Move(mask);
Assert.AreEqual(mask, move.GetBitMask());
}
}
}
|
Test if a failed test will fail the build
|
Test if a failed test will fail the build
|
C#
|
mit
|
plzb0ss/Saurus-Othello
|
fa3a3f4f0b3e0325d018e0946331b0416e2e1d33
|
SupportManager.Web/Program.cs
|
SupportManager.Web/Program.cs
|
using System.Diagnostics;
using System.IO;
using Hangfire;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.HttpSys;
using SupportManager.Contracts;
using Topshelf;
namespace SupportManager.Web
{
public class Program
{
private static string[] args;
public static void Main()
{
HostFactory.Run(cfg =>
{
cfg.AddCommandLineDefinition("aspnetcoreargs", v => args = v.Split(' '));
cfg.SetServiceName("SupportManager.Web");
cfg.SetDisplayName("SupportManager.Web");
cfg.SetDescription("SupportManager Web Interface");
cfg.Service<IWebHost>(svc =>
{
svc.ConstructUsing(CreateWebHost);
svc.WhenStarted(webHost =>
{
webHost.Start();
RecurringJob.AddOrUpdate<IForwarder>(f => f.ReadAllTeamStatus(null), Cron.Minutely);
});
svc.WhenStopped(webHost => webHost.Dispose());
});
cfg.RunAsLocalSystem();
cfg.StartAutomatically();
});
}
private static IWebHost CreateWebHost()
{
var builder = WebHost.CreateDefaultBuilder(args).UseStartup<Startup>();
if (!Debugger.IsAttached)
{
builder.UseHttpSys(options =>
{
options.Authentication.Schemes = AuthenticationSchemes.NTLM | AuthenticationSchemes.Negotiate;
options.Authentication.AllowAnonymous = true;
});
builder.UseContentRoot(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName));
}
return builder.Build();
}
}
}
|
using System.Diagnostics;
using System.IO;
using Hangfire;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.HttpSys;
using SupportManager.Contracts;
using Topshelf;
namespace SupportManager.Web
{
public class Program
{
private static string[] args;
public static void Main()
{
HostFactory.Run(cfg =>
{
cfg.AddCommandLineDefinition("aspnetcoreargs", v => args = v.Split(' '));
cfg.SetServiceName("SupportManager.Web");
cfg.SetDisplayName("SupportManager.Web");
cfg.SetDescription("SupportManager Web Interface");
cfg.Service<IWebHost>(svc =>
{
svc.ConstructUsing(CreateWebHost);
svc.WhenStarted(webHost =>
{
webHost.Start();
RecurringJob.AddOrUpdate<IForwarder>(f => f.ReadAllTeamStatus(null), Cron.MinuteInterval(10));
});
svc.WhenStopped(webHost => webHost.Dispose());
});
cfg.RunAsLocalSystem();
cfg.StartAutomatically();
});
}
private static IWebHost CreateWebHost()
{
var builder = WebHost.CreateDefaultBuilder(args).UseStartup<Startup>();
if (!Debugger.IsAttached)
{
builder.UseHttpSys(options =>
{
options.Authentication.Schemes = AuthenticationSchemes.NTLM | AuthenticationSchemes.Negotiate;
options.Authentication.AllowAnonymous = true;
});
builder.UseContentRoot(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName));
}
return builder.Build();
}
}
}
|
Set interval to 10 minutes
|
ReadAllTeamStatus: Set interval to 10 minutes
|
C#
|
mit
|
mycroes/SupportManager,mycroes/SupportManager,mycroes/SupportManager
|
62d4704d69b0e15675ec6a088b7e22dc09779bd0
|
src/Nether.Web/Features/Identity/Controllers/IdentityTestController.cs
|
src/Nether.Web/Features/Identity/Controllers/IdentityTestController.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
namespace Nether.Web.Features.Identity
{
[Route("identity-test")]
[Authorize]
public class IdentityTestController : ControllerBase
{
[HttpGet]
public IActionResult Get()
{
return new JsonResult(from c in User.Claims select new { c.Type, c.Value });
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
namespace Nether.Web.Features.Identity
{
[Route("identity-test")]
[Authorize]
public class IdentityTestController : ControllerBase
{
[HttpGet]
public IActionResult Get()
{
// Convert claim type, value pairs into a dictionary for easier consumption as JSON
// Need to group as there can be multiple claims of the same type (e.g. 'scope')
var result = User.Claims
.GroupBy(c => c.Type)
.ToDictionary(
keySelector: g => g.Key,
elementSelector: g => g.Count() == 1 ? (object)g.First().Value : g.Select(t => t.Value).ToArray()
);
return new JsonResult(result);
}
}
}
|
Make identity-test API easier to consume
|
Make identity-test API easier to consume
|
C#
|
mit
|
vflorusso/nether,stuartleeks/nether,navalev/nether,brentstineman/nether,ankodu/nether,vflorusso/nether,stuartleeks/nether,vflorusso/nether,navalev/nether,krist00fer/nether,MicrosoftDX/nether,ankodu/nether,brentstineman/nether,navalev/nether,ankodu/nether,brentstineman/nether,vflorusso/nether,brentstineman/nether,oliviak/nether,stuartleeks/nether,ankodu/nether,navalev/nether,stuartleeks/nether,brentstineman/nether,stuartleeks/nether,vflorusso/nether
|
59b65197f5fa35904f3cf047c482241ae7aa94fc
|
Brokerages/Alpaca/Markets/Messages/JsonError.cs
|
Brokerages/Alpaca/Markets/Messages/JsonError.cs
|
/*
* The official C# API client for alpaca brokerage
* Sourced from: https://github.com/alpacahq/alpaca-trade-api-csharp/tree/v3.0.2
*/
using System;
using Newtonsoft.Json;
namespace QuantConnect.Brokerages.Alpaca.Markets
{
internal sealed class JsonError
{
[JsonProperty(PropertyName = "code", Required = Required.Always)]
public Int32 Code { get; set; }
[JsonProperty(PropertyName = "message", Required = Required.Always)]
public String Message { get; set; }
}
}
|
/*
* The official C# API client for alpaca brokerage
* Sourced from: https://github.com/alpacahq/alpaca-trade-api-csharp/tree/v3.0.2
*/
using System;
using Newtonsoft.Json;
namespace QuantConnect.Brokerages.Alpaca.Markets
{
internal sealed class JsonError
{
[JsonProperty(PropertyName = "code", Required = Required.Default)]
public Int32 Code { get; set; }
[JsonProperty(PropertyName = "message", Required = Required.Always)]
public String Message { get; set; }
}
}
|
Fix Alpaca error message deserialization
|
Fix Alpaca error message deserialization
Some JSON error messages could not be deserialized because they do not contain the "code" property.
|
C#
|
apache-2.0
|
jameschch/Lean,JKarathiya/Lean,StefanoRaggi/Lean,jameschch/Lean,AlexCatarino/Lean,QuantConnect/Lean,QuantConnect/Lean,StefanoRaggi/Lean,AlexCatarino/Lean,AlexCatarino/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,JKarathiya/Lean,StefanoRaggi/Lean,QuantConnect/Lean,JKarathiya/Lean,JKarathiya/Lean,jameschch/Lean,jameschch/Lean,jameschch/Lean,QuantConnect/Lean
|
1013749a83365c54d7585e1a4289c54113754e52
|
osu.Game/Online/RealtimeMultiplayer/MultiplayerRoomUser.cs
|
osu.Game/Online/RealtimeMultiplayer/MultiplayerRoomUser.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using System;
using osu.Game.Users;
namespace osu.Game.Online.RealtimeMultiplayer
{
[Serializable]
public class MultiplayerRoomUser : IEquatable<MultiplayerRoomUser>
{
public readonly long UserID;
public MultiplayerUserState State { get; set; } = MultiplayerUserState.Idle;
public User? User { get; set; }
public MultiplayerRoomUser(in int userId)
{
UserID = userId;
}
public bool Equals(MultiplayerRoomUser other)
{
if (ReferenceEquals(this, other)) return true;
return UserID == other.UserID;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((MultiplayerRoomUser)obj);
}
public override int GetHashCode() => UserID.GetHashCode();
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using System;
using osu.Game.Users;
namespace osu.Game.Online.RealtimeMultiplayer
{
[Serializable]
public class MultiplayerRoomUser : IEquatable<MultiplayerRoomUser>
{
public readonly int UserID;
public MultiplayerUserState State { get; set; } = MultiplayerUserState.Idle;
public User? User { get; set; }
public MultiplayerRoomUser(in int userId)
{
UserID = userId;
}
public bool Equals(MultiplayerRoomUser other)
{
if (ReferenceEquals(this, other)) return true;
return UserID == other.UserID;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((MultiplayerRoomUser)obj);
}
public override int GetHashCode() => UserID.GetHashCode();
}
}
|
Change user id type to int
|
Change user id type to int
|
C#
|
mit
|
peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu-new,ppy/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu
|
66d270fc28a9b7ff70452576819af9f9b05295ae
|
IvionSoft/History.cs
|
IvionSoft/History.cs
|
using System;
using System.Collections.Generic;
namespace IvionSoft
{
public class History<T>
{
public int Length { get; private set; }
HashSet<T> hashes;
Queue<T> queue;
object _locker = new object();
public History(int length) : this(length, null)
{}
public History(int length, IEqualityComparer<T> comparer)
{
if (length < 1)
throw new ArgumentException("Must be 1 or larger", "length");
Length = length;
queue = new Queue<T>(length + 1);
if (comparer != null)
hashes = new HashSet<T>(comparer);
else
hashes = new HashSet<T>();
}
public bool Contains(T item)
{
return hashes.Contains(item);
}
public bool Add(T item)
{
bool added;
lock (_locker)
{
added = hashes.Add(item);
if (added)
{
queue.Enqueue(item);
if (queue.Count > Length)
{
T toRemove = queue.Dequeue();
hashes.Remove(toRemove);
}
}
}
return added;
}
}
}
|
using System;
using System.Collections.Generic;
namespace IvionSoft
{
public class History<T>
{
public int Length { get; private set; }
HashSet<T> hashes;
Queue<T> queue;
public History()
{
Length = 0;
}
public History(int length) : this(length, null)
{}
public History(int length, IEqualityComparer<T> comparer)
{
if (length < 1)
throw new ArgumentException("Cannot be less than or equal to 0.", "length");
Length = length;
queue = new Queue<T>(length + 1);
if (comparer != null)
hashes = new HashSet<T>(comparer);
else
hashes = new HashSet<T>();
}
public bool Contains(T item)
{
if (Length > 0)
return hashes.Contains(item);
else
return false;
}
public bool Add(T item)
{
if (Length == 0)
return false;
bool added;
added = hashes.Add(item);
if (added)
{
queue.Enqueue(item);
if (queue.Count > Length)
{
T toRemove = queue.Dequeue();
hashes.Remove(toRemove);
}
}
return added;
}
}
}
|
Remove locking code and make it possible to have a dummy history, by calling the parameterless constructor.
|
Remove locking code and make it possible to have a dummy history, by calling the parameterless constructor.
|
C#
|
bsd-2-clause
|
IvionSauce/MeidoBot
|
d4b35d236c240ca3e90fcb6c4ff31531a4930497
|
Confuser.Core/Project/Patterns/ModuleFunction.cs
|
Confuser.Core/Project/Patterns/ModuleFunction.cs
|
using System;
using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
/// <summary>
/// A function that compare the module of definition.
/// </summary>
public class ModuleFunction : PatternFunction {
internal const string FnName = "module";
/// <inheritdoc />
public override string Name {
get { return FnName; }
}
/// <inheritdoc />
public override int ArgumentCount {
get { return 1; }
}
/// <inheritdoc />
public override object Evaluate(IDnlibDef definition) {
if (!(definition is IOwnerModule))
return false;
object name = Arguments[0].Evaluate(definition);
return ((IOwnerModule)definition).Module.Name == name.ToString();
}
}
}
|
using System;
using dnlib.DotNet;
namespace Confuser.Core.Project.Patterns {
/// <summary>
/// A function that compare the module of definition.
/// </summary>
public class ModuleFunction : PatternFunction {
internal const string FnName = "module";
/// <inheritdoc />
public override string Name {
get { return FnName; }
}
/// <inheritdoc />
public override int ArgumentCount {
get { return 1; }
}
/// <inheritdoc />
public override object Evaluate(IDnlibDef definition) {
if (!(definition is IOwnerModule) && !(definition is IModule))
return false;
object name = Arguments[0].Evaluate(definition);
if (definition is IModule)
return ((IModule)definition).Name == name.ToString();
return ((IOwnerModule)definition).Module.Name == name.ToString();
}
}
}
|
Support module def in module function
|
Support module def in module function
|
C#
|
mit
|
Desolath/Confuserex,Desolath/ConfuserEx3,timnboys/ConfuserEx,yeaicc/ConfuserEx,engdata/ConfuserEx
|
e0ba1ddf58b73f8b6bfd86d01e1929352d1a904a
|
Destinations/FileDestination.cs
|
Destinations/FileDestination.cs
|
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Stampsy.ImageSource
{
public class FileDestination : IDestination<FileRequest>
{
public string Folder { get; private set; }
public FileDestination (string folder)
{
Folder = folder;
}
public FileRequest CreateRequest (IDescription description)
{
var url = description.Url;
var filename = ComputeHash (url) + description.Extension;
return new FileRequest (description) {
Filename = Path.Combine (Folder, filename)
};
}
static string ComputeHash (Uri url)
{
string hash;
using (var sha1 = new SHA1CryptoServiceProvider ()) {
var bytes = Encoding.ASCII.GetBytes (url.ToString ());
hash = BitConverter.ToString (sha1.ComputeHash (bytes));
}
return hash.Replace ("-", string.Empty).ToLower ();
}
}
}
|
using System;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace Stampsy.ImageSource
{
public class FileDestination : IDestination<FileRequest>
{
public static FileDestination InLibrary (params string [] folders)
{
var folder = Path.Combine (new [] { "..", "Library" }.Concat (folders).ToArray ());
Directory.CreateDirectory (folder);
return new FileDestination (folder);
}
public static FileDestination InLibraryCaches (params string [] folders)
{
return InLibrary (new [] { "Caches" }.Concat (folders).ToArray ());
}
public string Folder { get; private set; }
public FileDestination (string folder)
{
Folder = folder;
}
public FileRequest CreateRequest (IDescription description)
{
var url = description.Url;
var filename = ComputeHash (url) + description.Extension;
return new FileRequest (description) {
Filename = Path.Combine (Folder, filename)
};
}
static string ComputeHash (Uri url)
{
string hash;
using (var sha1 = new SHA1CryptoServiceProvider ()) {
var bytes = Encoding.ASCII.GetBytes (url.ToString ());
hash = BitConverter.ToString (sha1.ComputeHash (bytes));
}
return hash.Replace ("-", string.Empty).ToLower ();
}
}
}
|
Add helpers for saving in Library and Library/Caches
|
Add helpers for saving in Library and Library/Caches
|
C#
|
mit
|
stampsy/Stampsy.ImageSource
|
cd09499bbe4017e3fe29f7798177a8264836bec5
|
Simple.Domain/Model/Organization/Organization.cs
|
Simple.Domain/Model/Organization/Organization.cs
|
using System;
using System.Collections.Generic;
namespace Simple.Domain.Model
{
public class Organization
{
public Guid Id { get; set; }
public string Name { get; set; }
public string CatchPhrase { get; set; }
public string BSPhrase { get; set; }
// Ref
public DomainUser Owner { get; set; }
// List Ref
public List<Address> Addresses { get; set; }
public List<DomainUser> Employees { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using Simple.Domain.Entities;
namespace Simple.Domain.Model
{
public class Organization
{
public Guid Id { get; set; }
public string Name { get; set; }
public string CatchPhrase { get; set; }
public string BSPhrase { get; set; }
// Ref
public User Owner { get; set; }
// List Ref
public List<Address> Addresses { get; set; }
public List<User> Employees { get; set; }
}
}
|
Update to use new User
|
Update to use new User
|
C#
|
mit
|
csengineer13/Simple.MVC,csengineer13/Simple.MVC,csengineer13/Simple.MVC
|
000c021d81956b48bac83f43e9b9a5ccea2513f0
|
ElectronicCash/Alice.cs
|
ElectronicCash/Alice.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ElectronicCash
{
/// <summary>
/// The customer
/// </summary>
public class Alice : BaseActor
{
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ElectronicCash
{
/// <summary>
/// The customer
/// </summary>
public class Alice : BaseActor
{
public List<MoneyOrder> MoneyOrders { get; private set; }
public string PersonalData { get; private set; }
public byte[] PersonalDataBytes { get; private set; }
public Alice(string _name, Guid _actorGuid, string _personalData)
{
Name = _name;
ActorGuid = _actorGuid;
Money = 1000;
PersonalData = _personalData;
PersonalDataBytes = GetBytes(_personalData);
}
/// <summary>
/// Called every time the customer wants to pay for something
/// </summary>
public void CreateMoneyOrders()
{
MoneyOrders = new List<MoneyOrder>();
}
#region private methods
/// <summary>
/// stackoverflow.com/questions/472906/converting-a-string-to-byte-array-without-using-an-encoding-byte-by-byte
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private static byte[] GetBytes(string str)
{
byte[] bytes = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}
/// <summary>
/// stackoverflow.com/questions/472906/converting-a-string-to-byte-array-without-using-an-encoding-byte-by-byte
/// </summary>
/// <param name="bytes"></param>
/// <returns></returns>
private static string GetString(byte[] bytes)
{
char[] chars = new char[bytes.Length / sizeof(char)];
System.Buffer.BlockCopy(bytes, 0, chars, 0, bytes.Length);
return new string(chars);
}
#endregion
}
}
|
Add some helpers and stuff
|
Add some helpers and stuff
|
C#
|
mit
|
0culus/ElectronicCash
|
967c658b5d023b72ef74de8c1724e875068f4891
|
Source/ue4czmq/ue4czmq.Build.cs
|
Source/ue4czmq/ue4czmq.Build.cs
|
// Copyright 2015 Palm Stone Games, Inc. All Rights Reserved.
using System.IO;
namespace UnrealBuildTool.Rules
{
public class ue4czmq : ModuleRules
{
public ue4czmq(TargetInfo Target)
{
// Include paths
//PublicIncludePaths.AddRange(new string[] {});
//PrivateIncludePaths.AddRange(new string[] {});
// Dependencies
PublicDependencyModuleNames.AddRange(new string[] { "Core", "Engine", });
//PrivateDependencyModuleNames.AddRange(new string[] {});
// Dynamically loaded modules
//DynamicallyLoadedModuleNames.AddRange(new string[] {});
// Definitions
Definitions.Add("WITH_UE4CZMQ=1");
LoadLib(Target);
}
public void LoadLib(TargetInfo Target)
{
string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
// CZMQ
string czmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "czmq"));
PrivateAdditionalLibraries.Add(Path.Combine(czmqPath, "Libraries", "czmq.lib"));
PrivateIncludePaths.Add(Path.Combine(czmqPath, "Includes"));
// LIBZMQ
string libzmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "libzmq"));
PrivateIncludePaths.Add(Path.Combine(libzmqPath, "Includes"));
}
}
}
|
// Copyright 2015 Palm Stone Games, Inc. All Rights Reserved.
using System.IO;
namespace UnrealBuildTool.Rules
{
public class ue4czmq : ModuleRules
{
public ue4czmq(TargetInfo Target)
{
// Include paths
//PublicIncludePaths.AddRange(new string[] {});
//PrivateIncludePaths.AddRange(new string[] {});
// Dependencies
PublicDependencyModuleNames.AddRange(new string[] { "Core", "Engine", });
//PrivateDependencyModuleNames.AddRange(new string[] {});
// Dynamically loaded modules
//DynamicallyLoadedModuleNames.AddRange(new string[] {});
// Definitions
Definitions.Add("WITH_UE4CZMQ=1");
LoadLib(Target);
}
public void LoadLib(TargetInfo Target)
{
string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
// CZMQ
string czmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "czmq"));
PublicAdditionalLibraries.Add(Path.Combine(czmqPath, "Libraries", "czmq.lib"));
PrivateIncludePaths.Add(Path.Combine(czmqPath, "Includes"));
// LIBZMQ
string libzmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "libzmq"));
PrivateIncludePaths.Add(Path.Combine(libzmqPath, "Includes"));
}
}
}
|
Revert "Use a PrivateAdditionalLibrary for czmq.lib instead of a public one"
|
Revert "Use a PrivateAdditionalLibrary for czmq.lib instead of a public one"
This reverts commit f1e6a83fdd73c5589772ab9d3fef316853a5cd19.
|
C#
|
apache-2.0
|
DeltaMMO/ue4czmq,DeltaMMO/ue4czmq
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.