commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13 values | lang stringclasses 23 values |
|---|---|---|---|---|---|---|---|---|
e2d0788518b201080160dd0b168707228830bab5 | Fix NRE 2 | DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer | Client/Systems/VesselImmortalSys/VesselImmortalEvents.cs | Client/Systems/VesselImmortalSys/VesselImmortalEvents.cs | using LunaClient.Base;
using UniLinq;
namespace LunaClient.Systems.VesselImmortalSys
{
public class VesselImmortalEvents : SubSystem<VesselImmortalSystem>
{
/// <summary>
/// Set vessel immortal state just when the vessel loads
/// </summary>
public void VesselLoaded(Vessel vessel)
{
if(vessel == null) return;
if (System.OtherPeopleVessels.Any(v => v?.id == vessel.id))
{
System.SetVesselImmortalState(vessel, true);
}
}
}
}
| using LunaClient.Base;
using UniLinq;
namespace LunaClient.Systems.VesselImmortalSys
{
public class VesselImmortalEvents : SubSystem<VesselImmortalSystem>
{
/// <summary>
/// Set vessel immortal state just when the vessel loads
/// </summary>
public void VesselLoaded(Vessel vessel)
{
if(vessel == null) return;
//Do it this way as vessel can become null later one
var vesselId = vessel.id;
if (System.OtherPeopleVessels.Any(v => v?.id == vesselId))
{
System.SetVesselImmortalState(vessel, true);
}
}
}
}
| mit | C# |
cf8d96dcfbaa64aa76ec7033d9ee546b64eabbc9 | Set NullHandling to Ignore for key | SuperDrew/MbDotNet,mattherman/MbDotNet,mattherman/MbDotNet | MbDotNet/Models/Imposters/HttpsImposter.cs | MbDotNet/Models/Imposters/HttpsImposter.cs | using MbDotNet.Models.Stubs;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace MbDotNet.Models.Imposters
{
public class HttpsImposter : Imposter
{
[JsonProperty("stubs")]
public ICollection<HttpStub> Stubs { get; private set; }
// TODO This won't serialize key, but how does a user of this imposter know it's using the self-signed cert?
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
public string Key { get; private set; }
public HttpsImposter(int port, string name) : this(port, name, null)
{
}
public HttpsImposter(int port, string name, string key) : base(port, MbDotNet.Enums.Protocol.Https, name)
{
Key = key;
Stubs = new List<HttpStub>();
}
public HttpStub AddStub()
{
var stub = new HttpStub();
Stubs.Add(stub);
return stub;
}
}
}
| using MbDotNet.Models.Stubs;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace MbDotNet.Models.Imposters
{
public class HttpsImposter : Imposter
{
[JsonProperty("stubs")]
public ICollection<HttpStub> Stubs { get; private set; }
// TODO Need to not include key in serialization when its null to allow mb to use self-signed certificate.
[JsonProperty("key")]
public string Key { get; private set; }
public HttpsImposter(int port, string name) : this(port, name, null)
{
}
public HttpsImposter(int port, string name, string key) : base(port, MbDotNet.Enums.Protocol.Https, name)
{
Key = key;
Stubs = new List<HttpStub>();
}
public HttpStub AddStub()
{
var stub = new HttpStub();
Stubs.Add(stub);
return stub;
}
}
}
| mit | C# |
b072b7f10a7409489b8e644bc04a8527b5614da3 | Fix issue with keyboard focus on SystemButtons. | Grabacr07/MetroRadiance | source/MetroRadiance/UI/Controls/SystemButtons.cs | source/MetroRadiance/UI/Controls/SystemButtons.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace MetroRadiance.UI.Controls
{
public class SystemButtons : Control
{
static SystemButtons()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(SystemButtons), new FrameworkPropertyMetadata(typeof(SystemButtons)));
IsTabStopProperty.OverrideMetadata(typeof(SystemButtons), new FrameworkPropertyMetadata(false));
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace MetroRadiance.UI.Controls
{
public class SystemButtons : Control
{
static SystemButtons()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(SystemButtons), new FrameworkPropertyMetadata(typeof(SystemButtons)));
}
}
}
| mit | C# |
b0d00cb00e3d49f23365c5eb0612fd28c57bb358 | Put in defensive code to prevent crash when toggling wait cursor state. | JohnThomson/libpalaso,ermshiperete/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,JohnThomson/libpalaso,gtryus/libpalaso,darcywong00/libpalaso,glasseyes/libpalaso,marksvc/libpalaso,hatton/libpalaso,andrew-polk/libpalaso,mccarthyrb/libpalaso,gmartin7/libpalaso,chrisvire/libpalaso,ddaspit/libpalaso,hatton/libpalaso,marksvc/libpalaso,glasseyes/libpalaso,ermshiperete/libpalaso,andrew-polk/libpalaso,andrew-polk/libpalaso,ddaspit/libpalaso,glasseyes/libpalaso,mccarthyrb/libpalaso,sillsdev/libpalaso,tombogle/libpalaso,andrew-polk/libpalaso,gtryus/libpalaso,hatton/libpalaso,gtryus/libpalaso,JohnThomson/libpalaso,darcywong00/libpalaso,mccarthyrb/libpalaso,gmartin7/libpalaso,ddaspit/libpalaso,hatton/libpalaso,sillsdev/libpalaso,chrisvire/libpalaso,JohnThomson/libpalaso,darcywong00/libpalaso,tombogle/libpalaso,chrisvire/libpalaso,sillsdev/libpalaso,gtryus/libpalaso,chrisvire/libpalaso,sillsdev/libpalaso,ddaspit/libpalaso,ermshiperete/libpalaso,gmartin7/libpalaso,ermshiperete/libpalaso,gmartin7/libpalaso,tombogle/libpalaso,marksvc/libpalaso,mccarthyrb/libpalaso | PalasoUIWindowsForms/Miscellaneous/WaitCursor.cs | PalasoUIWindowsForms/Miscellaneous/WaitCursor.cs | using System;
using System.Linq;
using System.Windows.Forms;
namespace Palaso.UI.WindowsForms.Miscellaneous
{
/// ----------------------------------------------------------------------------------------
public class WaitCursor
{
/// ------------------------------------------------------------------------------------
public static void Show()
{
ToggleWaitCursorState(true);
}
/// ------------------------------------------------------------------------------------
public static void Hide()
{
ToggleWaitCursorState(false);
}
/// ------------------------------------------------------------------------------------
private static void ToggleWaitCursorState(bool turnOn)
{
Application.UseWaitCursor = turnOn;
foreach (var frm in Application.OpenForms.Cast<Form>().ToList())
{
Form form = frm; // Avoid resharper message about accessing foreach variable in closure.
try
{
if (form.InvokeRequired)
form.Invoke(new Action(() => form.Cursor = (turnOn ? Cursors.WaitCursor : Cursors.Default)));
else
form.Cursor = (turnOn ? Cursors.WaitCursor : Cursors.Default);
}
catch
{
// Form may have closed and been disposed. Oh, well.
}
}
try
{
// I hate doing this, but setting the cursor property in .Net
// often doesn't otherwise take effect until it's too late.
Application.DoEvents();
}
catch { }
}
}
}
| using System;
using System.Linq;
using System.Windows.Forms;
namespace Palaso.UI.WindowsForms.Miscellaneous
{
/// ----------------------------------------------------------------------------------------
public class WaitCursor
{
/// ------------------------------------------------------------------------------------
public static void Show()
{
ToggleWaitCursorState(true);
}
/// ------------------------------------------------------------------------------------
public static void Hide()
{
ToggleWaitCursorState(false);
}
/// ------------------------------------------------------------------------------------
private static void ToggleWaitCursorState(bool turnOn)
{
Application.UseWaitCursor = turnOn;
foreach (var frm in Application.OpenForms.Cast<Form>())
{
if (frm.InvokeRequired)
frm.Invoke(new Action(() => frm.Cursor = (turnOn ? Cursors.WaitCursor : Cursors.Default)));
else
frm.Cursor = (turnOn ? Cursors.WaitCursor : Cursors.Default);
}
try
{
// I hate doing this, but setting the cursor property in .Net
// often doesn't otherwise take effect until it's too late.
Application.DoEvents();
}
catch { }
}
}
}
| mit | C# |
abbcdea006b0972a39e036c036b6412a9e276a7a | Bump From 0.5.0 (not the good reading) since first release is 1.0 to 1.0.1 | MobBotTeam/PokeMobBot,MobBotTeam/PokeMobBot | PoGo.PokeMobBot.Logic/Properties/AssemblyInfo.cs | PoGo.PokeMobBot.Logic/Properties/AssemblyInfo.cs | #region using directives
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PokeMobBot Logic for Pokémon GO")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PoGo.PokeMobBot.Logic")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0739e40d-c589-4aeb-93e5-ee8cd6773c60")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.0.0")] | #region using directives
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PokeMobBot Logic for Pokémon GO")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PoGo.PokeMobBot.Logic")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0739e40d-c589-4aeb-93e5-ee8cd6773c60")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] | agpl-3.0 | C# |
97131143b60119cc6fac2d78a41d9b26e5f08fb2 | add some cooldown time after each process invocation | os2kitos/kitos,os2kitos/kitos,os2kitos/kitos,os2kitos/kitos | Presentation.Web/Hangfire/KeepReadModelsInSyncProcess.cs | Presentation.Web/Hangfire/KeepReadModelsInSyncProcess.cs | using System;
using System.Threading;
using Hangfire.Server;
using Infrastructure.Services.BackgroundJobs;
using Microsoft.Extensions.DependencyInjection;
using Ninject;
using Presentation.Web.Ninject;
namespace Presentation.Web.Hangfire
{
public class KeepReadModelsInSyncProcess : IBackgroundProcess
{
private readonly StandardKernel _kernel;
public KeepReadModelsInSyncProcess()
{
_kernel = new KernelBuilder().ForHangFire().Build();
}
public void Execute(BackgroundProcessContext context)
{
using var combinedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(context.ShutdownToken, context.StoppingToken);
using (new HangfireNinjectResolutionScope(_kernel))
{
var backgroundJobLauncher = _kernel.GetRequiredService<IBackgroundJobLauncher>();
backgroundJobLauncher.LaunchScheduleDataProcessingAgreementReadUpdates(combinedTokenSource.Token).Wait(CancellationToken.None);
backgroundJobLauncher.LaunchUpdateDataProcessingAgreementReadModels(combinedTokenSource.Token).Wait(CancellationToken.None);
}
var secondsPassed = 0;
do
{
Thread.Sleep(TimeSpan.FromSeconds(1));
secondsPassed++;
} while (secondsPassed < 5 && combinedTokenSource.IsCancellationRequested == false);
}
}
}
| using System.Threading;
using Hangfire.Server;
using Infrastructure.Services.BackgroundJobs;
using Microsoft.Extensions.DependencyInjection;
using Ninject;
using Presentation.Web.Ninject;
namespace Presentation.Web.Hangfire
{
public class KeepReadModelsInSyncProcess : IBackgroundProcess
{
private readonly StandardKernel _kernel;
public KeepReadModelsInSyncProcess()
{
_kernel = new KernelBuilder().ForHangFire().Build();
}
public void Execute(BackgroundProcessContext context)
{
using (new HangfireNinjectResolutionScope(_kernel))
{
var backgroundJobLauncher = _kernel.GetRequiredService<IBackgroundJobLauncher>();
using var combinedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(context.ShutdownToken, context.StoppingToken);
backgroundJobLauncher.LaunchScheduleDataProcessingAgreementReadUpdates(combinedTokenSource.Token).Wait(CancellationToken.None);
backgroundJobLauncher.LaunchUpdateDataProcessingAgreementReadModels(combinedTokenSource.Token).Wait(CancellationToken.None);
}
}
}
}
| mpl-2.0 | C# |
2259399d899c397788ee320aec39881db7c201b8 | Bump version | oozcitak/imagelistview | ImageListView/Properties/AssemblyInfo.cs | ImageListView/Properties/AssemblyInfo.cs | // ImageListView - A listview control for image files
// Copyright (C) 2009 Ozgur Ozcitak
//
// 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.
//
// Ozgur Ozcitak (ozcitak@yahoo.com)
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("ImageListView")]
[assembly: AssemblyDescription("A ListView like control for displaying image files with asynchronously loaded thumbnails.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Özgür Özçıtak")]
[assembly: AssemblyProduct("ImageListView")]
[assembly: AssemblyCopyright("Copyright © 2013 Özgür Özçıtak")]
[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("3eb67a8d-4c80-4c11-944d-c99ef0ec7eb9")]
// 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("13.6.0.0")]
[assembly: AssemblyFileVersion("13.6.0.0")]
| // ImageListView - A listview control for image files
// Copyright (C) 2009 Ozgur Ozcitak
//
// 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.
//
// Ozgur Ozcitak (ozcitak@yahoo.com)
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("ImageListView")]
[assembly: AssemblyDescription("A ListView like control for displaying image files with asynchronously loaded thumbnails.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Özgür Özçıtak")]
[assembly: AssemblyProduct("ImageListView")]
[assembly: AssemblyCopyright("Copyright © 2013 Özgür Özçıtak")]
[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("3eb67a8d-4c80-4c11-944d-c99ef0ec7eb9")]
// 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("13.5.0.0")]
[assembly: AssemblyFileVersion("13.5.0.0")]
| apache-2.0 | C# |
530ddbdbb27157b058fa4c5114c7d113ff17ae5f | add vector extension | Weingartner/SolidworksAddinFramework | SolidworksAddinFramework/MathVectorExtensions.cs | SolidworksAddinFramework/MathVectorExtensions.cs | using System;
using SolidWorks.Interop.sldworks;
namespace SolidworksAddinFramework
{
public static class MathVectorExtensions
{
/// <summary>
/// gives the multiplier for b which would be the projection of a on b
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static double Project(this IMathVector a, IMathVector b)
{
return a.Dot(b)/(b.Dot(b));
}
public static double[] Cross(this IMathUtility math, double[] a, double[] b)
{
var v0 = (IMathVector) math.CreateVector(a);
var v1 = (IMathVector) math.CreateVector(b);
return (double[]) ((IMathVector)v0.Cross(v1)).ArrayData;
}
public static MathVector ScaleTs(this IMathVector a, double b)
{
return (MathVector) a.Scale(b);
}
public static MathVector CrossTs(this IMathVector a, IMathVector b)
{
return (MathVector) a.Cross(b);
}
public static MathVector MultiplyTransformTs(this IMathVector v, IMathTransform t)
{
return (MathVector) v.MultiplyTransform(t);
}
public static double AngleBetweenVectors(this IMathVector v0, IMathVector v1)
{
if (((double[])v0.ArrayData).Length==((double[])v1.ArrayData).Length)
{
return Math.Acos(v0.Dot(v1)/(v0.GetLength()*v1.GetLength()));
}
throw new Exception("Vectors must have the same dimension!");
}
}
} | using SolidWorks.Interop.sldworks;
namespace SolidworksAddinFramework
{
public static class MathVectorExtensions
{
/// <summary>
/// gives the multiplier for b which would be the projection of a on b
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static double Project(this IMathVector a, IMathVector b)
{
return a.Dot(b)/(b.Dot(b));
}
public static double[] Cross(this IMathUtility math, double[] a, double[] b)
{
var v0 = (IMathVector) math.CreateVector(a);
var v1 = (IMathVector) math.CreateVector(b);
return (double[]) ((IMathVector)v0.Cross(v1)).ArrayData;
}
public static MathVector ScaleTs(this IMathVector a, double b)
{
return (MathVector) a.Scale(b);
}
public static MathVector CrossTs(this IMathVector a, IMathVector b)
{
return (MathVector) a.Cross(b);
}
public static MathVector MultiplyTransformTs(this IMathVector v, IMathTransform t)
{
return (MathVector) v.MultiplyTransform(t);
}
}
} | mit | C# |
5c871f0e3c6c7685b0887350031fe5fc93097da9 | Add method to get entity by id | isurakka/ecs | ECS/EntityComponentSystem.cs | ECS/EntityComponentSystem.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ECS
{
public class EntityComponentSystem
{
private readonly EntityManager entityManager;
private readonly SystemManager systemManager;
private static readonly bool running64Bit;
static EntityComponentSystem()
{
running64Bit = Environment.Is64BitProcess;
}
public EntityComponentSystem()
{
entityManager = new EntityManager();
systemManager = new SystemManager { context = this };
}
public Entity CreateEntity() => entityManager.CreateEntity();
public void AddSystem(System system, int layer = 0) =>
systemManager.AddSystem(system, layer);
public void RemoveSystem(System system, int layer) =>
systemManager.RemoveSystem(system, layer);
// TODO: Is this needed and is this right place for this method?
public IEnumerable<Entity> FindEntities(Aspect aspect) =>
entityManager.GetEntitiesForAspect(aspect);
public Entity GetEntity(int id)
{
return new Entity(id, entityManager);
}
public void Update(float deltaTime)
{
FlushChanges();
// 256 MB
var noGc = GC.TryStartNoGCRegion(running64Bit ? 256000000L : 16000000L);
foreach (var systems in systemManager.GetSystemsInLayerOrder())
{
foreach (var system in systems)
{
system.Update(deltaTime);
}
FlushChanges();
}
if (noGc) GC.EndNoGCRegion();
}
public void UpdateSpecific(float deltaTime, int layer)
{
FlushChanges();
foreach (var system in systemManager.GetSystems(layer))
{
system.Update(deltaTime);
}
FlushChanges();
}
public void FlushChanges()
{
entityManager.FlushPending();
systemManager.FlushPendingChanges();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ECS
{
public class EntityComponentSystem
{
private readonly EntityManager entityManager;
private readonly SystemManager systemManager;
private static readonly bool running64Bit;
static EntityComponentSystem()
{
running64Bit = Environment.Is64BitProcess;
}
public EntityComponentSystem()
{
entityManager = new EntityManager();
systemManager = new SystemManager { context = this };
}
public Entity CreateEntity() => entityManager.CreateEntity();
public void AddSystem(System system, int layer = 0) =>
systemManager.AddSystem(system, layer);
public void RemoveSystem(System system, int layer) =>
systemManager.RemoveSystem(system, layer);
// TODO: Is this needed and is this right place for this method?
public IEnumerable<Entity> FindEntities(Aspect aspect) =>
entityManager.GetEntitiesForAspect(aspect);
public void Update(float deltaTime)
{
FlushChanges();
// 256 MB
var noGc = GC.TryStartNoGCRegion(running64Bit ? 256000000L : 16000000L);
foreach (var systems in systemManager.GetSystemsInLayerOrder())
{
foreach (var system in systems)
{
system.Update(deltaTime);
}
FlushChanges();
}
if (noGc) GC.EndNoGCRegion();
}
public void UpdateSpecific(float deltaTime, int layer)
{
FlushChanges();
foreach (var system in systemManager.GetSystems(layer))
{
system.Update(deltaTime);
}
FlushChanges();
}
public void FlushChanges()
{
entityManager.FlushPending();
systemManager.FlushPendingChanges();
}
}
}
| apache-2.0 | C# |
0b6d5a9cfcab959f31451ccb18da760f24e1e9e8 | Transpose Array | snownz/VI | VI/VI.Neural/ANNOperations/ANNDenseOperations.cs | VI/VI.Neural/ANNOperations/ANNDenseOperations.cs | using VI.Neural.ActivationFunction;
using VI.Neural.Error;
using VI.Neural.Layer;
using VI.Neural.OptimizerFunction;
using VI.NumSharp.Arrays;
namespace VI.Neural.ANNOperations
{
public class ANNDenseOperations : ISupervisedOperations
{
private IActivationFunction _activationFunction;
protected IErrorFunction _errorFunction;
private IOptimizerFunction _optimizerFunction;
protected ILayer _target;
public virtual void FeedForward(FloatArray feed)
{
_target.SumVector = (feed.T * _target.KnowlodgeMatrix).SumLine() + _target.BiasVector;
_target.OutputVector = _activationFunction.Activate(_target.SumVector);
}
public virtual void BackWard(FloatArray values)
{
var DE = _errorFunction.Error(_target.OutputVector, values);
var DO = _activationFunction.Derivate(_target.SumVector);
_target.ErrorVector = DE * DO;
_target.ErrorWeightVector = (_target.ErrorVector * _target.KnowlodgeMatrix).SumColumn();
}
public void ErrorGradient(FloatArray feed)
{
_target.GradientMatrix = feed.T * _target.ErrorVector;
}
public void ComputeGradient(FloatArray inputs)
{
_target.GradientMatrix += inputs.T * _target.ErrorVector;
}
public void UpdateParams()
{
_optimizerFunction.UpdateWeight(_target);
_optimizerFunction.UpdateBias(_target);
}
public void SetLayer(ILayer layer)
{
_target = layer;
_optimizerFunction.CalculateParams(_target);
}
public void SetActivation(IActivationFunction act)
{
_activationFunction = act;
}
public void SetError(IErrorFunction err)
{
_errorFunction = err;
}
public void SetOptimizer(IOptimizerFunction opt)
{
_optimizerFunction = opt;
}
}
} | using VI.Neural.ActivationFunction;
using VI.Neural.Error;
using VI.Neural.Layer;
using VI.Neural.OptimizerFunction;
using VI.NumSharp.Arrays;
namespace VI.Neural.ANNOperations
{
public class ANNDenseOperations : ISupervisedOperations
{
private IActivationFunction _activationFunction;
protected IErrorFunction _errorFunction;
private IOptimizerFunction _optimizerFunction;
protected ILayer _target;
public virtual void FeedForward(FloatArray feed)
{
_target.SumVector = (feed.T * _target.KnowlodgeMatrix).SumLine() + _target.BiasVector;
_target.OutputVector = _activationFunction.Activate(_target.SumVector);
}
public virtual void BackWard(FloatArray values)
{
var DE = _errorFunction.Error(_target.OutputVector, values);
var DO = _activationFunction.Derivate(_target.SumVector);
_target.ErrorVector = DE * DO;
_target.ErrorWeightVector = (_target.ErrorVector * _target.KnowlodgeMatrix).SumColumn();
}
public void ErrorGradient(FloatArray feed)
{
_target.GradientMatrix = feed * _target.ErrorVector.T;
}
public void ComputeGradient(FloatArray inputs)
{
_target.GradientMatrix += inputs * _target.ErrorVector.T;
}
public void UpdateParams()
{
_optimizerFunction.UpdateWeight(_target);
_optimizerFunction.UpdateBias(_target);
}
public void SetLayer(ILayer layer)
{
_target = layer;
_optimizerFunction.CalculateParams(_target);
}
public void SetActivation(IActivationFunction act)
{
_activationFunction = act;
}
public void SetError(IErrorFunction err)
{
_errorFunction = err;
}
public void SetOptimizer(IOptimizerFunction opt)
{
_optimizerFunction = opt;
}
}
} | mit | C# |
dda43e440c0520b4bd795e3198c0911765238618 | Add comments for XBox360GamepadButton enum | mina-asham/XBox360ControllerManager | XBox360ControllerManager/XBox360GamepadButton.cs | XBox360ControllerManager/XBox360GamepadButton.cs | namespace XBox360ControllerManager
{
/// <summary>
/// Enum to represent XBox 360 gamepad buttons
/// For more info check: http://support.xbox.com/en-GB/xbox-360/accessories/controllers
/// </summary>
public enum XBox360GamepadButton : ushort
{
/// <summary>
/// Directional pad up
/// </summary>
DPadUp = 0x0001,
/// <summary>
/// Directional pad down
/// </summary>
DPadDown = 0x0002,
/// <summary>
/// Directional pad left
/// </summary>
DPadLeft = 0x0004,
/// <summary>
/// Directional pad right
/// </summary>
DPadRight = 0x0008,
/// <summary>
/// Start
/// </summary>
Start = 0x0010,
/// <summary>
/// Back (options)
/// </summary>
Back = 0x0020,
/// <summary>
/// Left stick click
/// </summary>
LeftThumb = 0x0040,
/// <summary>
/// Right stick click
/// </summary>
RightThumb = 0x0080,
/// <summary>
/// Left bumper button (upper)
/// </summary>
LeftShoulder = 0x0100,
/// <summary>
/// Right bumper button (upper)
/// </summary>
RightShoulder = 0x0200,
/// <summary>
/// A button
/// </summary>
A = 0x1000,
/// <summary>
/// B button
/// </summary>
B = 0x2000,
/// <summary>
/// X button
/// </summary>
X = 0x4000,
/// <summary>
/// Y button
/// </summary>
Y = 0x8000,
/// <summary>
/// Guide button (main button)
/// </summary>
Guide = 0x0400
}
}
| namespace XBox360ControllerManager
{
public enum XBox360GamepadButton : ushort
{
DPadUp = 0x0001,
DPadDown = 0x0002,
DPadLeft = 0x0004,
DPadRight = 0x0008,
Start = 0x0010,
Back = 0x0020,
LeftThumb = 0x0040,
RightThumb = 0x0080,
LeftShoulder = 0x0100,
RightShoulder = 0x0200,
A = 0x1000,
B = 0x2000,
X = 0x4000,
Y = 0x8000,
Guide = 0x0400
}
}
| mit | C# |
a2f1ae628620743a54beecadb9f03d2c6664e32a | Make test more robust | sillsdev/icu-dotnet,sillsdev/icu-dotnet | source/icu.net.tests/NativeMethods/DllResolverTests.cs | source/icu.net.tests/NativeMethods/DllResolverTests.cs | // Copyright (c) 2022 SIL International
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System.IO;
using NUnit.Framework;
namespace Icu.Tests
{
#if NET
[TestFixture]
public class DllResolverTests
{
private string _tempPath;
[TearDown]
public void TearDown()
{
if (string.IsNullOrEmpty(_tempPath))
return;
try
{
Directory.Delete(_tempPath, true);
}
catch (System.Exception)
{
// just ignore
}
_tempPath = null;
}
[TestCase("linux", ExpectedResult = true, IncludePlatform = "Linux")]
[TestCase("Linux", ExpectedResult = true, IncludePlatform = "Linux")]
[TestCase("!windows,osx", ExpectedResult = true, IncludePlatform = "Linux")]
[TestCase("!windows,linux", ExpectedResult = false, IncludePlatform = "Linux, Win")]
[TestCase("windows,linux", ExpectedResult = true, IncludePlatform = "Linux")]
[TestCase("windows", ExpectedResult = true, IncludePlatform = "Win")]
[TestCase("Windows", ExpectedResult = true, IncludePlatform = "Win")]
[TestCase("!linux,osx", ExpectedResult = true, IncludePlatform = "Win")]
[TestCase("windows,linux", ExpectedResult = true, IncludePlatform = "Win")]
[TestCase("osx", ExpectedResult = true, IncludePlatform = "MacOsX")]
[TestCase("OSX", ExpectedResult = true, IncludePlatform = "MacOsX")]
[TestCase("!linux,windows", ExpectedResult = true, IncludePlatform = "MacOsX")]
[TestCase("!windows,osx", ExpectedResult = false, IncludePlatform = "MacOsX, Win")]
[TestCase("windows,osx", ExpectedResult = true, IncludePlatform = "MacOsX")]
public bool ConditionApplies(string condition)
{
return DllResolver.ConditionApplies(condition);
}
[TestCase(ExpectedResult = "libdl.so.2", IncludePlatform = "Linux")]
[TestCase(ExpectedResult = "libdl.dylib", IncludePlatform = "MacOsX")]
[TestCase(ExpectedResult = "libdl.dll", IncludePlatform = "Win")]
public string MapLibraryName()
{
_tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(_tempPath);
var fakeDll = Path.Combine(_tempPath, "test.dll");
var configFile = fakeDll + ".config";
File.WriteAllText(configFile, @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
<dllmap os=""!windows,osx"" dll=""libdl.dll"" target=""libdl.so.2"" />
<dllmap os=""osx"" dll=""libdl.dll"" target=""libdl.dylib""/>
</configuration>");
return DllResolver.MapLibraryName(fakeDll, "libdl.dll");
}
}
#endif
}
| // Copyright (c) 2022 SIL International
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System.IO;
using NUnit.Framework;
namespace Icu.Tests
{
#if NET
[TestFixture]
public class DllResolverTests
{
private string _tempPath;
[TearDown]
public void TearDown()
{
if (string.IsNullOrEmpty(_tempPath))
return;
Directory.Delete(_tempPath, true);
_tempPath = null;
}
[TestCase("linux", ExpectedResult = true, IncludePlatform = "Linux")]
[TestCase("Linux", ExpectedResult = true, IncludePlatform = "Linux")]
[TestCase("!windows,osx", ExpectedResult = true, IncludePlatform = "Linux")]
[TestCase("!windows,linux", ExpectedResult = false, IncludePlatform = "Linux, Win")]
[TestCase("windows,linux", ExpectedResult = true, IncludePlatform = "Linux")]
[TestCase("windows", ExpectedResult = true, IncludePlatform = "Win")]
[TestCase("Windows", ExpectedResult = true, IncludePlatform = "Win")]
[TestCase("!linux,osx", ExpectedResult = true, IncludePlatform = "Win")]
[TestCase("windows,linux", ExpectedResult = true, IncludePlatform = "Win")]
[TestCase("osx", ExpectedResult = true, IncludePlatform = "MacOsX")]
[TestCase("OSX", ExpectedResult = true, IncludePlatform = "MacOsX")]
[TestCase("!linux,windows", ExpectedResult = true, IncludePlatform = "MacOsX")]
[TestCase("!windows,osx", ExpectedResult = false, IncludePlatform = "MacOsX, Win")]
[TestCase("windows,osx", ExpectedResult = true, IncludePlatform = "MacOsX")]
public bool ConditionApplies(string condition)
{
return DllResolver.ConditionApplies(condition);
}
[TestCase(ExpectedResult = "libdl.so.2", IncludePlatform = "Linux")]
[TestCase(ExpectedResult = "libdl.dylib", IncludePlatform = "MacOsX")]
[TestCase(ExpectedResult = "libdl.dll", IncludePlatform = "Win")]
public string MapLibraryName()
{
_tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(_tempPath);
var fakeDll = Path.Combine(_tempPath, "test.dll");
var configFile = fakeDll + ".config";
File.WriteAllText(configFile, @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<configuration>
<dllmap os=""!windows,osx"" dll=""libdl.dll"" target=""libdl.so.2"" />
<dllmap os=""osx"" dll=""libdl.dll"" target=""libdl.dylib""/>
</configuration>");
return DllResolver.MapLibraryName(fakeDll, "libdl.dll");
}
}
#endif
}
| mit | C# |
eab394fcfaaa30c38d03b4589e1b8127b4d7e490 | unify string representation for end of stream | acple/ParsecSharp | ParsecSharp/Data/Internal/EmptyStream.cs | ParsecSharp/Data/Internal/EmptyStream.cs | namespace ParsecSharp.Internal
{
public sealed class EmptyStream<TToken> : IParsecStateStream<TToken>
{
public static IParsecStateStream<TToken> Instance { get; } = new EmptyStream<TToken>();
public TToken Current => default!;
public bool HasValue => false;
public IPosition Position => LinearPosition.Initial;
public IParsecStateStream<TToken> Next => this;
private EmptyStream()
{ }
public void Dispose()
{ }
public bool Equals(IParsecState<TToken> other)
=> other is EmptyStream<TToken>;
public sealed override bool Equals(object obj)
=> obj is EmptyStream<TToken>;
public sealed override int GetHashCode()
=> 0;
public sealed override string ToString()
=> "<EndOfStream>";
}
}
| namespace ParsecSharp.Internal
{
public sealed class EmptyStream<TToken> : IParsecStateStream<TToken>
{
public static IParsecStateStream<TToken> Instance { get; } = new EmptyStream<TToken>();
public TToken Current => default!;
public bool HasValue => false;
public IPosition Position => LinearPosition.Initial;
public IParsecStateStream<TToken> Next => this;
private EmptyStream()
{ }
public void Dispose()
{ }
public bool Equals(IParsecState<TToken> other)
=> other is EmptyStream<TToken>;
public sealed override bool Equals(object obj)
=> obj is EmptyStream<TToken>;
public sealed override int GetHashCode()
=> 0;
public sealed override string ToString()
=> "<EmptyStream>";
}
}
| mit | C# |
e8b0cb84ea03777c1e476caed241afb889313658 | add 2x GetExtension() unit tests | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | tests/FilterLists.Agent.Tests/Extensions/UriExtensionsTests.cs | tests/FilterLists.Agent.Tests/Extensions/UriExtensionsTests.cs | using System;
using System.Collections.Generic;
using FilterLists.Agent.Extensions;
using Xunit;
namespace FilterLists.Agent.Tests.Extensions
{
public class UriExtensionsTests
{
[Fact]
public void GetExtension_UriWithoutExtension_ReturnsEmptyString()
{
var uri = new Uri("https://www.google.com/");
var sut = uri.GetExtension();
Assert.Equal("", sut);
}
[Fact]
public void GetExtension_UriWithExtension_ReturnsExtension()
{
var uri = new Uri("https://www.google.com/robots.txt");
var sut = uri.GetExtension();
Assert.Equal(".txt", sut);
}
[Fact]
public void IsValidUrl_WithValidUrl_ReturnsTrue()
{
const string uriString = "https://www.google.com/";
var uri = new Uri(uriString);
var sut = uri.IsValidUrl();
Assert.True(sut);
}
[Fact]
public void DistributeByHost_HasOverweightHost_DistributesEvenly()
{
var uris = new List<Uri>
{
new Uri("https://www.google.com/"),
new Uri("https://www.google.com/"),
new Uri("https://www.google.com/"),
new Uri("https://www.facebook.com/"),
new Uri("https://www.facebook.com/")
};
var sut = uris.DistributeByHost();
var expected = new List<Uri>
{
new Uri("https://www.google.com/"),
new Uri("https://www.facebook.com/"),
new Uri("https://www.google.com/"),
new Uri("https://www.facebook.com/"),
new Uri("https://www.google.com/")
};
Assert.Equal(expected, sut);
}
}
} | using System;
using System.Collections.Generic;
using FilterLists.Agent.Extensions;
using Xunit;
namespace FilterLists.Agent.Tests.Extensions
{
public class UriExtensionsTests
{
[Fact]
public void IsValidUrl_WithValidUrl_ReturnsTrue()
{
const string uriString = "https://www.google.com/";
var uri = new Uri(uriString);
var sut = uri.IsValidUrl();
Assert.True(sut);
}
[Fact]
public void DistributeByHost_HasOverweightHost_DistributesEvenly()
{
var uris = new List<Uri>
{
new Uri("https://www.google.com/"),
new Uri("https://www.google.com/"),
new Uri("https://www.google.com/"),
new Uri("https://www.facebook.com/"),
new Uri("https://www.facebook.com/")
};
var sut = uris.DistributeByHost();
var expected = new List<Uri>
{
new Uri("https://www.google.com/"),
new Uri("https://www.facebook.com/"),
new Uri("https://www.google.com/"),
new Uri("https://www.facebook.com/"),
new Uri("https://www.google.com/")
};
Assert.Equal(expected, sut);
}
}
} | mit | C# |
bd2fa5d16f61ea53d939320e970022b3b1bd377d | Use the managed thread id as identifier in our trace messages. | Bloomcredit/SSH.NET,sshnet/SSH.NET,miniter/SSH.NET | src/Renci.SshNet/Abstractions/DiagnosticAbstraction.cs | src/Renci.SshNet/Abstractions/DiagnosticAbstraction.cs | using System.Diagnostics;
using System.Threading;
namespace Renci.SshNet.Abstractions
{
internal static class DiagnosticAbstraction
{
#if FEATURE_DIAGNOSTICS_TRACESOURCE
private static readonly SourceSwitch SourceSwitch = new SourceSwitch("SshNetSwitch");
public static bool IsEnabled(TraceEventType traceEventType)
{
return SourceSwitch.ShouldTrace(traceEventType);
}
private static readonly TraceSource Loggging =
#if DEBUG
new TraceSource("SshNet.Logging", SourceLevels.All);
#else
new TraceSource("SshNet.Logging");
#endif // DEBUG
#endif // FEATURE_DIAGNOSTICS_TRACESOURCE
[Conditional("DEBUG")]
public static void Log(string text)
{
#if FEATURE_DIAGNOSTICS_TRACESOURCE
Loggging.TraceEvent(TraceEventType.Verbose, Thread.CurrentThread.ManagedThreadId, text);
#endif // FEATURE_DIAGNOSTICS_TRACESOURCE
}
}
}
| using System.Diagnostics;
namespace Renci.SshNet.Abstractions
{
internal static class DiagnosticAbstraction
{
#if FEATURE_DIAGNOSTICS_TRACESOURCE
private static readonly SourceSwitch SourceSwitch = new SourceSwitch("SshNetSwitch");
public static bool IsEnabled(TraceEventType traceEventType)
{
return SourceSwitch.ShouldTrace(traceEventType);
}
private static readonly TraceSource Loggging =
#if DEBUG
new TraceSource("SshNet.Logging", SourceLevels.All);
#else
new TraceSource("SshNet.Logging");
#endif // DEBUG
#endif // FEATURE_DIAGNOSTICS_TRACESOURCE
[Conditional("DEBUG")]
public static void Log(string text)
{
#if FEATURE_DIAGNOSTICS_TRACESOURCE
Loggging.TraceEvent(TraceEventType.Verbose, 1, text);
#endif // FEATURE_DIAGNOSTICS_TRACESOURCE
}
}
}
| mit | C# |
99a08883b3f818b5251f856a05bf3d8f215ece46 | Remove leftover debug output | protyposis/Aurio,protyposis/Aurio | AudioAlign/AudioAlign/ViewModels/WangFingerprintingViewModel.cs | AudioAlign/AudioAlign/ViewModels/WangFingerprintingViewModel.cs | using AudioAlign.Audio.Matching;
using AudioAlign.Audio.Project;
using AudioAlign.Audio.TaskMonitor;
using AudioAlign.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
namespace AudioAlign.ViewModels {
public class WangFingerprintingViewModel {
private ProgressMonitor progressMonitor;
private TrackList<AudioTrack> trackList;
private Collection<Match> matchCollection;
private WangFingerprintingModel model;
private readonly DelegateCommand fingerprintCommand;
private readonly DelegateCommand findMatchesCommand;
private readonly DelegateCommand clearCommand;
public WangFingerprintingViewModel(ProgressMonitor progressMonitor, TrackList<AudioTrack> trackList, Collection<Match> matchCollection) {
this.progressMonitor = progressMonitor;
this.trackList = trackList;
this.matchCollection = matchCollection;
model = new WangFingerprintingModel();
model.FingerprintingFinished += FingerprintingFinished;
fingerprintCommand = new DelegateCommand(o => {
model.Reset();
model.Fingerprint(new List<AudioTrack>(trackList), progressMonitor);
});
findMatchesCommand = new DelegateCommand(o => {
FindAndAddMatches();
});
clearCommand = new DelegateCommand(o => {
model.Reset();
});
}
private void FindAndAddMatches() {
model.FindAllMatches(progressMonitor, matches => {
foreach (Match match in matches) {
matchCollection.Add(match);
}
});
}
private void FingerprintingFinished(object sender, EventArgs e) {
FindAndAddMatches();
}
public DelegateCommand FingerprintCommand { get { return fingerprintCommand; } }
public DelegateCommand FindMatchesCommand { get { return findMatchesCommand; } }
public DelegateCommand ClearCommand { get { return clearCommand; } }
}
}
| using AudioAlign.Audio.Matching;
using AudioAlign.Audio.Project;
using AudioAlign.Audio.TaskMonitor;
using AudioAlign.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
namespace AudioAlign.ViewModels {
public class WangFingerprintingViewModel {
private ProgressMonitor progressMonitor;
private TrackList<AudioTrack> trackList;
private Collection<Match> matchCollection;
private WangFingerprintingModel model;
private readonly DelegateCommand fingerprintCommand;
private readonly DelegateCommand findMatchesCommand;
private readonly DelegateCommand clearCommand;
public WangFingerprintingViewModel(ProgressMonitor progressMonitor, TrackList<AudioTrack> trackList, Collection<Match> matchCollection) {
this.progressMonitor = progressMonitor;
this.trackList = trackList;
this.matchCollection = matchCollection;
model = new WangFingerprintingModel();
model.FingerprintingFinished += FingerprintingFinished;
fingerprintCommand = new DelegateCommand(o => {
model.Reset();
model.Fingerprint(new List<AudioTrack>(trackList), progressMonitor);
});
findMatchesCommand = new DelegateCommand(o => {
FindAndAddMatches();
});
clearCommand = new DelegateCommand(o => {
model.Reset();
});
}
private void FindAndAddMatches() {
Console.WriteLine(Thread.CurrentThread.ManagedThreadId + " " + Thread.CurrentThread.Name);
model.FindAllMatches(progressMonitor, matches => {
foreach (Match match in matches) {
matchCollection.Add(match);
}
});
}
private void FingerprintingFinished(object sender, EventArgs e) {
FindAndAddMatches();
}
public DelegateCommand FingerprintCommand { get { return fingerprintCommand; } }
public DelegateCommand FindMatchesCommand { get { return findMatchesCommand; } }
public DelegateCommand ClearCommand { get { return clearCommand; } }
}
}
| agpl-3.0 | C# |
d2dfa89a5f59d9ef23f3e529313e24158833cf29 | fix scope resolver | ircnelson/enjoy.cqrs,ircnelson/enjoy.cqrs | src/EnjoyCQRS/Configuration/EnjoyConfiguration.cs | src/EnjoyCQRS/Configuration/EnjoyConfiguration.cs | using System.Linq;
using EnjoyCQRS.Commands;
using EnjoyCQRS.Events;
namespace EnjoyCQRS.Configuration
{
public class EnjoyConfiguration
{
private readonly IResolver _resolver;
private readonly HandlerDictionary _handlerDictionary;
private readonly IEnjoyTypeScanner _scanner;
public EnjoyConfiguration(
IScopeResolver resolver,
HandlerDictionary handlerDictionary,
IEnjoyTypeScanner scanner)
{
_resolver = resolver;
_handlerDictionary = handlerDictionary;
_scanner = scanner;
}
public void Setup()
{
var commands = HandlerHelper.Get<ICommand>(_scanner);
CommandWrapper.Wrap(_resolver, _handlerDictionary, commands);
var events = HandlerHelper.Get<IDomainEvent>(_scanner);
EventWrapper.Wrap(_resolver, _handlerDictionary, events);
}
}
} | using System.Linq;
using EnjoyCQRS.Commands;
using EnjoyCQRS.Events;
namespace EnjoyCQRS.Configuration
{
public class EnjoyConfiguration
{
private readonly IScopeResolver _scopeResolver;
private readonly HandlerDictionary _handlerDictionary;
private readonly IEnjoyTypeScanner _scanner;
public EnjoyConfiguration(
IScopeResolver scopeScopeResolver,
HandlerDictionary handlerDictionary,
IEnjoyTypeScanner scanner)
{
_scopeResolver = scopeScopeResolver;
_handlerDictionary = handlerDictionary;
_scanner = scanner;
}
public void Setup()
{
var resolver = _scopeResolver.BeginScope();
var commands = HandlerHelper.Get<ICommand>(_scanner);
CommandWrapper.Wrap(resolver, _handlerDictionary, commands);
var events = HandlerHelper.Get<IDomainEvent>(_scanner);
EventWrapper.Wrap(resolver, _handlerDictionary, events);
}
}
} | mit | C# |
492ac3bdac1724b2c0d6fdcb96c4fe155d2b7335 | Add a title for nested types | theprash/FSharp.Formatting,tpetricek/FSharp.Formatting,modulexcite/FSharp.Formatting,Rickasaurus/FSharp.Formatting,tpetricek/FSharp.Formatting,mktange/FSharp.Formatting,ademar/FSharp.Formatting,halcwb/FSharp.Formatting,ademar/FSharp.Formatting,modulexcite/FSharp.Formatting,ademar/FSharp.Formatting,tpetricek/FSharp.Formatting,tpetricek/FSharp.Formatting,Rickasaurus/FSharp.Formatting,mktange/FSharp.Formatting,ademar/FSharp.Formatting,mktange/FSharp.Formatting,theprash/FSharp.Formatting,Rickasaurus/FSharp.Formatting,modulexcite/FSharp.Formatting,tpetricek/FSharp.Formatting,modulexcite/FSharp.Formatting,halcwb/FSharp.Formatting,halcwb/FSharp.Formatting,modulexcite/FSharp.Formatting,Rickasaurus/FSharp.Formatting,ademar/FSharp.Formatting,theprash/FSharp.Formatting,mktange/FSharp.Formatting,halcwb/FSharp.Formatting,modulexcite/FSharp.Formatting,halcwb/FSharp.Formatting,Rickasaurus/FSharp.Formatting,mktange/FSharp.Formatting,theprash/FSharp.Formatting,tpetricek/FSharp.Formatting,theprash/FSharp.Formatting,theprash/FSharp.Formatting,halcwb/FSharp.Formatting,mktange/FSharp.Formatting,Rickasaurus/FSharp.Formatting,ademar/FSharp.Formatting | src/FSharp.MetadataFormat/templates/module.cshtml | src/FSharp.MetadataFormat/templates/module.cshtml | @{
Layout = "default";
Title = "Module";
}
<div class="row">
<div class="span1"></div>
<div class="span10" id="main">
<h1>@Model.Module.Name</h1>
<div class="xmldoc">
@Model.Module.Comment.FullText
</div>
@if (Model.Module.NestedTypes.Length > 0) {
<h2>Nested types</h2>
<div>
<table class="table table-bordered type-list">
<thread>
<tr><td>Type</td><td>Description</td></tr>
</thread>
<tbody>
@foreach (var it in Model.Module.NestedTypes) {
<tr>
<td class="type-name">
<a href="@(it.UrlName).html">@Html.Encode(it.Name)</a>
</td>
<td class="xmldoc">@it.Comment.Blurb</td>
</tr>
}
</tbody>
</table>
</div>
}
@RenderPart("members", new {
Header = "Functions and values",
TableHeader = "Function or value",
Members = Model.Module.ValuesAndFuncs
})
@RenderPart("members", new {
Header = "Type extensions",
TableHeader = "Type extension",
Members = Model.Module.TypeExtensions
})
@RenderPart("members", new {
Header = "Active patterns",
TableHeader = "Active pattern",
Members = Model.Module.ActivePatterns
})
</div>
<div class="span1"></div>
</div> | @{
Layout = "default";
Title = "Module";
}
<div class="row">
<div class="span1"></div>
<div class="span10" id="main">
<h1>@Model.Module.Name</h1>
<div class="xmldoc">
@Model.Module.Comment.FullText
</div>
@if (Model.Module.NestedTypes.Length > 0) {
<div>
<table class="table table-bordered type-list">
<thread>
<tr><td>Type</td><td>Description</td></tr>
</thread>
<tbody>
@foreach (var it in Model.Module.NestedTypes) {
<tr>
<td class="type-name">
<a href="@(it.UrlName).html">@Html.Encode(it.Name)</a>
</td>
<td class="xmldoc">@it.Comment.Blurb</td>
</tr>
}
</tbody>
</table>
</div>
}
@RenderPart("members", new {
Header = "Functions and values",
TableHeader = "Function or value",
Members = Model.Module.ValuesAndFuncs
})
@RenderPart("members", new {
Header = "Type extensions",
TableHeader = "Type extension",
Members = Model.Module.TypeExtensions
})
@RenderPart("members", new {
Header = "Active patterns",
TableHeader = "Active pattern",
Members = Model.Module.ActivePatterns
})
</div>
<div class="span1"></div>
</div> | apache-2.0 | C# |
e931b47d5cdbe32d5b7030193f3f1934772998b1 | fix compile error | LagoVista/DeviceAdmin | src/LagoVista.IoT.DeviceAdmin/Models/Attribute.cs | src/LagoVista.IoT.DeviceAdmin/Models/Attribute.cs | using LagoVista.Core.Attributes;
using LagoVista.Core.Models;
using LagoVista.Core.Validation;
using LagoVista.IoT.DeviceAdmin.Resources;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace LagoVista.IoT.DeviceAdmin.Models
{
[EntityDescription(DeviceAdminDomain.DeviceAdmin, DeviceLibraryResources.Names.Attribute_Title, DeviceLibraryResources.Names.Attribute_Description, DeviceLibraryResources.Names.Attribute_Help, EntityDescriptionAttribute.EntityTypes.SimpleModel, typeof(DeviceLibraryResources))]
public class Attribute : NodeBase, IValidateable
{
public Attribute()
{
States = new ObservableCollection<State>();
Units = new ObservableCollection<UnitSet>();
}
public enum AttributeTypes
{
[EnumLabel("state", DeviceLibraryResources.Names.Attribute_Type_States, typeof(DeviceLibraryResources), DeviceLibraryResources.Names.Attribute_Type_State_Help)]
States,
[EnumLabel("discrete", DeviceLibraryResources.Names.Attribute_Type_Discrete, typeof(DeviceLibraryResources), DeviceLibraryResources.Names.Attribute_Type_Discrete_Help)]
Discrete,
[EnumLabel("discrete-units", DeviceLibraryResources.Names.Attribute_Type_Discrete_Units, typeof(DeviceLibraryResources), DeviceLibraryResources.Names.Attribute_Type_Discrete_Units_Help)]
DiscreteUnits
}
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Attribute_AttributeType, EnumType:(typeof(AttributeTypes)), HelpResource: Resources.DeviceLibraryResources.Names.Attribute_AttributeType_Help, FieldType: FieldTypes.Picker, ResourceType: typeof(DeviceLibraryResources), WaterMark:Resources.DeviceLibraryResources.Names.Attribute_AttributeType_Select, IsRequired: true, IsUserEditable: true)]
public EntityHeader AttributeType { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Attribute_SetScript, HelpResource: Resources.DeviceLibraryResources.Names.Attribute_SetScript_Help, FieldType: FieldTypes.NodeScript, ResourceType: typeof(DeviceLibraryResources), IsRequired: true)]
public String Script { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Attribute_UnitSet, HelpResource: Resources.DeviceLibraryResources.Names.Attribute_UnitSet_Help, ResourceType: typeof(DeviceLibraryResources))]
public ObservableCollection<UnitSet> Units { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Attribute_States, HelpResource: Resources.DeviceLibraryResources.Names.Attribute_States_Help, ResourceType: typeof(DeviceLibraryResources))]
public ObservableCollection<State> States { get; set; }
}
}
| using LagoVista.Core.Attributes;
using LagoVista.Core.Models;
using LagoVista.Core.Validation;
using LagoVista.IoT.DeviceAdmin.Resources;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace LagoVista.IoT.DeviceAdmin.Models
{
[EntityDescription(DeviceAdminDomain.DeviceAdmin, DeviceLibraryResources.Names.Attribute_Title, DeviceLibraryResources.Names.Attribute_Description, DeviceLibraryResources.Names.Attribute_Help, EntityDescriptionAttribute.EntityTypes.SimpleModel, typeof(DeviceLibraryResources))]
public class Attribute : NodeBase, IValidateable
{
public Attribute()
{
States = new ObservableCollection<State>();
Units = new ObservableCollection<UnitSet>();
Connections = new List<Connection>();
}
public enum AttributeTypes
{
[EnumLabel("state", DeviceLibraryResources.Names.Attribute_Type_States, typeof(DeviceLibraryResources), DeviceLibraryResources.Names.Attribute_Type_State_Help)]
States,
[EnumLabel("discrete", DeviceLibraryResources.Names.Attribute_Type_Discrete, typeof(DeviceLibraryResources), DeviceLibraryResources.Names.Attribute_Type_Discrete_Help)]
Discrete,
[EnumLabel("discrete-units", DeviceLibraryResources.Names.Attribute_Type_Discrete_Units, typeof(DeviceLibraryResources), DeviceLibraryResources.Names.Attribute_Type_Discrete_Units_Help)]
DiscreteUnits
}
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Attribute_AttributeType, EnumType:(typeof(AttributeTypes)), HelpResource: Resources.DeviceLibraryResources.Names.Attribute_AttributeType_Help, FieldType: FieldTypes.Picker, ResourceType: typeof(DeviceLibraryResources), WaterMark:Resources.DeviceLibraryResources.Names.Attribute_AttributeType_Select, IsRequired: true, IsUserEditable: true)]
public EntityHeader AttributeType { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Attribute_SetScript, HelpResource: Resources.DeviceLibraryResources.Names.Attribute_SetScript_Help, FieldType: FieldTypes.NodeScript, ResourceType: typeof(DeviceLibraryResources), IsRequired: true)]
public String Script { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Attribute_UnitSet, HelpResource: Resources.DeviceLibraryResources.Names.Attribute_UnitSet_Help, ResourceType: typeof(DeviceLibraryResources))]
public ObservableCollection<UnitSet> Units { get; set; }
[FormField(LabelResource: Resources.DeviceLibraryResources.Names.Attribute_States, HelpResource: Resources.DeviceLibraryResources.Names.Attribute_States_Help, ResourceType: typeof(DeviceLibraryResources))]
public ObservableCollection<State> States { get; set; }
public Point DiagramLocation { get; set; }
}
}
| mit | C# |
9ee8644234591e209e49b1c99dc31e23c56e18cb | Make IND hostile to everybody by default | will-hart/AnvilEditor,will-hart/AnvilEditor | AnvilEditor/Templates/MissionBase.cs | AnvilEditor/Templates/MissionBase.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AnvilParser;
using AnvilParser.Tokens;
namespace AnvilEditor.Templates
{
public class MissionBase : ParserClass
{
/// <summary>
/// Handles random seeds
/// </summary>
private static readonly Random Rand = new Random();
/// <summary>
/// Creates a new mission base, with the `populate` flag determining if the class should be prepopulated with
/// default mission classes
/// </summary>
/// <param name="name"></param>
/// <param name="populate"></param>
public MissionBase(string name) : base(name)
{
if (name == "root")
{
this.Add("version", 12);
this.Add(new MissionBase("Mission"));
this.Add(new MissionBase("Intro"));
this.Add(new MissionBase("OutroLoose"));
this.Add(new MissionBase("OutroWin"));
this.Inject("Mission.Groups", new ParserObject("items") { Value = 1 });
this.Inject("Mission.Groups", new ServerBase());
this.Inject("Mission.Intel", new ParserObject("resistanceWest") { Value = 0 });
}
else
{
this.Add("Addons", new List<object> { "a3_map_altis" });
this.Add("addOnsAuto", new List<object> { "a3_map_altis" });
this.Add("randomSeed", Rand.Next());
this.Add(new IntelBase());
if (name == "Missions")
{
this.Add(new ParserClass("Groups"));
this.Add(new ParserClass("Vehicles"));
this.Add(new ParserClass("Sensors"));
}
}
}
public MissionBase(string name, IEnumerable<IParserToken> tokens, IEnumerable<ParserClass> objects)
: this(name)
{
this.Tokens = tokens.ToList();
this.Objects = objects.ToList();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AnvilParser;
using AnvilParser.Tokens;
namespace AnvilEditor.Templates
{
public class MissionBase : ParserClass
{
/// <summary>
/// Handles random seeds
/// </summary>
private static readonly Random Rand = new Random();
/// <summary>
/// Creates a new mission base, with the `populate` flag determining if the class should be prepopulated with
/// default mission classes
/// </summary>
/// <param name="name"></param>
/// <param name="populate"></param>
public MissionBase(string name) : base(name)
{
if (name == "root")
{
this.Add("version", 12);
this.Add(new MissionBase("Mission"));
this.Add(new MissionBase("Intro"));
this.Add(new MissionBase("OutroLoose"));
this.Add(new MissionBase("OutroWin"));
this.Inject("Mission.Groups", new ParserObject("items") { Value = 1 });
this.Inject("Mission.Groups", new ServerBase());
}
else
{
this.Add("Addons", new List<object> { "a3_map_altis" });
this.Add("addOnsAuto", new List<object> { "a3_map_altis" });
this.Add("randomSeed", Rand.Next());
this.Add(new IntelBase());
if (name == "Missions")
{
this.Add(new ParserClass("Groups"));
this.Add(new ParserClass("Vehicles"));
this.Add(new ParserClass("Sensors"));
}
}
}
public MissionBase(string name, IEnumerable<IParserToken> tokens, IEnumerable<ParserClass> objects)
: this(name)
{
this.Tokens = tokens.ToList();
this.Objects = objects.ToList();
}
}
}
| mit | C# |
c9563e6c38a5c55b944de847cb66285c4cc4dfe6 | Remove NetSerializable from DamageTypePrototype (#12594) | space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14 | Content.Shared/Damage/Prototypes/DamageTypePrototype.cs | Content.Shared/Damage/Prototypes/DamageTypePrototype.cs | using Robust.Shared.Prototypes;
namespace Content.Shared.Damage.Prototypes
{
/// <summary>
/// A single damage type. These types are grouped together in <see cref="DamageGroupPrototype"/>s.
/// </summary>
[Prototype("damageType")]
public sealed class DamageTypePrototype : IPrototype
{
[IdDataFieldAttribute]
public string ID { get; } = default!;
/// <summary>
/// The price for each 1% damage reduction in armors
/// </summary>
[DataField("armorCoefficientPrice")]
public double ArmorPriceCoefficient { get; set; }
/// <summary>
/// The price for each flat damage reduction in armors
/// </summary>
[DataField("armorFlatPrice")]
public double ArmorPriceFlat { get; set; }
}
}
| using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Damage.Prototypes
{
/// <summary>
/// A single damage type. These types are grouped together in <see cref="DamageGroupPrototype"/>s.
/// </summary>
[Prototype("damageType")]
[Serializable, NetSerializable]
public sealed class DamageTypePrototype : IPrototype
{
[IdDataFieldAttribute]
public string ID { get; } = default!;
/// <summary>
/// The price for each 1% damage reduction in armors
/// </summary>
[DataField("armorCoefficientPrice")]
public double ArmorPriceCoefficient { get; set; }
/// <summary>
/// The price for each flat damage reduction in armors
/// </summary>
[DataField("armorFlatPrice")]
public double ArmorPriceFlat { get; set; }
}
}
| mit | C# |
7f146a07fd5428fd866aa8114221a0829e910f39 | Fix License information in UrbanDictionary.cs | TheInterframe/Urban10 | PixelatedTile.Urban10/UrbanDictionary.cs | PixelatedTile.Urban10/UrbanDictionary.cs | /*
The MIT License (MIT)
Copyright (c) 2015 Suraj "Interframe" G.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using Newtonsoft.Json;
using PixelatedTile.Urban10.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace PixelatedTile.Urban10
{
/// <summary>
/// A simple class to interact with the Urban Dictionary API
/// </summary>
public class UrbanDictionary
{
private const string SEARCH_URL = "http://api.urbandictionary.com/v0/define?term=";
private string _urbanSound;
/// <summary>
/// Find a word in Urban Dictionary
/// </summary>
/// <param name="Word">The word or phrase you'd like to search</param>
/// <returns>LIST: Word, meaning, author etc...</returns>
public async Task<List<ResultsList>> FindWord(string Word) {
HttpClient httpClient = new HttpClient();
var response = await httpClient.GetStringAsync(SEARCH_URL + Word);
if (response.Contains("no_results"))
{
throw new Exception("No Results Found");
}
else
{
var urbanResults = JsonConvert.DeserializeObject<UrbanResults>(response);
_urbanSound = urbanResults.sounds.FirstOrDefault().ToString();
return urbanResults.list;
}
}
/// <summary>
/// returns the URL to the default audio transcription to the word.
/// </summary>
[Obsolete] //TODO: MAKE SURE THIS WORKS.
public string GetDefaultAudio {
get {
return _urbanSound;
}
}
}
}
| /*
Class: UrbanDictionary.cs
Description: A simple class to interact with the Urban Dictionary API
Created By: @Interframe
Copyright 2015 Suraj "Interframe" G.
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 Newtonsoft.Json;
using PixelatedTile.Urban10.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace PixelatedTile.Urban10
{
public class UrbanDictionary
{
private const string SEARCH_URL = "http://api.urbandictionary.com/v0/define?term=";
private string _urbanSound;
/// <summary>
/// Find a word in Urban Dictionary
/// </summary>
/// <param name="Word">The word or phrase you'd like to search</param>
/// <returns>LIST: Word, meaning, author etc...</returns>
public async Task<List<ResultsList>> FindWord(string Word) {
HttpClient httpClient = new HttpClient();
var response = await httpClient.GetStringAsync(SEARCH_URL + Word);
if (response.Contains("no_results"))
{
throw new Exception("No Results Found");
}
else
{
var urbanResults = JsonConvert.DeserializeObject<UrbanResults>(response);
_urbanSound = urbanResults.sounds.FirstOrDefault().ToString();
return urbanResults.list;
}
}
/// <summary>
/// returns the URL to the default audio transcription to the word.
/// </summary>
[Obsolete] //TODO: MAKE SURE THIS WORKS.
public string GetDefaultAudio {
get {
return _urbanSound;
}
}
}
}
| apache-2.0 | C# |
da9364fbf2e3c8c1bd1e8ce0524004affc6b455b | Fix call dot expression first test | ajlopez/BScript | Src/BScript.Tests/Expressions/CallDotExpressionTests.cs | Src/BScript.Tests/Expressions/CallDotExpressionTests.cs | namespace BScript.Tests.Expressions
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BScript.Commands;
using BScript.Expressions;
using BScript.Language;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class CallDotExpressionTests
{
[TestMethod]
public void CreateCallDotExpression()
{
DotExpression dotexpr = new DotExpression(new NameExpression("foo"), "bar");
IList<IExpression> exprs = new List<IExpression>() { new ConstantExpression(1), new ConstantExpression(2) };
var expr = new CallDotExpression(dotexpr, exprs);
Assert.AreEqual(dotexpr, expr.Expression);
Assert.AreSame(exprs, expr.ArgumentExpressions);
}
}
}
| namespace BScript.Tests.Expressions
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BScript.Commands;
using BScript.Expressions;
using BScript.Language;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class CallDotExpressionTests
{
[TestMethod]
public void CreateCallDotExpression()
{
NameExpression nexpr = new NameExpression("foo");
IList<IExpression> exprs = new List<IExpression>() { new ConstantExpression(1), new ConstantExpression(2) };
var expr = new CallDotExpression(nexpr, exprs);
Assert.AreEqual(nexpr, expr.Expression);
Assert.AreSame(exprs, expr.ArgumentExpressions);
}
}
}
| mit | C# |
31c280489e1e52dafa46cd99a1dee13ea4a25012 | Order cleanup deletes. (Try to fix test failure due to referential constraint on MySQL on the build server (unable to reproduce locally)). | livioc/nhibernate-core,fredericDelaporte/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,RogerKratz/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,alobakov/nhibernate-core,ngbrown/nhibernate-core,RogerKratz/nhibernate-core,nkreipke/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,ManufacturingIntelligence/nhibernate-core,lnu/nhibernate-core,ngbrown/nhibernate-core,ManufacturingIntelligence/nhibernate-core,fredericDelaporte/nhibernate-core,lnu/nhibernate-core,livioc/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,RogerKratz/nhibernate-core,nhibernate/nhibernate-core,alobakov/nhibernate-core,RogerKratz/nhibernate-core,nkreipke/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,nhibernate/nhibernate-core,livioc/nhibernate-core,lnu/nhibernate-core,alobakov/nhibernate-core | src/NHibernate.Test/NHSpecificTest/NH3641/TestFixture.cs | src/NHibernate.Test/NHSpecificTest/NH3641/TestFixture.cs | using System.Linq;
using NHibernate.Linq;
using NUnit.Framework;
namespace NHibernate.Test.NHSpecificTest.NH3641
{
public class TestFixture : BugTestCase
{
protected override void OnSetUp()
{
using (var session = OpenSession())
using (var tx = session.BeginTransaction())
{
var child = new Entity {Id = 1, Flag = true};
var parent = new Entity {Id = 2, ChildInterface = child, ChildConcrete = child};
session.Save(child);
session.Save(parent);
tx.Commit();
}
}
protected override void OnTearDown()
{
using (var session = OpenSession())
using (var tx = session.BeginTransaction())
{
DeleteAll<Entity>(session);
tx.Commit();
}
}
private static void DeleteAll<T>(ISession session)
{
session.CreateQuery("delete from " + typeof(T).Name + " where ChildInterface is null").ExecuteUpdate();
session.CreateQuery("delete from " + typeof(T).Name).ExecuteUpdate();
}
[Test]
public void TrueOrChildPropertyConcrete()
{
using (var session = OpenSession())
{
var result = session.Query<IEntity>()
.Where(x => x.ChildConcrete == null || x.ChildConcrete.Flag)
.ToList();
Assert.That(result, Has.Count.EqualTo(2));
}
}
[Test]
public void TrueOrChildPropertyInterface()
{
using (var session = OpenSession())
{
var result = session.Query<IEntity>()
.Where(x => x.ChildInterface == null || ((Entity) x.ChildInterface).Flag)
.ToList();
Assert.That(result, Has.Count.EqualTo(2));
}
}
}
} | using System.Linq;
using NHibernate.Linq;
using NUnit.Framework;
namespace NHibernate.Test.NHSpecificTest.NH3641
{
public class TestFixture : BugTestCase
{
protected override void OnSetUp()
{
using (var session = OpenSession())
using (var tx = session.BeginTransaction())
{
var child = new Entity {Id = 1, Flag = true};
var parent = new Entity {Id = 2, ChildInterface = child, ChildConcrete = child};
session.Save(child);
session.Save(parent);
tx.Commit();
}
}
protected override void OnTearDown()
{
using (var session = OpenSession())
using (var tx = session.BeginTransaction())
{
DeleteAll<Entity>(session);
tx.Commit();
}
}
private static void DeleteAll<T>(ISession session)
{
session.CreateQuery("delete from " + typeof (T).Name).ExecuteUpdate();
}
[Test]
public void TrueOrChildPropertyConcrete()
{
using (var session = OpenSession())
{
var result = session.Query<IEntity>()
.Where(x => x.ChildConcrete == null || x.ChildConcrete.Flag)
.ToList();
Assert.That(result, Has.Count.EqualTo(2));
}
}
[Test]
public void TrueOrChildPropertyInterface()
{
using (var session = OpenSession())
{
var result = session.Query<IEntity>()
.Where(x => x.ChildInterface == null || ((Entity) x.ChildInterface).Flag)
.ToList();
Assert.That(result, Has.Count.EqualTo(2));
}
}
}
} | lgpl-2.1 | C# |
1f24c74b3c5aad71aa76a01e198d744361d6f479 | Make sure the anchor is the parent element | PearMed/Pear-Interaction-Engine | Scripts/Interactions/ObjectWithAnchor.cs | Scripts/Interactions/ObjectWithAnchor.cs | using UnityEngine;
namespace Pear.InteractionEngine.Interactions
{
/// <summary>
/// Manipulating objects, such as resizing and moving, can be tricky when you have multiple scripts trying the modify the same thing.
/// This class creates an anchor element which is used to help these manipulations
/// </summary>
public class ObjectWithAnchor : MonoBehaviour
{
/// <summary>
/// Used to move and manipulate this object
/// </summary>
public Anchor AnchorElement;
void Awake()
{
if (AnchorElement != null && AnchorElement.transform == transform.parent)
return;
// Create the anchor element
GameObject anchor = new GameObject("Anchor");
AnchorElement = anchor.AddComponent<Anchor>();
AnchorElement.Child = this;
AnchorElement.transform.position = transform.position;
anchor.transform.SetParent(transform.parent, true);
transform.SetParent(AnchorElement.transform, true);
}
}
} | using UnityEngine;
namespace Pear.InteractionEngine.Interactions
{
/// <summary>
/// Manipulating objects, such as resizing and moving, can be tricky when you have multiple scripts trying the modify the same thing.
/// This class creates an anchor element which is used to help these manipulations
/// </summary>
public class ObjectWithAnchor : MonoBehaviour
{
/// <summary>
/// Used to move and manipulate this object
/// </summary>
public Anchor AnchorElement;
void Awake()
{
if (AnchorElement != null)
return;
// Create the anchor element
GameObject anchor = new GameObject("Anchor");
AnchorElement = anchor.AddComponent<Anchor>();
AnchorElement.Child = this;
AnchorElement.transform.position = transform.position;
anchor.transform.SetParent(transform.parent, true);
transform.SetParent(AnchorElement.transform, true);
}
}
} | mit | C# |
c900d4ff46309eafbeeff6a2646dddb3272e6496 | Fix from phone number for SMS sender | MasterOfSomeTrades/CommentEverythingCommunications | CEComms/ClassLibrary1/Communications/Twilio/SMS/TextMessageSender.cs | CEComms/ClassLibrary1/Communications/Twilio/SMS/TextMessageSender.cs | using CEComms.Communications.Twilio.User;
using CommentEverythingCryptography.Encryption;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Twilio;
namespace Stockiment.Communications.Twilio.SMS {
public class TextMessageSender {
public TextMessageSender() {
MaxSend = 20;
CharLimit = 4000;
}
public int MaxSend { get; set; }
public int CharLimit { get; set; }
private int _numberSent = 0;
public void SendText(string msg) {
IEncryptionProvider decryptor = EncryptionProviderFactory.CreateInstance(EncryptionProviderFactory.CryptographyMethod.AES);
// Find your Account Sid and Auth Token at twilio.com/user/account
TwilioRestClient twilio = new TwilioRestClient(decryptor.Decrypt(UserProfile.ACCOUNT_SID_CIPHER), decryptor.Decrypt(UserProfile.AUTH_TOKEN_CIPHER));
if (_numberSent < MaxSend) {
if (msg.Length <= CharLimit) {
foreach (string recipientCipher in UserProfile.RecipientListCiphers) {
if (_numberSent < MaxSend) {
Message message = twilio.SendMessage(decryptor.Decrypt(UserProfile.PHONE_NUMBER_CIPHER), decryptor.Decrypt(recipientCipher), msg);
_numberSent++;
}
}
} else {
Message message = twilio.SendMessage(decryptor.Decrypt(UserProfile.PHONE_NUMBER_CIPHER), decryptor.Decrypt(UserProfile.ADMIN_NUMBER_CIPHER), "====\nSMS length over character limit/n====");
_numberSent++;
}
}
if (_numberSent == MaxSend) {
Message message = twilio.SendMessage(decryptor.Decrypt(UserProfile.PHONE_NUMBER_CIPHER), decryptor.Decrypt(UserProfile.ADMIN_NUMBER_CIPHER), "====\nSMS alerts maxed out for time period/n====");
_numberSent++;
}
}
// TODO: Counter reset as function of this class
// TODO: Count message segments in counter (e.g. using message length)
public void ResetCounter() {
_numberSent = 0;
}
}
}
| using CEComms.Communications.Twilio.User;
using CommentEverythingCryptography.Encryption;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Twilio;
namespace Stockiment.Communications.Twilio.SMS {
public class TextMessageSender {
public TextMessageSender() {
MaxSend = 20;
CharLimit = 4000;
}
public int MaxSend { get; set; }
public int CharLimit { get; set; }
private int _numberSent = 0;
public void SendText(string msg) {
IEncryptionProvider decryptor = EncryptionProviderFactory.CreateInstance(EncryptionProviderFactory.CryptographyMethod.AES);
// Find your Account Sid and Auth Token at twilio.com/user/account
TwilioRestClient twilio = new TwilioRestClient(decryptor.Decrypt(UserProfile.ACCOUNT_SID_CIPHER), decryptor.Decrypt(UserProfile.AUTH_TOKEN_CIPHER));
if (_numberSent < MaxSend) {
if (msg.Length <= CharLimit) {
foreach (string recipientCipher in UserProfile.RecipientListCiphers) {
if (_numberSent < MaxSend) {
Message message = twilio.SendMessage(UserProfile.PHONE_NUMBER_CIPHER, decryptor.Decrypt(recipientCipher), msg);
_numberSent++;
}
}
} else {
Message message = twilio.SendMessage(decryptor.Decrypt(UserProfile.PHONE_NUMBER_CIPHER), decryptor.Decrypt(UserProfile.ADMIN_NUMBER_CIPHER), "====\nSMS length over character limit/n====");
_numberSent++;
}
}
if (_numberSent == MaxSend) {
Message message = twilio.SendMessage(decryptor.Decrypt(UserProfile.PHONE_NUMBER_CIPHER), decryptor.Decrypt(UserProfile.ADMIN_NUMBER_CIPHER), "====\nSMS alerts maxed out for time period/n====");
_numberSent++;
}
}
// TODO: Counter reset as function of this class
// TODO: Count message segments in counter (e.g. using message length)
public void ResetCounter() {
_numberSent = 0;
}
}
}
| mit | C# |
76c075df2cee8be3a45b14f24826a8933d0ee2fb | Fix codefactor | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/Views/AddWallet/LegalDocumentsView.axaml.cs | WalletWasabi.Fluent/Views/AddWallet/LegalDocumentsView.axaml.cs | using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace WalletWasabi.Fluent.Views.AddWallet
{
public class LegalDocumentsView : UserControl
{
public LegalDocumentsView()
{
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
| using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace WalletWasabi.Fluent.Views.AddWallet
{
public class LegalDocumentsView : UserControl
{
public LegalDocumentsView()
{
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
| mit | C# |
895f7386943f554aae3c9509df69569415a475a0 | Update for cookies | wbsimms/PracticeTime,wbsimms/PracticeTime,wbsimms/PracticeTime,wbsimms/PracticeTime | src/Web/PracticeTime.Web.Test/UI_Automation/LoginTest.cs | src/Web/PracticeTime.Web.Test/UI_Automation/LoginTest.cs | using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WatiN.Core;
namespace PracticeTime.Web.Test.UI_Automation
{
[TestClass]
public class LoginTest
{
[TestMethod, Ignore]
public void LoginStudentTest()
{
using (var browser = new IE("http://localhost:29116/"))
{
if (browser.ContainsText("Hello"))
{
// logout
Link logoff = browser.Link(Find.ByText("Log off"));
if (logoff.Exists)
{
logoff.Click();
browser.WaitUntilContainsText("Log in");
}
}
browser.WaitUntilContainsText("Log in");
var links = browser.Links;
Assert.IsTrue(links.Count > 0);
Link login = browser.Link(Find.ByText("Log in"));
Assert.IsTrue(login.Exists);
login.Click();
browser.WaitUntilContainsText("Log in.");
browser.TextField(Find.ById("UserName")).TypeText("student");
browser.TextField(Find.ById("Password")).TypeText("student");
var buttons = browser.Buttons;
Button loginButton = browser.Button(Find.ByValue("Log in"));
Assert.IsTrue(loginButton.Exists);
loginButton.Click();
browser.WaitUntilContainsText("Hello student!");
Assert.IsTrue(browser.ContainsText("Sessions"));
}
}
}
}
| using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WatiN.Core;
namespace PracticeTime.Web.Test.UI_Automation
{
[TestClass]
public class LoginTest
{
[TestMethod, Ignore]
public void LoginStudentTest()
{
using (var browser = new IE("http://localhost:29116/"))
{
if (browser.ContainsText("Hello"))
{
// logout
Link logoff = browser.Link(Find.ByLabelText("Log off"));
if (logoff.Exists)
{
logoff.Click();
browser.WaitUntilContainsText("Log in");
}
}
var links = browser.Links;
Assert.IsTrue(links.Count > 0);
Link login = browser.Link(Find.ByText("Log in"));
Assert.IsTrue(login.Exists);
login.Click();
browser.WaitUntilContainsText("Log in.");
browser.TextField(Find.ById("UserName")).TypeText("student");
browser.TextField(Find.ById("Password")).TypeText("student");
var buttons = browser.Buttons;
Button loginButton = browser.Button(Find.ByValue("Log in"));
Assert.IsTrue(loginButton.Exists);
loginButton.Click();
browser.WaitUntilContainsText("Hello student!");
Assert.IsTrue(true);
}
}
}
}
| apache-2.0 | C# |
4cfca71d080822734e7f29de27b5273f3304460a | Fix a few test scenes | smoogipooo/osu,UselessToucan/osu,peppy/osu-new,smoogipoo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,peppy/osu,NeoAdonis/osu | osu.Game/Tests/Visual/RateAdjustedBeatmapTestScene.cs | osu.Game/Tests/Visual/RateAdjustedBeatmapTestScene.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.Diagnostics;
using osu.Framework.Extensions.ObjectExtensions;
namespace osu.Game.Tests.Visual
{
/// <summary>
/// Test case which adjusts the beatmap's rate to match any speed adjustments in visual tests.
/// </summary>
public abstract class RateAdjustedBeatmapTestScene : ScreenTestScene
{
protected override void Update()
{
base.Update();
// note that this will override any mod rate application
if (MusicController.TrackLoaded)
{
Debug.Assert(MusicController.CurrentTrack != null);
MusicController.CurrentTrack.Tempo.Value = Clock.Rate;
}
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Extensions.ObjectExtensions;
namespace osu.Game.Tests.Visual
{
/// <summary>
/// Test case which adjusts the beatmap's rate to match any speed adjustments in visual tests.
/// </summary>
public abstract class RateAdjustedBeatmapTestScene : ScreenTestScene
{
protected override void Update()
{
base.Update();
// note that this will override any mod rate application
MusicController.CurrentTrack.AsNonNull().Tempo.Value = Clock.Rate;
}
}
}
| mit | C# |
006f91456dfed7607e0b1be44c26ade04ec85b5e | make SpecExtensions.Find by name more reliable | nspec/NSpec,mattflo/NSpec,BennieCopeland/NSpec,mattflo/NSpec,mattflo/NSpec,nspec/NSpec,BennieCopeland/NSpec,mattflo/NSpec | NSpecSpecs/SpecExtensions.cs | NSpecSpecs/SpecExtensions.cs | using System.Linq;
using System.Text.RegularExpressions;
using NSpec;
using NSpec.Domain;
namespace NSpecSpecs
{
public static class SpecExtensions
{
public static Context Find(this ContextCollection contextCollection, string name)
{
return contextCollection.AllContexts().SingleOrDefault(c => c.Name == name);
}
public static ExampleBase FindExample(this ContextCollection contextCollection, string name)
{
return contextCollection.Examples().SingleOrDefault(e => e.Spec == name);
}
public static void should_have_passed(this ExampleBase example)
{
(example.HasRun && example.Exception == null).is_true();
}
public static void should_have_failed(this ExampleBase example)
{
(example.HasRun && example.Exception == null).is_false();
}
public static string RegexReplace(this string input, string pattern, string replace)
{
return Regex.Replace(input, pattern, replace);
}
}
} | using System.Linq;
using System.Text.RegularExpressions;
using NSpec;
using NSpec.Domain;
namespace NSpecSpecs
{
public static class SpecExtensions
{
public static Context Find(this ContextCollection contextCollection, string name)
{
return contextCollection.AllContexts().FirstOrDefault(c => c.Name == name);
}
public static ExampleBase FindExample(this ContextCollection contextCollection, string name)
{
return contextCollection.Examples().FirstOrDefault(e => e.Spec == name);
}
public static void should_have_passed(this ExampleBase example)
{
(example.HasRun && example.Exception == null).is_true();
}
public static void should_have_failed(this ExampleBase example)
{
(example.HasRun && example.Exception == null).is_false();
}
public static string RegexReplace(this string input, string pattern, string replace)
{
return Regex.Replace(input, pattern, replace);
}
}
} | mit | C# |
252be27100ec45a916be258b1e147c5ec7c23584 | Remove namespace and public from console app | mlorbetske/cli,johnbeisner/cli,dasMulli/cli,blackdwarf/cli,svick/cli,blackdwarf/cli,blackdwarf/cli,ravimeda/cli,weshaggard/cli,harshjain2/cli,livarcocc/cli-1,nguerrera/cli,AbhitejJohn/cli,mlorbetske/cli,nguerrera/cli,Faizan2304/cli,weshaggard/cli,MichaelSimons/cli,svick/cli,EdwardBlair/cli,harshjain2/cli,MichaelSimons/cli,AbhitejJohn/cli,johnbeisner/cli,mlorbetske/cli,jonsequitur/cli,harshjain2/cli,weshaggard/cli,svick/cli,MichaelSimons/cli,livarcocc/cli-1,dasMulli/cli,naamunds/cli,naamunds/cli,MichaelSimons/cli,jonsequitur/cli,weshaggard/cli,MichaelSimons/cli,nguerrera/cli,johnbeisner/cli,naamunds/cli,Faizan2304/cli,AbhitejJohn/cli,nguerrera/cli,jonsequitur/cli,naamunds/cli,EdwardBlair/cli,jonsequitur/cli,Faizan2304/cli,ravimeda/cli,weshaggard/cli,livarcocc/cli-1,AbhitejJohn/cli,ravimeda/cli,dasMulli/cli,mlorbetske/cli,EdwardBlair/cli,naamunds/cli,blackdwarf/cli | src/dotnet/commands/dotnet-new/CSharp_Console/Program.cs | src/dotnet/commands/dotnet-new/CSharp_Console/Program.cs | using System;
public class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
| using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
| mit | C# |
ccc164c1a061d1dc29bc3022d2583d5c9066d38a | set version to 1.5.0.6 | evitself/HTML-Renderer,tinygg/graphic-HTML-Renderer,evitself/HTML-Renderer,ArthurHub/HTML-Renderer,tinygg/graphic-HTML-Renderer,Perspex/HTML-Renderer,Perspex/HTML-Renderer,todor-dk/HTML-Renderer,slagou/HTML-Renderer,todor-dk/HTML-Renderer,verdesgrobert/HTML-Renderer,ArthurHub/HTML-Renderer,tinygg/graphic-HTML-Renderer,verdesgrobert/HTML-Renderer,drickert5/HTML-Renderer,windygu/HTML-Renderer,todor-dk/HTML-Renderer,windygu/HTML-Renderer,drickert5/HTML-Renderer,slagou/HTML-Renderer | Source/SharedAssemblyInfo.cs | Source/SharedAssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HTML Renderer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Open source hosted on CodePlex")]
[assembly: AssemblyProduct("HTML Renderer")]
[assembly: AssemblyCopyright("Copyright © 2008")]
[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("ec8a9e7e-9a9d-43c3-aa97-f6f505b1d3ed")]
// Version information for an assembly consists of the following four values:
[assembly: AssemblyVersion("1.5.0.6")] | 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("HTML Renderer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Open source hosted on CodePlex")]
[assembly: AssemblyProduct("HTML Renderer")]
[assembly: AssemblyCopyright("Copyright © 2008")]
[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("ec8a9e7e-9a9d-43c3-aa97-f6f505b1d3ed")]
// Version information for an assembly consists of the following four values:
[assembly: AssemblyVersion("1.5.1.0")] | bsd-3-clause | C# |
2976883ddb383462f01418a79d06b5582db93274 | Add docs to Result | exodrifter/unity-rumor | Parser/Result.cs | Parser/Result.cs | namespace Exodrifter.Rumor.Parser
{
/// <summary>
/// Represents a successful result from a parser.
/// </summary>
/// <typeparam name="T">
/// The type of the value which was parsed.
/// </typeparam>
public sealed class Result<T>
{
/// <summary>
/// The state to use for the next parser after this one.
/// </summary>
public State NextState { get; }
/// <summary>
/// The value that was successfully parsed.
/// </summary>
public T Value { get; }
/// <summary>
/// Creates a new successful parse result.
/// </summary>
/// <param name="nextState">
/// The state to use for the next parser after this one.
/// </param>
/// <param name="value">
/// The value that was successfully parsed.
/// </param>
public Result(State nextState, T value)
{
NextState = nextState;
Value = value;
}
}
}
| namespace Exodrifter.Rumor.Parser
{
public sealed class Result<T>
{
public State NextState { get; }
public T Value { get; }
public Result(State nextState, T value)
{
NextState = nextState;
Value = value;
}
}
}
| mit | C# |
9179a84932db8f9a6973f3d3e1bbfb3672cca64b | Handle filename changes | Unity-Technologies/editorconfig-visualstudio,jedmao/editorconfig-visualstudio,jedmao/editorconfig-visualstudio,Unity-Technologies/editorconfig-visualstudio | Plugin/Plugin.cs | Plugin/Plugin.cs | using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
namespace EditorConfig.VisualStudio
{
/// <summary>
/// This plugin attaches to an editor instance and updates its settings at
/// the appropriate times
/// </summary>
internal class Plugin
{
public Plugin(IWpfTextView view, ITextDocument document)
{
document.FileActionOccurred += FileActionOccurred;
LoadSettings(document.FilePath);
}
/// <summary>
/// Reloads the settings when the filename changes
/// </summary>
void FileActionOccurred(object sender, TextDocumentFileActionEventArgs e)
{
if ((e.FileActionType & FileActionTypes.DocumentRenamed) != 0)
LoadSettings(e.FilePath);
}
/// <summary>
/// Loads the settings for the given file path
/// </summary>
private void LoadSettings(string path)
{
using (var log = new System.IO.StreamWriter(System.IO.Path.GetTempPath() + "editorconfig.log"))
log.Write("Load settings for file " + path);
}
}
}
| using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
namespace EditorConfig.VisualStudio
{
/// <summary>
/// This plugin attaches to an editor instance and updates its settings at
/// the appropriate times
/// </summary>
internal class Plugin
{
public Plugin(IWpfTextView view, ITextDocument document)
{
using (var log = new System.IO.StreamWriter(System.IO.Path.GetTempPath() + "editorconfig.log"))
log.Write("Plugin object created for document " + document.FilePath);
}
}
}
| bsd-2-clause | C# |
b5a71683de5b2b0aabe22b5b9f89f07a95a20427 | Change date range input field type to text | jittuu/AzureLog,jittuu/AzureLog,jittuu/AzureLog | AzureLog.Web/Views/Home/Index.cshtml | AzureLog.Web/Views/Home/Index.cshtml | @model IEnumerable<AzureLog.Web.Models.AzureLogEntity>
@{
ViewBag.Title = "Home Page";
}
<div class="row">
<div class="page-header" id="banner">
Azure Log Viewer
</div>
@using (Html.BeginForm())
{
<div class="form-group">
<div class="timestamp">
<input type="text" class="form-control" id="accountName" name="accountName" placeholder="Account Name" value="@ViewBag.AccountName" />
<span>-</span>
<input type="text" class="form-control" id="key" name="key" placeholder="Key" value="@ViewBag.Key" />
<span>-</span>
<input type="text" class="form-control" id="tableName" name="tableName" placeholder="Table Name" value="@ViewBag.TableName" />
</div>
</div>
<div class="form-group">
<div class="timestamp">
<input type="text" class="form-control" id="from" name="from" placeholder="e.g. 2006-01-28 15:04:05" value="@ViewBag.From" />
<span>-</span>
<input type="text" class="form-control" id="to" name="to" placeholder="e.g. 2006-01-28 15:04:05" value="@ViewBag.To" />
</div>
</div>
<div class="form-group">
<textarea id="regex" name="regex" class="form-control" rows="3" placeholder="Search (regex)" >@ViewBag.Regex</textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">
<span class="glyphicon glyphicon-search"></span> Search
</button>
</div>
}
</div>
<div class="row">
<table>
<thead>
<tr>
<th>Log Messages</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>@item.Message</td>
</tr>
}
</tbody>
</table>
</div> | @model IEnumerable<AzureLog.Web.Models.AzureLogEntity>
@{
ViewBag.Title = "Home Page";
}
<div class="row">
<div class="page-header" id="banner">
Azure Log Viewer
</div>
@using (Html.BeginForm())
{
<div class="form-group">
<div class="timestamp">
<input type="text" class="form-control" id="accountName" name="accountName" placeholder="Account Name" value="@ViewBag.AccountName" />
<span>-</span>
<input type="text" class="form-control" id="key" name="key" placeholder="Key" value="@ViewBag.Key" />
<span>-</span>
<input type="text" class="form-control" id="tableName" name="tableName" placeholder="Table Name" value="@ViewBag.TableName" />
</div>
</div>
<div class="form-group">
<div class="timestamp">
<input type="date" class="form-control" id="from" name="from" placeholder="e.g. 2006-01-28 15:04:05" value="@ViewBag.From" />
<span>-</span>
<input type="date" class="form-control" id="to" name="to" placeholder="e.g. 2006-01-28 15:04:05" value="@ViewBag.To" />
</div>
</div>
<div class="form-group">
<textarea id="regex" name="regex" class="form-control" rows="3" placeholder="Search (regex)" >@ViewBag.Regex</textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">
<span class="glyphicon glyphicon-search"></span> Search
</button>
</div>
}
</div>
<div class="row">
<table>
<thead>
<tr>
<th>Log Messages</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>@item.Message</td>
</tr>
}
</tbody>
</table>
</div> | mit | C# |
ba1beeddf437673b1e66764038b3eeea2cb8012c | Fix prog | jefking/King.Azure.Imaging,jefking/King.Azure.Imaging,jefking/King.Azure.Imaging | King.Azure.Imaging.WebJob/Program.cs | King.Azure.Imaging.WebJob/Program.cs | namespace King.Azure.Imaging.WebJob
{
using System;
using Microsoft.Azure;
using Microsoft.Azure.WebJobs;
public class Program
{
public static void Main()
{
var webJobsDashboard = CloudConfigurationManager.GetSetting("AzureWebJobsDashboard");
var webJobsStorage = CloudConfigurationManager.GetSetting("AzureWebJobsStorage");
var storageAcc = CloudConfigurationManager.GetSetting("StorageAccount");
if (string.IsNullOrWhiteSpace(webJobsStorage) || string.IsNullOrWhiteSpace(storageAcc) || string.IsNullOrWhiteSpace(webJobsDashboard))
{
Console.WriteLine("Please add the Azure Storage account credentials ['StorageAccount' & 'AzureWebJobsStorage' & 'AzureWebJobsDashboard'] in App.config");
Console.Read();
return;
}
else
{
var host = new JobHost();
host.RunAndBlock();
}
}
}
} | namespace King.Azure.Imaging.WebJob
{
using System;
using System.Configuration;
using Microsoft.Azure.WebJobs;
public class Program
{
public static void Main()
{
var webJobsStorage = ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ConnectionString;
var storageAcc = ConfigurationManager.ConnectionStrings["StorageAccount"].ConnectionString;
if (string.IsNullOrWhiteSpace(webJobsStorage) || string.IsNullOrWhiteSpace(storageAcc))
{
Console.WriteLine("Please add the Azure Storage account credentials ['StorageAccount' & 'AzureWebJobsStorage'] in App.config");
Console.Read();
return;
}
else
{
var host = new JobHost();
host.RunAndBlock();
}
}
}
} | mit | C# |
a861edbf9931de5ae87b054fa13f04d581712eb4 | Fix "deposit notification" message | croquet-australia/croquet-australia-website,croquet-australia/website-application,croquet-australia/croquet-australia-website,croquet-australia/croquet-australia.com.au,croquet-australia/croquet-australia.com.au,croquet-australia/croquet-australia-website,croquet-australia/croquet-australia.com.au,croquet-australia/croquet-australia-website,croquet-australia/website-application,croquet-australia/croquet-australia.com.au,croquet-australia/website-application,croquet-australia/website-application | source/CroquetAustralia.Website/app/tournaments/deposited.cshtml | source/CroquetAustralia.Website/app/tournaments/deposited.cshtml | <section>
<h1>EFT Deposit</h1>
<p>Thank you for notifying us of your EFT Deposit</p>
<p>
Regards<br/>
Croquet Australia
</p>
</section> | <section>
<h1>EFT Deposit</h1>
<p>Thank you notifying us of your EFT Deposit</p>
<p>
Regards<br/>
Croquet Australia
</p>
</section> | mit | C# |
bd64240b97c2df2e00f9e06af2c37ff60f28849f | Remove reference to Hibernating Rhinos | sixteencolors/Pablo.Gallery,sixteencolors/Pablo.Gallery,sixteencolors/Pablo.Gallery,sixteencolors/Pablo.Gallery | src/Pablo.Gallery/Global.asax.cs | src/Pablo.Gallery/Global.asax.cs | using Pablo.Gallery.Models;
using System.Data.Entity;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System;
using System.Threading;
namespace Pablo.Gallery
{
public class MvcApplication : HttpApplication
{
static MvcApplication()
{
// need to setup here otherwise it won't load embedded dll's properly
Global.Initialize();
}
protected void Application_Start()
{
//HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
AuthConfig.RegisterAuth();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
BundleConfig.RegisterExternalBundles(BundleTable.Bundles);
}
protected void Application_Error(object sender, EventArgs e)
{
Exception exception = Server.GetLastError();
Console.WriteLine("Application error {0}", exception);
}
}
} | using Pablo.Gallery.Models;
using System.Data.Entity;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System;
using System.Threading;
namespace Pablo.Gallery
{
public class MvcApplication : HttpApplication
{
static MvcApplication()
{
// need to setup here otherwise it won't load embedded dll's properly
Global.Initialize();
}
protected void Application_Start()
{
HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
AuthConfig.RegisterAuth();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
BundleConfig.RegisterExternalBundles(BundleTable.Bundles);
}
protected void Application_Error(object sender, EventArgs e)
{
Exception exception = Server.GetLastError();
Console.WriteLine("Application error {0}", exception);
}
}
} | mit | C# |
3c88f894037f8d7c7bb80791009465a4a11f53b0 | remove commented out code | jobeland/NeuralNetwork | NeuralNetwork/NeuralNetwork/Layer.cs | NeuralNetwork/NeuralNetwork/Layer.cs | using ArtificialNeuralNetwork.ActivationFunctions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ArtificialNeuralNetwork
{
[Serializable]
public class Layer : ILayer
{
private readonly IList<INeuron> _neuronsInLayer;
private Layer(IList<INeuron> neuronsInLayer)
{
_neuronsInLayer = neuronsInLayer;
}
public static ILayer GetInstance(IList<INeuron> neuronsInLayer)
{
return new Layer(neuronsInLayer);
}
public void Process()
{
foreach (INeuron n in _neuronsInLayer)
{
n.Process();
}
}
}
}
| using ArtificialNeuralNetwork.ActivationFunctions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ArtificialNeuralNetwork
{
[Serializable]
public class Layer : ILayer
{
private readonly IList<INeuron> _neuronsInLayer;
private Layer(IList<INeuron> neuronsInLayer)
{
_neuronsInLayer = neuronsInLayer;
//NeuronsInLayer = new List<ActiveNeuron>();
//for (int i = 0; i < numberOfNeuronsInLayer; i++)
//{
// ActiveNeuron n = new ActiveNeuron(connectionsIn, activationFunction);
// n.initBias();
// NeuronsInLayer.Add(n);
//}
}
public static ILayer GetInstance(IList<INeuron> neuronsInLayer)
{
return new Layer(neuronsInLayer);
}
public void Process()
{
foreach (INeuron n in _neuronsInLayer)
{
n.Process();
}
}
}
}
| mit | C# |
eda41176d157bf12179714100b762c1abaca17dd | test ultra small index prefix | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | src/FilterLists.Api/Migrations/20181019141708_AddRuleRawIndex.cs | src/FilterLists.Api/Migrations/20181019141708_AddRuleRawIndex.cs | using FilterLists.Api.Migrations.Extensions;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FilterLists.Api.Migrations
{
public partial class AddRuleRawIndex : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
"IX_rules_Raw",
"rules",
"Raw",
10); //191);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
"IX_rules_Raw",
"rules");
}
}
} | using FilterLists.Api.Migrations.Extensions;
using Microsoft.EntityFrameworkCore.Migrations;
namespace FilterLists.Api.Migrations
{
public partial class AddRuleRawIndex : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
"IX_rules_Raw",
"rules",
"Raw",
191);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
"IX_rules_Raw",
"rules");
}
}
} | mit | C# |
5b9fb5cb861caae6b98d7b3e78330f7183fa812d | Fix EmptyContainer properly. | space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14 | Content.Server/Construction/Completions/EmptyContainer.cs | Content.Server/Construction/Completions/EmptyContainer.cs | #nullable enable
using System.Linq;
using System.Threading.Tasks;
using Content.Shared.Construction;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
public class EmptyContainer : IGraphAction
{
public string Container { get; private set; } = string.Empty;
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.Container, "container", string.Empty);
}
public async Task PerformAction(IEntity entity, IEntity? user)
{
if (entity.Deleted) return;
if (!entity.TryGetComponent(out ContainerManagerComponent? containerManager) ||
!containerManager.TryGetContainer(Container, out var container)) return;
// TODO: Use container helpers.
foreach (var contained in container.ContainedEntities.ToArray())
{
container.ForceRemove(contained);
contained.Transform.Coordinates = entity.Transform.Coordinates;
contained.Transform.AttachToGridOrMap();
}
}
}
}
| #nullable enable
using System.Threading.Tasks;
using Content.Shared.Construction;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
public class EmptyContainer : IGraphAction
{
public string Container { get; private set; } = string.Empty;
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.Container, "container", string.Empty);
}
public async Task PerformAction(IEntity entity, IEntity? user)
{
if (entity.Deleted) return;
if (!entity.TryGetComponent(out ContainerManagerComponent? containerManager) ||
!containerManager.TryGetContainer(Container, out var container)) return;
container.EmptyContainer(true, entity.Transform.Coordinates);
entity.Transform.AttachToGridOrMap();
}
}
}
| mit | C# |
dd0e4e05d8562193f478bc3ac2ec1a45476790b3 | Apply naming conventions to QAnimation | jnbt/NeoQueues | Assets/NeoQueues/QAnimation.cs | Assets/NeoQueues/QAnimation.cs | using System;
using System.Collections;
using Neo.Async;
namespace Neo.Queues {
/// <summary>
/// Wraps any Unity-base animation into a queue item which will finished
/// as soon as the animation has finished.
/// </summary>
/// <example><![CDATA[
/// QAnimation qAni = new QAnimation(gameObject.GetComponent<Animation>());
/// ]]></example>
public class QAnimation : Base {
private UnityEngine.Animation ani;
/// <summary>
/// Construct a queue item bound to a Unity animation
/// </summary>
/// <param name="ani"></param>
public QAnimation(UnityEngine.Animation ani)
: base() {
this.ani = ani;
}
/// <summary>
/// Stops the animation and finishes this queue item
/// </summary>
public void Abort() {
ani.Stop();
Finished();
}
/// <summary>
/// Executes this queue item
/// </summary>
protected override void Execute() {
ani.Play();
Async.CoroutineStarter.Instance.Add(waitForAnimation(ani));
}
private IEnumerator waitForAnimation(UnityEngine.Animation ani) {
do {
yield return null;
} while(ani.isPlaying);
Finished();
}
}
}
| using System;
using System.Collections;
using Neo.Async;
namespace Neo.Queues {
/// <summary>
/// Wraps any Unity-base animation into a queue item which will finished
/// as soon as the animation has finished.
/// </summary>
/// <example><![CDATA[
/// QAnimation qAni = new QAnimation(gameObject.GetComponent<Animation>());
/// ]]></example>
public class QAnimation : Base {
private UnityEngine.Animation Ani;
/// <summary>
/// Construct a queue item bound to a Unity animation
/// </summary>
/// <param name="Ani"></param>
public QAnimation(UnityEngine.Animation Ani)
: base() {
this.Ani = Ani;
}
/// <summary>
/// Stops the animation and finishes this queue item
/// </summary>
public void Abort() {
Ani.Stop();
Finished();
}
/// <summary>
/// Executes this queue item
/// </summary>
protected override void Execute() {
Ani.Play();
Async.CoroutineStarter.Instance.Add(waitForAnimation(Ani));
}
private IEnumerator waitForAnimation(UnityEngine.Animation ani) {
do {
yield return null;
} while(ani.isPlaying);
Finished();
}
}
}
| mit | C# |
443e63430fcccb76e542e2f5bc86b979a8a70374 | Remove unused using | Galad/tranquire,Galad/tranquire,Galad/tranquire | src/Sandbox/Program.cs | src/Sandbox/Program.cs | using FluentAssertions;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Edge;
using OpenQA.Selenium.Firefox;
using Tranquire;
using Tranquire.Selenium;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ToDoList.Automation.Actions;
using ToDoList.Automation.Questions;
namespace Sandbox
{
class Program
{
static void Main(string[] args)
{
//using (var webDriver = new FirefoxDriver())
//{
// IActor actor = new Actor("John");
// actor.Can(BrowseTheWeb.With(webDriver))
// .WasAbleTo(Open.TheApplication())
// .AttemptsTo(ToDoItem.AddAToDoItem("buy some milk"));
// actor.AsksFor(TheItems.Displayed()).Should().Contain("buy some milk");
//}
//using (var a = new WebDriverFixture())
//{
// a.NavigateTo("Targets.html");
// Console.Read();
//}
//Console.Read();
}
}
}
| using FluentAssertions;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Edge;
using OpenQA.Selenium.Firefox;
using Tranquire;
using Tranquire.Selenium;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ToDoList.Automation.Actions;
using ToDoList.Automation.Questions;
using Tranquire.Selenium.Tests;
namespace Sandbox
{
class Program
{
static void Main(string[] args)
{
//using (var webDriver = new FirefoxDriver())
//{
// IActor actor = new Actor("John");
// actor.Can(BrowseTheWeb.With(webDriver))
// .WasAbleTo(Open.TheApplication())
// .AttemptsTo(ToDoItem.AddAToDoItem("buy some milk"));
// actor.AsksFor(TheItems.Displayed()).Should().Contain("buy some milk");
//}
//using (var a = new WebDriverFixture())
//{
// a.NavigateTo("Targets.html");
// Console.Read();
//}
//Console.Read();
}
}
}
| mit | C# |
3b6ee74b81eb12d0da78d63119d96e8d3eb0d5fd | Add back missing bracket | Weingartner/SolidworksAddinFramework | SolidworksAddinFramework.Spec/EnumerableExtensionsSpec.cs | SolidworksAddinFramework.Spec/EnumerableExtensionsSpec.cs | using System.Linq;
using FluentAssertions;
using Xunit;
namespace SolidworksAddinFramework.Spec
{
public class EnumerableExtensionsSpec
{
[Fact]
public void BufferWhileNotChangedShouldWork()
{
var list = new[] {2, 4, 6, 8, 1, 3, 7, 2, 9, 7, 11, 4, 8, 100};
var r = list.BufferTillChanged(v => v % 2).ToList();
r[0].Value.Should().Equal(2, 4, 6, 8);
r[1].Value.Should().Equal(1, 3, 7);
r[2].Value.Should().Equal(2);
r[3].Value.Should().Equal(9, 7, 11);
r[4].Value.Should().Equal(4, 8, 100);
new int[] {}.BufferTillChanged(v => v).ToList().Count.Should().Be(0);
}
[Fact]
public void TransposeShouldWork()
{
var t = new[] { new[] { 1, 2, 3 }, new[] { 4, 5, 6 }, new[] { 7, 8, 9 } };
var r = t.Transpose().Select(v => v.ToList()).ToList();
r[0].Should().Equal(1, 4, 7);
r[1].Should().Equal(2, 5, 8);
r[2].Should().Equal(3, 6, 9);
r.Count.Should().Be(3);
}
}
} | using System.Linq;
using FluentAssertions;
using Xunit;
namespace SolidworksAddinFramework.Spec
{
public class EnumerableExtensionsSpec
{
[Fact]
public void BufferWhileNotChangedShouldWork()
{
var list = new[] {2, 4, 6, 8, 1, 3, 7, 2, 9, 7, 11, 4, 8, 100};
var r = list.BufferTillChanged(v => v % 2).ToList();
r[0].Value.Should().Equal(2, 4, 6, 8);
r[1].Value.Should().Equal(1, 3, 7);
r[2].Value.Should().Equal(2);
r[3].Value.Should().Equal(9, 7, 11);
r[4].Value.Should().Equal(4, 8, 100);
new int[] {}.BufferTillChanged(v => v).ToList().Count.Should().Be(0);
[Fact]
public void TransposeShouldWork()
{
var t = new[] { new[] { 1, 2, 3 }, new[] { 4, 5, 6 }, new[] { 7, 8, 9 } };
var r = t.Transpose().Select(v => v.ToList()).ToList();
r[0].Should().Equal(1, 4, 7);
r[1].Should().Equal(2, 5, 8);
r[2].Should().Equal(3, 6, 9);
r.Count.Should().Be(3);
}
}
} | mit | C# |
8ae48aee68d459fb479179814688fa9b867a7534 | 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. | autofac/Autofac.Extras.AttributeMetadata | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Extras.Attributed")]
[assembly: InternalsVisibleTo("Autofac.Tests.Extras.Attributed, PublicKey=00240000048000009400000006020000002400005253413100040000010001008728425885ef385e049261b18878327dfaaf0d666dea3bd2b0e4f18b33929ad4e5fbc9087e7eda3c1291d2de579206d9b4292456abffbe8be6c7060b36da0c33b883e3878eaf7c89fddf29e6e27d24588e81e86f3a22dd7b1a296b5f06fbfb500bbd7410faa7213ef4e2ce7622aefc03169b0324bcd30ccfe9ac8204e4960be6")]
[assembly: ComVisible(false)] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Extras.Attributed")]
[assembly: AssemblyDescription("Autofac Extensions for categorized discovery using attributes")]
[assembly: InternalsVisibleTo("Autofac.Tests.Extras.Attributed, PublicKey=00240000048000009400000006020000002400005253413100040000010001008728425885ef385e049261b18878327dfaaf0d666dea3bd2b0e4f18b33929ad4e5fbc9087e7eda3c1291d2de579206d9b4292456abffbe8be6c7060b36da0c33b883e3878eaf7c89fddf29e6e27d24588e81e86f3a22dd7b1a296b5f06fbfb500bbd7410faa7213ef4e2ce7622aefc03169b0324bcd30ccfe9ac8204e4960be6")]
[assembly: ComVisible(false)] | mit | C# |
660011854b2d4d2f472d58d0990dc7fa287dabea | bump version to v1.1 | micdenny/PRTG-Redis-Sensor,cdemi/PRTG-Redis-Sensor | 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("PRTG Redis Sensor")]
[assembly: AssemblyDescription("https://github.com/cdemi/PRTG-Redis-Sensor")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PRTG Redis Sensor")]
[assembly: AssemblyCopyright("MIT License (MIT)")]
[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("df6bf3bb-1835-4f6e-92c3-0b3926129f73")]
// 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.1.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("PRTG Redis Sensor")]
[assembly: AssemblyDescription("https://github.com/cdemi/PRTG-Redis-Sensor")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PRTG Redis Sensor")]
[assembly: AssemblyCopyright("MIT License (MIT)")]
[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("df6bf3bb-1835-4f6e-92c3-0b3926129f73")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
d41fcaa9b90691d0e2a78bd3e46d4a4475158c19 | Bump version to 1.2.0 | kalaider/kPassKeep,kalaider/kPassKeep,kalaider/kPassKeep | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows.Media;
// 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("kPassKeep")]
[assembly: AssemblyDescription("Keep your passwords in a safe place")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("kalaider")]
[assembly: AssemblyProduct("kPassKeep")]
[assembly: AssemblyCopyright("Copyright © kalaider 2021")]
[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("6644e1f5-67c5-44ab-8c24-abfd6a4eacb3")]
// required to support per-monitor DPI awareness in Windows 8.1+
// see also https://mui.codeplex.com/wikipage?title=Per-monitor%20DPI%20awareness
[assembly: DisableDpiAwareness]
// 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.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows.Media;
// 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("kPassKeep")]
[assembly: AssemblyDescription("Keep your passwords in safe place")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("kalaider")]
[assembly: AssemblyProduct("kPassKeep")]
[assembly: AssemblyCopyright("Copyright © kalaider 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6644e1f5-67c5-44ab-8c24-abfd6a4eacb3")]
// required to support per-monitor DPI awareness in Windows 8.1+
// see also https://mui.codeplex.com/wikipage?title=Per-monitor%20DPI%20awareness
[assembly: DisableDpiAwareness]
// 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.1.0.0")]
| apache-2.0 | C# |
51dc56c0dcdb80dad09ea06e4e489569699201a5 | update version for web | cswares/CS.Utility | sources/CS.Utility.Web/Properties/AssemblyInfo.cs | sources/CS.Utility.Web/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("CS.Utility.Web")]
[assembly: AssemblyDescription("所有关于Web的,MVC的相关的扩展和实用方法扩展")]
[assembly: AssemblyConfiguration("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("6d2753a2-a75e-46e7-9fc8-6e0d3bac0068")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [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;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("CS.Utility.Web")]
[assembly: AssemblyDescription("所有关于Web的,MVC的相关的扩展和实用方法扩展")]
[assembly: AssemblyConfiguration("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("6d2753a2-a75e-46e7-9fc8-6e0d3bac0068")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
/*
*/ | apache-2.0 | C# |
de5c3db54d33791f3f00c3b751e60d43b024b9ad | Rename DragOperationsMask enum values Apply flags attribute and implement `Every` option | gregmartinhtc/CefSharp,wangzheng888520/CefSharp,VioletLife/CefSharp,yoder/CefSharp,windygu/CefSharp,Haraguroicha/CefSharp,Haraguroicha/CefSharp,rlmcneary2/CefSharp,joshvera/CefSharp,zhangjingpu/CefSharp,rover886/CefSharp,VioletLife/CefSharp,battewr/CefSharp,rlmcneary2/CefSharp,AJDev77/CefSharp,haozhouxu/CefSharp,twxstar/CefSharp,Livit/CefSharp,Livit/CefSharp,yoder/CefSharp,Livit/CefSharp,illfang/CefSharp,battewr/CefSharp,wangzheng888520/CefSharp,illfang/CefSharp,zhangjingpu/CefSharp,gregmartinhtc/CefSharp,dga711/CefSharp,twxstar/CefSharp,gregmartinhtc/CefSharp,NumbersInternational/CefSharp,zhangjingpu/CefSharp,haozhouxu/CefSharp,ITGlobal/CefSharp,ITGlobal/CefSharp,windygu/CefSharp,illfang/CefSharp,VioletLife/CefSharp,Octopus-ITSM/CefSharp,AJDev77/CefSharp,Octopus-ITSM/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,AJDev77/CefSharp,AJDev77/CefSharp,dga711/CefSharp,gregmartinhtc/CefSharp,joshvera/CefSharp,battewr/CefSharp,ruisebastiao/CefSharp,rover886/CefSharp,wangzheng888520/CefSharp,ruisebastiao/CefSharp,windygu/CefSharp,rover886/CefSharp,zhangjingpu/CefSharp,wangzheng888520/CefSharp,Haraguroicha/CefSharp,NumbersInternational/CefSharp,yoder/CefSharp,battewr/CefSharp,Haraguroicha/CefSharp,rover886/CefSharp,VioletLife/CefSharp,ruisebastiao/CefSharp,yoder/CefSharp,dga711/CefSharp,joshvera/CefSharp,rlmcneary2/CefSharp,illfang/CefSharp,ruisebastiao/CefSharp,Haraguroicha/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,joshvera/CefSharp,Octopus-ITSM/CefSharp,haozhouxu/CefSharp,ITGlobal/CefSharp,windygu/CefSharp,NumbersInternational/CefSharp,NumbersInternational/CefSharp,rlmcneary2/CefSharp,rover886/CefSharp,Livit/CefSharp,twxstar/CefSharp,dga711/CefSharp,Octopus-ITSM/CefSharp,jamespearce2006/CefSharp,ITGlobal/CefSharp,haozhouxu/CefSharp,twxstar/CefSharp | CefSharp/DragOperationsMask.cs | CefSharp/DragOperationsMask.cs | // Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
namespace CefSharp
{
[Flags]
public enum DragOperationsMask
{
None = 0,
Copy = 1,
Link = 2,
Generic = 4,
Private = 8,
Move = 16,
Delete = 32,
Every = None | Copy | Link | Generic | Private | Move | Delete
}
}
| // Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
namespace CefSharp
{
public enum DragOperationsMask
{
DRAG_OPERATION_NONE = 0,
DRAG_OPERATION_COPY = 1,
DRAG_OPERATION_LINK = 2,
DRAG_OPERATION_GENERIC = 4,
DRAG_OPERATION_PRIVATE = 8,
DRAG_OPERATION_MOVE = 16,
DRAG_OPERATION_DELETE = 32
//DRAG_OPERATION_EVERY = UINT_MAX,
}
}
| bsd-3-clause | C# |
3226e87eb23bb0254e7165817e4e5c826dc34fc7 | test case | jefking/King.A-Trak | King.ATrak.Test/ContentTypesTests.cs | King.ATrak.Test/ContentTypesTests.cs | namespace King.ATrak.Test
{
using King.ATrak;
using NUnit.Framework;
using System;
[TestFixture]
public class ContentTypesTests
{
[Test]
[ExpectedException(typeof(ArgumentException))]
public void ContentTypeFilePathInvalid()
{
ContentTypes.ContentType(null);
}
[Test]
[ExpectedException(typeof(InvalidOperationException))]
public void ContentTypeFilePathWierd()
{
ContentTypes.ContentType(". ");
}
[TestCase("image/jpeg", ".jpg")]
[TestCase("text/css", ".css")]
[TestCase("image/png", ".png")]
[TestCase("image/x-icon", ".ico")]
[TestCase("text/plain", ".txt")]
[TestCase("", ".jrnl")]
public void Types(string expected, string extension)
{
Assert.AreEqual(expected, ContentTypes.ContentType(extension));
}
[TestCase("image/jpeg", ".jpg")]
[TestCase("text/css", ".css")]
[TestCase("image/png", ".png")]
[TestCase("image/x-icon", ".ico")]
[TestCase("text/plain", ".txt")]
public void TypesCached(string expected, string extension)
{
Assert.AreEqual(expected, ContentTypes.ContentType(extension));
Assert.AreEqual(expected, ContentTypes.ContentType(extension));
Assert.AreEqual(expected, ContentTypes.ContentType(extension));
}
}
} | namespace King.ATrak.Test
{
using King.ATrak;
using NUnit.Framework;
using System;
[TestFixture]
public class ContentTypesTests
{
[Test]
[ExpectedException(typeof(ArgumentException))]
public void ContentTypeFilePathInvalid()
{
ContentTypes.ContentType(null);
}
[Test]
[ExpectedException(typeof(InvalidOperationException))]
public void ContentTypeFilePathWierd()
{
ContentTypes.ContentType(". ");
}
[TestCase("image/jpeg", ".jpg")]
[TestCase("text/css", ".css")]
[TestCase("image/png", ".png")]
[TestCase("image/x-icon", ".ico")]
[TestCase("text/plain", ".txt")]
public void Types(string expected, string extension)
{
Assert.AreEqual(expected, ContentTypes.ContentType(extension));
}
[TestCase("image/jpeg", ".jpg")]
[TestCase("text/css", ".css")]
[TestCase("image/png", ".png")]
[TestCase("image/x-icon", ".ico")]
[TestCase("text/plain", ".txt")]
public void TypesCached(string expected, string extension)
{
Assert.AreEqual(expected, ContentTypes.ContentType(extension));
Assert.AreEqual(expected, ContentTypes.ContentType(extension));
Assert.AreEqual(expected, ContentTypes.ContentType(extension));
}
}
} | mit | C# |
f133b0d93d157533f1a134d5b2dff83e7a0af814 | add extensions for creating sequences from integers | Pondidum/Ledger,Pondidum/Ledger | Ledger/Infrastructure/Extensions.cs | Ledger/Infrastructure/Extensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace Ledger.Infrastructure
{
public static class Extensions
{
public static IEnumerable<T> Apply<T>(this IEnumerable<T> self, Action<T> action)
{
foreach (var item in self)
{
action(item);
yield return item;
}
}
public static IEnumerable<T> Apply<T>(this IEnumerable<T> self, Action<T, int> action)
{
var i = 0;
foreach (var item in self)
{
action(item, i++);
yield return item;
}
}
public static void ForEach<T>(this IEnumerable<T> self, Action<T> action)
{
foreach (var item in self)
{
action(item);
}
}
public static void ForEach<T>(this IEnumerable<T> self, Action<T, int> action)
{
var i = 0;
foreach (var item in self)
{
action(item, i++);
}
}
public static bool None<T>(this IEnumerable<T> self)
{
return self.Any() == false;
}
public static bool ImplementsSnapshottable(this Type aggregate)
{
return aggregate
.GetInterfaces()
.Where(i => i.IsGenericType)
.Any(i => i.GetGenericTypeDefinition() == typeof(ISnapshotable<,>));
}
public static Sequence AsSequence(this int self)
{
return new Sequence(self);
}
public static StreamSequence AsStreamSequence(this int self)
{
return new StreamSequence(self);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace Ledger.Infrastructure
{
public static class Extensions
{
public static IEnumerable<T> Apply<T>(this IEnumerable<T> self, Action<T> action)
{
foreach (var item in self)
{
action(item);
yield return item;
}
}
public static IEnumerable<T> Apply<T>(this IEnumerable<T> self, Action<T, int> action)
{
var i = 0;
foreach (var item in self)
{
action(item, i++);
yield return item;
}
}
public static void ForEach<T>(this IEnumerable<T> self, Action<T> action)
{
foreach (var item in self)
{
action(item);
}
}
public static void ForEach<T>(this IEnumerable<T> self, Action<T, int> action)
{
var i = 0;
foreach (var item in self)
{
action(item, i++);
}
}
public static bool None<T>(this IEnumerable<T> self)
{
return self.Any() == false;
}
public static bool ImplementsSnapshottable(this Type aggregate)
{
return aggregate
.GetInterfaces()
.Where(i => i.IsGenericType)
.Any(i => i.GetGenericTypeDefinition() == typeof(ISnapshotable<,>));
}
}
}
| lgpl-2.1 | C# |
222f83c2bdcd548b27bc7573906a7c6046648d33 | Update GenericType enum in accordance with spec | roblans/ZWave4Net,MiTheFreeman/ZWave4Net | ZWave/GenericType.cs | ZWave/GenericType.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace ZWave
{
public enum GenericType : byte
{
Unknown = 0x00,
GenericController = 0x01,
StaticController = 0x02,
AVControlPoint = 0x03,
Display = 0x04,
NetworkExtender = 0x05,
Appliance = 0x06,
SensorNotification = 0x07,
Thermostat = 0x08,
WindowCovering = 0x09,
RepeaterSlave = 0x0F,
SwitchBinary = 0x10,
SwitchMultiLevel = 0x11,
SwitchRemote = 0x12,
SwitchToggle = 0x13,
ZipNode = 0x15,
Ventilation = 0x16,
SecurityPanel = 0x17,
WallController = 0x18,
SensorBinary = 0x20,
SensorMultiLevel = 0x21,
MeterPulse = 0x30,
Meter = 0x31,
EntryControl = 0x40,
SemiInteroperable = 0x50,
SensorAlarm = 0xA1,
NonInteroperable = 0xFF
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace ZWave
{
public enum GenericType : byte
{
Unknown = 0x00,
PortableRemote = 0x01,
StaticController = 0x02,
AVControlPoint = 0x03,
RoutingSlave = 0x04,
Display = 0x06,
GarageDoor = 0x07,
Thermostat = 0x08,
WindowCovering = 0x09,
RepeaterSlave = 0x0F,
SwitchBinary = 0x10,
SwitchMultiLevel = 0x11,
SwitchRemote = 0x12,
SwitchToggle = 0x13,
SensorBinary = 0x20,
SensorMultiLevel = 0x21,
WaterControl = 0x22,
MeterPulse = 0x30,
EntryControl = 0x40,
SemiInteroperable = 0x50,
SmokeDetector = 0xA1,
NonInteroperable = 0xFF
}
}
| mit | C# |
c862759598dad173b88c8950af00b9d762c15640 | fix ConnectionFactoryOracle | bgTeamDev/bgTeam.Core,bgTeamDev/bgTeam.Core | src/bgTeam.Impl.Oracle/ConnectionFactoryOracle.cs | src/bgTeam.Impl.Oracle/ConnectionFactoryOracle.cs | namespace bgTeam.DataAccess.Impl.Oracle
{
using System.Data;
using System.Threading.Tasks;
using global::Oracle.ManagedDataAccess.Client;
public class ConnectionFactoryOracle : IConnectionFactory
{
private readonly IAppLogger _logger;
private readonly IConnectionSetting _setting;
public ConnectionFactoryOracle(
IAppLogger logger,
IConnectionSetting setting,
ISqlDialect dialect)
{
_logger = logger;
_setting = setting;
if (dialect != null)
{
dialect.Init(SqlDialectEnum.Oracle);
}
}
public ConnectionFactoryOracle(
IAppLogger logger,
string connectionString,
ISqlDialect dialect)
: this(logger, new ConnectionSettingDefault(connectionString), dialect)
{
}
public IDbConnection Create()
{
return CreateAsync().Result;
}
public IDbConnection Create(string connectionString)
{
_logger.Debug($"ConnectionFactoryMsSql: {connectionString}");
OracleConnection dbConnection = new OracleConnection(connectionString);
dbConnection.Open();
_logger.Debug($"ConnectionFactoryMsSql: connect open");
return dbConnection;
}
public async Task<IDbConnection> CreateAsync()
{
return await CreateAsync(_setting.ConnectionString);
}
public async Task<IDbConnection> CreateAsync(string connectionString)
{
_logger.Debug($"ConnectionFactoryMsSql: {connectionString}");
OracleConnection dbConnection = new OracleConnection(connectionString);
await dbConnection.OpenAsync().ConfigureAwait(false);
_logger.Debug($"ConnectionFactoryMsSql: connect open");
return dbConnection;
}
}
}
| namespace bgTeam.DataAccess.Impl.Oracle
{
using System.Data;
using System.Threading.Tasks;
using global::Oracle.ManagedDataAccess.Client;
public class ConnectionFactoryOracle : IConnectionFactory
{
private readonly IAppLogger _logger;
private readonly IConnectionSetting _setting;
public ConnectionFactoryOracle(
IAppLogger logger,
IConnectionSetting setting,
ISqlDialect dialect)
{
_logger = logger;
_setting = setting;
if (dialect != null)
{
dialect.Init(SqlDialectEnum.MsSql);
}
}
public ConnectionFactoryOracle(
IAppLogger logger,
string connectionString,
ISqlDialect dialect)
: this(logger, new ConnectionSettingDefault(connectionString), dialect)
{
}
public IDbConnection Create()
{
return CreateAsync().Result;
}
public IDbConnection Create(string connectionString)
{
_logger.Debug($"ConnectionFactoryMsSql: {connectionString}");
OracleConnection dbConnection = new OracleConnection(connectionString);
dbConnection.Open();
_logger.Debug($"ConnectionFactoryMsSql: connect open");
return dbConnection;
}
public async Task<IDbConnection> CreateAsync()
{
return await CreateAsync(_setting.ConnectionString);
}
public async Task<IDbConnection> CreateAsync(string connectionString)
{
_logger.Debug($"ConnectionFactoryMsSql: {connectionString}");
OracleConnection dbConnection = new OracleConnection(connectionString);
await dbConnection.OpenAsync().ConfigureAwait(false);
_logger.Debug($"ConnectionFactoryMsSql: connect open");
return dbConnection;
}
}
}
| mit | C# |
1c47823d9e2fb696c5d5f6518250da7d0adc84d7 | Format adjustment. | DragonSpark/Framework,DragonSpark/Framework,DragonSpark/Framework,DragonSpark/Framework | DragonSpark.Presentation/Components/Forms/ValidationDefinition.cs | DragonSpark.Presentation/Components/Forms/ValidationDefinition.cs | using Microsoft.AspNetCore.Components.Forms;
using System.Threading.Tasks;
namespace DragonSpark.Presentation.Components.Forms
{
sealed class ValidationDefinition : IValidationDefinition
{
readonly OperationView<FieldIdentifier, bool> _view;
public ValidationDefinition(OperationView<FieldIdentifier, bool> view, FieldValidationMessages messages)
{
_view = view;
Messages = messages;
}
public bool IsActive => _view.IsActive;
public FieldValidationMessages Messages { get; }
public async ValueTask<ValidationResult> Get(FieldValidator parameter)
{
var call = await _view.Get(parameter.Identifier);
var result = call ? ValidationResult.Success : new ValidationResult(false, Messages.Invalid);
return result;
}
}
} | using Microsoft.AspNetCore.Components.Forms;
using System.Threading.Tasks;
namespace DragonSpark.Presentation.Components.Forms
{
public sealed class ValidationDefinition : IValidationDefinition
{
readonly OperationView<FieldIdentifier, bool> _view;
public ValidationDefinition(OperationView<FieldIdentifier, bool> view,
FieldValidationMessages messages)
{
_view = view;
Messages = messages;
}
public bool IsActive => _view.IsActive;
public FieldValidationMessages Messages { get; }
public async ValueTask<ValidationResult> Get(FieldValidator parameter)
{
var call = await _view.Get(parameter.Identifier);
var result = call ? ValidationResult.Success : new ValidationResult(false, Messages.Invalid);
return result;
}
}
} | mit | C# |
8880f6fd1e9edd01651226e4512c4a42bb8216f6 | fix the foreignKey link | sitedisks/YuYan | YuYan.API/YuYan.Domain/Database/tbSurveyClientAnswer.cs | YuYan.API/YuYan.Domain/Database/tbSurveyClientAnswer.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace YuYan.Domain.Database
{
[Table("SurveyClientAnswer")]
public class tbSurveyClientAnswer
{
[Key,Column("Id")]
public long AnswerId { get; set; }
[Column("SurveyClientId")]
public long ClientId { get; set; }
public int QuestionId { get; set; }
public int QuestionItemId { get; set; }
public bool IsChecked { get; set; }
public DateTime CreatedDate { get; set; }
[ForeignKey("ClientId")]
public virtual tbSurveyClient tbSurveyClient { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace YuYan.Domain.Database
{
[Table("SurveyClientAnswer")]
public class tbSurveyClientAnswer
{
[Key,Column("Id")]
public long AnswerId { get; set; }
[Column("SurveyClientId")]
public long ClientId { get; set; }
public int QuestionId { get; set; }
public int QuestionItemId { get; set; }
public bool IsChecked { get; set; }
public DateTime CreatedDate { get; set; }
[ForeignKey("SurveyClientId")]
public virtual tbSurveyClient tbSurveyClient { get; set; }
}
}
| mit | C# |
cb80e620fda4ab5c0c85142b3f1b4ca17668aac2 | Fix ListBox column autosizing (#766) | mono/xwt,TheBrainTech/xwt,hamekoz/xwt,antmicro/xwt,cra0zy/xwt,lytico/xwt,hwthomas/xwt | Xwt.XamMac/Xwt.Mac/ListBoxBackend.cs | Xwt.XamMac/Xwt.Mac/ListBoxBackend.cs | //
// ListBoxBackend.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2013 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using AppKit;
using Xwt.Backends;
namespace Xwt.Mac
{
public class ListBoxBackend: ListViewBackend, IListBoxBackend
{
ListViewColumn column = new ListViewColumn ();
NSTableColumn columnHandle;
public ListBoxBackend ()
{
}
public new bool GridLinesVisible {
get {
return (base.GridLinesVisible == Xwt.GridLines.Horizontal || base.GridLinesVisible == Xwt.GridLines.Both);
}
set {
base.GridLinesVisible = value ? Xwt.GridLines.Horizontal : Xwt.GridLines.None;
}
}
public override void Initialize ()
{
base.Initialize ();
HeadersVisible = false;
columnHandle = AddColumn (column);
VerticalScrollPolicy = ScrollPolicy.Automatic;
HorizontalScrollPolicy = ScrollPolicy.Automatic;
}
public void SetViews (CellViewCollection views)
{
column.Views.Clear ();
foreach (var v in views)
column.Views.Add (v);
UpdateColumn (column, columnHandle, ListViewColumnChange.Cells);
}
}
}
| //
// ListBoxBackend.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2013 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using AppKit;
using Xwt.Backends;
namespace Xwt.Mac
{
public class ListBoxBackend: ListViewBackend, IListBoxBackend
{
ListViewColumn column = new ListViewColumn ();
NSTableColumn columnHandle;
public ListBoxBackend ()
{
}
public new bool GridLinesVisible {
get {
return (base.GridLinesVisible == Xwt.GridLines.Horizontal || base.GridLinesVisible == Xwt.GridLines.Both);
}
set {
base.GridLinesVisible = value ? Xwt.GridLines.Horizontal : Xwt.GridLines.None;
}
}
public override void Initialize ()
{
base.Initialize ();
HeadersVisible = false;
columnHandle = AddColumn (column);
VerticalScrollPolicy = ScrollPolicy.Automatic;
HorizontalScrollPolicy = ScrollPolicy.Automatic;
}
public void SetViews (CellViewCollection views)
{
column.Views.Clear ();
foreach (var v in views)
column.Views.Add (v);
UpdateColumn (column, columnHandle, ListViewColumnChange.Cells);
}
public override void SetSource (IListDataSource source, IBackend sourceBackend)
{
base.SetSource (source, sourceBackend);
source.RowInserted += HandleColumnSizeChanged;
source.RowDeleted += HandleColumnSizeChanged;
source.RowChanged += HandleColumnSizeChanged;
ResetColumnSize (source);
}
void HandleColumnSizeChanged (object sender, ListRowEventArgs e)
{
var source = (IListDataSource)sender;
ResetColumnSize (source);
}
void ResetColumnSize (IListDataSource source)
{
// Calculate size of column
// This is how Apple implements it; unfortunately, they don't expose this functionality in the API.
// https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSTableViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/NSTableViewDelegate/tableView:sizeToFitWidthOfColumn:
nfloat w = 0;
for (var row = 0; row < source.RowCount; row++) {
using (var cell = Table.GetCell (0, row)) {
var size = cell.CellSize;
w = (nfloat)Math.Max (w, size.Width);
}
}
columnHandle.MinWidth = (nfloat)Math.Ceiling (w);
columnHandle.Width = (nfloat)Math.Ceiling (w);
}
}
}
| mit | C# |
d1be5005a8476293e24d3db5ce473f8fc964cc32 | Make equipped list a property instead of a field | Cisien/OniBot | OniBot/CommandConfigs/SweepConfig.cs | OniBot/CommandConfigs/SweepConfig.cs | using Newtonsoft.Json;
using OniBot.Interfaces;
using System.Collections.Generic;
namespace OniBot.CommandConfigs
{
public class SweepConfig : CommandConfig
{
public Dictionary<ulong, string> Equiped { get; set; } = new Dictionary<ulong, string>();
[JsonIgnore]
public override string ConfigKey => "sweep";
}
}
| using Newtonsoft.Json;
using OniBot.Interfaces;
using System.Collections.Generic;
namespace OniBot.CommandConfigs
{
public class SweepConfig : CommandConfig
{
public Dictionary<ulong, string> Equiped = new Dictionary<ulong, string>();
[JsonIgnore]
public override string ConfigKey => "sweep";
}
}
| apache-2.0 | C# |
0e980b69e04def5999fddd7c7d318c0cccd55524 | Update parallel task | marcotmp/BehaviorTree | Assets/Scripts/BehaviorTree/Composites/Parallel.cs | Assets/Scripts/BehaviorTree/Composites/Parallel.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Parallel : CompositeTask
{
private int taskIndex = 0;
private int maxFailCount = 0;
private int maxSuccessCount = 0;
public Parallel(string name, int maxSuccessCount = 0, int maxFailCount = 0) : base(name)
{
this.maxFailCount = maxFailCount;
this.maxSuccessCount = maxSuccessCount;
}
override public ReturnCode Update()
{
var returnCode = ReturnCode.Running;
var failCount = 0;
var successCount = 0;
foreach (Task task in tasks)
{
returnCode = task.Update();
if (returnCode == ReturnCode.Fail)
{
failCount++;
}
else if (returnCode == ReturnCode.Succeed)
{
successCount++;
}
}
if (maxFailCount == 0)
maxFailCount = tasks.Count;
if (maxSuccessCount == 0)
maxSuccessCount = tasks.Count;
if (failCount > maxFailCount)
return ReturnCode.Fail;
if (successCount > maxSuccessCount)
return ReturnCode.Succeed;
return ReturnCode.Running;
}
public override void Restart()
{
taskIndex = 0;
base.Restart();
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Parallel : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
| unlicense | C# |
e5d762319bd976e4ff11fc076352f81adb6e6b83 | Bump to version 2.1.2.0 | Silv3rPRO/proshine,bobus15/proshine,MeltWS/proshine | PROShine/Properties/AssemblyInfo.cs | PROShine/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PROShine")]
[assembly: AssemblyDescription("A free, open-source and advanced bot for Pokemon Revolution Online.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Silv3r")]
[assembly: AssemblyProduct("PROShine")]
[assembly: AssemblyCopyright("Copyright © Silv3r, 2016-2032")]
[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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.2.0")]
[assembly: AssemblyFileVersion("2.1.2.0")]
[assembly: NeutralResourcesLanguage("en")]
| using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PROShine")]
[assembly: AssemblyDescription("A free, open-source and advanced bot for Pokemon Revolution Online.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Silv3r")]
[assembly: AssemblyProduct("PROShine")]
[assembly: AssemblyCopyright("Copyright © Silv3r, 2016-2032")]
[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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.1.0")]
[assembly: AssemblyFileVersion("2.1.1.0")]
[assembly: NeutralResourcesLanguage("en")]
| mit | C# |
dbeae8376a360097c4611a360654ba0eed3b2908 | Remove dead code | cbcrc/LinkIt | HeterogeneousDataSources/PropertyInfoExtensions.cs | HeterogeneousDataSources/PropertyInfoExtensions.cs | using System.Reflection;
namespace HeterogeneousDataSources
{
public static class PropertyInfoExtensions
{
public static bool IsPublicReadWrite(this PropertyInfo property) {
return property.CanRead &&
property.GetGetMethod(false)!=null &&
property.CanWrite &&
property.GetSetMethod(false)!=null;
}
public static string GetLinkTargetId(this PropertyInfo property) {
return string.Format(
"{0}/{1}",
property.DeclaringType,
property.Name
);
}
}
} | using System.Reflection;
namespace HeterogeneousDataSources
{
public static class PropertyInfoExtensions
{
public static bool IsPublicReadWrite(this PropertyInfo property) {
return property.CanRead &&
property.GetGetMethod(false)!=null &&
property.CanWrite &&
property.GetSetMethod(false)!=null;
}
private static bool MatchLinkedSourceModelPropertyName(string linkTargetPropertyName, string linkedSourceModelPropertyName, string suffix) {
return linkTargetPropertyName + suffix == linkedSourceModelPropertyName;
}
private static string RemoveLastCharacter(PropertyInfo property, string lastCharacterToIgnore){
return property.Name.Remove(property.Name.Length - lastCharacterToIgnore.Length);
}
public static string GetLinkTargetId(this PropertyInfo property) {
return string.Format(
"{0}/{1}",
property.DeclaringType,
property.Name
);
}
}
} | mit | C# |
bacf89f94d2737781c055208c35e72620224ab6e | Update version to 1.3.6 | anonymousthing/ListenMoeClient | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Listen.moe Client")]
[assembly: AssemblyProduct("Listen.moe Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright 2017 Listen.moe. All rights reserved.")]
// 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("88b02799-425e-4622-a849-202adb19601b")]
// 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.3.6.0")]
[assembly: AssemblyFileVersion("1.3.6.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Listen.moe Client")]
[assembly: AssemblyProduct("Listen.moe Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright 2017 Listen.moe. All rights reserved.")]
// 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("88b02799-425e-4622-a849-202adb19601b")]
// 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.3.5.0")]
[assembly: AssemblyFileVersion("1.3.5.0")]
| mit | C# |
2f2bd59844e65fa6a57ab05d81dc39907a3aeb23 | Remove editor functionality from VirtualBeatmapTrack | peppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,johnneijzen/osu,2yangk23/osu,naoey/osu,johnneijzen/osu,NeoAdonis/osu,EVAST9919/osu,ppy/osu,DrabWeb/osu,UselessToucan/osu,ppy/osu,peppy/osu-new,smoogipoo/osu,2yangk23/osu,DrabWeb/osu,ppy/osu,ZLima12/osu,naoey/osu,DrabWeb/osu,UselessToucan/osu,EVAST9919/osu,naoey/osu,smoogipoo/osu,ZLima12/osu,smoogipoo/osu | 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 const double excess_length = 1000;
public VirtualBeatmapTrack(IBeatmap beatmap)
{
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;
}
}
}
}
}
| // 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;
}
}
}
}
}
| mit | C# |
5a592012c673c89035edf80a167f7f85d4eb6468 | 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. | autofac/Autofac.Extras.EnterpriseLibraryConfigurator | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Extras.EnterpriseLibraryConfigurator")]
[assembly: ComVisible(false)] | using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Extras.EnterpriseLibraryConfigurator")]
[assembly: AssemblyDescription("Autofac support for Enterprise Library container configuration.")]
[assembly: ComVisible(false)] | mit | C# |
f4ccbbd09261ac4ba63d4633d3d884841b4139c9 | Add basic server implementation | UselessToucan/osu,ppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,smoogipooo/osu,UselessToucan/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu | osu.Game/Online/RealtimeMultiplayer/ISpectatorServer.cs | osu.Game/Online/RealtimeMultiplayer/ISpectatorServer.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.Tasks;
namespace osu.Game.Online.RealtimeMultiplayer
{
/// <summary>
/// An interface defining the spectator server instance.
/// </summary>
public interface IMultiplayerServer
{
/// <summary>
/// Request to join a multiplayer room.
/// </summary>
/// <param name="roomId">The databased room ID.</param>
/// <returns>Whether the room could be joined.</returns>
Task<bool> JoinRoom(long roomId);
/// <summary>
/// Request to leave the currently joined room.
/// </summary>
/// <param name="roomId">The databased room ID.</param>
Task LeaveRoom(long roomId);
}
}
| // 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.RealtimeMultiplayer
{
/// <summary>
/// An interface defining the spectator server instance.
/// </summary>
public interface IMultiplayerServer
{
// TODO: implement
}
}
| mit | C# |
7807dfe3c49f7a623eb2824e4af91f269ca9ed53 | bump version | BeowulfStratOps/BSU.Sync | 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("BSU.Sync")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BSU.Sync")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9379c93a-a9ff-4653-8cac-d082e256f879")]
// 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.1.0.0")]
[assembly: InternalsVisibleTo("BSU.Sync.Tests")]
[assembly: InternalsVisibleTo("BSU.Sync.Explorables")]
| 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("BSU.Sync")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BSU.Sync")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9379c93a-a9ff-4653-8cac-d082e256f879")]
// 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")]
[assembly: InternalsVisibleTo("BSU.Sync.Tests")]
[assembly: InternalsVisibleTo("BSU.Sync.Explorables")]
| mit | C# |
d26bf79d4d82681d4fec888c383b9e82f00054af | Add weakreferences to UrhoEventAdapter | florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho | bindings/src/Runtime/UrhoEventAdapter.cs | bindings/src/Runtime/UrhoEventAdapter.cs | using System;
using System.Collections.Generic;
namespace Urho
{
internal class UrhoEventAdapter<TEventArgs>
{
readonly Dictionary<IntPtr, List<WeakReference<Action<TEventArgs>>>> managedSubscribersByObjects;
readonly Dictionary<IntPtr, Subscription> nativeSubscriptionsForObjects;
public UrhoEventAdapter()
{
managedSubscribersByObjects = new Dictionary<IntPtr, List<WeakReference<Action<TEventArgs>>>>();
nativeSubscriptionsForObjects = new Dictionary<IntPtr, Subscription>();
}
public void AddManagedSubscriber(IntPtr handle, Action<TEventArgs> action, Func<Action<TEventArgs>, Subscription> nativeSubscriber)
{
List<WeakReference<Action<TEventArgs>>> listOfManagedSubscribers;
if (!managedSubscribersByObjects.TryGetValue(handle, out listOfManagedSubscribers))
{
listOfManagedSubscribers = new List<WeakReference<Action<TEventArgs>>> { new WeakReference<Action<TEventArgs>>(action) };
managedSubscribersByObjects[handle] = listOfManagedSubscribers;
nativeSubscriptionsForObjects[handle] = nativeSubscriber(args =>
{
foreach (var managedSubscriber in listOfManagedSubscribers)
{
Action<TEventArgs> actionRef;
if (managedSubscriber.TryGetTarget(out actionRef))
{
actionRef(args);
}
}
});
}
else
{
//this handle is already subscribed to the native event - don't call native subscription again - just add it to the list.
listOfManagedSubscribers.Add(new WeakReference<Action<TEventArgs>>(action));
}
}
public void RemoveManagedSubscriber(IntPtr handle, Action<TEventArgs> action)
{
List<WeakReference<Action<TEventArgs>>> listOfManagedSubscribers;
if (managedSubscribersByObjects.TryGetValue(handle, out listOfManagedSubscribers))
{
listOfManagedSubscribers.RemoveAll(weakRef =>
{
Action<TEventArgs> item;
return weakRef.TryGetTarget(out item) && item == action;
});
if (listOfManagedSubscribers.Count < 1)
{
managedSubscribersByObjects.Remove(handle);
nativeSubscriptionsForObjects[handle].Unsubscribe();
}
}
}
}
}
| using System;
using System.Collections.Generic;
namespace Urho
{
internal class UrhoEventAdapter<TEventArgs>
{
//TODO: seems we should use List<WeakReference<Action<TEventArgs>>>> here
readonly Dictionary<IntPtr, List<Action<TEventArgs>>> managedSubscribersByObjects;
readonly Dictionary<IntPtr, Subscription> nativeSubscriptionsForObjects;
public UrhoEventAdapter()
{
managedSubscribersByObjects = new Dictionary<IntPtr, List<Action<TEventArgs>>>();
nativeSubscriptionsForObjects = new Dictionary<IntPtr, Subscription>();
}
public void AddManagedSubscriber(IntPtr handle, Action<TEventArgs> action, Func<Action<TEventArgs>, Subscription> nativeSubscriber)
{
List<Action<TEventArgs>> listOfManagedSubscribers;
if (!managedSubscribersByObjects.TryGetValue(handle, out listOfManagedSubscribers))
{
listOfManagedSubscribers = new List<Action<TEventArgs>> { action };
managedSubscribersByObjects[handle] = listOfManagedSubscribers;
nativeSubscriptionsForObjects[handle] = nativeSubscriber(args =>
{
foreach (var managedSubscriber in listOfManagedSubscribers)
{
managedSubscriber(args);
}
});
}
else
{
//this handle is already subscribed to the native event - don't call native subscription again - just add it to the list.
listOfManagedSubscribers.Add(action);
}
}
public void RemoveManagedSubscriber(IntPtr handle, Action<TEventArgs> action)
{
List<Action<TEventArgs>> listOfManagedSubscribers;
if (managedSubscribersByObjects.TryGetValue(handle, out listOfManagedSubscribers))
{
listOfManagedSubscribers.Remove(action);
if (listOfManagedSubscribers.Count < 1)
{
managedSubscribersByObjects.Remove(handle);
nativeSubscriptionsForObjects[handle].Unsubscribe();
}
}
}
}
}
| mit | C# |
0886036d3306c2c5b5987d2a484952b3bf2f4ad5 | Revert "I added a table of garbage" | Manchen08/ToDoList,Manchen08/ToDoList,Manchen08/ToDoList | Project1/Views/ToDoList/Index.cshtml | Project1/Views/ToDoList/Index.cshtml | @model IEnumerable<Project1.ToDoList>
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create" )
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.IsComplete)
</th>
<th>
@Html.DisplayNameFor(model => model.CreatedDate)
</th>
<th>
@Html.DisplayNameFor(model => model.CompletedDate)
</th>
<th>
@Html.DisplayNameFor(model => model.Category)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.IsComplete)
</td>
<td>
@Html.DisplayFor(modelItem => item.CreatedDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.CompletedDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.Category.Name)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ToDoListID }) |
@Html.ActionLink("Details", "Details", new { id=item.ToDoListID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ToDoListID })
</td>
</tr>
}
</table>
| @model IEnumerable<Project1.ToDoList>
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create" )
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.IsComplete)
</th>
<th>
@Html.DisplayNameFor(model => model.CreatedDate)
</th>
<th>
@Html.DisplayNameFor(model => model.CompletedDate)
</th>
<th>
@Html.DisplayNameFor(model => model.Category)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.IsComplete)
</td>
<td>
@Html.DisplayFor(modelItem => item.CreatedDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.CompletedDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.Category.Name)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ToDoListID }) |
@Html.ActionLink("Details", "Details", new { id=item.ToDoListID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ToDoListID })
</td>
</tr>
}
</table>
<table>GARBAGE</table> | mit | C# |
58d76e903618e640fe97d9b341959cca33804940 | Use FinishTransforms() | UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,ppy/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu-new,smoogipoo/osu,NeoAdonis/osu | osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs | osu.Game/Screens/OnlinePlay/Lounge/Components/RoomStatusPill.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Rooms;
using osu.Game.Online.Rooms.RoomStatuses;
using osuTK.Graphics;
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
/// <summary>
/// A pill that displays the room's current status.
/// </summary>
public class RoomStatusPill : OnlinePlayComposite
{
[Resolved]
private OsuColour colours { get; set; }
private PillContainer pill;
private SpriteText statusText;
public RoomStatusPill()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = pill = new PillContainer
{
Child = statusText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 12),
Colour = Color4.Black
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
EndDate.BindValueChanged(_ => updateDisplay());
Status.BindValueChanged(_ => updateDisplay(), true);
FinishTransforms(true);
}
private void updateDisplay()
{
RoomStatus status = getDisplayStatus();
pill.Background.Alpha = 1;
pill.Background.FadeColour(status.GetAppropriateColour(colours), 100);
statusText.Text = status.Message;
}
private RoomStatus getDisplayStatus()
{
if (EndDate.Value < DateTimeOffset.Now)
return new RoomStatusEnded();
return Status.Value ?? new RoomStatusOpen();
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Rooms;
using osu.Game.Online.Rooms.RoomStatuses;
using osuTK.Graphics;
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
/// <summary>
/// A pill that displays the room's current status.
/// </summary>
public class RoomStatusPill : OnlinePlayComposite
{
[Resolved]
private OsuColour colours { get; set; }
private bool firstDisplay = true;
private PillContainer pill;
private SpriteText statusText;
public RoomStatusPill()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = pill = new PillContainer
{
Child = statusText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 12),
Colour = Color4.Black
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
EndDate.BindValueChanged(_ => updateDisplay());
Status.BindValueChanged(_ => updateDisplay(), true);
}
private void updateDisplay()
{
RoomStatus status = getDisplayStatus();
pill.Background.Alpha = 1;
pill.Background.FadeColour(status.GetAppropriateColour(colours), firstDisplay ? 0 : 100);
statusText.Text = status.Message;
firstDisplay = false;
}
private RoomStatus getDisplayStatus()
{
if (EndDate.Value < DateTimeOffset.Now)
return new RoomStatusEnded();
return Status.Value ?? new RoomStatusOpen();
}
}
}
| mit | C# |
518dba02fe65bb1ca32d7e7d98be8febe995ca8e | Update program.cs | justynak2/indywidualne | program.cs | program.cs | int a =2;
int b =4;
| int a =2;
| mit | C# |
92a7308e3f64ac46f2c5a03abae0cc423863e6e7 | optimize unit test naming | tinohager/Nager.Date,tinohager/Nager.Date,tinohager/Nager.Date | Src/Nager.Date.UnitTest/Country/UnitedKingdomTest.cs | Src/Nager.Date.UnitTest/Country/UnitedKingdomTest.cs | using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace Nager.Date.UnitTest.Country
{
[TestClass]
public class UnitedKingdomTest
{
[TestMethod]
public void TestUnitedKingdom()
{
var testDate = new DateTime(2017, 08, 28);
var isPublicHoliday = DateSystem.IsOfficialPublicHolidayByCounty(testDate, CountryCode.GB, "GB-ENG");
Assert.AreEqual(true, isPublicHoliday);
}
[TestMethod]
public void TestUnitedKingdomStPatricksDay()
{
var testDate = new DateTime(2017, 03, 17);
var isPublicHoliday = DateSystem.IsOfficialPublicHolidayByCounty(testDate, CountryCode.GB, "GB-NIR");
Assert.AreEqual(true, isPublicHoliday);
}
}
}
| using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace Nager.Date.UnitTest.Country
{
[TestClass]
public class UnitedKingdomTest
{
[TestMethod]
public void TestUnitedKingdom()
{
var testDate = new DateTime(2017, 08, 28);
var isPublicHoliday = DateSystem.IsOfficialPublicHolidayByCounty(testDate, CountryCode.GB, "GB-ENG");
Assert.AreEqual(true, isPublicHoliday);
}
[TestMethod]
public void TestStPatricksDay()
{
var testDate = new DateTime(2017, 03, 17);
var isPublicHoliday = DateSystem.IsOfficialPublicHolidayByCounty(testDate, CountryCode.GB, "GB-NIR");
Assert.AreEqual(true, isPublicHoliday);
}
}
}
| mit | C# |
bede40838233618c6c494d678da464a79b9e283e | Remove unneeded using statements. | codemonkey85/libuxie | libuxie/libuxie/libuxie.cs | libuxie/libuxie/libuxie.cs | using System;
namespace libuxie {
namespace GBA {
}
namespace NDS {
}
namespace DSI {
}
/*
namespace 3DS {
}
*/
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace libuxie {
namespace GBA {
}
namespace NDS {
}
namespace DSI {
}
/*
namespace 3DS {
}
*/
}
| unlicense | C# |
775fc50d031ac6b392bdc74c895d1dd027280cdf | fix compilation errors | dkataskin/bstrkr | bstrkr.mobile/bstrkr.mvvm/Converters/ZoomToMarkerSizeConverter.cs | bstrkr.mobile/bstrkr.mvvm/Converters/ZoomToMarkerSizeConverter.cs | using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Cirrious.CrossCore.Converters;
using bstrkr.mvvm.views;
namespace bstrkr.mvvm.converters
{
public class ZoomToMarkerSizeConverter : IMvxValueConverter
{
private readonly IList<Tuple<float, MapMarkerSizes>> _map = new List<Tuple<float, MapMarkerSizes>>
{
new Tuple<float, MapMarkerSizes>(16.0f, MapMarkerSizes.Big),
new Tuple<float, MapMarkerSizes>(12.0f, MapMarkerSizes.BigMedium),
new Tuple<float, MapMarkerSizes>(8.0f, MapMarkerSizes.Medium),
new Tuple<float, MapMarkerSizes>(4.0f, MapMarkerSizes.Small)
};
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType != typeof(MapMarkerSizes))
{
throw new InvalidOperationException("Invalid target type");
}
var zoom = (float)value;
if (zoom >= _map.First().Item1)
{
return _map.First().Item2;
}
foreach (var tuple in _map)
{
if (zoom <= tuple.Item1)
{
return tuple.Item2;
}
}
return _map.Last().Item2;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
} | using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Cirrious.CrossCore.Converters;
using bstrkr.mvvm.views;
namespace bstrkr.mvvm.converters
{
public class ZoomToMarkerSizeConverter : IMvxValueConverter
{
private readonly IList<Tuple<float, MapMarkerSizes>> _map = new List<Tuple<float, MapMarkerSizes>>
{
new Tuple<float, MapMarkerSizes>(16.0f, MapMarkerSizes.Big),
new Tuple<float, MapMarkerSizes>(12.0f, MapMarkerSizes.BigMedium),
new Tuple<float, MapMarkerSizes>(8.0f, MapMarkerSizes.Medium),
new Tuple<float, MapMarkerSizes>(4.0f, MapMarkerSizes.Small)
};
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType != typeof(MapMarkerSizes))
{
throw new InvalidOperationException("Invalid target type");
}
var zoom = (float)value;
if (zoom >= _map.First().Item1)
{
return _map.First().Item2;
}
foreach (var tuple in _map)
{
if (zoom <= tuple.Item1)
{
return tuple.Item2;
}
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
} | bsd-2-clause | C# |
439f41a38e209e7558475327fd77b3cba93d6a81 | Reduce minimum measurement distance. | Simie/PrecisionEngineering | Src/PrecisionEngineering/Settings.cs | Src/PrecisionEngineering/Settings.cs | using UnityEngine;
namespace PrecisionEngineering
{
internal static class Settings
{
public const float MinimumDistanceMeasure = 0.9f;
public const float SnapAngle = 5;
public const float GuideLinesVisibilityDistance = 80f;
public const float GuideLinesSnapDistance = 5f;
/// <summary>
/// Number of segments to query for guide-lines. More = better result, slower performance
/// </summary>
public const int GuideLineQueryCount = 512;
public const int MaxGuideLineQueryDistance = 1024;
public const int MaxGuideLineQueryDistanceSqr = MaxGuideLineQueryDistance*MaxGuideLineQueryDistance;
public static Color BlueprintColor = new Color(1, 1, 1, 1);
public static Color PrimaryColor = Color.green;
public static Color SecondaryColor = Color.yellow;
}
}
| using UnityEngine;
namespace PrecisionEngineering
{
internal static class Settings
{
public const float MinimumDistanceMeasure = 3;
public const float SnapAngle = 5;
public const float GuideLinesVisibilityDistance = 80f;
public const float GuideLinesSnapDistance = 5f;
/// <summary>
/// Number of segments to query for guide-lines. More = better result, slower performance
/// </summary>
public const int GuideLineQueryCount = 512;
public const int MaxGuideLineQueryDistance = 1024;
public const int MaxGuideLineQueryDistanceSqr = MaxGuideLineQueryDistance*MaxGuideLineQueryDistance;
public static Color BlueprintColor = new Color(1, 1, 1, 1);
public static Color PrimaryColor = Color.green;
public static Color SecondaryColor = Color.yellow;
}
}
| mit | C# |
e37b86d123d1156d4b115732234f75dc7c352939 | Fix code style issue | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Stores/BitcoinStore.cs | WalletWasabi/Stores/BitcoinStore.cs | using NBitcoin;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using WalletWasabi.Blockchain.Blocks;
using WalletWasabi.Blockchain.Mempool;
using WalletWasabi.Blockchain.P2p;
using WalletWasabi.Blockchain.Transactions;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
namespace WalletWasabi.Stores
{
/// <summary>
/// The purpose of this class is to safely and performantly manage all the Bitcoin related data
/// that's being serialized to disk, like transactions, wallet files, keys, blocks, index files, etc...
/// </summary>
public class BitcoinStore
{
public BitcoinStore(
string workFolderPath,
Network network,
IndexStore indexStore,
AllTransactionStore transactionStore,
SmartHeaderChain smartHeaderChain,
MempoolService mempoolService)
{
WorkFolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(workFolderPath), workFolderPath, trim: true);
IoHelpers.EnsureDirectoryExists(WorkFolderPath);
Network = Guard.NotNull(nameof(network), network);
IndexStore = indexStore;
TransactionStore = transactionStore;
SmartHeaderChain = smartHeaderChain;
MempoolService = mempoolService;
}
public bool IsInitialized { get; private set; }
private string WorkFolderPath { get; }
public Network Network { get; }
public IndexStore IndexStore { get; }
public AllTransactionStore TransactionStore { get; }
public SmartHeaderChain SmartHeaderChain { get; }
public MempoolService MempoolService { get; }
/// <summary>
/// This should not be a property, but a creator function, because it'll be cloned left and right by NBitcoin later.
/// So it should not be assumed it's some singleton.
/// </summary>
public UntrustedP2pBehavior CreateUntrustedP2pBehavior() => new UntrustedP2pBehavior(MempoolService);
public async Task InitializeAsync()
{
using (BenchmarkLogger.Measure())
{
var networkWorkFolderPath = Path.Combine(WorkFolderPath, Network.ToString());
var indexStoreFolderPath = Path.Combine(networkWorkFolderPath, "IndexStore");
var initTasks = new[]
{
IndexStore.InitializeAsync(indexStoreFolderPath, Network, SmartHeaderChain),
TransactionStore.InitializeAsync(networkWorkFolderPath, Network)
};
await Task.WhenAll(initTasks).ConfigureAwait(false);
IsInitialized = true;
}
}
}
}
| using NBitcoin;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using WalletWasabi.Blockchain.Blocks;
using WalletWasabi.Blockchain.Mempool;
using WalletWasabi.Blockchain.P2p;
using WalletWasabi.Blockchain.Transactions;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
namespace WalletWasabi.Stores
{
/// <summary>
/// The purpose of this class is to safely and performantly manage all the Bitcoin related data
/// that's being serialized to disk, like transactions, wallet files, keys, blocks, index files, etc...
/// </summary>
public class BitcoinStore
{
public bool IsInitialized { get; private set; }
private string WorkFolderPath { get; }
public Network Network { get; }
public IndexStore IndexStore { get; }
public AllTransactionStore TransactionStore { get; }
public SmartHeaderChain SmartHeaderChain { get; }
public MempoolService MempoolService { get; }
/// <summary>
/// This should not be a property, but a creator function, because it'll be cloned left and right by NBitcoin later.
/// So it should not be assumed it's some singleton.
/// </summary>
public UntrustedP2pBehavior CreateUntrustedP2pBehavior() => new UntrustedP2pBehavior(MempoolService);
public BitcoinStore(
string workFolderPath,
Network network,
IndexStore indexStore,
AllTransactionStore transactionStore,
SmartHeaderChain smartHeaderChain,
MempoolService mempoolService)
{
WorkFolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(workFolderPath), workFolderPath, trim: true);
IoHelpers.EnsureDirectoryExists(WorkFolderPath);
Network = Guard.NotNull(nameof(network), network);
IndexStore = indexStore;
TransactionStore = transactionStore;
SmartHeaderChain = smartHeaderChain;
MempoolService = mempoolService;
}
public async Task InitializeAsync()
{
using (BenchmarkLogger.Measure())
{
var networkWorkFolderPath = Path.Combine(WorkFolderPath, Network.ToString());
var indexStoreFolderPath = Path.Combine(networkWorkFolderPath, "IndexStore");
var initTasks = new[]
{
IndexStore.InitializeAsync(indexStoreFolderPath, Network, SmartHeaderChain),
TransactionStore.InitializeAsync(networkWorkFolderPath, Network)
};
await Task.WhenAll(initTasks).ConfigureAwait(false);
IsInitialized = true;
}
}
}
}
| mit | C# |
5888f9905ec7c03b6f2d7155fb98136b8af7666c | Reconfigure Constructor to allow Initialization with values | xivSolutions/StaticAnchorManager | WLWSimpleAnchorManager/AnchorData.cs | WLWSimpleAnchorManager/AnchorData.cs | using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace WLWSimpleAnchorManager
{
public class AnchorData
{
private static string rgxOnlyAlphaNumeric = "[^0-9a-zA-Z-]";
private string _anchorName = "";
//public AnchorData() : this("", "", AnchorTypes.None)
//{
//}
public AnchorData(string anchorName, string displayText, AnchorTypes type)
{
this.AnchorName = anchorName;
this.DisplayText = displayText;
this.AnchorType = type;
}
public string DisplayText { get; set; }
public string AnchorName
{
get
{
return _anchorName;
}
set
{
var rgx = new Regex(rgxOnlyAlphaNumeric);
_anchorName = rgx.Replace(value, "-");
}
}
public AnchorTypes AnchorType { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace WLWSimpleAnchorManager
{
public class AnchorData
{
private string rgxOnlyAlphaNumeric = "[^0-9a-zA-Z-]";
private string _anchorName;
public string DisplayText { get; set; }
public string AnchorName
{
get
{
return _anchorName;
}
set
{
var rgx = new Regex(rgxOnlyAlphaNumeric);
_anchorName = rgx.Replace(value, "-");
}
}
public AnchorTypes AnchorType { get; set; }
}
}
| mit | C# |
92b762d0c42cc46199387637e0be1c8cf81eff31 | Add docs for IMenuItemBackend | directhex/xwt,akrisiun/xwt,lytico/xwt,antmicro/xwt,mono/xwt,iainx/xwt,mminns/xwt,TheBrainTech/xwt,mminns/xwt,hamekoz/xwt,sevoku/xwt,residuum/xwt,hwthomas/xwt,cra0zy/xwt,steffenWi/xwt | Xwt/Xwt.Backends/IMenuItemBackend.cs | Xwt/Xwt.Backends/IMenuItemBackend.cs | //
// IMenuItemBackend.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
// Eric Maupin <ermau@xamarin.com>
//
// Copyright (c) 2011-2012 Xamarin Inc
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Xwt.Backends
{
public interface IMenuItemBackend: IBackend
{
void Initialize (IMenuItemEventSink eventSink);
/// <summary>
/// Sets a submenu for this menu item.
/// </summary>
/// <param name="menu">The menu to use as a submenu of this item.</param>
void SetSubmenu (IMenuBackend menu);
/// <summary>
/// Sets the image to display for the menu item.
/// </summary>
/// <param name="imageBackend">The image backend to set as the image for this menu item.</param>
void SetImage (object imageBackend);
/// <summary>
/// Gets or sets the label for the menu item.
/// </summary>
string Label { get; set; }
/// <summary>
/// Gets or sets whether the menu item is enabled.
/// </summary>
bool Sensitive { get; set; }
/// <summary>
/// Gets or sets whether the menu item is visible.
/// </summary>
bool Visible { get; set; }
}
public interface IMenuItemEventSink
{
void OnClicked ();
}
public enum MenuItemEvent
{
Clicked = 1
}
}
| //
// IMenuItemBackend.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2011 Xamarin Inc
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace Xwt.Backends
{
public interface IMenuItemBackend: IBackend
{
void Initialize (IMenuItemEventSink eventSink);
void SetSubmenu (IMenuBackend menu);
void SetImage (object imageBackend);
string Label { get; set; }
bool Sensitive { get; set; }
bool Visible { get; set; }
}
public interface IMenuItemEventSink
{
void OnClicked ();
}
public enum MenuItemEvent
{
Clicked = 1
}
}
| mit | C# |
83195bee3abe58c13bf59389e1db2b17802e3ba3 | fix compile error | kheiakiyama/speech-eng-functions | QuestionEntity.csx | QuestionEntity.csx | using System.Configuration;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
public class QuestionEntity : TableEntity
{
public QuestionEntity(ulong id)
{
this.PartitionKey = "speech-eng";
this.RowKey = id.ToString();
ResultCount = 0;
CorrectCount = 0;
}
public QuestionEntity() { }
public string Sentence { get; set; }
public int ResultCount { get; set; }
public int CorrectCount { get; set; }
public static QuestionEntity GetEntity(string id)
{
CloudTable table = GetTable();
TableOperation retrieveOperation = TableOperation.Retrieve<QuestionEntity>("speech-eng", id);
TableResult retrievedResult = table.Execute(retrieveOperation);
return (QuestionEntity)retrievedResult.Result;
}
private static CloudTable tmpTable = null;
private static CloudTable GetTable()
{
if (tmpTable != null)
return tmpTable;
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["speechengfunction_STORAGE"]);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
return tmpTable = tableClient.GetTableReference("sentences");
}
public void Replace()
{
CloudTable table = GetTable();
TableOperation updateOperation = TableOperation.Replace(this);
table.Execute(updateOperation);
}
public void Insert()
{
CloudTable table = GetTable();
TableOperation insertOperation = TableOperation.Insert(this);
table.Execute(insertOperation);
}
} | using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
public class QuestionEntity : TableEntity
{
public QuestionEntity(ulong id)
{
this.PartitionKey = "speech-eng";
this.RowKey = id.ToString();
ResultCount = 0;
CorrectCount = 0;
}
public QuestionEntity() { }
public string Sentence { get; set; }
public int ResultCount { get; set; }
public int CorrectCount { get; set; }
public static QuestionEntity GetEntity(string id)
{
CloudTable table = GetTable();
TableOperation retrieveOperation = TableOperation.Retrieve<QuestionEntity>("speech-eng", id);
TableResult retrievedResult = table.Execute(retrieveOperation);
return (QuestionEntity)retrievedResult.Result;
}
private static CloudTable tmpTable = null;
private static CloudTable GetTable()
{
if (tmpTable != null)
return tmpTable;
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["speechengfunction_STORAGE"]);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
return tmpTable = tableClient.GetTableReference("sentences");
}
public void Replace()
{
CloudTable table = GetTable();
TableOperation updateOperation = TableOperation.Replace(question);
table.Execute(updateOperation);
}
public void Insert()
{
CloudTable table = GetTable();
TableOperation insertOperation = TableOperation.Insert(question);
table.Execute(insertOperation);
}
} | mit | C# |
5bcb4aa61441e21bd1f823aa1131e921889d5fa1 | Update GitHubMarkdownProcessor.cs | SimonCropp/CaptureSnippets | src/CaptureSnippetsSimple/Processing/GitHubMarkdownProcessor.cs | src/CaptureSnippetsSimple/Processing/GitHubMarkdownProcessor.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace CaptureSnippets
{
public static class GitHubMarkdownProcessor
{
static Action<string> log;
static GitHubMarkdownProcessor()
{
log = s => { };
}
public static Action<string> Log
{
get => log;
set
{
Guard.AgainstNull(value, nameof(value));
log = value;
}
}
public static void Run(string targetDirectory)
{
Guard.AgainstNullAndEmpty(targetDirectory, nameof(targetDirectory));
var snippetFileFinder = new FileFinder();
var findFiles = snippetFileFinder.FindFiles(targetDirectory);
Run(targetDirectory, findFiles);
}
internal static void Run(string targetDirectory, List<string> snippetSourceFiles)
{
log($"Searching {snippetSourceFiles.Count} files for snippets");
var sourceMdFileFinder = new FileFinder(path => true, IsSourceMd);
var snippets = FileSnippetExtractor.Read(snippetSourceFiles).ToList();
log($"Found {snippets.Count} snippets");
var markdownProcessor = new MarkdownProcessor(snippets, SimpleSnippetMarkdownHandling.AppendGroup);
foreach (var sourceFile in sourceMdFileFinder.FindFiles(targetDirectory))
{
log($"Processing {sourceFile}");
var target = sourceFile.Replace(".source.md", ".md");
var contents = markdownProcessor.Apply(File.ReadAllText(sourceFile));
File.WriteAllText(target, contents);
}
}
static bool IsSourceMd(string path)
{
return path.EndsWith(".source.md", StringComparison.OrdinalIgnoreCase);
}
}
} | using System;
using System.Collections.Generic;
using System.IO;
namespace CaptureSnippets
{
public static class GitHubMarkdownProcessor
{
public static void Run(string targetDirectory)
{
Guard.AgainstNullAndEmpty(targetDirectory, nameof(targetDirectory));
var snippetFileFinder = new FileFinder();
var findFiles = snippetFileFinder.FindFiles(targetDirectory);
Run(targetDirectory, findFiles);
}
public static void Run(string targetDirectory, IEnumerable<string> findFiles)
{
Guard.AgainstNullAndEmpty(targetDirectory, nameof(targetDirectory));
Guard.AgainstNull(findFiles, nameof(findFiles));
var sourceMdFileFinder = new FileFinder(path => true, IsSourceMd);
var snippets = FileSnippetExtractor.Read(findFiles);
var markdownProcessor = new MarkdownProcessor(snippets, SimpleSnippetMarkdownHandling.AppendGroup);
foreach (var sourceFile in sourceMdFileFinder.FindFiles(targetDirectory))
{
var target = sourceFile.Replace(".source.md", ".md");
var contents = markdownProcessor.Apply(File.ReadAllText(sourceFile));
File.WriteAllText(target, contents);
}
}
static bool IsSourceMd(string path)
{
return path.EndsWith(".source.md", StringComparison.OrdinalIgnoreCase);
}
}
} | mit | C# |
bd9de18625575575000a7be476abd2e779480048 | Sort Enteties | Acumatica/cb-cli | Utils/Sorter.cs | Utils/Sorter.cs | using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace PX.Api.ContractBased.Maintenance.Cli.Utils
{
static class Sorter
{
public static void Sort(this XDocument original)
{
XElement root = original.Elements().Single();
XNamespace Namespace = root.Name.Namespace;
List<XElement> Entities = root.Elements().Except(new[] { root.Element(Namespace + "ExtendsEndpoint") }).OrderBy(GetName).ToList();
foreach (XElement elt in Entities) elt.Remove();
root.Add(Entities);
}
private static string GetName(XElement elt)
{
return elt.Attribute("name").Value;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace PX.Api.ContractBased.Maintenance.Cli.Utils
{
static class Sorter
{
public static void Sort(this XDocument original)
{
}
}
}
| mit | C# |
a0febec277304655ae547b59a7c2b7ce125ac0e9 | Add TODO for wishlist tests | rileywhite/Cilador | src/Bix.Mixers/Fody.Tests/InterfaceMixTests/EmptyInterfaceFixture.cs | src/Bix.Mixers/Fody.Tests/InterfaceMixTests/EmptyInterfaceFixture.cs | using Bix.Mixers.Fody.Core;
using Bix.Mixers.Fody.InterfaceMixing;
using Bix.Mixers.Fody.Tests.Common;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Bix.Mixers.Fody.Tests.InterfaceMixTests
{
[TestFixture]
internal class EmptyInterfaceFixture
{
[Test]
public void CanAddInterface()
{
InterfaceMixConfigType config = new InterfaceMixConfigType
{
InterfaceMap = new InterfaceMapType[]
{
new InterfaceMapType
{
Interface = "Bix.Mixers.Fody.TestInterfaces.IEmptyInterface, Bix.Mixers.Fody.TestInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
Template = "Bix.Mixers.Fody.TestSource.EmptyInterfaceTemplate, Bix.Mixers.Fody.TestSource, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
}
}
};
var assembly = ModuleWeaverHelper.WeaveAndLoadTestTarget(ModuleWeaverHelper.CreateConfig(config));
var targetType = assembly.GetType("Bix.Mixers.Fody.TestTarget.EmptyInterfaceTarget");
Assert.That(typeof(Bix.Mixers.Fody.TestInterfaces.IEmptyInterface).IsAssignableFrom(targetType));
// TODO Removing unused assembly dependencies would be a nice feature, but I'm not sure how to do it, in general (e.g. maybe the source assembly should truly be referenced)
//Assert.That(!assembly.GetReferencedAssemblies().Any(referencedAssembly => referencedAssembly.Name == "Bix.Mixers.Fody"));
//Assert.That(!assembly.GetReferencedAssemblies().Any(referencedAssembly => referencedAssembly.Name == "Bix.Mixers.Fody.TestSource"));
}
}
}
| using Bix.Mixers.Fody.Core;
using Bix.Mixers.Fody.InterfaceMixing;
using Bix.Mixers.Fody.Tests.Common;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Bix.Mixers.Fody.Tests.InterfaceMixTests
{
[TestFixture]
internal class EmptyInterfaceFixture
{
[Test]
public void CanAddInterface()
{
InterfaceMixConfigType config = new InterfaceMixConfigType
{
InterfaceMap = new InterfaceMapType[]
{
new InterfaceMapType
{
Interface = "Bix.Mixers.Fody.TestInterfaces.IEmptyInterface, Bix.Mixers.Fody.TestInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
Template = "Bix.Mixers.Fody.TestSource.EmptyInterfaceTemplate, Bix.Mixers.Fody.TestSource, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
}
}
};
var assembly = ModuleWeaverHelper.WeaveAndLoadTestTarget(ModuleWeaverHelper.CreateConfig(config));
var targetType = assembly.GetType("Bix.Mixers.Fody.TestTarget.EmptyInterfaceTarget");
Assert.IsTrue(typeof(Bix.Mixers.Fody.TestInterfaces.IEmptyInterface).IsAssignableFrom(targetType));
}
}
}
| apache-2.0 | C# |
c825f028c10d69dfbd328135040819d57dee8573 | Fix StackTrace unit test for Release builds | n1ghtmare/corefx,cydhaselton/corefx,benjamin-bader/corefx,dhoehna/corefx,krk/corefx,weltkante/corefx,dhoehna/corefx,fgreinacher/corefx,twsouthwick/corefx,CherryCxldn/corefx,shmao/corefx,rjxby/corefx,axelheer/corefx,larsbj1988/corefx,iamjasonp/corefx,dtrebbien/corefx,rahku/corefx,marksmeltzer/corefx,comdiv/corefx,manu-silicon/corefx,pallavit/corefx,shahid-pk/corefx,heXelium/corefx,janhenke/corefx,brett25/corefx,YoupHulsebos/corefx,vrassouli/corefx,wtgodbe/corefx,gkhanna79/corefx,jeremymeng/corefx,parjong/corefx,jcme/corefx,rjxby/corefx,gkhanna79/corefx,rubo/corefx,PatrickMcDonald/corefx,khdang/corefx,manu-silicon/corefx,the-dwyer/corefx,Priya91/corefx-1,weltkante/corefx,CloudLens/corefx,shrutigarg/corefx,benjamin-bader/corefx,mmitche/corefx,DnlHarvey/corefx,seanshpark/corefx,cartermp/corefx,krytarowski/corefx,janhenke/corefx,marksmeltzer/corefx,krk/corefx,chaitrakeshav/corefx,zmaruo/corefx,elijah6/corefx,shimingsg/corefx,zmaruo/corefx,marksmeltzer/corefx,Jiayili1/corefx,scott156/corefx,jlin177/corefx,adamralph/corefx,wtgodbe/corefx,alphonsekurian/corefx,benpye/corefx,PatrickMcDonald/corefx,axelheer/corefx,zhangwenquan/corefx,Frank125/corefx,anjumrizwi/corefx,Yanjing123/corefx,benjamin-bader/corefx,PatrickMcDonald/corefx,richlander/corefx,DnlHarvey/corefx,SGuyGe/corefx,alphonsekurian/corefx,gkhanna79/corefx,CloudLens/corefx,mmitche/corefx,weltkante/corefx,Frank125/corefx,jlin177/corefx,Petermarcu/corefx,jlin177/corefx,KrisLee/corefx,bpschoch/corefx,pgavlin/corefx,mmitche/corefx,rahku/corefx,jlin177/corefx,vrassouli/corefx,jcme/corefx,kkurni/corefx,ptoonen/corefx,Alcaro/corefx,s0ne0me/corefx,ericstj/corefx,alexandrnikitin/corefx,jhendrixMSFT/corefx,YoupHulsebos/corefx,jeremymeng/corefx,ptoonen/corefx,andyhebear/corefx,chaitrakeshav/corefx,PatrickMcDonald/corefx,shana/corefx,jlin177/corefx,janhenke/corefx,stormleoxia/corefx,seanshpark/corefx,dsplaisted/corefx,seanshpark/corefx,vidhya-bv/corefx-sorting,690486439/corefx,mokchhya/corefx,the-dwyer/corefx,jeremymeng/corefx,jeremymeng/corefx,billwert/corefx,oceanho/corefx,bpschoch/corefx,bpschoch/corefx,vrassouli/corefx,wtgodbe/corefx,billwert/corefx,jmhardison/corefx,brett25/corefx,lggomez/corefx,zhenlan/corefx,uhaciogullari/corefx,parjong/corefx,bitcrazed/corefx,richlander/corefx,zhangwenquan/corefx,josguil/corefx,Chrisboh/corefx,larsbj1988/corefx,rahku/corefx,KrisLee/corefx,dotnet-bot/corefx,shahid-pk/corefx,gregg-miskelly/corefx,nbarbettini/corefx,vidhya-bv/corefx-sorting,stone-li/corefx,mmitche/corefx,dotnet-bot/corefx,scott156/corefx,Priya91/corefx-1,weltkante/corefx,alexandrnikitin/corefx,mokchhya/corefx,akivafr123/corefx,rahku/corefx,oceanho/corefx,krytarowski/corefx,khdang/corefx,jmhardison/corefx,billwert/corefx,josguil/corefx,kkurni/corefx,zhenlan/corefx,dotnet-bot/corefx,marksmeltzer/corefx,gabrielPeart/corefx,heXelium/corefx,gregg-miskelly/corefx,josguil/corefx,mellinoe/corefx,dkorolev/corefx,thiagodin/corefx,parjong/corefx,nbarbettini/corefx,benpye/corefx,comdiv/corefx,stone-li/corefx,comdiv/corefx,cydhaselton/corefx,yizhang82/corefx,alexandrnikitin/corefx,pgavlin/corefx,scott156/corefx,jhendrixMSFT/corefx,viniciustaveira/corefx,rubo/corefx,Petermarcu/corefx,josguil/corefx,jcme/corefx,thiagodin/corefx,tijoytom/corefx,anjumrizwi/corefx,axelheer/corefx,krk/corefx,fffej/corefx,Yanjing123/corefx,jmhardison/corefx,SGuyGe/corefx,janhenke/corefx,Yanjing123/corefx,nbarbettini/corefx,nchikanov/corefx,tstringer/corefx,iamjasonp/corefx,Chrisboh/corefx,erpframework/corefx,ViktorHofer/corefx,Frank125/corefx,pallavit/corefx,mokchhya/corefx,khdang/corefx,Petermarcu/corefx,shahid-pk/corefx,janhenke/corefx,tijoytom/corefx,jcme/corefx,Jiayili1/corefx,jlin177/corefx,shana/corefx,twsouthwick/corefx,Petermarcu/corefx,nbarbettini/corefx,n1ghtmare/corefx,CherryCxldn/corefx,pgavlin/corefx,cartermp/corefx,parjong/corefx,kkurni/corefx,stone-li/corefx,marksmeltzer/corefx,jhendrixMSFT/corefx,anjumrizwi/corefx,oceanho/corefx,mafiya69/corefx,cydhaselton/corefx,nchikanov/corefx,stephenmichaelf/corefx,alexperovich/corefx,stephenmichaelf/corefx,mmitche/corefx,shrutigarg/corefx,tijoytom/corefx,tijoytom/corefx,parjong/corefx,ellismg/corefx,ellismg/corefx,ravimeda/corefx,cartermp/corefx,lydonchandra/corefx,krk/corefx,andyhebear/corefx,vidhya-bv/corefx-sorting,pallavit/corefx,ptoonen/corefx,alphonsekurian/corefx,ptoonen/corefx,krytarowski/corefx,erpframework/corefx,fffej/corefx,oceanho/corefx,khdang/corefx,elijah6/corefx,rajansingh10/corefx,dtrebbien/corefx,chaitrakeshav/corefx,Jiayili1/corefx,benpye/corefx,alexperovich/corefx,yizhang82/corefx,dkorolev/corefx,Alcaro/corefx,nchikanov/corefx,tijoytom/corefx,CloudLens/corefx,kyulee1/corefx,huanjie/corefx,jmhardison/corefx,yizhang82/corefx,mazong1123/corefx,DnlHarvey/corefx,mafiya69/corefx,heXelium/corefx,rjxby/corefx,jcme/corefx,JosephTremoulet/corefx,s0ne0me/corefx,bitcrazed/corefx,axelheer/corefx,jhendrixMSFT/corefx,KrisLee/corefx,stephenmichaelf/corefx,krytarowski/corefx,stone-li/corefx,Chrisboh/corefx,BrennanConroy/corefx,ericstj/corefx,elijah6/corefx,twsouthwick/corefx,ravimeda/corefx,tstringer/corefx,gabrielPeart/corefx,ptoonen/corefx,VPashkov/corefx,YoupHulsebos/corefx,twsouthwick/corefx,matthubin/corefx,rubo/corefx,pallavit/corefx,shmao/corefx,ptoonen/corefx,krytarowski/corefx,vidhya-bv/corefx-sorting,dsplaisted/corefx,Ermiar/corefx,cydhaselton/corefx,Jiayili1/corefx,Ermiar/corefx,matthubin/corefx,khdang/corefx,MaggieTsang/corefx,alphonsekurian/corefx,elijah6/corefx,weltkante/corefx,jeremymeng/corefx,s0ne0me/corefx,benpye/corefx,weltkante/corefx,iamjasonp/corefx,Frank125/corefx,Alcaro/corefx,seanshpark/corefx,anjumrizwi/corefx,axelheer/corefx,ellismg/corefx,huanjie/corefx,MaggieTsang/corefx,richlander/corefx,VPashkov/corefx,dhoehna/corefx,axelheer/corefx,shimingsg/corefx,viniciustaveira/corefx,vidhya-bv/corefx-sorting,billwert/corefx,dhoehna/corefx,Priya91/corefx-1,dotnet-bot/corefx,mmitche/corefx,rjxby/corefx,ellismg/corefx,lggomez/corefx,twsouthwick/corefx,erpframework/corefx,ericstj/corefx,elijah6/corefx,zhangwenquan/corefx,kyulee1/corefx,mokchhya/corefx,mafiya69/corefx,khdang/corefx,krytarowski/corefx,kkurni/corefx,jlin177/corefx,alphonsekurian/corefx,huanjie/corefx,dotnet-bot/corefx,zhenlan/corefx,parjong/corefx,uhaciogullari/corefx,shimingsg/corefx,gkhanna79/corefx,mazong1123/corefx,mazong1123/corefx,seanshpark/corefx,jhendrixMSFT/corefx,billwert/corefx,alphonsekurian/corefx,parjong/corefx,stephenmichaelf/corefx,kkurni/corefx,thiagodin/corefx,VPashkov/corefx,dhoehna/corefx,KrisLee/corefx,wtgodbe/corefx,zhangwenquan/corefx,bpschoch/corefx,tijoytom/corefx,yizhang82/corefx,elijah6/corefx,tstringer/corefx,dhoehna/corefx,comdiv/corefx,Priya91/corefx-1,heXelium/corefx,shahid-pk/corefx,larsbj1988/corefx,ravimeda/corefx,shmao/corefx,dotnet-bot/corefx,mafiya69/corefx,seanshpark/corefx,the-dwyer/corefx,vs-team/corefx,s0ne0me/corefx,nelsonsar/corefx,bitcrazed/corefx,shahid-pk/corefx,MaggieTsang/corefx,lggomez/corefx,gkhanna79/corefx,JosephTremoulet/corefx,kyulee1/corefx,rajansingh10/corefx,iamjasonp/corefx,Ermiar/corefx,nelsonsar/corefx,MaggieTsang/corefx,fgreinacher/corefx,YoupHulsebos/corefx,n1ghtmare/corefx,Chrisboh/corefx,wtgodbe/corefx,ellismg/corefx,shimingsg/corefx,josguil/corefx,cnbin/corefx,YoupHulsebos/corefx,Jiayili1/corefx,brett25/corefx,cartermp/corefx,shimingsg/corefx,cartermp/corefx,scott156/corefx,richlander/corefx,dtrebbien/corefx,rjxby/corefx,mokchhya/corefx,jhendrixMSFT/corefx,CherryCxldn/corefx,SGuyGe/corefx,stephenmichaelf/corefx,twsouthwick/corefx,ViktorHofer/corefx,akivafr123/corefx,mellinoe/corefx,nbarbettini/corefx,manu-silicon/corefx,vs-team/corefx,fffej/corefx,BrennanConroy/corefx,lggomez/corefx,lydonchandra/corefx,thiagodin/corefx,cnbin/corefx,kyulee1/corefx,mafiya69/corefx,manu-silicon/corefx,shmao/corefx,mmitche/corefx,andyhebear/corefx,krytarowski/corefx,cnbin/corefx,Priya91/corefx-1,nbarbettini/corefx,cydhaselton/corefx,josguil/corefx,nchikanov/corefx,tstringer/corefx,stephenmichaelf/corefx,ravimeda/corefx,Jiayili1/corefx,zhenlan/corefx,gkhanna79/corefx,uhaciogullari/corefx,shimingsg/corefx,the-dwyer/corefx,rahku/corefx,lggomez/corefx,viniciustaveira/corefx,CloudLens/corefx,lggomez/corefx,benjamin-bader/corefx,690486439/corefx,andyhebear/corefx,benjamin-bader/corefx,gregg-miskelly/corefx,stormleoxia/corefx,jhendrixMSFT/corefx,alexperovich/corefx,Alcaro/corefx,lggomez/corefx,vrassouli/corefx,rahku/corefx,shana/corefx,cydhaselton/corefx,Petermarcu/corefx,Ermiar/corefx,mellinoe/corefx,yizhang82/corefx,akivafr123/corefx,shmao/corefx,alexperovich/corefx,Priya91/corefx-1,Chrisboh/corefx,Jiayili1/corefx,rahku/corefx,SGuyGe/corefx,stormleoxia/corefx,benjamin-bader/corefx,rajansingh10/corefx,ericstj/corefx,dhoehna/corefx,nelsonsar/corefx,alexandrnikitin/corefx,fffej/corefx,zmaruo/corefx,rajansingh10/corefx,mellinoe/corefx,dsplaisted/corefx,VPashkov/corefx,BrennanConroy/corefx,stormleoxia/corefx,dotnet-bot/corefx,uhaciogullari/corefx,ViktorHofer/corefx,ViktorHofer/corefx,gkhanna79/corefx,JosephTremoulet/corefx,gabrielPeart/corefx,DnlHarvey/corefx,viniciustaveira/corefx,ericstj/corefx,alexperovich/corefx,ViktorHofer/corefx,richlander/corefx,richlander/corefx,krk/corefx,stone-li/corefx,nchikanov/corefx,mazong1123/corefx,billwert/corefx,Petermarcu/corefx,huanjie/corefx,pallavit/corefx,rubo/corefx,twsouthwick/corefx,the-dwyer/corefx,shmao/corefx,Petermarcu/corefx,kkurni/corefx,Yanjing123/corefx,pallavit/corefx,ViktorHofer/corefx,mafiya69/corefx,JosephTremoulet/corefx,DnlHarvey/corefx,cartermp/corefx,fgreinacher/corefx,mazong1123/corefx,akivafr123/corefx,nchikanov/corefx,SGuyGe/corefx,pgavlin/corefx,SGuyGe/corefx,MaggieTsang/corefx,Ermiar/corefx,nelsonsar/corefx,matthubin/corefx,shimingsg/corefx,nbarbettini/corefx,elijah6/corefx,jcme/corefx,PatrickMcDonald/corefx,yizhang82/corefx,yizhang82/corefx,erpframework/corefx,ViktorHofer/corefx,stephenmichaelf/corefx,mazong1123/corefx,tstringer/corefx,stone-li/corefx,iamjasonp/corefx,shrutigarg/corefx,shmao/corefx,vs-team/corefx,zhenlan/corefx,adamralph/corefx,gabrielPeart/corefx,ravimeda/corefx,vs-team/corefx,mellinoe/corefx,cnbin/corefx,JosephTremoulet/corefx,alexperovich/corefx,dkorolev/corefx,iamjasonp/corefx,shrutigarg/corefx,fgreinacher/corefx,chaitrakeshav/corefx,ptoonen/corefx,ellismg/corefx,rubo/corefx,shahid-pk/corefx,Yanjing123/corefx,Chrisboh/corefx,Ermiar/corefx,rjxby/corefx,the-dwyer/corefx,mazong1123/corefx,YoupHulsebos/corefx,manu-silicon/corefx,akivafr123/corefx,alphonsekurian/corefx,gregg-miskelly/corefx,marksmeltzer/corefx,krk/corefx,DnlHarvey/corefx,zmaruo/corefx,benpye/corefx,benpye/corefx,manu-silicon/corefx,MaggieTsang/corefx,alexperovich/corefx,mokchhya/corefx,adamralph/corefx,MaggieTsang/corefx,rjxby/corefx,larsbj1988/corefx,DnlHarvey/corefx,wtgodbe/corefx,zhenlan/corefx,ravimeda/corefx,dkorolev/corefx,ravimeda/corefx,nchikanov/corefx,CherryCxldn/corefx,wtgodbe/corefx,seanshpark/corefx,ericstj/corefx,bitcrazed/corefx,cydhaselton/corefx,mellinoe/corefx,tstringer/corefx,richlander/corefx,weltkante/corefx,dtrebbien/corefx,JosephTremoulet/corefx,Ermiar/corefx,zhenlan/corefx,matthubin/corefx,janhenke/corefx,iamjasonp/corefx,ericstj/corefx,690486439/corefx,billwert/corefx,the-dwyer/corefx,lydonchandra/corefx,n1ghtmare/corefx,stone-li/corefx,YoupHulsebos/corefx,n1ghtmare/corefx,brett25/corefx,alexandrnikitin/corefx,marksmeltzer/corefx,krk/corefx,bitcrazed/corefx,tijoytom/corefx,690486439/corefx,690486439/corefx,shana/corefx,lydonchandra/corefx,manu-silicon/corefx,JosephTremoulet/corefx | src/System.Runtime.Extensions/tests/System/Environment.StackTrace.cs | src/System.Runtime.Extensions/tests/System/Environment.StackTrace.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace System.Runtime.Extensions.Tests
{
public class EnvironmentStackTrace
{
static string s_stackTrace;
[Fact]
public void StackTraceTest()
{
//arrange
List<string> knownFrames = new List<string>()
{
"System.Runtime.Extensions.Tests.EnvironmentStackTrace.StaticFrame(Object obj)",
"System.Runtime.Extensions.Tests.EnvironmentStackTrace.TestClass..ctor()",
"System.Runtime.Extensions.Tests.EnvironmentStackTrace.GenericFrame[T1,T2](T1 t1, T2 t2)",
"System.Runtime.Extensions.Tests.EnvironmentStackTrace.TestFrame()"
};
//act
Task.Run(() => TestFrame()).Wait();
//assert
int index = 0;
foreach(string frame in knownFrames)
{
index = s_stackTrace.IndexOf(frame, index);
Assert.True(index > -1);
index += frame.Length;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public void TestFrame()
{
GenericFrame<DateTime, StringBuilder>(DateTime.Now, null);
}
[MethodImpl(MethodImplOptions.NoInlining)]
public void GenericFrame<T1, T2>(T1 t1, T2 t2)
{
var test = new TestClass();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void StaticFrame(object obj)
{
s_stackTrace = Environment.StackTrace;
}
class TestClass
{
[MethodImpl(MethodImplOptions.NoInlining)]
public TestClass()
{
EnvironmentStackTrace.StaticFrame(null);
}
}
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace System.Runtime.Extensions.Tests
{
public class EnvironmentStackTrace
{
static string s_stackTrace;
[Fact]
public void StackTraceTest()
{
//arrange
List<string> knownFrames = new List<string>()
{
"System.Runtime.Extensions.Tests.EnvironmentStackTrace.StaticFrame(Object obj)",
"System.Runtime.Extensions.Tests.EnvironmentStackTrace.TestClass..ctor()",
"System.Runtime.Extensions.Tests.EnvironmentStackTrace.GenericFrame[T1,T2](T1 t1, T2 t2)",
"System.Runtime.Extensions.Tests.EnvironmentStackTrace.TestFrame()"
};
//act
Task.Run(() => TestFrame()).Wait();
//assert
int index = 0;
foreach(string frame in knownFrames)
{
index = s_stackTrace.IndexOf(frame, index);
Assert.True(index > -1);
index += frame.Length;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public void TestFrame()
{
GenericFrame<DateTime, StringBuilder>(DateTime.Now, null);
}
[MethodImpl(MethodImplOptions.NoInlining)]
public void GenericFrame<T1, T2>(T1 t1, T2 t2)
{
var test = new TestClass();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void StaticFrame(object obj)
{
s_stackTrace = Environment.StackTrace;
}
class TestClass
{
public TestClass()
{
EnvironmentStackTrace.StaticFrame(null);
}
}
}
}
| mit | C# |
56525323e62ccbcf14ee2071f01c55961050b3b9 | add parameter check in sample | persi12/Hangfire.Mongo,persi12/Hangfire.Mongo | src/Hangfire.Mongo.Sample/Controllers/HomeController.cs | src/Hangfire.Mongo.Sample/Controllers/HomeController.cs | using MongoDB.Bson;
using System;
using System.Diagnostics;
using System.Web.Mvc;
namespace Hangfire.Mongo.Sample.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult FireAndForget(int id)
{
for (int i = 0; i < id; i++)
{
BackgroundJob.Enqueue(() => Debug.WriteLine($"Hangfire fire-and-forget task started with id {id}."));
}
return RedirectToAction("Index");
}
public ActionResult Delayed(int id)
{
for (int i = 0; i < id; i++)
{
BackgroundJob.Schedule(() => Debug.WriteLine($"Hangfire delayed task with id {id} started!"), TimeSpan.FromMinutes(1));
}
return RedirectToAction("Index");
}
public ActionResult Recurring()
{
RecurringJob.AddOrUpdate(() => Debug.WriteLine("Hangfire recurring task started!"), Cron.Minutely);
return RedirectToAction("Index");
}
}
} | using MongoDB.Bson;
using System;
using System.Diagnostics;
using System.Web.Mvc;
namespace Hangfire.Mongo.Sample.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult FireAndForget(int id)
{
for (int i = 0; i < id; i++)
{
BackgroundJob.Enqueue(() => Debug.WriteLine("Hangfire fire-and-forget task started."));
}
return RedirectToAction("Index");
}
public ActionResult Delayed(int id)
{
for (int i = 0; i < id; i++)
{
BackgroundJob.Schedule(() => Debug.WriteLine("Hangfire delayed task started!"), TimeSpan.FromMinutes(1));
}
return RedirectToAction("Index");
}
public ActionResult Recurring()
{
RecurringJob.AddOrUpdate(() => Debug.WriteLine("Hangfire recurring task started!"), Cron.Minutely);
return RedirectToAction("Index");
}
}
} | mit | C# |
63a06afab220c116928299a18582e4117c7be3e2 | Add missing license header | ppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu | osu.Game/Collections/CollectionToggleMenuItem.cs | osu.Game/Collections/CollectionToggleMenuItem.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Collections
{
public class CollectionToggleMenuItem : ToggleMenuItem
{
public CollectionToggleMenuItem(BeatmapCollection collection, IBeatmapInfo beatmap)
: base(collection.Name.Value, MenuItemType.Standard, s =>
{
if (s)
collection.BeatmapHashes.Add(beatmap.MD5Hash);
else
collection.BeatmapHashes.Remove(beatmap.MD5Hash);
})
{
State.Value = collection.BeatmapHashes.Contains(beatmap.MD5Hash);
}
}
}
| using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Collections
{
public class CollectionToggleMenuItem : ToggleMenuItem
{
public CollectionToggleMenuItem(BeatmapCollection collection, IBeatmapInfo beatmap)
: base(collection.Name.Value, MenuItemType.Standard, s =>
{
if (s)
collection.BeatmapHashes.Add(beatmap.MD5Hash);
else
collection.BeatmapHashes.Remove(beatmap.MD5Hash);
})
{
State.Value = collection.BeatmapHashes.Contains(beatmap.MD5Hash);
}
}
}
| mit | C# |
02e0e2474a12f9cc18d828cba8b837f090e81787 | remove self description as it complicates codegen in current state | Kukkimonsuta/Odachi | src/Odachi.AspNetCore.JsonRpc/Modules/ServerModule.cs | src/Odachi.AspNetCore.JsonRpc/Modules/ServerModule.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Odachi.AspNetCore.JsonRpc.Internal;
using Odachi.Annotations;
namespace Odachi.AspNetCore.JsonRpc.Modules
{
public class ServerModule
{
[RpcMethod]
public static string[] ListMethods(JsonRpcServer server)
{
var methods = server.Methods
.Select(m => m.Name)
.ToArray();
return methods;
}
[RpcMethod]
public static DateTime Ping()
{
return DateTime.Now;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Odachi.AspNetCore.JsonRpc.Internal;
using Odachi.Annotations;
namespace Odachi.AspNetCore.JsonRpc.Modules
{
public class ServerModule
{
[RpcMethod]
public static string[] ListMethods(JsonRpcServer server)
{
var methods = server.Methods
.Select(m => m.Name)
.ToArray();
return methods;
}
[RpcMethod]
public static DateTime Ping()
{
return DateTime.Now;
}
[RpcMethod]
public static Task<object[]> DescribeAsync(JsonRpcServer server, bool includeInternals = false)
{
var modules = server.Methods
.GroupBy(m => m.ModuleName, (k, g) => new
{
Name = k,
Methods = g.Select(m => new
{
Name = m.MethodName,
ReturnType = m.ReturnType?.JsonType.ToString().ToLowerInvariant(),
Parameters = m.Parameters.Where(p => includeInternals || !p.IsInternal).Select(p => new
{
Name = p.Name,
Type = p.Type.JsonType.ToString().ToLowerInvariant(),
IsOptional = p.IsOptional,
DefaultValue = p.DefaultValue,
}),
}),
})
.Cast<object>()
.ToArray();
return Task.FromResult(modules);
}
}
}
| apache-2.0 | C# |
885d163857c09f428113b690e6360c64fd103f71 | Hide keep alive warnings | darcymiranda/PFire | src/PFire.Core/Protocol/Messages/Inbound/KeepAlive.cs | src/PFire.Core/Protocol/Messages/Inbound/KeepAlive.cs | using System.Threading.Tasks;
using PFire.Core.Session;
namespace PFire.Core.Protocol.Messages.Inbound
{
internal sealed class KeepAlive : XFireMessage
{
public KeepAlive() : base(XFireMessageType.KeepAlive) {}
public override Task Process(IXFireClient client)
{
return Task.CompletedTask;
}
}
}
| namespace PFire.Core.Protocol.Messages.Inbound
{
internal sealed class KeepAlive : XFireMessage
{
public KeepAlive() : base(XFireMessageType.KeepAlive) {}
}
}
| mit | C# |
47cba5b3fefdd949a936373d61d2992aab1011f8 | Fix spacing. | mdavid/nuget,mdavid/nuget | src/Core/Repositories/IPackageRepository.cs | src/Core/Repositories/IPackageRepository.cs | using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace NuGet {
public interface IPackageRepository {
string Source { get; }
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "This call might be expensive")]
IQueryable<IPackage> GetPackages();
void AddPackage(IPackage package);
void RemovePackage(IPackage package);
}
}
| using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace NuGet {
public interface IPackageRepository {
string Source { get; }
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "This call might be expensive")]
IQueryable<IPackage> GetPackages();
void AddPackage(IPackage package);
void RemovePackage(IPackage package);
}
}
| apache-2.0 | C# |
1741a507f852284ff1ab7f0e2fa501ffdfe47359 | Replace Ticks by Random | Cybermaxs/Nullify | src/Nullify/Configuration/CreationPolicy.cs | src/Nullify/Configuration/CreationPolicy.cs | using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Linq;
namespace Nullify.Configuration
{
internal class CreationPolicy
{
/// <summary>
/// Name of the policy. Used for the generated class Name as well as for pre-registration.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Target Type for this policy.
/// </summary>
public Type Target { get; private set; }
public IList<CreationPolicy> NestedPolicies { get; private set; }
public string AutoGeneratedClassName
{
get
{
var builder = new StringBuilder();
builder.Append("NullOf");
builder.Append(Target.Name);
builder.Append("Named");
builder.Append(Name);
return builder.ToString();
}
}
/// <summary>
/// Configured Return values for Getters/Functions
/// </summary>
public Dictionary<MemberInfo, object> ReturnValues { get; private set; }
public CreationPolicy(Type target)
{
Target = target;
ReturnValues = new Dictionary<MemberInfo, object>();
NestedPolicies = new List<CreationPolicy>();
Name = new Random().Next().ToString();
}
public CreationPolicy Search(Type childType)
{
var policy = NestedPolicies.FirstOrDefault(t => t.Target == childType);
if (policy == null)
policy = new CreationPolicy(childType);
policy.Name = "NullOf" + childType.Name + "dep" + AutoGeneratedClassName;
return policy;
}
}
}
| using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Linq;
namespace Nullify.Configuration
{
internal class CreationPolicy
{
/// <summary>
/// Name of the policy. Used for the generated class Name as well as for pre-registration.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Target Type for this policy.
/// </summary>
public Type Target { get; private set; }
public IList<CreationPolicy> NestedPolicies { get; private set; }
public string AutoGeneratedClassName
{
get
{
var builder = new StringBuilder();
builder.Append("NullOf");
builder.Append(Target.Name);
builder.Append("Named");
builder.Append(Name);
return builder.ToString();
}
}
/// <summary>
/// Configured Return values for Getters/Functions
/// </summary>
public Dictionary<MemberInfo, object> ReturnValues { get; private set; }
public CreationPolicy(Type target)
{
Target = target;
ReturnValues = new Dictionary<MemberInfo, object>();
NestedPolicies = new List<CreationPolicy>();
Name = DateTime.UtcNow.Ticks.ToString();
}
public CreationPolicy Search(Type childType)
{
var policy = NestedPolicies.FirstOrDefault(t => t.Target == childType);
if (policy == null)
policy = new CreationPolicy(childType);
policy.Name = "NullOf" + childType.Name + "dep" + AutoGeneratedClassName;
return policy;
}
}
}
| mit | C# |
7dd1d3827b6371fce755740489d238935584af8b | Use the AppSettings 'NuGetPackagePath' if exists and the default ~/Packages otherwise | mdavid/nuget,mdavid/nuget | src/Server/Infrastructure/PackageUtility.cs | src/Server/Infrastructure/PackageUtility.cs | using System;
using System.Web;
using System.Web.Hosting;
using System.Configuration;
namespace NuGet.Server.Infrastructure
{
public class PackageUtility
{
internal static string PackagePhysicalPath;
private static string DefaultPackagePhysicalPath = HostingEnvironment.MapPath("~/Packages");
static PackageUtility()
{
string packagePath = ConfigurationManager.AppSettings["NuGetPackagePath"];
if (string.IsNullOrEmpty(packagePath))
{
PackagePhysicalPath = DefaultPackagePhysicalPath;
}
else
{
PackagePhysicalPath = packagePath;
}
}
public static Uri GetPackageUrl(string path, Uri baseUri)
{
return new Uri(baseUri, GetPackageDownloadUrl(path));
}
private static string GetPackageDownloadUrl(string path)
{
return VirtualPathUtility.ToAbsolute("~/Packages/" + path);
}
}
}
| using System;
using System.Web;
using System.Web.Hosting;
namespace NuGet.Server.Infrastructure {
public class PackageUtility {
internal static string PackagePhysicalPath = HostingEnvironment.MapPath("~/Packages");
public static Uri GetPackageUrl(string path, Uri baseUri) {
return new Uri(baseUri, GetPackageDownloadUrl(path));
}
private static string GetPackageDownloadUrl(string path) {
return VirtualPathUtility.ToAbsolute("~/Packages/" + path);
}
}
}
| apache-2.0 | C# |
dbbe4e7343ffb9cd8d81ceba5f0cf8e0d777ee4b | Update LoginRequestQuery with additional fields. Closes #193 | jerriep/auth0.net,auth0/auth0.net,jerriep/auth0.net,jerriep/auth0.net,auth0/auth0.net | src/Auth0.ManagementApi/Models/Rules/LoginRequestQuery.cs | src/Auth0.ManagementApi/Models/Rules/LoginRequestQuery.cs | using Newtonsoft.Json;
namespace Auth0.ManagementApi.Models.Rules
{
/// <summary>
///
/// </summary>
[JsonObject]
public class LoginRequestQuery
{
/// <summary>
///
/// </summary>
[JsonProperty("audience")]
public string Audience { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("client_id")]
public string ClientId { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("connection")]
public string Connection { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("device")]
public string Device { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("protocol")]
public string Protocol { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("prompt")]
public string Prompt { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("redirect_uri")]
public string RedirectUri { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("response_type")]
public string ResponseType { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("scope")]
public string Scope { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("sso")]
public string Sso { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("state")]
public string State { get; set; }
}
} | using Newtonsoft.Json;
namespace Auth0.ManagementApi.Models.Rules
{
/// <summary>
///
/// </summary>
[JsonObject]
public class LoginRequestQuery
{
/// <summary>
///
/// </summary>
[JsonProperty("client_id")]
public string ClientId { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("connection")]
public string Connection { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("prompt")]
public string Prompt { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("redirect_uri")]
public string RedirectUri { get; set; }
/// <summary>
///
/// </summary>
[JsonProperty("response_type")]
public string ResponseType { get; set; }
}
} | mit | C# |
e40f195956bfb0a4581abdf5d4e98d5401a46582 | Add CreateCollector to interface | bcemmett/SurveyMonkeyApi | SurveyMonkey/ISurveyMonkeyApi.cs | SurveyMonkey/ISurveyMonkeyApi.cs | using System.Collections.Generic;
namespace SurveyMonkey
{
public interface ISurveyMonkeyApi
{
int RequestsMade { get; }
int QuotaAllotted { get; }
int QuotaUsed { get; }
//Endpoints
List<Survey> GetSurveyList();
List<Survey> GetSurveyList(GetSurveyListSettings settings);
List<Survey> GetSurveyList(int page);
List<Survey> GetSurveyList(int page, GetSurveyListSettings settings);
List<Survey> GetSurveyList(int page, int pageSize);
List<Survey> GetSurveyList(int page, int pageSize, GetSurveyListSettings settings);
Survey GetSurveyDetails(long surveyId);
List<Collector> GetCollectorList(long surveyId);
List<Collector> GetCollectorList(long surveyId, GetCollectorListSettings settings);
List<Collector> GetCollectorList(long surveyId, int page);
List<Collector> GetCollectorList(long surveyId, int page, GetCollectorListSettings settings);
List<Collector> GetCollectorList(long surveyId, int page, int pageSize);
List<Collector> GetCollectorList(long surveyId, int page, int pageSize, GetCollectorListSettings settings);
List<Respondent> GetRespondentList(long surveyId);
List<Respondent> GetRespondentList(long surveyId, GetRespondentListSettings settings);
List<Respondent> GetRespondentList(long surveyId, int page);
List<Respondent> GetRespondentList(long surveyId, int page, GetRespondentListSettings settings);
List<Respondent> GetRespondentList(long surveyId, int page, int pageSize);
List<Respondent> GetRespondentList(long surveyId, int page, int pageSize, GetRespondentListSettings settings);
List<Response> GetResponses(long surveyId, List<long> respondents);
Collector GetResponseCounts(long collectorId);
UserDetails GetUserDetails();
List<Template> GetTemplateList();
List<Template> GetTemplateList(GetTemplateListSettings settings);
List<Template> GetTemplateList(int page);
List<Template> GetTemplateList(int page, GetTemplateListSettings settings);
List<Template> GetTemplateList(int page, int pageSize);
List<Template> GetTemplateList(int page, int pageSize, GetTemplateListSettings settings);
CreateRecipientsResponse CreateRecipients(long collectorId, long emailMessageId, List<Recipient> recipients);
SendFlowResponse SendFlow(long surveyId, SendFlowSettings settings);
Collector CreateCollector(long surveyId);
Collector CreateCollector(long surveyId, CreateCollectorSettings settings);
//Data processing
void FillMissingSurveyInformation(List<Survey> surveys);
void FillMissingSurveyInformation(Survey survey);
}
} | using System.Collections.Generic;
namespace SurveyMonkey
{
public interface ISurveyMonkeyApi
{
int RequestsMade { get; }
int QuotaAllotted { get; }
int QuotaUsed { get; }
//Endpoints
List<Survey> GetSurveyList();
List<Survey> GetSurveyList(GetSurveyListSettings settings);
List<Survey> GetSurveyList(int page);
List<Survey> GetSurveyList(int page, GetSurveyListSettings settings);
List<Survey> GetSurveyList(int page, int pageSize);
List<Survey> GetSurveyList(int page, int pageSize, GetSurveyListSettings settings);
Survey GetSurveyDetails(long surveyId);
List<Collector> GetCollectorList(long surveyId);
List<Collector> GetCollectorList(long surveyId, GetCollectorListSettings settings);
List<Collector> GetCollectorList(long surveyId, int page);
List<Collector> GetCollectorList(long surveyId, int page, GetCollectorListSettings settings);
List<Collector> GetCollectorList(long surveyId, int page, int pageSize);
List<Collector> GetCollectorList(long surveyId, int page, int pageSize, GetCollectorListSettings settings);
List<Respondent> GetRespondentList(long surveyId);
List<Respondent> GetRespondentList(long surveyId, GetRespondentListSettings settings);
List<Respondent> GetRespondentList(long surveyId, int page);
List<Respondent> GetRespondentList(long surveyId, int page, GetRespondentListSettings settings);
List<Respondent> GetRespondentList(long surveyId, int page, int pageSize);
List<Respondent> GetRespondentList(long surveyId, int page, int pageSize, GetRespondentListSettings settings);
List<Response> GetResponses(long surveyId, List<long> respondents);
Collector GetResponseCounts(long collectorId);
UserDetails GetUserDetails();
List<Template> GetTemplateList();
List<Template> GetTemplateList(GetTemplateListSettings settings);
List<Template> GetTemplateList(int page);
List<Template> GetTemplateList(int page, GetTemplateListSettings settings);
List<Template> GetTemplateList(int page, int pageSize);
List<Template> GetTemplateList(int page, int pageSize, GetTemplateListSettings settings);
CreateRecipientsResponse CreateRecipients(long collectorId, long emailMessageId, List<Recipient> recipients);
SendFlowResponse SendFlow(long surveyId, SendFlowSettings settings);
//Data processing
void FillMissingSurveyInformation(List<Survey> surveys);
void FillMissingSurveyInformation(Survey survey);
}
} | mit | C# |
37869ed78acee76444ba9947c80d5fe186dc1d5a | Fix local service discovery now that services are listening on 0.0.0.0 | LukeTillman/killrvideo-csharp,LukeTillman/killrvideo-csharp,LukeTillman/killrvideo-csharp | src/KillrVideo.Protobuf/ServiceDiscovery/LocalServiceDiscovery.cs | src/KillrVideo.Protobuf/ServiceDiscovery/LocalServiceDiscovery.cs | using System;
using Google.Protobuf.Reflection;
using KillrVideo.Host.Config;
namespace KillrVideo.Protobuf.ServiceDiscovery
{
/// <summary>
/// Service discovery implementation that just points all service clients to 'localhost' and the port
/// where they have been configured to run locally.
/// </summary>
public class LocalServiceDiscovery : IFindGrpcServices
{
private readonly IHostConfiguration _hostConfig;
private readonly Lazy<ServiceLocation> _localServicesIp;
public LocalServiceDiscovery(IHostConfiguration hostConfig)
{
if (hostConfig == null) throw new ArgumentNullException(nameof(hostConfig));
_hostConfig = hostConfig;
_localServicesIp = new Lazy<ServiceLocation>(GetLocalGrpcServer);
}
public ServiceLocation Find(ServiceDescriptor service)
{
return _localServicesIp.Value;
}
private ServiceLocation GetLocalGrpcServer()
{
// Get the host/port configuration for the Grpc Server
string host = "localhost";
string portVal = _hostConfig.GetRequiredConfigurationValue(GrpcServerTask.HostPortKey);
int port = int.Parse(portVal);
return new ServiceLocation(host, port);
}
}
}
| using System;
using System.Linq;
using System.Net;
using Google.Protobuf.Reflection;
using KillrVideo.Host.Config;
namespace KillrVideo.Protobuf.ServiceDiscovery
{
/// <summary>
/// Service discovery implementation that just points all service clients to the host/port where they
/// have been configured to run locally.
/// </summary>
public class LocalServiceDiscovery : IFindGrpcServices
{
private readonly IHostConfiguration _hostConfig;
private readonly Lazy<ServiceLocation> _localServicesIp;
public LocalServiceDiscovery(IHostConfiguration hostConfig)
{
if (hostConfig == null) throw new ArgumentNullException(nameof(hostConfig));
_hostConfig = hostConfig;
_localServicesIp = new Lazy<ServiceLocation>(GetLocalGrpcServer);
}
public ServiceLocation Find(ServiceDescriptor service)
{
return _localServicesIp.Value;
}
private ServiceLocation GetLocalGrpcServer()
{
// Get the host/port configuration for the Grpc Server
string host = _hostConfig.GetRequiredConfigurationValue(GrpcServerTask.HostConfigKey);
string portVal = _hostConfig.GetRequiredConfigurationValue(GrpcServerTask.HostPortKey);
int port = int.Parse(portVal);
return new ServiceLocation(host, port);
}
}
}
| apache-2.0 | C# |
b6aa083983084bdeae67ac279f32031ae6ca1a2f | Use AlmostEquals for CircularContainer test cases | DrabWeb/osu-framework,peppy/osu-framework,ZLima12/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,default0/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,default0/osu-framework,ZLima12/osu-framework | osu.Framework.Tests/Visual/TestCaseCircularContainer.cs | osu.Framework.Tests/Visual/TestCaseCircularContainer.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics;
using OpenTK;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.MathUtils;
using osu.Framework.Testing;
namespace osu.Framework.Tests.Visual
{
[System.ComponentModel.Description(@"Checking for bugged corner radius")]
public class TestCaseCircularContainer : TestCase
{
private SingleUpdateCircularContainer container;
public TestCaseCircularContainer()
{
AddStep("128x128 box", () => addContainer(new Vector2(128)));
AddAssert("Expect CornerRadius = 64", () => Precision.AlmostEquals(container.CornerRadius, 64));
AddStep("128x64 box", () => addContainer(new Vector2(128, 64)));
AddAssert("Expect CornerRadius = 32", () => Precision.AlmostEquals(container.CornerRadius, 32));
AddStep("64x128 box", () => addContainer(new Vector2(64, 128)));
AddAssert("Expect CornerRadius = 32", () => Precision.AlmostEquals(container.CornerRadius, 32));
}
private void addContainer(Vector2 size)
{
Clear();
Add(container = new SingleUpdateCircularContainer
{
Masking = true,
AutoSizeAxes = Axes.Both,
Child = new Box { Size = size }
});
}
private class SingleUpdateCircularContainer : CircularContainer
{
private bool firstUpdate = true;
public override bool UpdateSubTree()
{
if (!firstUpdate)
return true;
firstUpdate = false;
return base.UpdateSubTree();
}
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics;
using OpenTK;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing;
namespace osu.Framework.Tests.Visual
{
[System.ComponentModel.Description(@"Checking for bugged corner radius")]
public class TestCaseCircularContainer : TestCase
{
private SingleUpdateCircularContainer container;
public TestCaseCircularContainer()
{
AddStep("128x128 box", () => addContainer(new Vector2(128)));
AddAssert("Expect CornerRadius = 64", () => container.CornerRadius == 64);
AddStep("128x64 box", () => addContainer(new Vector2(128, 64)));
AddAssert("Expect CornerRadius = 32", () => container.CornerRadius == 32);
AddStep("64x128 box", () => addContainer(new Vector2(64, 128)));
AddAssert("Expect CornerRadius = 32", () => container.CornerRadius == 32);
}
private void addContainer(Vector2 size)
{
Clear();
Add(container = new SingleUpdateCircularContainer
{
Masking = true,
AutoSizeAxes = Axes.Both,
Child = new Box { Size = size }
});
}
private class SingleUpdateCircularContainer : CircularContainer
{
private bool firstUpdate = true;
public override bool UpdateSubTree()
{
if (!firstUpdate)
return true;
firstUpdate = false;
return base.UpdateSubTree();
}
}
}
}
| mit | C# |
90753a8e407ead9d242761e20c3dd1610c01d1b4 | Set correct version number in main window | arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5 | src/Arkivverket.Arkade.UI/Views/MainWindow.xaml.cs | src/Arkivverket.Arkade.UI/Views/MainWindow.xaml.cs | using System.Reflection;
using System.Windows;
namespace Arkivverket.Arkade.UI.Views
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Title = string.Format(UI.Resources.UI.General_WindowTitle, "0.3.0"); // Todo - get correct application version from assembly
}
}
} | using System.Reflection;
using System.Windows;
namespace Arkivverket.Arkade.UI.Views
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Title = string.Format(UI.Resources.UI.General_WindowTitle, typeof(App).Assembly.GetName().Version);
}
}
} | agpl-3.0 | C# |
501c9eaf66aa4c4dda93457269397e77b456cc4c | Update MockHttpHandlerTest.cs | WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common | test/WeihanLi.Common.Test/HttpTest/MockHttpHandlerTest.cs | test/WeihanLi.Common.Test/HttpTest/MockHttpHandlerTest.cs | // Copyright (c) Weihan Li. All rights reserved.
// Licensed under the MIT license.
using System.Net;
using WeihanLi.Common.Http;
using Xunit;
namespace WeihanLi.Common.Test.HttpTest;
public class MockHttpHandlerTest
{
[Theory]
[InlineData(HttpStatusCode.OK)]
[InlineData(HttpStatusCode.BadRequest)]
[InlineData(HttpStatusCode.Unauthorized)]
[InlineData(HttpStatusCode.Forbidden)]
[InlineData(HttpStatusCode.NotFound)]
[InlineData(HttpStatusCode.InternalServerError)]
public async Task HttpStatusTest(HttpStatusCode httpStatusCode)
{
using var httpHandler = new MockHttpHandler(_ => new HttpResponseMessage(httpStatusCode));
using var httpClient = new HttpClient(httpHandler);
using var response = await httpClient.GetAsync("http://localhost:32123/api/values");
Assert.Equal(httpStatusCode, response.StatusCode);
}
[Fact]
public async Task SetResponseFactoryTest()
{
using var httpHandler = new MockHttpHandler();
using var httpClient = new HttpClient(httpHandler);
using var response = await httpClient.GetAsync("http://localhost:32123/api/values");
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
httpHandler.SetResponseFactory(_ => new HttpResponseMessage(HttpStatusCode.BadRequest));
using var response1 = await httpClient.GetAsync("http://localhost:32123/api/values");
Assert.Equal(HttpStatusCode.BadRequest, response1.StatusCode);
}
[Fact]
public async Task DynamicResponseTest()
{
using var httpHandler = new MockHttpHandler(req => new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(req.Method.Method)
});
using var httpClient = new HttpClient(httpHandler);
var response = await httpClient.GetStringAsync("http://localhost:32123/api/values");
Assert.Equal(HttpMethod.Get.Method, response);
using var httpResponse = await httpClient.PostAsync("http://localhost:32123/api/values", new StringContent(""));
response = await httpResponse.Content.ReadAsStringAsync();
Assert.Equal(HttpMethod.Post.Method, response);
}
}
| // Copyright (c) Weihan Li. All rights reserved.
// Licensed under the MIT license.
using System.Net;
using WeihanLi.Common.Http;
using Xunit;
namespace WeihanLi.Common.Test.HttpTest;
public class MockHttpHandlerTest
{
[Theory]
[InlineData(HttpStatusCode.OK)]
[InlineData(HttpStatusCode.BadRequest)]
[InlineData(HttpStatusCode.Unauthorized)]
[InlineData(HttpStatusCode.Forbidden)]
[InlineData(HttpStatusCode.NotFound)]
[InlineData(HttpStatusCode.InternalServerError)]
public async Task HttpStatusTest(HttpStatusCode httpStatusCode)
{
var httpHandler = new MockHttpHandler(_ => new HttpResponseMessage(httpStatusCode));
using var httpClient = new HttpClient(httpHandler);
using var response = await httpClient.GetAsync("http://localhost:32123/api/values");
Assert.Equal(httpStatusCode, response.StatusCode);
}
[Fact]
public async Task SetResponseFactoryTest()
{
var httpHandler = new MockHttpHandler();
using var httpClient = new HttpClient(httpHandler);
var response = await httpClient.GetAsync("http://localhost:32123/api/values");
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
httpHandler.SetResponseFactory(_ => new HttpResponseMessage(HttpStatusCode.BadRequest));
response = await httpClient.GetAsync("http://localhost:32123/api/values");
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}
[Fact]
public async Task DynamicResponseTest()
{
var httpHandler = new MockHttpHandler(req => new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(req.Method.Method)
});
using var httpClient = new HttpClient(httpHandler);
var response = await httpClient.GetStringAsync("http://localhost:32123/api/values");
Assert.Equal(HttpMethod.Get.Method, response);
using var httpResponse = await httpClient.PostAsync("http://localhost:32123/api/values", new StringContent(""));
response = await httpResponse.Content.ReadAsStringAsync();
Assert.Equal(HttpMethod.Post.Method, response);
}
}
| mit | C# |
a33d5f1d2f966f115c53943bdafc7b1561052f5e | Fix typo. | ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton | src/CK.Glouton.Model/Server/Handlers/AlertEntry.cs | src/CK.Glouton.Model/Server/Handlers/AlertEntry.cs | using System;
using System.Collections.Generic;
using CK.Core;
using CK.Monitoring;
namespace CK.Glouton.Model.Server.Handlers
{
public class AlertEntry : IAlertEntry
{
public IMulticastLogEntry MulticastLogEntry { get; set; }
public string AppName { get; set; }
public void WriteLogEntry( CKBinaryWriter w )
{
MulticastLogEntry.WriteLogEntry( w );
}
public LogEntryType LogType => MulticastLogEntry.LogType;
public LogLevel LogLevel => MulticastLogEntry.LogLevel;
public string Text => MulticastLogEntry.Text;
public CKTrait Tags => MulticastLogEntry.Tags;
public DateTimeStamp LogTime => MulticastLogEntry.LogTime;
public CKExceptionData Exception => MulticastLogEntry.Exception;
public string FileName => MulticastLogEntry.FileName;
public int LineNumber => MulticastLogEntry.LineNumber;
public IReadOnlyList<ActivityLogGroupConclusion> Conclusions => MulticastLogEntry.Conclusions;
public Guid MonitorId => MulticastLogEntry.MonitorId;
public ILogEntry CreateUnicastLogEntry()
{
return MulticastLogEntry.CreateUnicastLogEntry();
}
public int GroupDepth => MulticastLogEntry.GroupDepth;
public LogEntryType PreviousEntryType => MulticastLogEntry.PreviousEntryType;
public DateTimeStamp PreviousLogTime => MulticastLogEntry.PreviousLogTime;
public AlertEntry( IMulticastLogEntry multicastLogEntry, string appName )
{
MulticastLogEntry = multicastLogEntry;
AppName = appName;
}
}
} | using CK.Core;
using CK.Monitoring;
using System;
using System.Collections.Generic;
namespace CK.Glouton.Model.Server.Handlers
{
public class AlertEntry : IAlertEntry
{
public IMulticastLogEntry MulticastMulticastLogEntry { get; set; }
public string AppName { get; set; }
public void WriteLogEntry( CKBinaryWriter w )
{
MulticastMulticastLogEntry.WriteLogEntry( w );
}
public LogEntryType LogType => MulticastMulticastLogEntry.LogType;
public LogLevel LogLevel => MulticastMulticastLogEntry.LogLevel;
public string Text => MulticastMulticastLogEntry.Text;
public CKTrait Tags => MulticastMulticastLogEntry.Tags;
public DateTimeStamp LogTime => MulticastMulticastLogEntry.LogTime;
public CKExceptionData Exception => MulticastMulticastLogEntry.Exception;
public string FileName => MulticastMulticastLogEntry.FileName;
public int LineNumber => MulticastMulticastLogEntry.LineNumber;
public IReadOnlyList<ActivityLogGroupConclusion> Conclusions => MulticastMulticastLogEntry.Conclusions;
public Guid MonitorId => MulticastMulticastLogEntry.MonitorId;
public ILogEntry CreateUnicastLogEntry()
{
return MulticastMulticastLogEntry.CreateUnicastLogEntry();
}
public int GroupDepth => MulticastMulticastLogEntry.GroupDepth;
public LogEntryType PreviousEntryType => MulticastMulticastLogEntry.PreviousEntryType;
public DateTimeStamp PreviousLogTime => MulticastMulticastLogEntry.PreviousLogTime;
public AlertEntry( IMulticastLogEntry multicastLogEntry, string appName )
{
MulticastMulticastLogEntry = multicastLogEntry;
AppName = appName;
}
}
} | mit | C# |
ed1686b489feae5a667d0336a15d0f95ec085d15 | Add missing semi-colon (to fix #22) | agc93/Cake.VisualStudio,agc93/Cake.VisualStudio | template/ItemTemplate/build.cake | template/ItemTemplate/build.cake | ///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(ctx =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});
Teardown(ctx =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Default")
.Does(() => {
Information("Hello Cake!");
});
RunTarget(target); | ///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(ctx =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});
Teardown(ctx =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Default")
.Does(() => {
Information("Hello Cake!")
});
RunTarget(target); | mit | C# |
f9a2dea556e2979df653fae8dfe240c0c6754a56 | Sort usings | appharbor/appharbor-cli | src/AppHarbor.Tests/Commands/BuildCommandTest.cs | src/AppHarbor.Tests/Commands/BuildCommandTest.cs | using System;
using System.Collections.Generic;
using System.IO;
using AppHarbor.Commands;
using AppHarbor.Model;
using Moq;
using Ploeh.AutoFixture.Xunit;
using Xunit;
using Xunit.Extensions;
namespace AppHarbor.Tests.Commands
{
public class BuildCommandTest
{
[Theory, AutoCommandData]
public void ShouldOutputBuilds([Frozen]Mock<IApplicationConfiguration> applicationConfiguration,
[Frozen]Mock<IAppHarborClient> client,
[Frozen]Mock<TextWriter> writer,
BuildCommand command, string applicationId)
{
applicationConfiguration.Setup(x => x.GetApplicationId()).Returns(applicationId);
var builds = new List<Build>
{
new Build { Commit = new Commit { Message = "foo bar", Id = "baz" }, Status = "Failed", Deployed = DateTime.Now },
};
client.Setup(x => x.GetBuilds(applicationId)).Returns(builds);
Assert.DoesNotThrow(() => command.Execute(new string[0]));
}
[Theory, AutoCommandData]
public void ShouldWriteIfNoBuildsExists(BuildCommand command,
[Frozen]Mock<TextWriter> writer, string applicationId)
{
command.Execute(new string[0]);
writer.Verify(x => x.WriteLine("No builds are associated with this application."));
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using AppHarbor.Commands;
using AppHarbor.Model;
using Moq;
using Ploeh.AutoFixture.Xunit;
using Xunit.Extensions;
using Xunit;
namespace AppHarbor.Tests.Commands
{
public class BuildCommandTest
{
[Theory, AutoCommandData]
public void ShouldOutputBuilds([Frozen]Mock<IApplicationConfiguration> applicationConfiguration,
[Frozen]Mock<IAppHarborClient> client,
[Frozen]Mock<TextWriter> writer,
BuildCommand command, string applicationId)
{
applicationConfiguration.Setup(x => x.GetApplicationId()).Returns(applicationId);
var builds = new List<Build>
{
new Build { Commit = new Commit { Message = "foo bar", Id = "baz" }, Status = "Failed", Deployed = DateTime.Now },
};
client.Setup(x => x.GetBuilds(applicationId)).Returns(builds);
Assert.DoesNotThrow(() => command.Execute(new string[0]));
}
[Theory, AutoCommandData]
public void ShouldWriteIfNoBuildsExists(BuildCommand command,
[Frozen]Mock<TextWriter> writer, string applicationId)
{
command.Execute(new string[0]);
writer.Verify(x => x.WriteLine("No builds are associated with this application."));
}
}
}
| mit | C# |
d0dfeb2056f6c610f372e3f534e70f291eae06d6 | Remove genuinely unused parameter | BenJenkinson/nodatime,BenJenkinson/nodatime,nodatime/nodatime,nodatime/nodatime | src/NodaTime/Annotations/TestExemptionAttribute.cs | src/NodaTime/Annotations/TestExemptionAttribute.cs | // Copyright 2017 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
namespace NodaTime.Annotations
{
/// <summary>
/// Attribute to effectively ignore a particular kind of test, because it's known
/// not to apply to this member. The optional message isn't stored, because we never
/// need it - it's for documentation purposes.
/// </summary>
[AttributeUsage(AttributeTargets.All)]
internal sealed class TestExemptionAttribute : Attribute
{
internal TestExemptionCategory Category { get; }
internal TestExemptionAttribute(TestExemptionCategory category)
{
Category = category;
}
}
internal enum TestExemptionCategory
{
ConversionName = 1
}
}
| // Copyright 2017 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
namespace NodaTime.Annotations
{
/// <summary>
/// Attribute to effectively ignore a particular kind of test, because it's known
/// not to apply to this member. The optional message isn't stored, because we never
/// need it - it's for documentation purposes.
/// </summary>
[AttributeUsage(AttributeTargets.All)]
internal sealed class TestExemptionAttribute : Attribute
{
internal TestExemptionCategory Category { get; }
internal TestExemptionAttribute(TestExemptionCategory category, string? message = null)
{
Category = category;
}
}
internal enum TestExemptionCategory
{
ConversionName = 1
}
}
| apache-2.0 | C# |
c1da3bc9cf831b35f368bb54c64e84bdede47339 | Remove skinnable parents at the same time as their smoke children | ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu | osu.Game.Rulesets.Osu/UI/SmokeContainer.cs | osu.Game.Rulesets.Osu/UI/SmokeContainer.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Osu.Skinning;
using osu.Game.Rulesets.Osu.Skinning.Default;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Osu.UI
{
[Cached]
public class SmokeContainer : Container, IRequireHighFrequencyMousePosition, IKeyBindingHandler<OsuAction>
{
public event Action<Vector2, double>? SmokeMoved;
public event Action<double>? SmokeEnded;
public Vector2 LastMousePosition;
private bool isSmoking;
public override bool ReceivePositionalInputAt(Vector2 _) => true;
public bool OnPressed(KeyBindingPressEvent<OsuAction> e)
{
if (e.Action == OsuAction.Smoke)
{
isSmoking = true;
AddInternal(new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.Smoke), _ => new DefaultSmoke()));
return true;
}
return false;
}
public void OnReleased(KeyBindingReleaseEvent<OsuAction> e)
{
if (e.Action == OsuAction.Smoke)
{
isSmoking = false;
SmokeEnded?.Invoke(Time.Current);
foreach (SkinnableDrawable skinnable in Children)
skinnable.LifetimeEnd = skinnable.Drawable.LifetimeEnd;
}
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
if (isSmoking)
SmokeMoved?.Invoke(e.MousePosition, Time.Current);
LastMousePosition = e.MousePosition;
return base.OnMouseMove(e);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Osu.Skinning.Default;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Osu.UI
{
[Cached]
public class SmokeContainer : Container, IRequireHighFrequencyMousePosition, IKeyBindingHandler<OsuAction>
{
public event Action<Vector2, double>? SmokeMoved;
public event Action<double>? SmokeEnded;
public Vector2 LastMousePosition;
private bool isSmoking;
public override bool ReceivePositionalInputAt(Vector2 _) => true;
public bool OnPressed(KeyBindingPressEvent<OsuAction> e)
{
if (e.Action == OsuAction.Smoke)
{
isSmoking = true;
AddInternal(new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.Smoke), _ => new DefaultSmoke()));
return true;
}
return false;
}
public void OnReleased(KeyBindingReleaseEvent<OsuAction> e)
{
if (e.Action == OsuAction.Smoke)
{
isSmoking = false;
SmokeEnded?.Invoke(Time.Current);
}
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
if (isSmoking)
SmokeMoved?.Invoke(e.MousePosition, Time.Current);
LastMousePosition = e.MousePosition;
return base.OnMouseMove(e);
}
}
}
| mit | C# |
1dfcfb386f25c2af7c0fe34ebbfd9850e6591893 | Add a debug assert when a node is being reparented. | KirillOsenkov/MSBuildStructuredLog,KirillOsenkov/MSBuildStructuredLog | src/StructuredLogger/ObjectModel/ParentedNode.cs | src/StructuredLogger/ObjectModel/ParentedNode.cs | using System.Collections.Generic;
namespace Microsoft.Build.Logging.StructuredLogger
{
public class ParentedNode : BaseNode
{
private TreeNode parent;
public TreeNode Parent
{
get => parent;
set
{
#if DEBUG
if (parent != null)
{
throw new System.InvalidOperationException("A node is being reparented");
}
#endif
parent = value;
}
}
public IEnumerable<ParentedNode> GetParentChain()
{
var chain = new List<ParentedNode>();
ParentedNode current = this;
while (current.Parent != null)
{
chain.Add(current);
current = current.Parent;
}
chain.Reverse();
return chain;
}
public T GetNearestParent<T>() where T : ParentedNode
{
ParentedNode current = this;
while (current.Parent != null)
{
current = current.Parent;
if (current is T)
{
return (T)current;
}
}
return null;
}
}
}
| using System.Collections.Generic;
namespace Microsoft.Build.Logging.StructuredLogger
{
public class ParentedNode : BaseNode
{
public TreeNode Parent { get; set; }
public IEnumerable<ParentedNode> GetParentChain()
{
var chain = new List<ParentedNode>();
ParentedNode current = this;
while (current.Parent != null)
{
chain.Add(current);
current = current.Parent;
}
chain.Reverse();
return chain;
}
public T GetNearestParent<T>() where T : ParentedNode
{
ParentedNode current = this;
while (current.Parent != null)
{
current = current.Parent;
if (current is T)
{
return (T)current;
}
}
return null;
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.