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 |
|---|---|---|---|---|---|---|---|---|
8888f20edc2c240b4812d72ce69c238ecad1ed6c
|
Change popup window base
|
DMagic1/KSP_Contract_Window
|
Source/ContractsWindow.Unity/CW_Popup.cs
|
Source/ContractsWindow.Unity/CW_Popup.cs
|
using System;
using System.Collections.Generic;
using UnityEngine;
namespace ContractsWindow.Unity
{
public abstract class CW_Popup : CanvasFader
{
}
}
|
using System;
using System.Collections.Generic;
using UnityEngine;
namespace ContractsWindow.Unity
{
public abstract class CW_Popup : MonoBehaviour
{
}
}
|
mit
|
C#
|
fa84a0bb401f8caf320998fa848835727e3dd6f4
|
Use `×` for close button
|
mohamedabdlaal/twitter.bootstrap.mvc,erichexter/twitter.bootstrap.mvc,mohamedabdlaal/twitter.bootstrap.mvc,erichexter/twitter.bootstrap.mvc
|
src/Bootstrap/Views/Shared/_validationSummary.cshtml
|
src/Bootstrap/Views/Shared/_validationSummary.cshtml
|
@if (ViewData.ModelState.Any(x => x.Value.Errors.Any()))
{
<div class="alert alert-error">
<a class="close" data-dismiss="alert">×/a>
@Html.ValidationSummary(true)
</div>
}
|
@if (ViewData.ModelState.Any(x => x.Value.Errors.Any()))
{
<div class="alert alert-error">
<a class="close" data-dismiss="alert">�</a>
@Html.ValidationSummary(true)
</div>
}
|
apache-2.0
|
C#
|
f6f06038cb54be606d03b37482762c37fa39fee1
|
Implement tracking in VoiceStatsService (tracking is enabled by default now though the only way to see results is through SQL Queries).
|
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
|
src/NadekoBot/Modules/Utility/Services/VoiceStatsService.cs
|
src/NadekoBot/Modules/Utility/Services/VoiceStatsService.cs
|
using Discord.WebSocket;
using Mitternacht.Modules.Utility.Common;
using Mitternacht.Services;
using System.Threading.Tasks;
namespace Mitternacht.Modules.Utility.Services
{
public class VoiceStatsService : INService
{
private readonly DbService _db;
private readonly DiscordSocketClient _client;
private Task _writeStats;
private readonly VoiceStateTimeHelper _timeHelper;
public VoiceStatsService(DiscordSocketClient client, DbService db)
{
_client = client;
_db = db;
_timeHelper = new VoiceStateTimeHelper();
_client.UserVoiceStateUpdated += UserVoiceStateUpdated;
_writeStats = Task.Run(async () =>
{
while (true)
{
var usertimes = _timeHelper.GetUserTimes();
using(var uow = _db.UnitOfWork)
{
foreach (var ut in usertimes)
{
uow.VoiceChannelStats.AddTime(ut.Key, ut.Value);
}
await uow.CompleteAsync().ConfigureAwait(false);
}
await Task.Delay(5000);
}
});
}
private Task UserVoiceStateUpdated(SocketUser user, SocketVoiceState stateo, SocketVoiceState staten)
{
if (stateo.VoiceChannel == null && staten.VoiceChannel != null) _timeHelper.StartTracking(user.Id);
if (stateo.VoiceChannel != null && staten.VoiceChannel == null && !_timeHelper.StopTracking(user.Id))
_timeHelper.EndUserTrackingAfterInterval.Add(user.Id);
return Task.CompletedTask;
}
}
}
|
using Discord.WebSocket;
using Mitternacht.Modules.Utility.Common;
using Mitternacht.Services;
using System.Threading.Tasks;
namespace Mitternacht.Modules.Utility.Services
{
public class VoiceStatsService : INService
{
private readonly DbService _db;
private readonly DiscordSocketClient _client;
private Task _writeStats;
private readonly VoiceStateTimeHelper _timeHelper;
public VoiceStatsService(DiscordSocketClient client, DbService db)
{
_client = client;
_db = db;
_timeHelper = new VoiceStateTimeHelper();
_client.UserVoiceStateUpdated += userVoiceStateUpdated;
_writeStats = Task.Run(async () =>
{
while (true)
{
var usertimes = _timeHelper.GetUserTimes();
using(var uow = _db.UnitOfWork)
{
}
await Task.Delay(5000);
}
});
}
private async Task userVoiceStateUpdated(SocketUser user, SocketVoiceState stateo, SocketVoiceState staten)
{
}
}
}
|
mit
|
C#
|
9c7d30b4fd18fa132242739cefc32c914872e744
|
Fix NRE
|
aelij/roslynpad
|
src/RoslynPad/Converters/DoubleToPercentageTextConverter.cs
|
src/RoslynPad/Converters/DoubleToPercentageTextConverter.cs
|
using System;
using System.Globalization;
using System.Windows.Data;
namespace RoslynPad.Converters
{
public class DoubleToPercentageTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var percent = value as double? ?? 0;
if (percent <= 0) percent = 0;
if (percent >= 1) percent = 1;
return ((int)Math.Round(percent * 100.0, 0)) + "%";
}
public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}
|
using System;
using System.Globalization;
using System.Windows.Data;
namespace RoslynPad.Converters
{
public class DoubleToPercentageTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double percent;
if (value is double?)
{
percent = (value as double?) ?? 0;
}
else
{
try
{
percent = (double)value;
}
catch
{
percent = 0.0;
}
}
if (percent <= 0) return "0%";
if (percent >= 1) return "100%";
return ((int)Math.Round(percent * 100.0, 0)) + "%";
}
public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}
|
apache-2.0
|
C#
|
a6fb39fb8709fc8fc31b65f35ebb214c7dbdc1df
|
Work on copy periodic wizard
|
el-mejor/LifeTimeV3
|
LifeTimeV3/LifeTimeV3.LifeTimeDiagram.CopyPeriodicDialog/LifeTimeV3.LifeTimeDiagram.CopyPeriodicDialog.cs
|
LifeTimeV3/LifeTimeV3.LifeTimeDiagram.CopyPeriodicDialog/LifeTimeV3.LifeTimeDiagram.CopyPeriodicDialog.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using LifeTimeV3.BL.LifeTimeDiagram;
namespace LifeTimeV3.LifeTimeDiagram.CopyPeriodicDialog
{
public partial class FormCopyPeriodicDialog : Form
{
#region properties
public LifeTimeDiagramEditor.LifeTimeElement Object
{ get; set; }
public List<LifeTimeDiagramEditor.LifeTimeElement> MultipliedObjectsCollection
{ get { return _multipliedObjects; } }
public enum PeriodBaseEnum { Days, Month, Years};
/// <summary>
/// Base unit of the period (every [Period] [Day/Month/Year])
/// </summary>
public PeriodBaseEnum PeriodBase { get; set; }
/// <summary>
/// Period (every x [BaseUnit])
/// </summary>
public int Period { get; set; }
/// <summary>
/// Ammount of copies to add
/// </summary>
public int AmmountOfCopies { get; set; }
/// <summary>
/// Limit until copies are made
/// </summary>
public DateTime LimitForAddingCopies { get; set; }
/// <summary>
/// Switch to use either Limit or Ammount for adding copies
/// </summary>
public bool UseLimitForAddingCopies { get; set; }
#endregion
#region fields
private List<LifeTimeDiagramEditor.LifeTimeElement> _multipliedObjects = new List<LifeTimeDiagramEditor.LifeTimeElement>();
#endregion
#region constructor
public FormCopyPeriodicDialog()
{
InitializeComponent();
}
#endregion
#region private
private void buttonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using LifeTimeV3.BL.LifeTimeDiagram;
namespace LifeTimeV3.LifeTimeDiagram.CopyPeriodicDialog
{
public partial class FormCopyPeriodicDialog : Form
{
#region properties
public LifeTimeDiagramEditor.LifeTimeElement Object
{ get; set; }
public List<LifeTimeDiagramEditor.LifeTimeElement> MultipliedObjectsCollection
{ get { return _multipliedObjects; } }
#endregion
#region fields
private List<LifeTimeDiagramEditor.LifeTimeElement> _multipliedObjects = new List<LifeTimeDiagramEditor.LifeTimeElement>();
#endregion
#region constructor
public FormCopyPeriodicDialog()
{
InitializeComponent();
}
#endregion
#region private
private void buttonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
#endregion
}
}
|
mit
|
C#
|
7c57d245718bacfa6c70c76b799ed683bc0fb9cf
|
add using system back
|
projectkudu/SiteExtensionGallery,projectkudu/SiteExtensionGallery,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,skbkontur/NuGetGallery,skbkontur/NuGetGallery,grenade/NuGetGallery_download-count-patch,ScottShingler/NuGetGallery,mtian/SiteExtensionGallery,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,projectkudu/SiteExtensionGallery,mtian/SiteExtensionGallery,mtian/SiteExtensionGallery,skbkontur/NuGetGallery
|
tests/NuGetGallery.FunctionalTests/GalleryTestBase.cs
|
tests/NuGetGallery.FunctionalTests/GalleryTestBase.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NuGetGallery.FunctionalTests.Helpers;
using NuGetGallery.FunctionTests.Helpers;
using System;
using System.Net;
namespace NuGetGallery.FunctionalTests.TestBase
{
/// <summary>
/// Base class for all the test classes. Has the common functions which individual test classes would use.
/// </summary>
[TestClass]
public class GalleryTestBase
{
#region InitializeMethods
[AssemblyInitialize()]
public static void AssemblyInit(TestContext context)
{
//Check if functional tests is enabled. If not, do an assert inconclusive.
#if DEBUG
#else
if (!EnvironmentSettings.RunFunctionalTests.Equals("True", StringComparison.OrdinalIgnoreCase))
{
Assert.Inconclusive("Functional tests are disabled in the current run. Please set environment variable RunFuntionalTests to True to enable them");
}
#endif
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; //supress SSL validation so that we can run tests against staging slot as well.
CheckIfBaseTestPackageExists();
}
public static void CheckIfBaseTestPackageExists()
{
//Check if the BaseTestPackage exists in current source and if not upload it. This will be used by the download related tests.
try
{
if (!ClientSDKHelper.CheckIfPackageExistsInSource(Constants.TestPackageId, UrlHelper.V2FeedRootUrl))
{
AssertAndValidationHelper.UploadNewPackageAndVerify(Constants.TestPackageId);
}
}
catch (AssertFailedException)
{
Assert.Inconclusive("The initialization method to pre-upload test package has failed. Hence failing all the tests. Make sure that a package by name {0} exists @ {1} before running tests. Check test run error for details", Constants.TestPackageId, UrlHelper.BaseUrl);
}
}
[TestInitialize()]
public void TestInit()
{
//Clear the machine cache during the start of every test to make sure that we always hit the gallery .
ClientSDKHelper.ClearMachineCache();
}
#endregion InitializeMethods
[AssemblyCleanup()]
public static void CleanAssembly()
{
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NuGetGallery.FunctionalTests.Helpers;
using NuGetGallery.FunctionTests.Helpers;
using System.Net;
namespace NuGetGallery.FunctionalTests.TestBase
{
/// <summary>
/// Base class for all the test classes. Has the common functions which individual test classes would use.
/// </summary>
[TestClass]
public class GalleryTestBase
{
#region InitializeMethods
[AssemblyInitialize()]
public static void AssemblyInit(TestContext context)
{
//Check if functional tests is enabled. If not, do an assert inconclusive.
#if DEBUG
#else
if (!EnvironmentSettings.RunFunctionalTests.Equals("True", StringComparison.OrdinalIgnoreCase))
{
Assert.Inconclusive("Functional tests are disabled in the current run. Please set environment variable RunFuntionalTests to True to enable them");
}
#endif
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; //supress SSL validation so that we can run tests against staging slot as well.
CheckIfBaseTestPackageExists();
}
public static void CheckIfBaseTestPackageExists()
{
//Check if the BaseTestPackage exists in current source and if not upload it. This will be used by the download related tests.
try
{
if (!ClientSDKHelper.CheckIfPackageExistsInSource(Constants.TestPackageId, UrlHelper.V2FeedRootUrl))
{
AssertAndValidationHelper.UploadNewPackageAndVerify(Constants.TestPackageId);
}
}
catch (AssertFailedException)
{
Assert.Inconclusive("The initialization method to pre-upload test package has failed. Hence failing all the tests. Make sure that a package by name {0} exists @ {1} before running tests. Check test run error for details", Constants.TestPackageId, UrlHelper.BaseUrl);
}
}
[TestInitialize()]
public void TestInit()
{
//Clear the machine cache during the start of every test to make sure that we always hit the gallery .
ClientSDKHelper.ClearMachineCache();
}
#endregion InitializeMethods
[AssemblyCleanup()]
public static void CleanAssembly()
{
}
}
}
|
apache-2.0
|
C#
|
721ee5639d32351f0ade6aa4f356151e59ec63aa
|
Add confine mouse mode config
|
peppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,smoogipooo/osu-framework
|
osu.Framework/Platform/DesktopWindow.cs
|
osu.Framework/Platform/DesktopWindow.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Configuration;
using osu.Framework.Input;
using osu.Framework.Platform.Sdl;
namespace osu.Framework.Platform
{
public class DesktopWindow : Window
{
private readonly BindableSize sizeWindowed = new BindableSize();
public readonly Bindable<ConfineMouseMode> ConfineMouseMode = new Bindable<ConfineMouseMode>();
/// <summary>
/// Initialises a window for desktop platforms.
/// Uses <see cref="Sdl2WindowBackend"/> and <see cref="PassthroughGraphicsBackend"/>.
/// </summary>
public DesktopWindow()
: base(new Sdl2WindowBackend(), new PassthroughGraphicsBackend())
{
}
public override void SetupWindow(FrameworkConfigManager config)
{
base.SetupWindow(config);
sizeWindowed.ValueChanged += evt =>
{
if (!evt.NewValue.IsEmpty && WindowState.Value == Platform.WindowState.Normal)
Size.Value = evt.NewValue;
};
config.BindWith(FrameworkSetting.WindowedSize, sizeWindowed);
config.BindWith(FrameworkSetting.ConfineMouseMode, ConfineMouseMode);
ConfineMouseMode.BindValueChanged(confineMouseModeChanged, true);
Resized += onResized;
}
private void onResized()
{
if (!Size.Value.IsEmpty && WindowMode.Value == Configuration.WindowMode.Windowed)
sizeWindowed.Value = Size.Value;
}
private void confineMouseModeChanged(ValueChangedEvent<ConfineMouseMode> args)
{
bool confine = false;
switch (args.NewValue)
{
case Input.ConfineMouseMode.Fullscreen:
confine = WindowMode.Value != Configuration.WindowMode.Windowed;
break;
case Input.ConfineMouseMode.Always:
confine = true;
break;
}
if (confine)
CursorState.Value |= Platform.CursorState.Confined;
else
CursorState.Value &= ~Platform.CursorState.Confined;
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Configuration;
using osu.Framework.Platform.Sdl;
namespace osu.Framework.Platform
{
public class DesktopWindow : Window
{
private readonly BindableSize sizeWindowed = new BindableSize();
/// <summary>
/// Initialises a window for desktop platforms.
/// Uses <see cref="Sdl2WindowBackend"/> and <see cref="PassthroughGraphicsBackend"/>.
/// </summary>
public DesktopWindow()
: base(new Sdl2WindowBackend(), new PassthroughGraphicsBackend())
{
}
public override void SetupWindow(FrameworkConfigManager config)
{
base.SetupWindow(config);
sizeWindowed.ValueChanged += evt =>
{
if (!evt.NewValue.IsEmpty && WindowState.Value == Platform.WindowState.Normal)
Size.Value = evt.NewValue;
};
config.BindWith(FrameworkSetting.WindowedSize, sizeWindowed);
Resized += onResized;
}
private void onResized()
{
if (!Size.Value.IsEmpty && WindowMode.Value == Configuration.WindowMode.Windowed)
sizeWindowed.Value = Size.Value;
}
}
}
|
mit
|
C#
|
ffac32a848b7755aa5e2f17f912b75946ab08014
|
Reword xmldoc
|
smoogipoo/osu,smoogipoo/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,peppy/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,ppy/osu
|
osu.Game/Skinning/ISkinnableDrawable.cs
|
osu.Game/Skinning/ISkinnableDrawable.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
namespace osu.Game.Skinning
{
/// <summary>
/// Denotes a drawable which, as a drawable, can be adjusted via skinning specifications.
/// </summary>
public interface ISkinnableDrawable : IDrawable
{
/// <summary>
/// Whether this component should be editable by an end user.
/// </summary>
bool IsEditable => true;
/// <summary>
/// In the context of the skin layout editor, whether this <see cref="ISkinnableDrawable"/> has a permanent anchor defined.
/// If <see langword="false"/>, this <see cref="ISkinnableDrawable"/>'s <see cref="Drawable.Anchor"/> is automatically determined by proximity,
/// If <see langword="true"/>, a fixed anchor point has been defined.
/// </summary>
bool UsesFixedAnchor { get; set; }
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
namespace osu.Game.Skinning
{
/// <summary>
/// Denotes a drawable which, as a drawable, can be adjusted via skinning specifications.
/// </summary>
public interface ISkinnableDrawable : IDrawable
{
/// <summary>
/// Whether this component should be editable by an end user.
/// </summary>
bool IsEditable => true;
/// <summary>
/// <see langword="false"/> if this <see cref="ISkinnableDrawable"/>'s <see cref="Drawable.Anchor"/> is automatically determined by proximity,
/// <see langword="true"/> if the user has chosen a fixed anchor point.
/// </summary>
bool UsesFixedAnchor { get; set; }
}
}
|
mit
|
C#
|
117fba0fb5837fe31280381758bb4ce557716129
|
Update Index.cshtml
|
KrishnaIBM/TestCt-1478684487505,KrishnaIBM/TestCt-1478684487505
|
src/dotnetCloudantWebstarter/Views/Home/Index.cshtml
|
src/dotnetCloudantWebstarter/Views/Home/Index.cshtml
|
@{
ViewData["Title"] = "Home Page";
}
<h3>@ViewData["Message"]</h3>
<form method="post" asp-action="Index" asp-controller="Home" enctype="multipart/form-data">
<input type="file" name="files" multiple />
<input type="submit" value="Upload" />
</form>
|
@{
ViewData["Title"] = "Home Page";
}
<h3></h3>
<form method="post" asp-action="Index" asp-controller="Home" enctype="multipart/form-data">
<input type="file" name="files" multiple />
<input type="submit" value="Upload" />
</form>
|
apache-2.0
|
C#
|
4c67c13410f0b7567944672ac1ba29f66d91b84a
|
Add hold note tail judgement.
|
DrabWeb/osu,Frontear/osuKyzer,NeoAdonis/osu,Damnae/osu,ZLima12/osu,osu-RP/osu-RP,DrabWeb/osu,tacchinotacchi/osu,ZLima12/osu,2yangk23/osu,peppy/osu-new,UselessToucan/osu,smoogipoo/osu,smoogipooo/osu,smoogipoo/osu,NeoAdonis/osu,naoey/osu,Drezi126/osu,smoogipoo/osu,ppy/osu,johnneijzen/osu,2yangk23/osu,NeoAdonis/osu,johnneijzen/osu,EVAST9919/osu,DrabWeb/osu,ppy/osu,ppy/osu,peppy/osu,UselessToucan/osu,EVAST9919/osu,naoey/osu,peppy/osu,naoey/osu,Nabile-Rahmani/osu,peppy/osu,UselessToucan/osu
|
osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs
|
osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Rulesets.Mania.Judgements
{
public class HoldNoteTailJudgement : ManiaJudgement
{
/// <summary>
/// Whether the hold note has been released too early and shouldn't give full score for the release.
/// </summary>
public bool HasBroken;
public override int NumericResultForScore(ManiaHitResult result)
{
switch (result)
{
default:
return base.NumericResultForScore(result);
case ManiaHitResult.Great:
case ManiaHitResult.Perfect:
return base.NumericResultForScore(HasBroken ? ManiaHitResult.Good : result);
}
}
public override int NumericResultForAccuracy(ManiaHitResult result)
{
switch (result)
{
default:
return base.NumericResultForAccuracy(result);
case ManiaHitResult.Great:
case ManiaHitResult.Perfect:
return base.NumericResultForAccuracy(HasBroken ? ManiaHitResult.Good : result);
}
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Rulesets.Mania.Judgements
{
public class HoldNoteTailJudgement : ManiaJudgement
{
/// <summary>
/// Whether the hold note has been released too early and shouldn't give full score for the release.
/// </summary>
public bool HasBroken;
}
}
|
mit
|
C#
|
81736a3d21fb924833761c18e0a23ff109c1cdeb
|
fix AuthenticationRequired
|
AlejandroCano/framework,avifatal/framework,signumsoftware/framework,AlejandroCano/framework,avifatal/framework,signumsoftware/framework
|
Signum.React/Filters/AuthenticationRequired.cs
|
Signum.React/Filters/AuthenticationRequired.cs
|
using Signum.Engine;
using Signum.Engine.Profiler;
using Signum.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
namespace Signum.React.Filters
{
public class SignumAuthenticationAndProfilerAttribute : FilterAttribute, IAuthorizationFilter
{
public static Func<HttpActionContext, IDisposable> Authenticate;
public Task<HttpResponseMessage> ExecuteAuthorizationFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation)
{
string action = ProfilerActionSplitterAttribute.GetActionSescription(actionContext);
actionContext.Request.RegisterForDispose(TimeTracker.Start(action));
IDisposable profiler = HeavyProfiler.Log("Web.API " + actionContext.Request.Method, () => actionContext.Request.RequestUri.ToString());
if (profiler != null)
actionContext.Request.RegisterForDispose(profiler);
//if (ProfilerLogic.SessionTimeout != null)
//{
// IDisposable sessionTimeout = Connector.CommandTimeoutScope(ProfilerLogic.SessionTimeout.Value);
// if (sessionTimeout != null)
// actionContext.Request.RegisterForDispose(sessionTimeout);
//}
if (Authenticate != null)
{
var session = Authenticate(actionContext);
if (session != null)
actionContext.Request.RegisterForDispose(session);
}
if (actionContext.Response != null)
return Task.FromResult(actionContext.Response);
return continuation();
}
}
[AttributeUsage(AttributeTargets.Method)]
public class AnonymousAttribute : Attribute
{
public static bool IsAnonymous(HttpActionContext actionContext)
{
var r = actionContext.ActionDescriptor as ReflectedHttpActionDescriptor;
return r.GetCustomAttributes<AnonymousAttribute>().Any();
}
}
}
|
using Signum.Engine;
using Signum.Engine.Profiler;
using Signum.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
namespace Signum.React.Filters
{
public class SignumAuthenticationAndProfilerAttribute : FilterAttribute, IAuthorizationFilter
{
public static Func<HttpActionContext, IDisposable> Authenticate;
public Task<HttpResponseMessage> ExecuteAuthorizationFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation)
{
string action = ProfilerActionSplitterAttribute.GetActionSescription(actionContext);
actionContext.Request.RegisterForDispose(TimeTracker.Start(action));
IDisposable profiler = HeavyProfiler.Log("Web.API " + actionContext.Request.Method, () => actionContext.Request.RequestUri.ToString());
if (profiler != null)
actionContext.Request.RegisterForDispose(profiler);
//if (ProfilerLogic.SessionTimeout != null)
//{
// IDisposable sessionTimeout = Connector.CommandTimeoutScope(ProfilerLogic.SessionTimeout.Value);
// if (sessionTimeout != null)
// actionContext.Request.RegisterForDispose(sessionTimeout);
//}
if (Authenticate != null)
{
var session = Authenticate(actionContext);
if (session != null)
actionContext.Request.RegisterForDispose(session);
}
return continuation();
}
}
[AttributeUsage(AttributeTargets.Method)]
public class AnonymousAttribute : Attribute
{
public static bool IsAnonymous(HttpActionContext actionContext)
{
var r = actionContext.ActionDescriptor as ReflectedHttpActionDescriptor;
return r.GetCustomAttributes<AnonymousAttribute>().Any();
}
}
}
|
mit
|
C#
|
51b81d774503e57432ace6710eb15f32c16702c7
|
fix virtual
|
buybackoff/IdentityServer3.EntityFramework,faithword/IdentityServer3.EntityFramework,henkmeulekamp/IdentityServer3.EntityFramework,IdentityServer/IdentityServer3.EntityFramework,chwilliamson/IdentityServer3.EntityFramework
|
Source/Core.EntityFramework/Entities/Client.cs
|
Source/Core.EntityFramework/Entities/Client.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Thinktecture.IdentityServer.Core.Models;
namespace Thinktecture.IdentityServer.Core.EntityFramework.Entities
{
public class Client
{
[Key]
public virtual int Id { get; set; }
public virtual bool Enabled { get; set; }
[Required]
public virtual string ClientId { get; set; }
public virtual string ClientSecret { get; set; }
[Required]
public virtual string ClientName { get; set; }
public virtual string ClientUri { get; set; }
public virtual string LogoUri { get; set; }
public virtual bool RequireConsent { get; set; }
public virtual bool AllowRememberConsent { get; set; }
public virtual Flows Flow { get; set; }
// in seconds
[Range(0, Int32.MaxValue)]
public virtual int IdentityTokenLifetime { get; set; }
[Range(0, Int32.MaxValue)]
public virtual int AccessTokenLifetime { get; set; }
[Range(0, Int32.MaxValue)]
public virtual int AbsoluteRefreshTokenLifetime { get; set; }
[Range(0, Int32.MaxValue)]
public virtual int SlidingRefreshTokenLifetime { get; set; }
public virtual TokenUsage RefreshTokenUsage { get; set; }
public virtual TokenExpiration RefreshTokenExpiration { get; set; }
[Range(0, Int32.MaxValue)]
public virtual int AuthorizationCodeLifetime { get; set; }
public virtual SigningKeyTypes IdentityTokenSigningKeyType { get; set; }
public virtual AccessTokenType AccessTokenType { get; set; }
// not implemented yet
public virtual bool RequireSignedAuthorizeRequest { get; set; }
public virtual SubjectTypes SubjectType { get; set; }
public virtual string SectorIdentifierUri { get; set; }
public virtual ApplicationTypes ApplicationType { get; set; }
public virtual ICollection<ClientRedirectUri> RedirectUris { get; set; }
public virtual ICollection<ClientScopeRestriction> ScopeRestrictions { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Thinktecture.IdentityServer.Core.Models;
namespace Thinktecture.IdentityServer.Core.EntityFramework.Entities
{
public class Client
{
[Key]
public virtual int Id { get; set; }
public virtual bool Enabled { get; set; }
[Required]
public virtual string ClientId { get; set; }
public virtual string ClientSecret { get; set; }
[Required]
public virtual string ClientName { get; set; }
public virtual string ClientUri { get; set; }
public virtual string LogoUri { get; set; }
public virtual bool RequireConsent { get; set; }
public virtual bool AllowRememberConsent { get; set; }
public virtual Flows Flow { get; set; }
// in seconds
[Range(0, Int32.MaxValue)]
public virtual int IdentityTokenLifetime { get; set; }
[Range(0, Int32.MaxValue)]
public virtual int AccessTokenLifetime { get; set; }
[Range(0, Int32.MaxValue)]
public int AbsoluteRefreshTokenLifetime { get; set; }
[Range(0, Int32.MaxValue)]
public int SlidingRefreshTokenLifetime { get; set; }
public TokenUsage RefreshTokenUsage { get; set; }
public TokenExpiration RefreshTokenExpiration { get; set; }
[Range(0, Int32.MaxValue)]
public virtual int AuthorizationCodeLifetime { get; set; }
public virtual SigningKeyTypes IdentityTokenSigningKeyType { get; set; }
public virtual AccessTokenType AccessTokenType { get; set; }
// not implemented yet
public virtual bool RequireSignedAuthorizeRequest { get; set; }
public virtual SubjectTypes SubjectType { get; set; }
public virtual string SectorIdentifierUri { get; set; }
public virtual ApplicationTypes ApplicationType { get; set; }
public virtual ICollection<ClientRedirectUri> RedirectUris { get; set; }
public virtual ICollection<ClientScopeRestriction> ScopeRestrictions { get; set; }
}
}
|
apache-2.0
|
C#
|
2cfa31a436752fa525777cf3722b0913594cdd11
|
Fix two properties to be string as expected on PaymentMethodDetails
|
richardlawley/stripe.net,stripe/stripe-dotnet
|
src/Stripe.net/Entities/Charges/ChargePaymentMethodDetails/ChargePaymentMethodDetailsCardPresentReceipt.cs
|
src/Stripe.net/Entities/Charges/ChargePaymentMethodDetails/ChargePaymentMethodDetailsCardPresentReceipt.cs
|
namespace Stripe
{
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class ChargePaymentMethodDetailsCardPresentReceipt : StripeEntity
{
[JsonProperty("application_cryptogram")]
public string ApplicationCryptogram { get; set; }
[JsonProperty("application_preferred_name")]
public string ApplicationPreferredName { get; set; }
[JsonProperty("authorization_code")]
public string AuthorizationCode { get; set; }
[JsonProperty("authorization_response_code")]
public string AuthorizationResponseCode { get; set; }
[JsonProperty("cardholder_verification_method")]
public string CardholderVerificationMethod { get; set; }
[JsonProperty("dedicated_file_name")]
public string DedicatedFileName { get; set; }
[JsonProperty("terminal_verification_results")]
public string TerminalVerificationResults { get; set; }
[JsonProperty("transaction_status_information")]
public string TransactionStatusInformation { get; set; }
}
}
|
namespace Stripe
{
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class ChargePaymentMethodDetailsCardPresentReceipt : StripeEntity
{
[JsonProperty("application_cryptogram")]
public string ApplicationCryptogram { get; set; }
[JsonProperty("application_preferred_name")]
public string ApplicationPreferredName { get; set; }
[JsonProperty("authorization_code")]
public string AuthorizationCode { get; set; }
[JsonProperty("authorization_response_code")]
public long AuthorizationResponseCode { get; set; }
[JsonProperty("cardholder_verification_method")]
public long CardholderVerificationMethod { get; set; }
[JsonProperty("dedicated_file_name")]
public string DedicatedFileName { get; set; }
[JsonProperty("terminal_verification_results")]
public string TerminalVerificationResults { get; set; }
[JsonProperty("transaction_status_information")]
public string TransactionStatusInformation { get; set; }
}
}
|
apache-2.0
|
C#
|
f023ba39db855eb755c6de0cc133a113aed0b063
|
fix client side of utc issue
|
PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer
|
StandUpTimer.Web/Views/Statistics/Index.cshtml
|
StandUpTimer.Web/Views/Statistics/Index.cshtml
|
@model StandUpTimer.Web.Statistic.StatisticModel
@{
ViewBag.Title = "Statistics";
}
@section styles
{
@Styles.Render("~/Content/Statistics.css")
}
<h2>Statistics</h2>
<div id="gantt" style="width: 100%; height: 400px"></div>
@section scripts
{
@Scripts.Render("~/bundles/d3")
<script>
var tasks = [
@foreach (var item in Model.Statuses)
{
@:{ "startDate": new Date(@Html.DisplayFor(modelItem => item.StartDate)), "endDate": @(item.EndDate.Equals("now") ? "Date.now()" : "new Date("+Html.DisplayFor(modelItem => item.EndDate)+")"), "taskName": "@Html.DisplayFor(modelItem => item.Day)", "status": "@Html.DisplayFor(modelItem => item.DeskState)" },
}
];
var taskStatus = {
"Standing": "standing",
"Sitting": "sitting",
"Inactive": "inactive"
};
var taskNames = [
@foreach (var day in Model.Days)
{
@:"@Html.DisplayFor(modelItem => day)",
}
];
tasks.sort(function (a, b) {
return a.endDate - b.endDate;
});
var maxDate = tasks[tasks.length - 1].endDate;
tasks.sort(function (a, b) {
return a.startDate - b.startDate;
});
var minDate = tasks[0].startDate;
var format = "%H:%M";
var gantt = d3.gantt("#gantt").taskTypes(taskNames).taskStatus(taskStatus).tickFormat(format);
gantt(tasks);
</script>
}
|
@model StandUpTimer.Web.Statistic.StatisticModel
@{
ViewBag.Title = "Statistics";
}
@section styles
{
@Styles.Render("~/Content/Statistics.css")
}
<h2>Statistics</h2>
<div id="gantt" style="width: 100%; height: 400px"></div>
@section scripts
{
@Scripts.Render("~/bundles/d3")
<script>
var tasks = [
@foreach (var item in Model.Statuses)
{
@:{ "startDate": new Date(@Html.DisplayFor(modelItem => item.StartDate)), "endDate": new Date(@Html.DisplayFor(modelItem => item.EndDate)), "taskName": "@Html.DisplayFor(modelItem => item.Day)", "status": "@Html.DisplayFor(modelItem => item.DeskState)" },
}
];
var taskStatus = {
"Standing": "standing",
"Sitting": "sitting",
"Inactive": "inactive"
};
var taskNames = [
@foreach (var day in Model.Days)
{
@:"@Html.DisplayFor(modelItem => day)",
}
];
tasks.sort(function (a, b) {
return a.endDate - b.endDate;
});
var maxDate = tasks[tasks.length - 1].endDate;
tasks.sort(function (a, b) {
return a.startDate - b.startDate;
});
var minDate = tasks[0].startDate;
var format = "%H:%M";
var gantt = d3.gantt("#gantt").taskTypes(taskNames).taskStatus(taskStatus).tickFormat(format);
gantt(tasks);
</script>
}
|
mit
|
C#
|
d32c97d4795988930df970dbacc3c85c8ac40ea4
|
Test commit for Sashi
|
ecologylab/BigSemanticsCSharp
|
ecologylab/net/UserAgent.cs
|
ecologylab/net/UserAgent.cs
|
//
// UserAgent.cs
// s.im.pl serialization
//
// Generated by DotNetTranslator on 11/16/10.
// Copyright 2010 Interface Ecology Lab.
//
using System;
using System.Collections.Generic;
using Simpl.Serialization.Attributes;
using Simpl.Serialization;
using Simpl.Serialization.Types.Element;
namespace ecologylab.net
{
/// <summary>
/// missing java doc comments or could not find the source file.
/// </summary>
public class UserAgent : ElementState, IMappable<String>
{
/// <summary>
/// missing java doc comments or could not find the source file.
/// </summary>
[SimplScalar]
private String name;
/// <summary>
/// missing java doc comments or could not find the source file.
/// </summary>
[SimplTag("string")]
[SimplScalar]
private String userAgentString;
/// <summary>
/// missing java doc comments or could not find the source file.
/// </summary>
[SimplTag("default")]
[SimplScalar]
private Boolean defaultAgent;
public UserAgent()
{ }
public String Name
{
get{return name;}
set{name = value;}
}
public String UserAgentString
{
get{return userAgentString;}
set{userAgentString = value;}
}
public Boolean DefaultAgent
{
get{return defaultAgent;}
set{defaultAgent = value;}
}
public String Key()
{
return Name;
}
}
}
|
//
// UserAgent.cs
// s.im.pl serialization
//
// Generated by DotNetTranslator on 11/16/10.
// Copyright 2010 Interface Ecology Lab.
//
using System;
using System.Collections.Generic;
using Simpl.Serialization.Attributes;
using Simpl.Serialization;
using Simpl.Serialization.Types.Element;
namespace ecologylab.net
{
/// <summary>
/// missing java doc comments or could not find the source file.
/// </summary>
public class UserAgent : ElementState, IMappable<String>
{
/// <summary>
/// missing java doc comments or could not find the source file.
/// </summary>
[SimplScalar]
private String name;
/// <summary>
/// missing java doc comments or could not find the source file.
/// </summary>
[SimplTag("string")]
[SimplScalar]
private String userAgentString;
/// <summary>
/// missing java doc comments or could not find the source file.
/// </summary>
[SimplTag("default")]
[SimplScalar]
private Boolean defaultAgent;
public UserAgent()
{ }
public String Name
{
get{return name;}
set{name = value;}
}
public String UserAgentString
{
get{return userAgentString;}
set{userAgentString = value;}
}
public Boolean DefaultAgent
{
get{return defaultAgent;}
set{defaultAgent = value;}
}
public String Key()
{
return Name;
}
}
}
|
apache-2.0
|
C#
|
21cdd3d33c40d397dc8ee2f88e80e84d37b49e74
|
Fix for CreateWwwAuthenticateResponseFromKeyVaultUrlAsync. (#2870)
|
AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet
|
tests/Microsoft.Identity.Test.Integration.netfx/HeadlessTests/WwwAuthenticateParametersIntegrationTests.cs
|
tests/Microsoft.Identity.Test.Integration.netfx/HeadlessTests/WwwAuthenticateParametersIntegrationTests.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Identity.Client;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.Identity.Test.Integration.NetFx.HeadlessTests
{
[TestClass]
public class WwwAuthenticateParametersIntegrationTests
{
[TestMethod]
public async Task CreateWwwAuthenticateResponseFromKeyVaultUrlAsync()
{
var authParams = await WwwAuthenticateParameters.CreateFromResourceResponseAsync("https://buildautomation.vault.azure.net/secrets/CertName/CertVersion").ConfigureAwait(false);
Assert.AreEqual("https://vault.azure.net", authParams.Resource);
Assert.AreEqual("login.windows.net", new Uri(authParams.Authority).Host);
Assert.AreEqual("https://vault.azure.net/.default", authParams.Scopes.FirstOrDefault());
Assert.AreEqual(2, authParams.RawParameters.Count);
Assert.IsNull(authParams.Claims);
Assert.IsNull(authParams.Error);
}
[TestMethod]
public async Task CreateWwwAuthenticateResponseFromGraphUrlAsync()
{
var authParams = await WwwAuthenticateParameters.CreateFromResourceResponseAsync("https://graph.microsoft.com/v1.0/me").ConfigureAwait(false);
Assert.AreEqual("00000003-0000-0000-c000-000000000000", authParams.Resource);
Assert.AreEqual("https://login.microsoftonline.com/common", authParams.Authority);
Assert.AreEqual("00000003-0000-0000-c000-000000000000/.default", authParams.Scopes.FirstOrDefault());
Assert.AreEqual(3, authParams.RawParameters.Count);
Assert.IsNull(authParams.Claims);
Assert.IsNull(authParams.Error);
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Identity.Client;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.Identity.Test.Integration.NetFx.HeadlessTests
{
[TestClass]
public class WwwAuthenticateParametersIntegrationTests
{
[TestMethod]
public async Task CreateWwwAuthenticateResponseFromKeyVaultUrlAsync()
{
var authParams = await WwwAuthenticateParameters.CreateFromResourceResponseAsync("https://msidentitywebsamples.vault.azure.net/secrets/CertName/CertVersion").ConfigureAwait(false);
Assert.AreEqual("https://vault.azure.net", authParams.Resource);
Assert.AreEqual("login.windows.net", new Uri(authParams.Authority).Host);
Assert.AreEqual("https://vault.azure.net/.default", authParams.Scopes.FirstOrDefault());
Assert.AreEqual(2, authParams.RawParameters.Count);
Assert.IsNull(authParams.Claims);
Assert.IsNull(authParams.Error);
}
[TestMethod]
public async Task CreateWwwAuthenticateResponseFromGraphUrlAsync()
{
var authParams = await WwwAuthenticateParameters.CreateFromResourceResponseAsync("https://graph.microsoft.com/v1.0/me").ConfigureAwait(false);
Assert.AreEqual("00000003-0000-0000-c000-000000000000", authParams.Resource);
Assert.AreEqual("https://login.microsoftonline.com/common", authParams.Authority);
Assert.AreEqual("00000003-0000-0000-c000-000000000000/.default", authParams.Scopes.FirstOrDefault());
Assert.AreEqual(3, authParams.RawParameters.Count);
Assert.IsNull(authParams.Claims);
Assert.IsNull(authParams.Error);
}
}
}
|
mit
|
C#
|
f8e555b1eb4af1c347b609b7a44e35b81a9ce33f
|
Add comments
|
farity/farity
|
Farity/Identity.cs
|
Farity/Identity.cs
|
namespace Farity
{
public static partial class F
{
/// <summary>
/// A function that returns the same value that it was provided.
/// </summary>
/// <typeparam name="T">The type of value provided.</typeparam>
/// <param name="x">The value provided.</param>
/// <returns>The same value that was provided to the function.</returns>
/// <remarks>Category: Function</remarks>
public static T Identity<T>(T x) => x;
}
}
|
namespace Farity
{
public static partial class F
{
public static T Identity<T>(T x) => x;
}
}
|
mit
|
C#
|
a132c220100669e2cb6503ec4d76cd5c76b018f9
|
解决忘写命名空间的错误。
|
Zongsoft/Zongsoft.Web.Launcher
|
Global.asax.cs
|
Global.asax.cs
|
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace Zongsoft.Web.Launcher
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
Zongsoft.Plugins.Application.Started += Application_Started;
Zongsoft.Plugins.Application.Start(Zongsoft.Web.Plugins.ApplicationContext.Current, null);
}
protected void Application_End(object sender, EventArgs e)
{
Zongsoft.Plugins.Application.Exit();
}
private void Application_Started(object sender, Zongsoft.Plugins.ApplicationEventArgs e)
{
var context = Zongsoft.Plugins.Application.Context;
//将应用上下文对象保存到ASP.NET的全局应用缓存容器中
Application["ApplicationContext"] = context;
//注册主页的控制器
context.PluginContext.PluginTree.Mount("/Workspace/Controllers/Home", new Func<IController>(() => new DefaultController()));
//卸载主题表单构件
context.PluginContext.PluginTree.Unmount(Zongsoft.Plugins.PluginPath.Combine(context.PluginContext.Settings.WorkbenchPath, "__ThemeForm__"));
//注销插件应用的启动完成事件的通知
Zongsoft.Plugins.Application.Started -= Application_Started;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace Zongsoft.Web.Launcher
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
Zongsoft.Plugins.Application.Started += Application_Started;
Zongsoft.Plugins.Application.Start(Zongsoft.Web.Plugins.ApplicationContext.Current, null);
}
protected void Application_End(object sender, EventArgs e)
{
Zongsoft.Plugins.Application.Exit();
}
private void Application_Started(object sender, Zongsoft.Plugins.ApplicationEventArgs e)
{
var context = Zongsoft.Plugins.Application.Context;
//将应用上下文对象保存到ASP.NET的全局应用缓存容器中
Application["ApplicationContext"] = context;
//注册主页的控制器
context.PluginContext.PluginTree.Mount("/Workspace/Controllers/Home", new Func<IController>(() => new DefaultController()));
//卸载主题表单构件
context.PluginContext.PluginTree.Unmount(PluginPath.Combine(context.PluginContext.Settings.WorkbenchPath, "__ThemeForm__"));
//注销插件应用的启动完成事件的通知
Zongsoft.Plugins.Application.Started -= Application_Started;
}
}
}
|
mit
|
C#
|
cf0e8e0a620faaa77ba490ab3e71b9901eabd658
|
Document nullability of seasonal backgrounds
|
UselessToucan/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu-new,smoogipoo/osu
|
osu.Game/Configuration/SessionStatics.cs
|
osu.Game/Configuration/SessionStatics.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.Online.API.Requests.Responses;
namespace osu.Game.Configuration
{
/// <summary>
/// Stores global per-session statics. These will not be stored after exiting the game.
/// </summary>
public class SessionStatics : InMemoryConfigManager<Static>
{
protected override void InitialiseDefaults()
{
Set(Static.LoginOverlayDisplayed, false);
Set(Static.MutedAudioNotificationShownOnce, false);
Set<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
}
}
public enum Static
{
LoginOverlayDisplayed,
MutedAudioNotificationShownOnce,
/// <summary>
/// Info about seasonal backgrounds available fetched from API - see <see cref="APISeasonalBackgrounds"/>.
/// Value under this lookup can be <c>null</c> if there are no backgrounds available (or API is not reachable).
/// </summary>
SeasonalBackgrounds,
}
}
|
// 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.Online.API.Requests.Responses;
namespace osu.Game.Configuration
{
/// <summary>
/// Stores global per-session statics. These will not be stored after exiting the game.
/// </summary>
public class SessionStatics : InMemoryConfigManager<Static>
{
protected override void InitialiseDefaults()
{
Set(Static.LoginOverlayDisplayed, false);
Set(Static.MutedAudioNotificationShownOnce, false);
Set<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
}
}
public enum Static
{
LoginOverlayDisplayed,
MutedAudioNotificationShownOnce,
SeasonalBackgrounds,
}
}
|
mit
|
C#
|
e693c4feb71843023c6441082d8494f95ff2bdc9
|
Fix DefaultBuild.
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
bootstrapping/DefaultBuild.cs
|
bootstrapping/DefaultBuild.cs
|
using System;
using System.Linq;
using Nuke.Common;
using Nuke.Common.Tools.MSBuild;
using Nuke.Core;
using static Nuke.Common.FileSystem.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
using static Nuke.Common.Tools.NuGet.NuGetTasks;
using static Nuke.Core.EnvironmentInfo;
class DefaultBuild : GitHubBuild
{
// This is the application entry point for the build.
// It also defines the default target to execute.
public static void Main () => Execute<DefaultBuild>(x => x.Compile);
Target Restore => _ => _
.Executes(() =>
{
// Remove restore tasks as needed. They exist for compatibility.
DotNetRestore(SolutionDirectory);
NuGetRestore(SolutionFile);
if (MSBuildVersion == Nuke.Common.Tools.MSBuild.MSBuildVersion.VS2017)
MSBuild(s => DefaultSettings.MSBuildRestore);
});
Target Compile => _ => _
.DependsOn(Restore)
.Executes(() => MSBuild(s => DefaultSettings.MSBuildCompile
.SetMSBuildVersion(MSBuildVersion)));
// If you have xproj-based projects, you need to downgrade to VS2015.
MSBuildVersion? MSBuildVersion =>
!IsUnix
? GlobFiles(SolutionDirectory, "*.xproj").Any()
? Nuke.Common.Tools.MSBuild.MSBuildVersion.VS2015
: Nuke.Common.Tools.MSBuild.MSBuildVersion.VS2017
: default(MSBuildVersion?);
}
|
using System;
using System.Linq;
using Nuke.Common;
using Nuke.Common.Tools.MSBuild;
using Nuke.Core;
using static Nuke.Common.FileSystem.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
using static Nuke.Common.Tools.NuGet.NuGetTasks;
using static Nuke.Core.EnvironmentInfo;
class DefaultBuild : GitHubBuild
{
// This is the application entry point for the build.
// It also defines the default target to execute.
public static void Main () => Execute<DefaultBuild>(x => x.Compile);
Target Restore => _ => _
.Executes(() =>
{
// Remove restore tasks as needed. They exist for compatibility.
DotNetRestore(SolutionDirectory);
NuGetRestore(SolutionFile);
if (MSBuildVersion == Nuke.Common.Tools.MSBuild.MSBuildVersion.VS2017)
MSBuild(s => DefaultSettings.MSBuildRestore);
});
Target Compile => _ => _
.DependsOn(Restore)
.Executes(() => MSBuild(s => DefaultSettings.MSBuildCompile
.SetMSBuildVersion(MSBuildVersion)));
// If you have xproj-based projects, you need to downgrade to VS2015.
MSBuildVersion? MSBuildVersion =>
!IsUnix
? GlobFiles(SolutionDirectory, "*.xproj").Any()
? Nuke.Common.Tools.MSBuild.MSBuildVersion.VS2015
: Nuke.Common.Tools.MSBuild.MSBuildVersion.VS2017
: default(MSBuildVersion);
}
|
mit
|
C#
|
c2d7d5aa1c1968b2a45ff8df6b74bd2195e08e9e
|
Update verion to v4.1.4
|
shabtaisharon/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,shabtaisharon/ds3_net_sdk,SpectraLogic/ds3_net_sdk,SpectraLogic/ds3_net_sdk,RachelTucker/ds3_net_sdk,RachelTucker/ds3_net_sdk,RachelTucker/ds3_net_sdk
|
VersionInfo.cs
|
VersionInfo.cs
|
/*
* ******************************************************************************
* Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
using System.Reflection;
// 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("4.1.4.0")]
[assembly: AssemblyFileVersion("4.1.4.0")]
|
/*
* ******************************************************************************
* Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
using System.Reflection;
// 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("4.1.3.0")]
[assembly: AssemblyFileVersion("4.1.3.0")]
|
apache-2.0
|
C#
|
f22dce023f3b74c90ab97a12daad4d5773e1e209
|
Revert assembly info change in uwp project
|
thomasgalliker/ValueConverters.NET
|
ValueConverters.UWP/Properties/AssemblyInfo.cs
|
ValueConverters.UWP/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("ValueConverters.UWP")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Thomas Galliker")]
[assembly: AssemblyProduct("ValueConverters.UWP")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
|
|
mit
|
C#
|
df96f514fd7c2c7e19fa57008a77ffff8b7a0af6
|
Move links.
|
tvanfosson/azure-web-jobs-demo,tvanfosson/azure-web-jobs-demo,tvanfosson/azure-web-jobs-demo
|
WebJobsDemo/WebApp/Views/Shared/_Layout.cshtml
|
WebJobsDemo/WebApp/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - WebJob Demos</title>
@Styles.Render("~/content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("WebJobs Demo", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("Subscribe", "Subscribe", "Home")</li>
<li>@Html.ActionLink("View Subscription", "Subscribed", "Home")</li>
<li>@Html.ActionLink("WebHooks", "WebHooks", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Tim VanFosson</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - WebJob Demos</title>
@Styles.Render("~/content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("WebJobs Demo", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
@Html.ActionLink("WebJobs Demo", "Subscribe", "Home", new { area = "" }, new { @class = "navbar-brand" })
@Html.ActionLink("WebJobs Demo", "Subscribed", "Home", new { area = "" }, new { @class = "navbar-brand" })
@Html.ActionLink("WebJobs Demo", "WebHooks", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Tim VanFosson</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
3af702453f66663cef225445e11f5cfc5d2cf4b4
|
Implement realtime match song select
|
smoogipoo/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,smoogipoo/osu
|
osu.Game/Screens/Multi/RealtimeMultiplayer/RealtimeMatchSongSelect.cs
|
osu.Game/Screens/Multi/RealtimeMultiplayer/RealtimeMatchSongSelect.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Screens;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.RealtimeMultiplayer;
using osu.Game.Screens.Select;
namespace osu.Game.Screens.Multi.RealtimeMultiplayer
{
public class RealtimeMatchSongSelect : SongSelect, IMultiplayerSubScreen
{
public string ShortTitle => "song selection";
public override string Title => ShortTitle.Humanize();
[Resolved(typeof(Room), nameof(Room.Playlist))]
private BindableList<PlaylistItem> playlist { get; set; }
[Resolved]
private StatefulMultiplayerClient client { get; set; }
protected override bool OnStart()
{
var item = new PlaylistItem();
item.Beatmap.Value = Beatmap.Value.BeatmapInfo;
item.Ruleset.Value = Ruleset.Value;
item.RequiredMods.Clear();
item.RequiredMods.AddRange(Mods.Value.Select(m => m.CreateCopy()));
// If the client is already in a room, update via the client.
// Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation.
if (client.Room != null)
client.ChangeSettings(item: item);
else
{
playlist.Clear();
playlist.Add(item);
}
this.Exit();
return true;
}
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
}
}
|
// 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.Screens.Select;
namespace osu.Game.Screens.Multi.RealtimeMultiplayer
{
public class RealtimeMatchSongSelect : SongSelect
{
protected override BeatmapDetailArea CreateBeatmapDetailArea()
{
throw new System.NotImplementedException();
}
protected override bool OnStart()
{
throw new System.NotImplementedException();
}
}
}
|
mit
|
C#
|
fabd521070082b155a4a7a7184aae60c0a9f3d11
|
Fix bug involving not downloading ffmpeg
|
nikeee/HolzShots
|
src/HolzShots.Capture.Video/Capture/Video/FFmpeg/FFmpegManager.cs
|
src/HolzShots.Capture.Video/Capture/Video/FFmpeg/FFmpegManager.cs
|
using System.IO;
using System.Text;
using System.Diagnostics;
namespace HolzShots.Capture.Video.FFmpeg
{
public static class FFmpegManager
{
const string FFmpegExecutable = "ffmpeg.exe";
/// <summary> Path where a downloaded version of FFmpeg will be saved. </summary>
public static string FFmpegAppDataPath { get; } = Path.Combine(IO.HolzShotsPaths.AppDataDirectory, "ffmpeg");
private static string? GetFFmpegAbsolutePathFromEnvVar()
{
var sb = new StringBuilder(Shlwapi.MAX_PATH);
sb.Append(FFmpegExecutable);
var res = Shlwapi.PathFindOnPath(sb, null);
var p = sb.ToString();
return res && File.Exists(p)
? p
: null;
}
/// <param name="allowPathEnvVar">If true, will be preferred if present</param>
public static string? GetAbsoluteFFmpegPath(bool allowPathEnvVar)
{
// We may ship with ffmpeg out of the box, so just return that if that is available
if (File.Exists(FFmpegExecutable))
return Path.GetFullPath(FFmpegExecutable);
if (allowPathEnvVar)
{
var ffmpegInPath = GetFFmpegAbsolutePathFromEnvVar();
if (ffmpegInPath != null)
{
Debug.Assert(File.Exists(ffmpegInPath));
return ffmpegInPath;
}
}
var downloadedFFmpeg = Path.Combine(FFmpegAppDataPath, FFmpegExecutable);
return File.Exists(downloadedFFmpeg) ? downloadedFFmpeg : null;
}
}
}
|
using System.IO;
using System.Text;
using System.Diagnostics;
namespace HolzShots.Capture.Video.FFmpeg
{
public static class FFmpegManager
{
const string FFmpegExecutable = "ffmpeg.exe";
/// <summary> Path where a downloaded version of FFmpeg will be saved. </summary>
public static string FFmpegAppDataPath { get; } = Path.Combine(IO.HolzShotsPaths.AppDataDirectory, "ffmpeg");
private static string? GetFFmpegAbsolutePathFromEnvVar()
{
var sb = new StringBuilder(Shlwapi.MAX_PATH);
sb.Append(FFmpegExecutable);
var res = Shlwapi.PathFindOnPath(sb, null);
return res && File.Exists(sb.ToString()) ? sb.ToString() : null;
}
/// <param name="allowPathEnvVar">If true, will be preferred if present</param>
public static string GetAbsoluteFFmpegPath(bool allowPathEnvVar)
{
// We may ship with ffmpeg out of the box, so just return that if that is available
if (File.Exists(FFmpegExecutable))
return Path.GetFullPath(FFmpegExecutable);
if (allowPathEnvVar)
{
var ffmpegInPath = GetFFmpegAbsolutePathFromEnvVar();
if (ffmpegInPath != null)
{
Debug.Assert(File.Exists(ffmpegInPath));
return ffmpegInPath;
}
}
var downloadedFFmpeg = Path.Combine(FFmpegAppDataPath, FFmpegExecutable);
Debug.Assert(File.Exists(downloadedFFmpeg));
return downloadedFFmpeg;
}
public static bool HasDownloadedFFmpeg()
{
var downloadedFFmpeg = Path.Combine(FFmpegAppDataPath, FFmpegExecutable);
return File.Exists(downloadedFFmpeg);
}
}
}
|
agpl-3.0
|
C#
|
c25692b531959293123f50e3571d374e8b7e085b
|
Update namespace #5
|
chrisber/typescript-addin,chrisber/typescript-addin
|
src/TypeScriptBinding/Hosting/LanguageServiceCancellationToken.cs
|
src/TypeScriptBinding/Hosting/LanguageServiceCancellationToken.cs
|
//
// LanguageServiceCancellationToken.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using TypeScriptLanguageService;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class LanguageServiceCancellationToken : ICancellationToken
{
public bool isCancellationRequested()
{
return false;
}
}
}
|
//
// LanguageServiceCancellationToken.cs
//
// Author:
// Matt Ward <ward.matt@gmail.com>
//
// Copyright (C) 2014 Matthew Ward
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace ICSharpCode.TypeScriptBinding.Hosting
{
public class LanguageServiceCancellationToken : ICancellationToken
{
public bool isCancellationRequested()
{
return false;
}
}
}
|
mit
|
C#
|
f3f8a0833a28b08d9d663d538f65050953c0160a
|
Add WorkItem attribution to unit tests.
|
tannergooding/roslyn,AlekseyTs/roslyn,jmarolf/roslyn,heejaechang/roslyn,abock/roslyn,KirillOsenkov/roslyn,agocke/roslyn,reaction1989/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,stephentoub/roslyn,weltkante/roslyn,agocke/roslyn,tmat/roslyn,aelij/roslyn,eriawan/roslyn,AmadeusW/roslyn,nguerrera/roslyn,abock/roslyn,KevinRansom/roslyn,heejaechang/roslyn,panopticoncentral/roslyn,AmadeusW/roslyn,dotnet/roslyn,bartdesmet/roslyn,brettfo/roslyn,shyamnamboodiripad/roslyn,abock/roslyn,sharwell/roslyn,davkean/roslyn,genlu/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,mgoertz-msft/roslyn,AlekseyTs/roslyn,mavasani/roslyn,sharwell/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,jmarolf/roslyn,bartdesmet/roslyn,reaction1989/roslyn,brettfo/roslyn,ErikSchierboom/roslyn,stephentoub/roslyn,tannergooding/roslyn,AmadeusW/roslyn,aelij/roslyn,weltkante/roslyn,tannergooding/roslyn,physhi/roslyn,mavasani/roslyn,heejaechang/roslyn,gafter/roslyn,eriawan/roslyn,gafter/roslyn,shyamnamboodiripad/roslyn,nguerrera/roslyn,jasonmalinowski/roslyn,reaction1989/roslyn,stephentoub/roslyn,aelij/roslyn,tmat/roslyn,weltkante/roslyn,wvdd007/roslyn,genlu/roslyn,ErikSchierboom/roslyn,sharwell/roslyn,physhi/roslyn,davkean/roslyn,mavasani/roslyn,dotnet/roslyn,genlu/roslyn,wvdd007/roslyn,brettfo/roslyn,AlekseyTs/roslyn,gafter/roslyn,KirillOsenkov/roslyn,agocke/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,panopticoncentral/roslyn,ErikSchierboom/roslyn,mgoertz-msft/roslyn,physhi/roslyn,diryboy/roslyn,diryboy/roslyn,diryboy/roslyn,eriawan/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,nguerrera/roslyn,dotnet/roslyn,tmat/roslyn,davkean/roslyn,panopticoncentral/roslyn,wvdd007/roslyn,KirillOsenkov/roslyn
|
src/Workspaces/CoreTest/UtilityTest/FormattingRangeHelperTests.cs
|
src/Workspaces/CoreTest/UtilityTest/FormattingRangeHelperTests.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests.UtilityTest
{
public class FormattingRangeHelperTests
{
[WorkItem(33560, "https://github.com/dotnet/roslyn/issues/33560")]
[Fact]
public void TestAreTwoTokensOnSameLineTrue()
{
var root = SyntaxFactory.ParseSyntaxTree("{Foo();}").GetRoot();
var token1 = root.GetFirstToken();
var token2 = root.GetLastToken();
Assert.True(FormattingRangeHelper.AreTwoTokensOnSameLine(token1, token2));
}
[WorkItem(33560, "https://github.com/dotnet/roslyn/issues/33560")]
[Fact]
public void TestAreTwoTokensOnSameLineFalse()
{
var root = SyntaxFactory.ParseSyntaxTree("{Fizz();\nBuzz();}").GetRoot();
var token1 = root.GetFirstToken();
var token2 = root.GetLastToken();
Assert.False(FormattingRangeHelper.AreTwoTokensOnSameLine(token1, token2));
}
[WorkItem(33560, "https://github.com/dotnet/roslyn/issues/33560")]
[Fact]
public void TestAreTwoTokensOnSameLineWithEqualTokens()
{
var token = SyntaxFactory.ParseSyntaxTree("else\nFoo();").GetRoot().GetFirstToken();
Assert.True(FormattingRangeHelper.AreTwoTokensOnSameLine(token, token));
}
[WorkItem(33560, "https://github.com/dotnet/roslyn/issues/33560")]
[Fact]
public void TestAreTwoTokensOnSameLineWithEqualTokensWithoutSyntaxTree()
{
var token = SyntaxFactory.ParseToken("else");
Assert.True(FormattingRangeHelper.AreTwoTokensOnSameLine(token, token));
}
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests.UtilityTest
{
public class FormattingRangeHelperTests
{
[Fact]
public void TestAreTwoTokensOnSameLineTrue()
{
var root = SyntaxFactory.ParseSyntaxTree("{Foo();}").GetRoot();
var token1 = root.GetFirstToken();
var token2 = root.GetLastToken();
Assert.True(FormattingRangeHelper.AreTwoTokensOnSameLine(token1, token2));
}
[Fact]
public void TestAreTwoTokensOnSameLineFalse()
{
var root = SyntaxFactory.ParseSyntaxTree("{Fizz();\nBuzz();}").GetRoot();
var token1 = root.GetFirstToken();
var token2 = root.GetLastToken();
Assert.False(FormattingRangeHelper.AreTwoTokensOnSameLine(token1, token2));
}
[Fact]
public void TestAreTwoTokensOnSameLineWithEqualTokens()
{
var token = SyntaxFactory.ParseSyntaxTree("else\nFoo();").GetRoot().GetFirstToken();
Assert.True(FormattingRangeHelper.AreTwoTokensOnSameLine(token, token));
}
[Fact]
public void TestAreTwoTokensOnSameLineWithEqualTokensWithoutSyntaxTree()
{
var token = SyntaxFactory.ParseToken("else");
Assert.True(FormattingRangeHelper.AreTwoTokensOnSameLine(token, token));
}
}
}
|
mit
|
C#
|
604eee1015dd0acb0af2c40a6799cc8151798151
|
Change Concat to accept params.
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Core/Utilities/Collections/Enumerable.Concat.cs
|
source/Nuke.Core/Utilities/Collections/Enumerable.Concat.cs
|
// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using JetBrains.Annotations;
namespace Nuke.Core.Utilities.Collections
{
[PublicAPI]
[SuppressMessage("ReSharper", "MissingXmlDoc")]
[DebuggerNonUserCode]
[DebuggerStepThrough]
public static partial class EnumerableExtensions
{
public static IEnumerable<T> Concat<T> ([CanBeNull] this T obj, IEnumerable<T> enumerable)
{
yield return obj;
foreach (var element in enumerable)
yield return element;
}
public static IEnumerable<T> Concat<T> (this IEnumerable<T> enumerable, params T[] others)
{
foreach (var element in enumerable)
yield return element;
foreach (var element in others)
yield return element;
}
}
}
|
// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using JetBrains.Annotations;
namespace Nuke.Core.Utilities.Collections
{
[PublicAPI]
[SuppressMessage("ReSharper", "MissingXmlDoc")]
[DebuggerNonUserCode]
[DebuggerStepThrough]
public static partial class EnumerableExtensions
{
public static IEnumerable<T> Concat<T> ([CanBeNull] this T obj, IEnumerable<T> enumerable)
{
yield return obj;
foreach (var element in enumerable)
yield return element;
}
public static IEnumerable<T> Concat<T> (this IEnumerable<T> enumerable, [CanBeNull] T obj)
{
foreach (var element in enumerable)
yield return element;
yield return obj;
}
}
}
|
mit
|
C#
|
0ba2a7ab23a26d46045bebba739867095979f29b
|
Update SeedHelper.cs
|
aspnetboilerplate/aspnetboilerplate-samples,aspnetboilerplate/aspnetboilerplate-samples,aspnetboilerplate/aspnetboilerplate-samples,aspnetboilerplate/aspnetboilerplate-samples,aspnetboilerplate/aspnetboilerplate-samples,aspnetboilerplate/aspnetboilerplate-samples
|
AbpCoreEf6Sample/aspnet-core/src/AbpCoreEf6Sample.EntityFrameworkCore/EntityFrameworkCore/Seed/SeedHelper.cs
|
AbpCoreEf6Sample/aspnet-core/src/AbpCoreEf6Sample.EntityFrameworkCore/EntityFrameworkCore/Seed/SeedHelper.cs
|
using AbpCoreEf6Sample.EntityFrameworkCore.Seed.Host;
using AbpCoreEf6Sample.EntityFrameworkCore.Seed.Tenants;
namespace AbpCoreEf6Sample.EntityFrameworkCore.Seed
{
public static class SeedHelper
{
public static void SeedHostDb(AbpCoreEf6SampleDbContext context)
{
context.SuppressAutoSetTenantId = true;
// Host seed
new InitialHostDbBuilder(context).Create();
// Default tenant seed (in host database).
new DefaultTenantBuilder(context).Create();
new TenantRoleAndUserBuilder(context, 1).Create();
}
}
}
|
using System;
using System.Transactions;
using System.Data.Entity;
using Abp.Dependency;
using Abp.Domain.Uow;
using Abp.EntityFrameworkCore.Uow;
using Abp.MultiTenancy;
using AbpCoreEf6Sample.EntityFrameworkCore.Seed.Host;
using AbpCoreEf6Sample.EntityFrameworkCore.Seed.Tenants;
namespace AbpCoreEf6Sample.EntityFrameworkCore.Seed
{
public static class SeedHelper
{
public static void SeedHostDb(IIocResolver iocResolver)
{
WithDbContext<AbpCoreEf6SampleDbContext>(iocResolver, SeedHostDb);
}
public static void SeedHostDb(AbpCoreEf6SampleDbContext context)
{
context.SuppressAutoSetTenantId = true;
// Host seed
new InitialHostDbBuilder(context).Create();
// Default tenant seed (in host database).
new DefaultTenantBuilder(context).Create();
new TenantRoleAndUserBuilder(context, 1).Create();
}
private static void WithDbContext<TDbContext>(IIocResolver iocResolver, Action<TDbContext> contextAction)
where TDbContext : DbContext
{
using (var uowManager = iocResolver.ResolveAsDisposable<IUnitOfWorkManager>())
{
using (var uow = uowManager.Object.Begin(TransactionScopeOption.Suppress))
{
var context = uowManager.Object.Current.GetDbContext<TDbContext>(MultiTenancySides.Host);
contextAction(context);
uow.Complete();
}
}
}
}
}
|
mit
|
C#
|
8ae7b63cfd1b8b7dde644daf69630779134c6841
|
Change max supported version constants
|
pdelvo/Pdelvo.Minecraft
|
Pdelvo.Minecraft.Protocol/Helper/ProtocolInformation.cs
|
Pdelvo.Minecraft.Protocol/Helper/ProtocolInformation.cs
|
namespace Pdelvo.Minecraft.Protocol.Helper
{
/// <summary>
///
/// </summary>
/// <remarks></remarks>
public static class ProtocolInformation
{
/// <summary>
///
/// </summary>
public const int MinSupportedClientVersion = 22;
/// <summary>
///
/// </summary>
public const int MaxSupportedClientVersion = 47;
/// <summary>
///
/// </summary>
public const int MinSupportedServerVersion = 22;
/// <summary>
///
/// </summary>
public const int MaxSupportedServerVersion = 47;
}
}
|
namespace Pdelvo.Minecraft.Protocol.Helper
{
/// <summary>
///
/// </summary>
/// <remarks></remarks>
public static class ProtocolInformation
{
/// <summary>
///
/// </summary>
public const int MinSupportedClientVersion = 22;
/// <summary>
///
/// </summary>
public const int MaxSupportedClientVersion = 46;
/// <summary>
///
/// </summary>
public const int MinSupportedServerVersion = 22;
/// <summary>
///
/// </summary>
public const int MaxSupportedServerVersion = 46;
}
}
|
mit
|
C#
|
2b7c725007ceac683ebf6e0fc397c15e28d9af1f
|
Change capitalisation
|
davek17/SurveyMonkeyApi-v3,bcemmett/SurveyMonkeyApi-v3
|
SurveyMonkey/RequestSettings/CreateCollectorSettings.cs
|
SurveyMonkey/RequestSettings/CreateCollectorSettings.cs
|
namespace SurveyMonkey.RequestSettings
{
public class CreateCollectorSettings
{
public enum TypeOption
{
Weblink,
Email
}
public TypeOption Type { get; set; }
public string Name { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SurveyMonkey.RequestSettings
{
public class CreateCollectorSettings
{
public enum TypeOption
{
weblink,
email
}
public TypeOption type { get; set; }
public string name { get; set; }
}
}
|
mit
|
C#
|
f7424cff11ed8bb36363b34ce824a44b8b3700a9
|
Bump version
|
Lone-Coder/letsencrypt-win-simple,brondavies/letsencrypt-win-simple
|
letsencrypt-win-simple/Properties/AssemblyInfo.cs
|
letsencrypt-win-simple/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("Let's Encrypt Simple Windows Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Let's Encrypt")]
[assembly: AssemblyProduct("LetsEncrypt.ACME.CLI")]
[assembly: AssemblyCopyright(" Let's Encrypt")]
[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("30cc3de8-aa52-4807-9b0d-eba08b539918")]
// 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.9.2.*")]
[assembly: AssemblyFileVersion("1.9.2.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("Let's Encrypt Simple Windows Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Let's Encrypt")]
[assembly: AssemblyProduct("LetsEncrypt.ACME.CLI")]
[assembly: AssemblyCopyright(" Let's Encrypt")]
[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("30cc3de8-aa52-4807-9b0d-eba08b539918")]
// 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.9.1.*")]
[assembly: AssemblyFileVersion("1.9.1.1")]
|
apache-2.0
|
C#
|
6fd0a5465f1faff64409a170df378c0329ab1afe
|
prepare lexeme attribute for generic parser use
|
b3b00/csly,b3b00/sly
|
sly/lexer/LexemeAttribute.cs
|
sly/lexer/LexemeAttribute.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace sly.lexer
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false,Inherited =true)]
public class LexemeAttribute : Attribute
{
public GenericToken GenericToken { get; set; }
public string GenericTokenParameter { get; set; }
public string Pattern { get; set; }
public bool IsSkippable { get; set; }
public bool IsLineEnding { get; set; }
public LexemeAttribute(string pattern, bool isSkippable = false, bool isLineEnding = false) {
Pattern = pattern;
IsSkippable = isSkippable;
IsLineEnding = isLineEnding;
}
public LexemeAttribute(GenericToken generic, string parameter = null)
{
GenericToken = generic;
GenericTokenParameter = parameter;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace sly.lexer
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false,Inherited =true)]
public class LexemeAttribute : Attribute
{
public string Pattern { get; set; }
public bool IsSkippable { get; set; }
public bool IsLineEnding { get; set; }
public LexemeAttribute(string pattern, bool isSkippable = false, bool isLineEnding = false) {
Pattern = pattern;
IsSkippable = isSkippable;
IsLineEnding = isLineEnding;
}
}
}
|
mit
|
C#
|
aee172b797ca93055c2ccdbb7602bcebe95f47e0
|
comment out bogus test
|
Kukkimonsuta/Odachi
|
test/Odachi.RazorTemplating.Tests/RazorTemplaterTests.cs
|
test/Odachi.RazorTemplating.Tests/RazorTemplaterTests.cs
|
using Odachi.RazorTemplating.Internal;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Odachi.RazorTemplating.Tests
{
public class RazorTemplaterTests
{
//[Fact]
//public void Works()
//{
// var OutputDirectory = "d:\\razor-temp";
// // normalize project directory (must include trailing slash)
// var ProjectDirectory = Directory.GetCurrentDirectory();
// if (ProjectDirectory[ProjectDirectory.Length - 1] != Path.DirectorySeparatorChar)
// ProjectDirectory += Path.DirectorySeparatorChar;
// // create templater
// var templater = new RazorTemplater(ProjectDirectory);
// // create templater
// var outputFileNames = new List<string>();
// foreach (var inputItem in Directory.GetFiles(ProjectDirectory, "*.cshtml", SearchOption.AllDirectories))
// {
// var inputFileName = inputItem;
// var outputFileName = Path.Combine(
// OutputDirectory,
// PathTools.GetRelativePath(ProjectDirectory, Path.GetDirectoryName(inputFileName)).Replace(Path.DirectorySeparatorChar, '_').Replace(Path.AltDirectorySeparatorChar, '_') + "_" + Path.GetFileNameWithoutExtension(inputFileName) + ".cs"
// );
// if (!Directory.Exists(OutputDirectory))
// {
// Directory.CreateDirectory(OutputDirectory);
// }
// templater.Generate(inputFileName, outputFileName);
// outputFileNames.Add(outputFileName);
// }
//}
}
}
|
using Odachi.RazorTemplating.Internal;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Odachi.RazorTemplating.Tests
{
public class RazorTemplaterTests
{
[Fact]
public void Works()
{
var OutputDirectory = "d:\\razor-temp";
// normalize project directory (must include trailing slash)
var ProjectDirectory = Directory.GetCurrentDirectory();
if (ProjectDirectory[ProjectDirectory.Length - 1] != Path.DirectorySeparatorChar)
ProjectDirectory += Path.DirectorySeparatorChar;
// create templater
var templater = new RazorTemplater(ProjectDirectory);
// create templater
var outputFileNames = new List<string>();
foreach (var inputItem in Directory.GetFiles(ProjectDirectory, "*.cshtml", SearchOption.AllDirectories))
{
var inputFileName = inputItem;
var outputFileName = Path.Combine(
OutputDirectory,
PathTools.GetRelativePath(ProjectDirectory, Path.GetDirectoryName(inputFileName)).Replace(Path.DirectorySeparatorChar, '_').Replace(Path.AltDirectorySeparatorChar, '_') + "_" + Path.GetFileNameWithoutExtension(inputFileName) + ".cs"
);
if (!Directory.Exists(OutputDirectory))
{
Directory.CreateDirectory(OutputDirectory);
}
templater.Generate(inputFileName, outputFileName);
outputFileNames.Add(outputFileName);
}
}
}
}
|
apache-2.0
|
C#
|
075bae7519494fd8b5bfbb46f871a238829a0ec8
|
Fix disposal pipe visibility in entity menu (#5790)
|
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.Client/SubFloor/SubFloorShowLayerVisualizer.cs
|
Content.Client/SubFloor/SubFloorShowLayerVisualizer.cs
|
using Content.Shared.SubFloor;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.SubFloor
{
[UsedImplicitly]
public class SubFloorShowLayerVisualizer : AppearanceVisualizer
{
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
var entities = IoCManager.Resolve<IEntityManager>();
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
return;
if (!component.TryGetData(SubFloorVisuals.SubFloor, out bool subfloor))
return;
foreach (var layer in sprite.AllLayers)
{
layer.Visible = subfloor;
}
if (!sprite.LayerMapTryGet(Layers.FirstLayer, out var firstLayer))
{
sprite.Visible = subfloor;
return;
}
// show the top part of the sprite. E.g. the grille-part of a vent, but not the connecting pipes.
sprite.LayerSetVisible(firstLayer, true);
sprite.Visible = true;
}
public enum Layers : byte
{
FirstLayer,
}
}
}
|
using Content.Shared.SubFloor;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.SubFloor
{
[UsedImplicitly]
public class SubFloorShowLayerVisualizer : AppearanceVisualizer
{
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
var entities = IoCManager.Resolve<IEntityManager>();
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
return;
if (component.TryGetData(SubFloorVisuals.SubFloor, out bool subfloor))
{
sprite.Visible = true;
// Due to the way this visualizer works, you might want to specify it before any other
// visualizer that hides/shows layers depending on certain conditions, such as PipeConnectorVisualizer.
foreach (var layer in sprite.AllLayers)
{
layer.Visible = subfloor;
}
if (sprite.LayerMapTryGet(Layers.FirstLayer, out var firstLayer))
{
sprite.LayerSetVisible(firstLayer, true);
}
}
}
public enum Layers : byte
{
FirstLayer,
}
}
}
|
mit
|
C#
|
34bf451c8a42982f8b235248b24eccf9d1442883
|
change constraints in CyclistNext
|
Entities-13/CyclingTeamProject
|
CyclingApplication/Cycling.Models/MSSQL/CyclistNext.cs
|
CyclingApplication/Cycling.Models/MSSQL/CyclistNext.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Cycling.Models.MSSQL
{
public class CyclistNext
{
private const string invalidName = "Names must be more than 3 and less than 40 sumbols, only Latyn symbols, not separated by any symbol";
private const string invalidNationality = "Nationality must be more than 3 and less than 40 sumbols, only latin symbol, separeted by comma";
public int Id { get; set; }
[MaxLength(40)]
[RegularExpression("^[A-Za-z]{3,40}$", ErrorMessage = invalidName)]
public string FirstName { get; set; }
[MaxLength(40)]
[RegularExpression("^[A-Za-z]{3,40}$", ErrorMessage = invalidName)]
public string LastName { get; set; }
public DateTime BirthDay { get; set; }
[MaxLength(40)]
[RegularExpression("^[A-Za-z ]{3,40}$", ErrorMessage = invalidNationality)]
public string Nationality { get; set; }
public virtual ICollection<TourDeFrance> TF_Id { get; set; }
public virtual ICollection<GiroDItalia> GI_Id { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Cycling.Models.MSSQL
{
public class CyclistNext
{
private const string invalidName = "Names must be more than 3 and less than 40 sumbols, start with uppaercase and follow by lowercase";
public int Id { get; set; }
[RegularExpression("^[A-Z][a-z]{2,40}$", ErrorMessage = invalidName)]
public string FirstName { get; set; }
[RegularExpression("^[A-Z][a-z]{2,40}$", ErrorMessage = invalidName)]
public string LastName { get; set; }
public DateTime BirthDay { get; set; }
public string Nationality { get; set; }
public virtual ICollection<TourDeFrance> TF_Id { get; set; }
public virtual ICollection<GiroDItalia> GI_Id { get; set; }
}
}
|
mit
|
C#
|
f16d9ba9b5e8ac67031ec4e3960fc325cef03050
|
Add unit test for Issue #57
|
mmsaffari/elmah-mvc,fhchina/elmah-mvc,jmptrader/elmah-mvc,alexbeletsky/elmah-mvc
|
src/Tests/ControllerTests.cs
|
src/Tests/ControllerTests.cs
|
namespace Elmah.Mvc.Tests
{
using Elmah.Mvc;
using Xunit;
public class ControllerTests
{
[Fact]
public void ElmahController_Index_Returns_ElmahResult()
{
// Arrange
var controller = new ElmahController();
// Act
var actionResult = controller.Index("test");
// Assert
Assert.IsType<ElmahResult>(actionResult);
}
[Fact]
public void ElmahController_Detail_Returns_ElmahResult()
{
// Arrange
var controller = new ElmahController();
// Act
var actionResult = controller.Detail("test");
// Assert
Assert.IsType<ElmahResult>(actionResult);
}
[Fact]
public void ElmahResult_ExecuteResult_ControllerContextIsNull()
{
// Arrange
var elmahResult = new ElmahResult();
// Assert
Assert.DoesNotThrow(() => elmahResult.ExecuteResult(null));
}
}
}
|
namespace Elmah.Mvc.Tests
{
using Elmah.Mvc;
using Xunit;
public class ControllerTests
{
[Fact]
public void ElmahController_Index_Returns_ElmahResult()
{
// Arrange
var controller = new ElmahController();
// Act
var actionResult = controller.Index("test");
// Assert
Assert.IsType<ElmahResult>(actionResult);
}
[Fact]
public void ElmahController_Detail_Returns_ElmahResult()
{
// Arrange
var controller = new ElmahController();
// Act
var actionResult = controller.Detail("test");
// Assert
Assert.IsType<ElmahResult>(actionResult);
}
}
}
|
apache-2.0
|
C#
|
3b9c262829ba8d8a9f7e8d0d53ab48897a74d017
|
Disable bundling
|
pekkah/tanka,pekkah/tanka,pekkah/tanka
|
src/Web/NancyBootstrapper.cs
|
src/Web/NancyBootstrapper.cs
|
namespace Web
{
using Autofac;
using Infrastructure;
using Nancy.Authentication.Forms;
using Nancy.Bootstrapper;
using Nancy.Bootstrappers.Autofac;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Tanka.Nancy.Optimization;
public class NancyBootstrapper : AutofacNancyBootstrapper
{
protected override void ApplicationStartup(ILifetimeScope container, IPipelines pipelines)
{
JsonConvert.DefaultSettings = (() =>
{
var settings = new JsonSerializerSettings();
settings.Converters.Add(new StringEnumConverter {CamelCaseText = true});
return settings;
});
FormsAuthentication.Enable(
pipelines,
new FormsAuthenticationConfiguration
{
RedirectUrl = "~/admin/login",
UserMapper = container.Resolve<IUserMapper>()
}
);
Bundler.Enable(false);
}
protected override ILifetimeScope GetApplicationContainer()
{
var builder = new ContainerBuilder();
builder.RegisterAssemblyModules(typeof (RavenModule).Assembly);
return builder.Build();
}
}
}
|
namespace Web
{
using Autofac;
using Infrastructure;
using Nancy;
using Nancy.Authentication.Forms;
using Nancy.Bootstrapper;
using Nancy.Bootstrappers.Autofac;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Tanka.Nancy.Optimization;
public class NancyBootstrapper : AutofacNancyBootstrapper
{
protected override void ApplicationStartup(ILifetimeScope container, IPipelines pipelines)
{
JsonConvert.DefaultSettings = (() =>
{
var settings = new JsonSerializerSettings();
settings.Converters.Add(new StringEnumConverter {CamelCaseText = true});
return settings;
});
FormsAuthentication.Enable(
pipelines,
new FormsAuthenticationConfiguration
{
RedirectUrl = "~/admin/login",
UserMapper = container.Resolve<IUserMapper>()
}
);
#if DEBUG
Bundler.Enable(false);
#else
Bundler.Enable(true);
#endif
}
protected override ILifetimeScope GetApplicationContainer()
{
var builder = new ContainerBuilder();
builder.RegisterAssemblyModules(typeof (RavenModule).Assembly);
return builder.Build();
}
}
}
|
mit
|
C#
|
7a0a573495bdbf5f7d063ba375e0e80435ce125b
|
Fix issue where Security Scheme responses are not parsed correctly.
|
raml-org/raml-dotnet-parser-2,raml-org/raml-dotnet-parser-2
|
source/Raml.Parser/Builders/SecuritySchemeDescriptorBuilder.cs
|
source/Raml.Parser/Builders/SecuritySchemeDescriptorBuilder.cs
|
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using Raml.Parser.Expressions;
namespace Raml.Parser.Builders
{
public class SecuritySchemeDescriptorBuilder
{
public SecuritySchemeDescriptor Build(IDictionary<string, object> dynamicRaml, string defaultMediaType)
{
var descriptor = new SecuritySchemeDescriptor();
if (dynamicRaml.ContainsKey("headers"))
descriptor.Headers = new ParametersBuilder((IDictionary<string, object>)dynamicRaml["headers"]).GetAsDictionary();
if (dynamicRaml.ContainsKey("queryParameters"))
descriptor.QueryParameters = new ParametersBuilder((IDictionary<string, object>)dynamicRaml["queryParameters"]).GetAsDictionary();
var responsesNest = ((object[])dynamicRaml["responses"]).ToList().Cast<ExpandoObject>() ;
var responses = responsesNest.ToDictionary(k => ((IDictionary<string, object>)k)["code"].ToString(), v => (object)v);
if (dynamicRaml.ContainsKey("responses"))
descriptor.Responses = new ResponsesBuilder(responses).GetAsDictionary(defaultMediaType);
return descriptor;
}
}
}
|
using System.Collections.Generic;
using Raml.Parser.Expressions;
namespace Raml.Parser.Builders
{
public class SecuritySchemeDescriptorBuilder
{
public SecuritySchemeDescriptor Build(IDictionary<string, object> dynamicRaml, string defaultMediaType)
{
var descriptor = new SecuritySchemeDescriptor();
if (dynamicRaml.ContainsKey("headers"))
descriptor.Headers = new ParametersBuilder((IDictionary<string, object>)dynamicRaml["headers"]).GetAsDictionary();
if (dynamicRaml.ContainsKey("queryParameters"))
descriptor.QueryParameters = new ParametersBuilder((IDictionary<string, object>)dynamicRaml["queryParameters"]).GetAsDictionary();
if (dynamicRaml.ContainsKey("responses"))
descriptor.Responses = new ResponsesBuilder((IDictionary<string, object>)dynamicRaml["responses"]).GetAsDictionary(defaultMediaType);
return descriptor;
}
}
}
|
apache-2.0
|
C#
|
d9350a37a60171e747cc83390e49d4b056897eca
|
Update 20180327.LuckWheelManager.cs
|
twilightspike/cuddly-disco,twilightspike/cuddly-disco
|
main/20180327.LuckWheelManager.cs
|
main/20180327.LuckWheelManager.cs
|
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System;
public class LuckWheelManager: MonoBehaviour{
/*stuffset*/
private bool _beStarted;
private float[] _angleSector;
private float _angleFinal;
private float _angleBegin;
private float _lerpRotateTimeNow;
/*message_how much*/
public int PressCost = 250; //pay how much on playing
public int MoneyPrevTotal;
public int MoneyNowTotal = 1000;
/*ui_basuc*/
public Button buttonPress;
public GameObject circleWheel;
/*message_win or lose*/
public Text MoneyDeltaText;
public Text MoneyNowText;
/*action*/
private void Awake(){
MoneyPrevTotal = MoneyNowTotal;
MoneyNowText.text = MoneyNowTotal.ToString();
}
public void SpinWheel(){
if(MoneyNowTotal >= PressCost){
_lerpRotateTimeNow = 0f;
_angleSector = new float[]{
30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360
};
int circleFull = 5;
float randomAngleFinal = _angleSector [UnityEngine.Random.Range(0, _angleSector.Length)];
/*angle would rotate*/
_angleFinal = -(circleFull * 360 + randomAngleFinal);
_beStarted = true;
MoneyPrevTotal = MoneyNowTotal;
/*Whenever I play, my wallet fades*/
MoneyNowTotal = -PressCost;
/*Addict to it?!*/
MoneyDeltaText.text = PressCost + "bye!";
MoneyDeltaText.gameObject.SetActive(true);
StartCoroutine(MoneyDeltaHide());
StartCoroutine(MoneyTotalUpdate());
}
}
/*void RewardByAngle(){
switch(_angleBegin){}
}*/
void Update(){}
}
|
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System;
public class LuckWheelManager: MonoBehaviour{
/*stuffset*/
private bool _beStarted;
private float[] _angleSector;
private float _angleFinal;
private float _angleBegin;
private float _lerpRotateTimeNow;
/*message_how much*/
public int PressCost = 250; //pay how much on playing
public int MoneyPrevTotal;
public int MoneyNowTotal = 1000;
/*ui_basuc*/
public Button buttonPress;
public GameObject circleWheel;
/*message_win or lose*/
public Text MoneyDeltaText;
public Text MoneyNowText;
/*action*/
private void Awake(){
MoneyPrevTotal = MoneyNowTotal;
MoneyNowText.text = MoneyNowTotal.ToString();
}
public void SpinWheel(){
if(MoneyNowTotal >= PressCost){
_lerpRotateTimeNow = 0f;
_angleSector = new float[]{
30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360
};
int circleFull = 5;
float randomAngleFinal = _angleSector [UnityEngine.Random.Range(0, _angleSector.Length)];
/*angle would rotate*/
_angleFinal = -(circleFull * 360 + randomAngleFinal);
_beStarted = true;
MoneyPrevTotal = MoneyNowTotal;
/*Whenever I play, my wallet fades*/
MoneyNowTotal = -PressCost;
/*Addict to it?!*/
MoneyDeltaText.text = PressCost + "bye!";
MoneyDeltaText.gameObject.SetActive(true);
StartCoroutine(MoneyDeltaHide());
StartCoroutine(MoneyTotalUpdate());
}
}
void RewardByAngle(){
}
void Update(){}
}
|
mit
|
C#
|
a1a8c55583a46a3bcead07fd73514b8979c2aa36
|
Add Good Friday as a bank holiday for Luxembourg (fixes #136)
|
tinohager/Nager.Date,tinohager/Nager.Date,tinohager/Nager.Date
|
Src/Nager.Date/PublicHolidays/LuxembourgProvider.cs
|
Src/Nager.Date/PublicHolidays/LuxembourgProvider.cs
|
using Nager.Date.Contract;
using Nager.Date.Model;
using System.Collections.Generic;
using System.Linq;
namespace Nager.Date.PublicHolidays
{
/// <summary>
/// Luxembourg
/// https://en.wikipedia.org/wiki/Public_holidays_in_Luxembourg
/// </summary>
public class LuxembourgProvider : IPublicHolidayProvider
{
private readonly ICatholicProvider _catholicProvider;
/// <summary>
/// LuxembourgProvider
/// </summary>
/// <param name="catholicProvider"></param>
public LuxembourgProvider(ICatholicProvider catholicProvider)
{
this._catholicProvider = catholicProvider;
}
/// <summary>
/// Get
/// </summary>
/// <param name="year">The year</param>
/// <returns></returns>
public IEnumerable<PublicHoliday> Get(int year)
{
var countryCode = CountryCode.LU;
var easterSunday = this._catholicProvider.EasterSunday(year);
var items = new List<PublicHoliday>();
items.Add(new PublicHoliday(year, 1, 1, "Neijoerschdag", "New Year's Day", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(1), "Ouschterméindeg", "Easter Monday", countryCode));
items.Add(new PublicHoliday(year, 5, 1, "Dag vun der Aarbecht", "Labour Day", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(-2), "Karfreideg", "Good Friday", countryCode, type: PublicHolidayType.Bank));
items.Add(new PublicHoliday(easterSunday.AddDays(39), "Christi Himmelfaart", "Ascension Day", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(50), "Péngschtméindeg", "Whit Monday", countryCode));
items.Add(new PublicHoliday(year, 6, 23, "Groussherzogsgebuertsdag", "Sovereign's birthday", countryCode));
items.Add(new PublicHoliday(year, 8, 15, "Léiffrawëschdag", "Assumption Day", countryCode));
items.Add(new PublicHoliday(year, 11, 1, "Allerhellgen", "All Saints' Day", countryCode));
items.Add(new PublicHoliday(year, 12, 25, "Chrëschtdag", "Christmas Day", countryCode));
items.Add(new PublicHoliday(year, 12, 26, "Stiefesdag", "St. Stephen's Day", countryCode));
return items.OrderBy(o => o.Date);
}
}
}
|
using Nager.Date.Contract;
using Nager.Date.Model;
using System.Collections.Generic;
using System.Linq;
namespace Nager.Date.PublicHolidays
{
/// <summary>
/// Luxembourg
/// https://en.wikipedia.org/wiki/Public_holidays_in_Luxembourg
/// </summary>
public class LuxembourgProvider : IPublicHolidayProvider
{
private readonly ICatholicProvider _catholicProvider;
/// <summary>
/// LuxembourgProvider
/// </summary>
/// <param name="catholicProvider"></param>
public LuxembourgProvider(ICatholicProvider catholicProvider)
{
this._catholicProvider = catholicProvider;
}
/// <summary>
/// Get
/// </summary>
/// <param name="year">The year</param>
/// <returns></returns>
public IEnumerable<PublicHoliday> Get(int year)
{
var countryCode = CountryCode.LU;
var easterSunday = this._catholicProvider.EasterSunday(year);
var items = new List<PublicHoliday>();
items.Add(new PublicHoliday(year, 1, 1, "Neijoerschdag", "New Year's Day", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(1), "Ouschterméindeg", "Easter Monday", countryCode));
items.Add(new PublicHoliday(year, 5, 1, "Dag vun der Aarbecht", "Labour Day", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(39), "Christi Himmelfaart", "Ascension Day", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(50), "Péngschtméindeg", "Whit Monday", countryCode));
items.Add(new PublicHoliday(year, 6, 23, "Groussherzogsgebuertsdag", "Sovereign's birthday", countryCode));
items.Add(new PublicHoliday(year, 8, 15, "Léiffrawëschdag", "Assumption Day", countryCode));
items.Add(new PublicHoliday(year, 11, 1, "Allerhellgen", "All Saints' Day", countryCode));
items.Add(new PublicHoliday(year, 12, 25, "Chrëschtdag", "Christmas Day", countryCode));
items.Add(new PublicHoliday(year, 12, 26, "Stiefesdag", "St. Stephen's Day", countryCode));
return items.OrderBy(o => o.Date);
}
}
}
|
mit
|
C#
|
7615184168ef684bc00b8167df04ff6780a93dcb
|
Use Path.Combine
|
zhdusurfin/HttpMock,hibri/HttpMock
|
src/HttpMock.Integration.Tests/EndpointsReturningFilesTests.cs
|
src/HttpMock.Integration.Tests/EndpointsReturningFilesTests.cs
|
using System;
using System.IO;
using System.Net;
using NUnit.Framework;
namespace HttpMock.Integration.Tests
{
[TestFixture]
public class EndpointsReturningFilesTests
{
private const string FILE_NAME = "transcode-input.mp3";
private static readonly string RES_TRANSCODE_INPUT_MP3 = Path.Combine("res",FILE_NAME);
[Test]
public void A_Setting_return_file_return_the_correct_content_length() {
var stubHttp = HttpMockRepository.At("http://localhost.:9191");
var pathToFile = Path.Combine(TestContext.CurrentContext.TestDirectory, RES_TRANSCODE_INPUT_MP3);
stubHttp.Stub(x => x.Get("/afile"))
.ReturnFile(pathToFile)
.OK();
Console.WriteLine(stubHttp.WhatDoIHave());
var fileLength = new FileInfo(pathToFile).Length;
var webRequest = (HttpWebRequest) WebRequest.Create("http://localhost.:9191/afile");
using (var response = webRequest.GetResponse())
using(var responseStream = response.GetResponseStream())
{
var bytes = new byte[response.ContentLength];
responseStream.Read(bytes, 0, (int) response.ContentLength);
Assert.That(response.ContentLength, Is.EqualTo(fileLength));
}
}
}
}
|
using System;
using System.IO;
using System.Net;
using NUnit.Framework;
namespace HttpMock.Integration.Tests
{
[TestFixture]
public class EndpointsReturningFilesTests
{
private const string FILE_NAME = "transcode-input.mp3";
private const string RES_TRANSCODE_INPUT_MP3 = "res\\"+FILE_NAME;
[Test]
public void A_Setting_return_file_return_the_correct_content_length() {
var stubHttp = HttpMockRepository.At("http://localhost.:9191");
var pathToFile = Path.Combine(TestContext.CurrentContext.TestDirectory, RES_TRANSCODE_INPUT_MP3);
stubHttp.Stub(x => x.Get("/afile"))
.ReturnFile(pathToFile)
.OK();
Console.WriteLine(stubHttp.WhatDoIHave());
var fileLength = new FileInfo(pathToFile).Length;
var webRequest = (HttpWebRequest) WebRequest.Create("http://localhost.:9191/afile");
using (var response = webRequest.GetResponse())
using(var responseStream = response.GetResponseStream())
{
var bytes = new byte[response.ContentLength];
responseStream.Read(bytes, 0, (int) response.ContentLength);
Assert.That(response.ContentLength, Is.EqualTo(fileLength));
}
}
}
}
|
mit
|
C#
|
9d044f27ead373e3f2b01f0897c0a95084173d76
|
Fix merge conflicts
|
nunit/nunit-console,nunit/nunit-console,nunit/nunit-console
|
src/NUnitEngine/nunit.engine.tests/Services/TestAgencyTests.cs
|
src/NUnitEngine/nunit.engine.tests/Services/TestAgencyTests.cs
|
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt
#if NETFRAMEWORK
using NUnit.Engine.Services;
using NUnit.Engine.Services.Tests.Fakes;
using NUnit.Framework;
namespace NUnit.Engine.Tests.Services
{
public class TestAgencyTests
{
private TestAgency _testAgency;
private ServiceContext _services;
[SetUp]
public void CreateServiceContext()
{
_services = new ServiceContext();
_services.Add(new FakeRuntimeService());
_testAgency = new TestAgency();
_services.Add(_testAgency);
_services.ServiceManager.StartServices();
}
[TearDown]
public void TearDown()
{
_services.ServiceManager.Dispose();
}
[Test]
public void ServiceIsStarted()
{
Assert.That(_testAgency.Status, Is.EqualTo(ServiceStatus.Started));
}
}
}
#endif
|
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt
#if NETFRAMEWORK
using NUnit.Engine.Services;
using NUnit.Engine.Services.Tests.Fakes;
using NUnit.Framework;
namespace NUnit.Engine.Tests.Services
{
public class TestAgencyTests
{
private TestAgency _testAgency;
private ServiceContext _services;
[SetUp]
public void CreateServiceContext()
{
var services = new ServiceContext();
services.Add(new FakeRuntimeService());
_testAgency = new TestAgency();
services.Add(_testAgency);
services.ServiceManager.StartServices();
}
[TearDown]
public void TearDown()
{
_services.ServiceManager.Dispose();
}
[Test]
public void ServiceIsStarted()
{
Assert.That(_testAgency.Status, Is.EqualTo(ServiceStatus.Started));
}
}
}
#endif
|
mit
|
C#
|
ebf3c93cfcd55fd9071b0e93945a1bf1dc9bd1ce
|
Change summary of interface IObjectiveFunction.
|
geoem/MSolve,geoem/MSolve
|
ISAAR.MSolve.Analyzers/Optimization/Problem/IObjectiveFunction.cs
|
ISAAR.MSolve.Analyzers/Optimization/Problem/IObjectiveFunction.cs
|
using ISAAR.MSolve.Matrices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ISAAR.MSolve.Analyzers.Optimization.Problem
{
/// <summary>
/// Represents an objective function of an optimization problem. It will be called be the selected optimization algorithm.
/// The user hooks the model he wants to optimize by implementing this interface.
/// All optimizers will try to find the global minimum of the IObjectiveFunction.
/// To maximize a function the user needs to provide its negative -f(x).
/// </summary>
public interface IObjectiveFunction
{
/// <summary>
/// Calculates the value of the IObjectiveFunction object.
/// This call may be time consuming (e.g. launching a FEM simulation).
/// Unless it is executed in a different thread it may block the current iteration of the optimization algorithm.
/// </summary>
/// <param name="x">The continuous decision variable vector.</param>
/// <returns>The value of the IObjectiveFunction object.</returns>
double Evaluate(double[] x);
}
}
|
using ISAAR.MSolve.Matrices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ISAAR.MSolve.Analyzers.Optimization.Problem
{
/// <summary>
/// Represents an objective function of an optimization problem. It will be called be the selected optimization algorithm.
/// The user hooks the model he wants to optimize by implementing this interface.
/// All optimizers will try to find the global minimum of the IObjectiveFunction.
/// To maximize a function the user needs to provide its negative -f(x).
/// </summary>
public interface IObjectiveFunction
{
/// <summary>
/// Calculates the value of the IObjectiveFunction object.
/// This call may be time consuming (e.g. launvhing a FEM simulation).
/// Unless it is executed in a different thread it may block the current iteration of the optimization algorithm.
/// </summary>
/// <param name="x">The continuous decision variable vector.</param>
/// <returns>The value of the IObjectiveFunction object.</returns>
double Evaluate(double[] x);
}
}
|
apache-2.0
|
C#
|
0f8530e3201b347127d8110802f4ef910b9b0a88
|
simplify program.cs
|
OlegKleyman/AlphaDev,OlegKleyman/AlphaDev,OlegKleyman/AlphaDev
|
web/AlphaDev.Web/Program.cs
|
web/AlphaDev.Web/Program.cs
|
using System.IO;
using System.Reflection;
using AlphaDev.Web.Bootstrap;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace AlphaDev.Web
{
public class Program
{
public static void Main(string[] args)
{
WebHost.CreateDefaultBuilder().UseStartup<Startup>().ConfigureServices(
services => services.AddSingleton<IConfigurationBuilder, IConfigurationBuilder>(
provider => new ConfigurationBuilder()
.AddJsonFile("connectionstrings.json", true, true))).Build().Run();
}
}
}
|
using System.IO;
using System.Reflection;
using AlphaDev.Web.Bootstrap;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace AlphaDev.Web
{
public class Program
{
public static void Main(string[] args)
{
var contentRoot = Directory.GetCurrentDirectory();
var host = new WebHostBuilder().UseKestrel().UseContentRoot(contentRoot).UseIISIntegration()
.UseStartup<Startup>().UseApplicationInsights().ConfigureServices(
services => services.AddSingleton<IConfigurationBuilder, IConfigurationBuilder>(
provider => new ConfigurationBuilder().SetBasePath(contentRoot)
.AddJsonFile("connectionstrings.json", true, true)))
.UseSetting(WebHostDefaults.ApplicationKey, typeof(Program).GetTypeInfo().Assembly.FullName).Build();
host.Run();
}
}
}
|
unlicense
|
C#
|
26e1349327da9500bd51bce37bcd0dac84ac5f11
|
Bump version.
|
mios-fi/mios.payment
|
core/Properties/AssemblyInfo.cs
|
core/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mios.Payment")]
[assembly: AssemblyDescription("A library for generating and verifying payment details for various online payment providers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mios Ltd")]
[assembly: AssemblyProduct("Mios.Payment")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("90888035-e560-4ab7-bcc5-c88aee09f29b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.1.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mios.Payment")]
[assembly: AssemblyDescription("A library for generating and verifying payment details for various online payment providers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mios Ltd")]
[assembly: AssemblyProduct("Mios.Payment")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("90888035-e560-4ab7-bcc5-c88aee09f29b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
|
bsd-2-clause
|
C#
|
de364b80e7e15277bbf1285e1402731ff9ad1b97
|
Fix for NullRecord serialization
|
neo4j/neo4j-dotnet-driver,neo4j/neo4j-dotnet-driver
|
Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/ResultNext.cs
|
Neo4j.Driver/Neo4j.Driver.Tests.TestBackend/Protocol/ResultNext.cs
|
using System;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Neo4j.Driver;
using System.Linq;
namespace Neo4j.Driver.Tests.TestBackend
{
internal class ResultNext : IProtocolObject
{
public ResultNextType data { get; set; } = new ResultNextType();
[JsonIgnore]
public IRecord Records { get; set; }
public class ResultNextType
{
public string resultId { get; set; }
}
public override async Task Process()
{
try
{
var results = ((Result)ObjManager.GetObject(data.resultId)).Results;
if (await results.FetchAsync().ConfigureAwait(false))
Records = results.Current;
else
Records = null;
}
catch (Exception ex)
{
throw new Exception($"Failed to Process NewDriver protocol object, failed with - {ex.Message}");
}
}
public override string Response()
{
if (!(Records is null))
{
//Generate list of ordered records
var valuesList = Records.Keys.Select(v => NativeToCypher.Convert(Records[v]));
return new Response("Record", new { values = valuesList }).Encode();
}
else
{
return new Response("NullRecord", null).Encode();
}
}
}
}
|
using System;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Neo4j.Driver;
using System.Linq;
namespace Neo4j.Driver.Tests.TestBackend
{
internal class ResultNext : IProtocolObject
{
public ResultNextType data { get; set; } = new ResultNextType();
[JsonIgnore]
public IRecord Records { get; set; }
public class ResultNextType
{
public string resultId { get; set; }
}
public override async Task Process()
{
try
{
var results = ((Result)ObjManager.GetObject(data.resultId)).Results;
if (await results.FetchAsync().ConfigureAwait(false))
Records = results.Current;
else
Records = null;
}
catch (Exception ex)
{
throw new Exception($"Failed to Process NewDriver protocol object, failed with - {ex.Message}");
}
}
public override string Response()
{
if (!(Records is null))
{
//Generate list of ordered records
var valuesList = Records.Keys.Select(v => NativeToCypher.Convert(Records[v]));
return new Response("Record", new { values = valuesList }).Encode();
}
else
{
return new Response("NullRecord", new {}).Encode();
}
}
}
}
|
apache-2.0
|
C#
|
aa51a59e22a117962cbc57aa1498d8cfa5e6ed06
|
Fix foreign key violation
|
tpkelly/voting-application,stevenhillcox/voting-application,JDawes-ScottLogic/voting-application,JDawes-ScottLogic/voting-application,stevenhillcox/voting-application,Generic-Voting-Application/voting-application,JDawes-ScottLogic/voting-application,Generic-Voting-Application/voting-application,Generic-Voting-Application/voting-application,stevenhillcox/voting-application,tpkelly/voting-application,tpkelly/voting-application
|
VotingApplication/VotingApplication.Data/Model/Vote.cs
|
VotingApplication/VotingApplication.Data/Model/Vote.cs
|
using System;
namespace VotingApplication.Data.Model
{
public class Vote
{
public long Id { get; set; }
public long OptionId { get; set; }
public Option Option { get; set; }
public int VoteValue { get; set; }
public String VoterName { get; set; }
public Guid PollId { get; set; }
public Poll Poll { get; set; }
public long TokenId { get; set; }
public Token Token { get; set; }
}
}
|
using System;
namespace VotingApplication.Data.Model
{
public class Vote
{
public long Id { get; set; }
public long OptionId { get; set; }
public Option Option { get; set; }
public int VoteValue { get; set; }
public String VoterName { get; set; }
public Guid PollId { get; set; }
public Poll Poll { get; set; }
public Token Token { get; set; }
}
}
|
apache-2.0
|
C#
|
9b287749f36c17bde58112e54411f365f2d69574
|
Fix AssemblyTitle
|
MilenPavlov/PortableRazorStarterKit,MilenPavlov/PortableRazorStarterKit,xamarin/PortableRazorStarterKit,xamarin/PortableRazorStarterKit
|
PortableCongress/PortableCongress/Properties/AssemblyInfo.cs
|
PortableCongress/PortableCongress/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("PortableCongress")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("joseph")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("PortableRazordex")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("joseph")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
|
mit
|
C#
|
38df49995ce77e2176b491375144a80227579f58
|
Fix cursor scale not matching osu-stable
|
ppy/osu,peppy/osu-new,UselessToucan/osu,peppy/osu,smoogipooo/osu,johnneijzen/osu,ZLima12/osu,2yangk23/osu,EVAST9919/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,ppy/osu,smoogipoo/osu,ZLima12/osu,2yangk23/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,johnneijzen/osu,NeoAdonis/osu,peppy/osu,EVAST9919/osu
|
osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs
|
osu.Game.Rulesets.Osu/UI/OsuPlayfieldAdjustmentContainer.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Osu.UI
{
public class OsuPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer
{
protected override Container<Drawable> Content => content;
private readonly Container content;
private const float playfield_size_adjust = 0.8f;
public OsuPlayfieldAdjustmentContainer()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
// Calculated from osu!stable as 512 (default gamefield size) / 640 (default window size)
Size = new Vector2(playfield_size_adjust);
InternalChild = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
FillAspectRatio = 4f / 3,
Child = content = new ScalingContainer { RelativeSizeAxes = Axes.Both }
};
}
/// <summary>
/// A <see cref="Container"/> which scales its content relative to a target width.
/// </summary>
private class ScalingContainer : Container
{
protected override void Update()
{
base.Update();
// The following calculation results in a constant of 1.6 when OsuPlayfieldAdjustmentContainer
// is consuming the full game_size. This matches the osu-stable "magic ratio".
//
// game_size = DrawSizePreservingFillContainer.TargetSize = new Vector2(1024, 768)
//
// Parent is a 4:3 aspect enforced, using height as the constricting dimension
// Parent.ChildSize.X = min(game_size.X, game_size.Y * (4 / 3)) * playfield_size_adjust
// Parent.ChildSize.X = 819.2
//
// Scale = 819.2 / 512
// Scale = 1.6
Scale = new Vector2(Parent.ChildSize.X / OsuPlayfield.BASE_SIZE.X);
// Size = 0.625
Size = Vector2.Divide(Vector2.One, Scale);
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Osu.UI
{
public class OsuPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer
{
protected override Container<Drawable> Content => content;
private readonly Container content;
public OsuPlayfieldAdjustmentContainer()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
// Calculated from osu!stable as 512 (default gamefield size) / 640 (default window size)
Size = new Vector2(0.8f);
InternalChild = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
FillAspectRatio = 4f / 3,
Child = content = new ScalingContainer { RelativeSizeAxes = Axes.Both }
};
}
/// <summary>
/// A <see cref="Container"/> which scales its content relative to a target width.
/// </summary>
private class ScalingContainer : Container
{
protected override void Update()
{
base.Update();
Scale = new Vector2(Parent.ChildSize.X / OsuPlayfield.BASE_SIZE.X);
Size = Vector2.Divide(Vector2.One, Scale);
}
}
}
}
|
mit
|
C#
|
9a8f1e0a411322a73233e810a861b8dd6d51def9
|
update IWorkersAsyncService
|
army-of-two/when-its-done,army-of-two/when-its-done,army-of-two/when-its-done
|
WhenItsDone/Lib/WhenItsDone.Services/Contracts/IWorkersAsyncService.cs
|
WhenItsDone/Lib/WhenItsDone.Services/Contracts/IWorkersAsyncService.cs
|
using System.Collections.Generic;
using WhenItsDone.Models;
namespace WhenItsDone.Services.Contracts
{
public interface IWorkersAsyncService : IGenericAsyncService<Worker>
{
IEnumerable<Worker> GetWorkersWithDIshes();
}
}
|
using WhenItsDone.Models;
namespace WhenItsDone.Services.Contracts
{
public interface IWorkersAsyncService : IGenericAsyncService<Worker>
{
}
}
|
mit
|
C#
|
5d495ee3b96e60b740fd26aef306577b2247b683
|
Remove redundant default constructor from ErrorDialogDisplayAction
|
ethanmoffat/EndlessClient
|
EndlessClient/Dialogs/Actions/ErrorDialogDisplayAction.cs
|
EndlessClient/Dialogs/Actions/ErrorDialogDisplayAction.cs
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using System;
using EOLib;
using EOLib.Data.Protocol;
using EOLib.Net.Communication;
namespace EndlessClient.Dialogs.Actions
{
public class ErrorDialogDisplayAction : IErrorDialogDisplayAction
{
public void ShowError(ConnectResult connectResult)
{
switch (connectResult)
{
case ConnectResult.Timeout:
case ConnectResult.InvalidEndpoint:
case ConnectResult.InvalidSocket:
case ConnectResult.SocketError:
EOMessageBox.Show(DATCONST1.CONNECTION_SERVER_NOT_FOUND);
break;
default: throw new ArgumentOutOfRangeException();
}
}
public void ShowError(IInitializationData initializationData)
{
switch (initializationData.Response)
{
case InitReply.ClientOutOfDate:
{
var versionNumber = initializationData[InitializationDataKey.RequiredVersionNumber];
var extra = string.Format(" 0.000.0{0}", versionNumber);
EOMessageBox.Show(DATCONST1.CONNECTION_CLIENT_OUT_OF_DATE, extra);
}
break;
case InitReply.BannedFromServer:
{
var banType = (BanType) initializationData[InitializationDataKey.BanType];
if (banType == BanType.PermanentBan)
EOMessageBox.Show(DATCONST1.CONNECTION_IP_BAN_PERM);
else if (banType == BanType.TemporaryBan)
{
var banMinutesRemaining = initializationData[InitializationDataKey.BanTimeRemaining];
var extra = string.Format(" {0} minutes.", banMinutesRemaining);
EOMessageBox.Show(DATCONST1.CONNECTION_IP_BAN_TEMP, extra);
}
}
break;
case InitReply.ErrorState:
ShowError(ConnectResult.SocketError);
break;
default: throw new ArgumentOutOfRangeException();
}
}
}
}
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using System;
using EOLib;
using EOLib.Data.Protocol;
using EOLib.Net.Communication;
namespace EndlessClient.Dialogs.Actions
{
public class ErrorDialogDisplayAction : IErrorDialogDisplayAction
{
public ErrorDialogDisplayAction()
{
}
public void ShowError(ConnectResult connectResult)
{
switch (connectResult)
{
case ConnectResult.Timeout:
case ConnectResult.InvalidEndpoint:
case ConnectResult.InvalidSocket:
case ConnectResult.SocketError:
EOMessageBox.Show(DATCONST1.CONNECTION_SERVER_NOT_FOUND);
break;
default: throw new ArgumentOutOfRangeException();
}
}
public void ShowError(IInitializationData initializationData)
{
switch (initializationData.Response)
{
case InitReply.ClientOutOfDate:
{
var versionNumber = initializationData[InitializationDataKey.RequiredVersionNumber];
var extra = string.Format(" 0.000.0{0}", versionNumber);
EOMessageBox.Show(DATCONST1.CONNECTION_CLIENT_OUT_OF_DATE, extra);
}
break;
case InitReply.BannedFromServer:
{
var banType = (BanType) initializationData[InitializationDataKey.BanType];
if (banType == BanType.PermanentBan)
EOMessageBox.Show(DATCONST1.CONNECTION_IP_BAN_PERM);
else if (banType == BanType.TemporaryBan)
{
var banMinutesRemaining = initializationData[InitializationDataKey.BanTimeRemaining];
var extra = string.Format(" {0} minutes.", banMinutesRemaining);
EOMessageBox.Show(DATCONST1.CONNECTION_IP_BAN_TEMP, extra);
}
}
break;
case InitReply.ErrorState:
ShowError(ConnectResult.SocketError);
break;
default: throw new ArgumentOutOfRangeException();
}
}
}
}
|
mit
|
C#
|
f90af21790778778a7522d876b60ea676a243af3
|
Fix Visualizer FillRect implementation
|
verybadcat/CSharpMath
|
CSharpMath.Editor.Tests.Visualizer/GraphicsContext.cs
|
CSharpMath.Editor.Tests.Visualizer/GraphicsContext.cs
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using CSharpMath.Display;
using CSharpMath.CoreTests.FrontEnd;
namespace CSharpMath.Editor.Tests.Visualizer {
public class GraphicsContext : Display.FrontEnd.IGraphicsContext<TestFont, char> {
readonly Stack<PointF> stack = new Stack<PointF>();
PointF trans = new PointF();
public void DrawGlyphRunWithOffset(AttributedGlyphRun<TestFont, char> text,
PointF point, Structures.Color? color) {
var advance = 0.0;
foreach (var ((glyph, kernAfter, foreground), bounds) in
text.GlyphInfos.Zip(
TestTypesettingContexts.Instance.GlyphBoundsProvider
.GetBoundingRectsForGlyphs(text.Font, text.Glyphs, text.Length
), ValueTuple.Create)) {
Checker.ConsoleDrawRectangle(
new Rectangle((int)(point.X + trans.X + advance),
(int)(point.Y + trans.Y), (int)bounds.Width, (int)bounds.Height),
glyph, foreground ?? color);
advance += bounds.Width + kernAfter;
}
}
public void DrawGlyphsAtPoints(IReadOnlyList<char> glyphs,
TestFont font, IEnumerable<PointF> points, Structures.Color? color) {
var zipped = glyphs.Zip(points, ValueTuple.Create);
var bounds = TestTypesettingContexts.Instance.GlyphBoundsProvider
.GetBoundingRectsForGlyphs(font, glyphs, glyphs.Count);
foreach (var ((glyph, point), bound) in zipped.Zip(bounds, ValueTuple.Create)) {
Checker.ConsoleDrawRectangle(
new Rectangle((int)(point.X + trans.X), (int)(point.Y + trans.Y),
(int)bound.Width, (int)bound.Height),
glyph, color
);
}
}
public void FillRect(Rectangle rect, Structures.Color color) =>
Checker.ConsoleFillRectangle(new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height), color);
public void DrawLine
(float x1, float y1, float x2, float y2, float strokeWidth, Structures.Color? color) {
if (y1 != y2) throw new NotImplementedException("Non-horizontal lines currently not supported");
if (!Checker.OutputLines) return;
Checker.ConsoleDrawHorizontal((int)(x1 + trans.X), (int)(y1 + trans.Y), (int)(x2 + trans.X),
(int)MathF.Round(strokeWidth) /* e.g. for \frac, strokeWidth = 0.8 */, color);
}
public void RestoreState() => trans = stack.Pop();
public void SaveState() => stack.Push(trans);
public void SetTextPosition(PointF position) => trans = trans.Plus(position);
public void Translate(PointF dxy) => trans = trans.Plus(dxy);
}
}
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using CSharpMath.Display;
using CSharpMath.CoreTests.FrontEnd;
namespace CSharpMath.Editor.Tests.Visualizer {
public class GraphicsContext : Display.FrontEnd.IGraphicsContext<TestFont, char> {
readonly Stack<PointF> stack = new Stack<PointF>();
PointF trans = new PointF();
public void DrawGlyphRunWithOffset(AttributedGlyphRun<TestFont, char> text,
PointF point, Structures.Color? color) {
var advance = 0.0;
foreach (var ((glyph, kernAfter, foreground), bounds) in
text.GlyphInfos.Zip(
TestTypesettingContexts.Instance.GlyphBoundsProvider
.GetBoundingRectsForGlyphs(text.Font, text.Glyphs, text.Length
), ValueTuple.Create)) {
Checker.ConsoleDrawRectangle(
new Rectangle((int)(point.X + trans.X + advance),
(int)(point.Y + trans.Y), (int)bounds.Width, (int)bounds.Height),
glyph, foreground ?? color);
advance += bounds.Width + kernAfter;
}
}
public void DrawGlyphsAtPoints(IReadOnlyList<char> glyphs,
TestFont font, IEnumerable<PointF> points, Structures.Color? color) {
var zipped = glyphs.Zip(points, ValueTuple.Create);
var bounds = TestTypesettingContexts.Instance.GlyphBoundsProvider
.GetBoundingRectsForGlyphs(font, glyphs, glyphs.Count);
foreach (var ((glyph, point), bound) in zipped.Zip(bounds, ValueTuple.Create)) {
Checker.ConsoleDrawRectangle(
new Rectangle((int)(point.X + trans.X), (int)(point.Y + trans.Y),
(int)bound.Width, (int)bound.Height),
glyph, color
);
}
}
public void FillRect(Rectangle rect, Structures.Color color) => Checker.ConsoleFillRectangle(rect, color);
public void DrawLine
(float x1, float y1, float x2, float y2, float strokeWidth, Structures.Color? color) {
if (y1 != y2) throw new NotImplementedException("Non-horizontal lines currently not supported");
if (!Checker.OutputLines) return;
Checker.ConsoleDrawHorizontal((int)(x1 + trans.X), (int)(y1 + trans.Y), (int)(x2 + trans.X),
(int)MathF.Round(strokeWidth) /* e.g. for \frac, strokeWidth = 0.8 */, color);
}
public void RestoreState() => trans = stack.Pop();
public void SaveState() => stack.Push(trans);
public void SetTextPosition(PointF position) => trans = trans.Plus(position);
public void Translate(PointF dxy) => trans = trans.Plus(dxy);
}
}
|
mit
|
C#
|
44c7f77dbc2fae14932b38a5a4e676fd9f2ec96d
|
Replace Property with Method
|
arfbtwn/banshee,arfbtwn/banshee,arfbtwn/banshee,arfbtwn/banshee,arfbtwn/banshee,Carbenium/banshee,arfbtwn/banshee,Carbenium/banshee,Carbenium/banshee,arfbtwn/banshee,Carbenium/banshee,Carbenium/banshee,arfbtwn/banshee,Carbenium/banshee
|
src/Extensions/Banshee.NotificationArea/Notifications/Notifications.cs
|
src/Extensions/Banshee.NotificationArea/Notifications/Notifications.cs
|
/*
* Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
*
* 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.
*/
#if INTERNAL_NOTIFY_SHARP
using System;
using System.Collections.Generic;
using DBus;
using org.freedesktop;
using org.freedesktop.DBus;
namespace Notifications {
[Interface ("org.freedesktop.Notifications")]
internal interface INotifications : Introspectable, Properties {
ServerInformation ServerInformation { get; }
string[] GetCapabilities ();
void CloseNotification (uint id);
uint Notify (string app_name, uint id, string icon, string summary, string body,
string[] actions, IDictionary<string, object> hints, int timeout);
event NotificationClosedHandler NotificationClosed;
event ActionInvokedHandler ActionInvoked;
}
public enum CloseReason : uint {
Expired = 1,
User = 2,
API = 3,
Reserved = 4
}
internal delegate void NotificationClosedHandler (uint id, uint reason);
internal delegate void ActionInvokedHandler (uint id, string action);
public struct ServerInformation {
public string Name;
public string Vendor;
public string Version;
public string SpecVersion;
}
public static class Global {
private const string interface_name = "org.freedesktop.Notifications";
private const string object_path = "/org/freedesktop/Notifications";
private static INotifications dbus_object = null;
private static object dbus_object_lock = new object ();
internal static INotifications DBusObject {
get {
if (dbus_object != null)
return dbus_object;
lock (dbus_object_lock) {
if (! Bus.Session.NameHasOwner (interface_name))
Bus.Session.StartServiceByName (interface_name);
dbus_object = Bus.Session.GetObject<INotifications>
(interface_name, new ObjectPath (object_path));
return dbus_object;
}
}
}
public static string[] Capabilities {
get {
return DBusObject.GetCapabilities ();
}
}
public static ServerInformation ServerInformation {
get {
return DBusObject.ServerInformation;
}
}
}
}
#endif
|
/*
* Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
*
* 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.
*/
#if INTERNAL_NOTIFY_SHARP
using System;
using System.Collections.Generic;
using DBus;
using org.freedesktop;
using org.freedesktop.DBus;
namespace Notifications {
[Interface ("org.freedesktop.Notifications")]
internal interface INotifications : Introspectable, Properties {
ServerInformation ServerInformation { get; }
string[] Capabilities { get; }
void CloseNotification (uint id);
uint Notify (string app_name, uint id, string icon, string summary, string body,
string[] actions, IDictionary<string, object> hints, int timeout);
event NotificationClosedHandler NotificationClosed;
event ActionInvokedHandler ActionInvoked;
}
public enum CloseReason : uint {
Expired = 1,
User = 2,
API = 3,
Reserved = 4
}
internal delegate void NotificationClosedHandler (uint id, uint reason);
internal delegate void ActionInvokedHandler (uint id, string action);
public struct ServerInformation {
public string Name;
public string Vendor;
public string Version;
public string SpecVersion;
}
public static class Global {
private const string interface_name = "org.freedesktop.Notifications";
private const string object_path = "/org/freedesktop/Notifications";
private static INotifications dbus_object = null;
private static object dbus_object_lock = new object ();
internal static INotifications DBusObject {
get {
if (dbus_object != null)
return dbus_object;
lock (dbus_object_lock) {
if (! Bus.Session.NameHasOwner (interface_name))
Bus.Session.StartServiceByName (interface_name);
dbus_object = Bus.Session.GetObject<INotifications>
(interface_name, new ObjectPath (object_path));
return dbus_object;
}
}
}
public static string[] Capabilities {
get {
return DBusObject.Capabilities;
}
}
public static ServerInformation ServerInformation {
get {
return DBusObject.ServerInformation;
}
}
}
}
#endif
|
mit
|
C#
|
db4491f4829d32beef87bbd1c3c226e02e21f617
|
Work v1.1.2 GetCheckinDataJsonResult 修改 checkindata 属性名称
|
JeffreySu/WeiXinMPSDK,down4u/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,down4u/WeiXinMPSDK,mc7246/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,mc7246/WeiXinMPSDK,lishewen/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,mc7246/WeiXinMPSDK,lishewen/WeiXinMPSDK,lishewen/WeiXinMPSDK,down4u/WeiXinMPSDK,jiehanlin/WeiXinMPSDK
|
src/Senparc.Weixin.Work/Senparc.Weixin.Work/Properties/AssemblyInfo.cs
|
src/Senparc.Weixin.Work/Senparc.Weixin.Work/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Senparc.Weixin.Work")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Senparc.Weixin.Work")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("2089f9fd-353b-40db-832b-36144b6a9010")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.2.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Senparc.Weixin.Work")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Senparc.Weixin.Work")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("2089f9fd-353b-40db-832b-36144b6a9010")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
a3b9912b1a1ce7ac67533b81b072f4bc9af2a71d
|
Make GlyphVector a readonly struct
|
SixLabors/Fonts
|
src/SixLabors.Fonts/Tables/General/Glyphs/GlyphVector.cs
|
src/SixLabors.Fonts/Tables/General/Glyphs/GlyphVector.cs
|
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
namespace SixLabors.Fonts.Tables.General.Glyphs
{
internal readonly struct GlyphVector
{
internal GlyphVector(Vector2[] controlPoints, bool[] onCurves, ushort[] endPoints, Bounds bounds)
{
this.ControlPoints = controlPoints;
this.OnCurves = onCurves;
this.EndPoints = endPoints;
this.Bounds = bounds;
}
public int PointCount => this.ControlPoints.Length;
public Vector2[] ControlPoints { get; }
public ushort[] EndPoints { get; }
public bool[] OnCurves { get; }
public Bounds Bounds { get; }
}
}
|
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
namespace SixLabors.Fonts.Tables.General.Glyphs
{
internal struct GlyphVector
{
internal GlyphVector(Vector2[] controlPoints, bool[] onCurves, ushort[] endPoints, Bounds bounds)
{
this.ControlPoints = controlPoints;
this.OnCurves = onCurves;
this.EndPoints = endPoints;
this.Bounds = bounds;
}
public int PointCount => this.ControlPoints.Length;
public Vector2[] ControlPoints { get; private set; }
public ushort[] EndPoints { get; private set; }
public bool[] OnCurves { get; private set; }
public Bounds Bounds { get; private set; }
}
}
|
apache-2.0
|
C#
|
cbf1d292ddc471f9c6f0b96efad9866e175adc74
|
Use IAsyncContextResolver for the type of the async context resolver object.
|
telerik/JustMockLite
|
Telerik.JustMock/Core/Context/AsyncContextResolver.cs
|
Telerik.JustMock/Core/Context/AsyncContextResolver.cs
|
namespace Telerik.JustMock.Core.Context
{
public static class AsyncContextResolver
{
#if NETCORE
static IAsyncContextResolver resolver = new AsyncLocalWrapper();
#else
static IAsyncContextResolver resolver = new CallContextWrapper();
#endif
public static IAsyncContextResolver GetResolver()
{
return resolver;
}
public static void CaptureContext()
{
resolver.CaptureContext();
}
}
}
|
namespace Telerik.JustMock.Core.Context
{
public static class AsyncContextResolver
{
#if NETCORE
static AsyncLocalWrapper resolver = new AsyncLocalWrapper();
#else
static CallContextWrapper resolver = new CallContextWrapper();
#endif
public static IAsyncContextResolver GetResolver()
{
return resolver;
}
public static void CaptureContext()
{
resolver.CaptureContext();
}
}
}
|
apache-2.0
|
C#
|
bc8370b8167b5206a765411e51b20033c4692177
|
Use 'nameof' when throwing ArgumentOutOfRangeException
|
mysticfall/Alensia
|
Assets/Alensia/Core/Common/Axis.cs
|
Assets/Alensia/Core/Common/Axis.cs
|
using System;
using UnityEngine;
using UnityEngine.Assertions;
namespace Alensia.Core.Common
{
public enum Axis
{
X,
Y,
Z,
InverseX,
InverseY,
InverseZ
}
public static class AxisExtensions
{
public static Vector3 Of(this Axis axis, Transform transform)
{
Assert.IsNotNull(transform, "transform != null");
switch (axis)
{
case Axis.X:
return transform.right;
case Axis.Y:
return transform.up;
case Axis.Z:
return transform.forward;
case Axis.InverseX:
return transform.right * -1;
case Axis.InverseY:
return transform.up * -1;
case Axis.InverseZ:
return transform.forward * -1;
default:
throw new ArgumentOutOfRangeException(nameof(axis));
}
}
public static Vector3 Direction(this Axis axis)
{
switch (axis)
{
case Axis.X:
return Vector3.right;
case Axis.Y:
return Vector3.up;
case Axis.Z:
return Vector3.forward;
case Axis.InverseX:
return Vector3.right * -1;
case Axis.InverseY:
return Vector3.up * -1;
case Axis.InverseZ:
return Vector3.forward * -1;
default:
throw new ArgumentOutOfRangeException(nameof(axis));
}
}
}
}
|
using System;
using UnityEngine;
using UnityEngine.Assertions;
namespace Alensia.Core.Common
{
public enum Axis
{
X,
Y,
Z,
InverseX,
InverseY,
InverseZ
}
public static class AxisExtensions
{
public static Vector3 Of(this Axis axis, Transform transform)
{
Assert.IsNotNull(transform, "transform != null");
switch (axis)
{
case Axis.X:
return transform.right;
case Axis.Y:
return transform.up;
case Axis.Z:
return transform.forward;
case Axis.InverseX:
return transform.right * -1;
case Axis.InverseY:
return transform.up * -1;
case Axis.InverseZ:
return transform.forward * -1;
default:
throw new ArgumentOutOfRangeException();
}
}
public static Vector3 Direction(this Axis axis)
{
switch (axis)
{
case Axis.X:
return Vector3.right;
case Axis.Y:
return Vector3.up;
case Axis.Z:
return Vector3.forward;
case Axis.InverseX:
return Vector3.right * -1;
case Axis.InverseY:
return Vector3.up * -1;
case Axis.InverseZ:
return Vector3.forward * -1;
default:
throw new ArgumentOutOfRangeException();
}
}
}
}
|
apache-2.0
|
C#
|
2acc062f3c756470b2c976c5e194f88a9df46c17
|
Update FancyItemStorage.cs
|
fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation
|
UnityProject/Assets/Scripts/Inventory/FancyItemStorage.cs
|
UnityProject/Assets/Scripts/Inventory/FancyItemStorage.cs
|
using Mirror;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
/// <summary>
/// The 'fancy' component defines objects like donut boxes, egg boxes or cigs packets
/// that show how many items are in the ItemStorage on the sprite itself
///
/// Need to have ItemStorage component on a same gameobject
/// </summary>
[RequireComponent(typeof(ItemStorage))]
public class FancyItemStorage : NetworkBehaviour
{
public SpriteHandler spriteHandler;
[Tooltip("Sprite for each objects count inside container")]
public Sprite[] spritesByCount;
private ItemStorage storage;
private Pickupable pickupable;
[SyncVar(hook = "OnObjectsCountChanged")]
private int objectsInsideCount;
private void Awake()
{
pickupable = GetComponent<Pickupable>();
}
[ServerCallback]
private void Start()
{
// get ItemStorage on a same object
storage = GetComponent<ItemStorage>();
if (!storage)
{
Logger.LogError($"FancyItemStorage on {gameObject.name} can't find ItemStorage component!", Category.Containers);
return;
}
// get all slots and subscribe if any slot changed
var allSlots = storage.GetItemSlots();
foreach (var slot in allSlots)
{
slot.OnSlotContentsChangeServer.AddListener(OnStorageChanged);
}
// calculate occupied slots count
objectsInsideCount = allSlots.Count((s) => s.IsOccupied);
}
private void OnObjectsCountChanged(int oldVal, int objectsCount)
{
if (!spriteHandler || spritesByCount == null
|| spritesByCount.Length == 0)
{
return;
}
// select new sprite for container
Sprite newSprite;
if (objectsCount < spritesByCount.Length)
{
newSprite = spritesByCount[objectsCount];
}
else
{
newSprite = spritesByCount.Last();
}
if (newSprite)
{
// apply it to sprite handler
spriteHandler.SetSprite(newSprite);
// try to update in-hand sprite
pickupable?.RefreshUISlotImage();
}
}
[Server]
private void OnStorageChanged()
{
// recalculate occupied slots count and send to client
var allSlots = storage.GetItemSlots();
objectsInsideCount = allSlots.Count((s) => s.IsOccupied);
}
}
|
using Mirror;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
/// <summary>
/// The 'fancy' component defines objects like donut boxes, egg boxes or cigs packets
/// that show how many items are in the ItemStorage on the sprite itself
///
/// Need to have ItemStorage component on a same gameobject
/// </summary>
[RequireComponent(typeof(ItemStorage))]
public class FancyItemStorage : NetworkBehaviour
{
public SpriteHandler spriteHandler;
[Tooltip("Sprite for each objects count inside container")]
public Sprite[] spritesByCount;
private ItemStorage storage;
[SyncVar(hook = "OnObjectsCountChanged")]
private int objectsInsideCount;
[ServerCallback]
private void Start()
{
// get ItemStorage on a same object
storage = GetComponent<ItemStorage>();
if (!storage)
{
Logger.LogError($"FancyItemStorage on {gameObject.name} can't find ItemStorage component!", Category.Containers);
return;
}
// get all slots and subscribe if any slot changed
var allSlots = storage.GetItemSlots();
foreach (var slot in allSlots)
{
slot.OnSlotContentsChangeServer.AddListener(OnStorageChanged);
}
// calculate occupied slots count
objectsInsideCount = allSlots.Count((s) => s.IsOccupied);
}
private void OnObjectsCountChanged(int oldVal, int objectsCount)
{
if (!spriteHandler || spritesByCount == null
|| spritesByCount.Length == 0)
{
return;
}
// select new sprite for container
Sprite newSprite;
if (objectsCount < spritesByCount.Length)
{
newSprite = spritesByCount[objectsCount];
}
else
{
newSprite = spritesByCount.Last();
}
// apply it to sprite handler
spriteHandler.SetSprite(newSprite);
}
[Server]
private void OnStorageChanged()
{
// recalculate occupied slots count and send to client
var allSlots = storage.GetItemSlots();
objectsInsideCount = allSlots.Count((s) => s.IsOccupied);
}
}
|
agpl-3.0
|
C#
|
1442db16001bf5a703f4b699a6ff8f728e87dc13
|
Clean out debug code
|
rusticgames/rts,rusticgames/rts
|
Assets/Scripts/ConstrainedMover.cs
|
Assets/Scripts/ConstrainedMover.cs
|
using UnityEngine;
using System.Collections;
public class ConstrainedMover : MonoBehaviour {
public float speed = 1.0f;
public float constraintRadius = 3.0f;
private Vector3 constraintCenter;
void Start() {
constraintCenter = transform.position;
}
void Update() {
Vector3 newPosition = constraintCenter;
newPosition.x += Input.GetAxis("Horizontal") * constraintRadius;
newPosition.y += Input.GetAxis("Vertical") * constraintRadius;
transform.position = newPosition;
}
void OnDrawGizmosSelected() {
Gizmos.color = Color.green;
Gizmos.DrawWireSphere(constraintCenter, constraintRadius);
}
}
|
using UnityEngine;
using System.Collections;
public class ConstrainedMover : MonoBehaviour {
public float speed = 1.0f;
public float constraintRadius = 3.0f;
private Vector3 constraintCenter;
void Start() {
constraintCenter = transform.position;
}
void Update() {
Vector3 newPosition = constraintCenter;
newPosition.x += Input.GetAxis("Horizontal") * constraintRadius;
newPosition.y += Input.GetAxis("Vertical") * constraintRadius;
transform.position = newPosition;
Debug.Log (Input.GetAxis("Horizontal") + " (" + newPosition.x + ")" + ", " + Input.GetAxis("Vertical") + " (" + newPosition.y + ")");
// Vector3 normalizedPosition = Vector3.Normalize(newPosition);
// transform.position = normalizedPosition;
}
void OnDrawGizmosSelected() {
Gizmos.color = Color.green;
Gizmos.DrawWireSphere(constraintCenter, constraintRadius);
}
}
|
mit
|
C#
|
0c9786bc5c6b8ec1e0209965ab6cb5e768054f63
|
Fix .
|
exKAZUu/Code2Xml,exKAZUu/Code2Xml,exKAZUu/Code2Xml,exKAZUu/Code2Xml
|
Code2Xml.Core/Code2XmlConstants.cs
|
Code2Xml.Core/Code2XmlConstants.cs
|
#region License
// Copyright (C) 2011-2014 Kazunori Sakamoto
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
namespace Code2Xml.Core {
public class Code2XmlConstants {
public const string SyntaxTreeCacheExtension = ".cached_xml";
public const string LearningCacheExtension = ".learning_cache_10_feature_count";
public const string DependenciesDirectoryName = "Dependencies";
public const string EofTokenName = "EOF";
public const string EofRuleId = "EOF";
public const string DefaultRuleId = "-1";
public const string DefaultHiddenRuleId = "-2";
public const string StartLineName = "startline";
public const string StartPositionName = "startpos";
public const string EndLineName = "endline"; // Inclusive
public const string EndPositionName = "endpos"; // Inclusive
public const string HiddenAttributeName = "hidden";
public const string IdAttributeName = "id";
public const string TokenElementName = "TOKEN";
public const string HiddenElementName = "HIDDEN";
public const string TokenSetElementName = "TOKENS";
}
}
|
#region License
// Copyright (C) 2011-2014 Kazunori Sakamoto
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
namespace Code2Xml.Core {
public class Code2XmlConstants {
public const string SyntaxTreeCacheExtension = ".cached_xml";
public const string LearningCacheExtension = ".learning_cache_6_fix_lua_op";
public const string DependenciesDirectoryName = "Dependencies";
public const string EofTokenName = "EOF";
public const string EofRuleId = "EOF";
public const string DefaultRuleId = "-1";
public const string DefaultHiddenRuleId = "-2";
public const string StartLineName = "startline";
public const string StartPositionName = "startpos";
public const string EndLineName = "endline"; // Inclusive
public const string EndPositionName = "endpos"; // Inclusive
public const string HiddenAttributeName = "hidden";
public const string IdAttributeName = "id";
public const string TokenElementName = "TOKEN";
public const string HiddenElementName = "HIDDEN";
public const string TokenSetElementName = "TOKENS";
}
}
|
apache-2.0
|
C#
|
3e6db217d651e25f5f55f290131f6ebf91ef9eb8
|
Update Program.cs
|
ThomasKV/GitTest1
|
ConsoleApp1/ConsoleApp1/Program.cs
|
ConsoleApp1/ConsoleApp1/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
// This remark was inserted using GitHub
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
mit
|
C#
|
ced581cfbb9c087f39607c937e2182c32abc0cf8
|
Fix BGP Multipath withdraw decoding
|
mstrother/BmpListener
|
src/BmpListener/Bgp/PathAttributeMPUnreachNLRI.cs
|
src/BmpListener/Bgp/PathAttributeMPUnreachNLRI.cs
|
using BmpListener.MiscUtil.Conversion;
using System;
using System.Collections.Generic;
using System.Linq;
namespace BmpListener.Bgp
{
public class PathAttributeMPUnreachNLRI : PathAttribute
{
public AddressFamily AFI { get; private set; }
public SubsequentAddressFamily SAFI { get; private set; }
public IList<IPAddrPrefix> WithdrawnRoutes { get; } = new List<IPAddrPrefix>();
public override void Decode(byte[] data, int offset)
{
AFI = (AddressFamily)EndianBitConverter.Big.ToInt16(data, offset);
offset++;
SAFI = (SubsequentAddressFamily)data.ElementAt(offset);
offset++;
for (var i = 3; i < Length;)
{
(IPAddrPrefix prefix, int byteLength) = IPAddrPrefix.Decode(data, offset + i, AFI);
WithdrawnRoutes.Add(prefix);
offset += byteLength;
i += byteLength;
}
}
}
}
|
using BmpListener.MiscUtil.Conversion;
using System;
using System.Collections.Generic;
using System.Linq;
namespace BmpListener.Bgp
{
public class PathAttributeMPUnreachNLRI : PathAttribute
{
public AddressFamily AFI { get; private set; }
public SubsequentAddressFamily SAFI { get; private set; }
public IList<IPAddrPrefix> WithdrawnRoutes { get; } = new List<IPAddrPrefix>();
public override void Decode(byte[] data, int offset)
{
AFI = (AddressFamily)EndianBitConverter.Big.ToInt16(data, offset);
SAFI = (SubsequentAddressFamily)data.ElementAt(offset + 2);
for (var i = 3; i < Length;)
{
(IPAddrPrefix prefix, int byteLength) = IPAddrPrefix.Decode(data, offset + i, AFI);
WithdrawnRoutes.Add(prefix);
offset += byteLength;
i += byteLength;
}
}
}
}
|
mit
|
C#
|
2b31ee2fc31130d1c16a53963aa84da7f6dd384e
|
Replace Theory with multiple Fact tests
|
robkeim/xcsharp,GKotfis/csharp,ErikSchierboom/xcsharp,ErikSchierboom/xcsharp,exercism/xcsharp,exercism/xcsharp,robkeim/xcsharp,GKotfis/csharp
|
exercises/acronym/AcronymTest.cs
|
exercises/acronym/AcronymTest.cs
|
using Xunit;
public class AcronymTest
{
[Fact]
public void Basic()
{
Assert.Equal("PNG", Acronym.Abbreviate("Portable Network Graphics"));
}
[Fact(Skip = "Remove to run test")]
public void Lowercase_words()
{
Assert.Equal("ROR", Acronym.Abbreviate("Ruby on Rails"));
}
[Fact(Skip = "Remove to run test")]
public void Camelcase()
{
Assert.Equal("HTML", Acronym.Abbreviate("HyperText Markup Language"));
}
[Fact(Skip = "Remove to run test")]
public void Punctuation()
{
Assert.Equal("FIFO", Acronym.Abbreviate("First In, First Out"));
}
[Fact(Skip = "Remove to run test")]
public void All_caps_words()
{
Assert.Equal("PHP", Acronym.Abbreviate("PHP: Hypertext Preprocessor"));
}
[Fact(Skip = "Remove to run test")]
public void NonAcronymAllCapsWord()
{
Assert.Equal("GIMP", Acronym.Abbreviate("GNU Image Manipulation Program"));
}
[Fact(Skip = "Remove to run test")]
public void Hyphenated()
{
Assert.Equal("CMOS", Acronym.Abbreviate("Complementary metal-oxide semiconductor"));
}
}
|
using Xunit;
public class AcronymTest
{
[Fact]
public void Empty_string_abbreviated_to_empty_string()
{
Assert.Equal(string.Empty, Acronym.Abbreviate(string.Empty));
}
[Theory(Skip = "Remove to run test")]
[InlineData("Portable Network Graphics", "PNG")]
[InlineData("Ruby on Rails", "ROR")]
[InlineData("HyperText Markup Language", "HTML")]
[InlineData("First In, First Out", "FIFO")]
[InlineData("PHP: Hypertext Preprocessor", "PHP")]
[InlineData("Complementary metal-oxide semiconductor", "CMOS")]
public void Phrase_abbreviated_to_acronym(string phrase, string expected)
{
Assert.Equal(expected, Acronym.Abbreviate(phrase));
}
}
|
mit
|
C#
|
6a8f62f814c8dd1780ca59d9d5bae9b5f30a632a
|
fix build
|
tparnell8/DotNetMashup,tparnell8/DotNetMashup,tparnell8/DotNetMashup
|
src/DotNetMashup.Web/Factory/RepositoryFactory.cs
|
src/DotNetMashup.Web/Factory/RepositoryFactory.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DotNetMashup.Web.Global;
using DotNetMashup.Web.Model;
using DotNetMashup.Web.Repositories;
using Microsoft.Framework.Caching.Memory;
using Microsoft.Framework.Configuration;
namespace DotNetMashup.Web.Factory
{
public class RepositoryFactory
{
private readonly IMemoryCache cache;
private List<IRepository> Repos;
private const string cacheKey = "data";
public RepositoryFactory(IEnumerable<IBlogMetaData> data, ISiteSetting setting, IMemoryCache cache, IConfiguration config)
{
if(data == null)
{
throw new ArgumentNullException("data");
}
if(setting == null)
{
throw new ArgumentNullException("setting");
}
if(cache == null)
{
throw new ArgumentNullException("cache");
}
Repos = new List<IRepository>()
{
new GitHubRepository(config),
new BlogPostRepository(data, setting),
new TwitterRepository(setting, config)
};
this.cache = cache;
}
public async Task<IEnumerable<IExternalData>> GetData()
{
var cachedData = this.cache.Get<IEnumerable<IExternalData>>(cacheKey);
if(cachedData != null && cachedData.Any()) return cachedData;
var tasks = Repos.Select(a => a.GetData());
await Task.WhenAll(tasks);
var result = tasks.SelectMany(a => a.Result).ToList();
cache.Set(cacheKey, result, new MemoryCacheEntryOptions { AbsoluteExpiration = DateTime.Now.AddHours(4) });
return result;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DotNetMashup.Web.Global;
using DotNetMashup.Web.Model;
using DotNetMashup.Web.Repositories;
using Microsoft.Framework.Caching.Memory;
using Microsoft.Framework.Configuration;
namespace DotNetMashup.Web.Factory
{
public class RepositoryFactory
{
private readonly IMemoryCache cache;
private List<IRepository> Repos;
private const string cacheKey = "data";
public RepositoryFactory(IEnumerable<IBlogMetaData> data, ISiteSetting setting, IMemoryCache cache, IConfiguration config)
{
if(data == null)
{
throw new ArgumentNullException("data");
}
if(setting == null)
{
throw new ArgumentNullException("setting");
}
if(cache == null)
{
throw new ArgumentNullException("cache");
}
Repos = new List<IRepository>()
{
new GitHubRepository(config),
new BlogPostRepository(data, setting),
new TwitterRepository(setting)
};
this.cache = cache;
}
public async Task<IEnumerable<IExternalData>> GetData()
{
var cachedData = this.cache.Get<IEnumerable<IExternalData>>(cacheKey);
if(cachedData != null && cachedData.Any()) return cachedData;
var tasks = Repos.Select(a => a.GetData());
await Task.WhenAll(tasks);
var result = tasks.SelectMany(a => a.Result).ToList();
cache.Set(cacheKey, result, new MemoryCacheEntryOptions { AbsoluteExpiration = DateTime.Now.AddHours(4) });
return result;
}
}
}
|
mit
|
C#
|
8cd16cbcf1cfd4b08bf08afcae5af349386fd605
|
Fix parent child index type
|
exceptionless/Foundatio.Repositories
|
src/Elasticsearch/Configuration/ChildIndexType.cs
|
src/Elasticsearch/Configuration/ChildIndexType.cs
|
using System;
namespace Foundatio.Repositories.Elasticsearch.Configuration {
public interface IChildIndexType : IIndexType {
string ParentPath { get; }
}
public interface IChildIndexType<T> : IChildIndexType {
string GetParentId(T document);
}
public class ChildIndexType<T> : IndexTypeBase<T>, IChildIndexType<T> where T : class {
protected readonly Func<T, string> _getParentId;
public ChildIndexType(string parentPath, Func<T, string> getParentId, string name = null, IIndex index = null): base(index, name) {
if (getParentId == null)
throw new ArgumentNullException(nameof(getParentId));
ParentPath = parentPath;
_getParentId = getParentId;
}
public string ParentPath { get; }
public virtual string GetParentId(T document) {
return _getParentId(document);
}
}
}
|
using System;
namespace Foundatio.Repositories.Elasticsearch.Configuration {
public interface IChildIndexType : IIndexType {
string ParentPath { get; }
}
public interface IChildIndexType<T> : IChildIndexType {
string GetParentId(T document);
}
public class ChildIndexType<T> : IndexTypeBase<T>, IChildIndexType<T> where T : class {
protected readonly Func<T, string> _getParentId;
public ChildIndexType(string parentPath, Func<T, string> getParentId, string name = null, IIndex index = null): base(index, name) {
if (_getParentId == null)
throw new ArgumentNullException(nameof(getParentId));
ParentPath = parentPath;
_getParentId = getParentId;
}
public string ParentPath { get; }
public virtual string GetParentId(T document) {
return _getParentId(document);
}
}
}
|
apache-2.0
|
C#
|
d8b1d5ef716b5692aa79b3e8aae173cdcc53004f
|
Replace Contains by IndexOf to build on .NET 1.1
|
fredericDelaporte/nhibernate-core,ngbrown/nhibernate-core,RogerKratz/nhibernate-core,lnu/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,alobakov/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,hazzik/nhibernate-core,alobakov/nhibernate-core,fredericDelaporte/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,ManufacturingIntelligence/nhibernate-core,livioc/nhibernate-core,gliljas/nhibernate-core,nkreipke/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,livioc/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,livioc/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,alobakov/nhibernate-core,nkreipke/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,lnu/nhibernate-core
|
src/NHibernate.Test/MappingExceptions/AddResourceFixture.cs
|
src/NHibernate.Test/MappingExceptions/AddResourceFixture.cs
|
using System;
using NHibernate.Cfg;
using NUnit.Framework;
namespace NHibernate.Test.MappingExceptions
{
/// <summary>
/// Summary description for AddResourceFixture.
/// </summary>
[TestFixture]
public class AddResourceFixture
{
[Test]
public void ResourceNotFound()
{
// add a resource that doesn't exist
string resource = "NHibernate.Test.MappingExceptions.A.DoesNotExists.hbm.xml";
Configuration cfg = new Configuration();
try
{
cfg.AddResource( resource, this.GetType().Assembly );
}
catch( MappingException me )
{
Assert.AreEqual( "Resource not found: " + resource, me.Message );
}
}
[Test]
public void AddDuplicateImport()
{
string resource = "NHibernate.Test.MappingExceptions.A.Valid.hbm.xml";
Configuration cfg = new Configuration();
try
{
// adding an import of "A" and then adding a class that has a
// name of "A" will cause a duplicate import problem. This can
// occur if two classes are in different namespaces but named the
// same and the auto-import attribute is not set to "false" for one
// of them.
cfg.Imports["A"] = "Some other class";
cfg.AddResource( resource, this.GetType().Assembly );
}
catch( MappingException me )
{
Assert.IsTrue( me.InnerException is MappingException );
Assert.AreEqual( "duplicate import: A", me.InnerException.Message );
}
}
[Test]
public void AddInvalidXml()
{
string resource = "NHibernate.Test.MappingExceptions.A.Invalid.hbm.xml";
string errorPosition = "(10,4)";
Configuration cfg = new Configuration();
try
{
cfg.AddResource( resource, this.GetType().Assembly );
Assert.Fail( "Should have thrown an exception" );
}
catch( MappingException me )
{
Assert.IsTrue( me.Message.IndexOf( resource + errorPosition ) >= 0 );
}
}
}
}
|
using System;
using NHibernate.Cfg;
using NUnit.Framework;
namespace NHibernate.Test.MappingExceptions
{
/// <summary>
/// Summary description for AddResourceFixture.
/// </summary>
[TestFixture]
public class AddResourceFixture
{
[Test]
public void ResourceNotFound()
{
// add a resource that doesn't exist
string resource = "NHibernate.Test.MappingExceptions.A.DoesNotExists.hbm.xml";
Configuration cfg = new Configuration();
try
{
cfg.AddResource( resource, this.GetType().Assembly );
}
catch( MappingException me )
{
Assert.AreEqual( "Resource not found: " + resource, me.Message );
}
}
[Test]
public void AddDuplicateImport()
{
string resource = "NHibernate.Test.MappingExceptions.A.Valid.hbm.xml";
Configuration cfg = new Configuration();
try
{
// adding an import of "A" and then adding a class that has a
// name of "A" will cause a duplicate import problem. This can
// occur if two classes are in different namespaces but named the
// same and the auto-import attribute is not set to "false" for one
// of them.
cfg.Imports["A"] = "Some other class";
cfg.AddResource( resource, this.GetType().Assembly );
}
catch( MappingException me )
{
Assert.IsTrue( me.InnerException is MappingException );
Assert.AreEqual( "duplicate import: A", me.InnerException.Message );
}
}
[Test]
public void AddInvalidXml()
{
string resource = "NHibernate.Test.MappingExceptions.A.Invalid.hbm.xml";
string errorPosition = "(10,4)";
Configuration cfg = new Configuration();
try
{
cfg.AddResource( resource, this.GetType().Assembly );
Assert.Fail( "Should have thrown an exception" );
}
catch( MappingException me )
{
Assert.IsTrue( me.Message.Contains( resource + errorPosition ) );
}
}
}
}
|
lgpl-2.1
|
C#
|
e3fb909607f23804854a2508b00fb3fa409fee30
|
Add parser test
|
Blue0500/JoshuaKearney.Measurements
|
src/JoshuaKearney.Measurements.Testing/Program.cs
|
src/JoshuaKearney.Measurements.Testing/Program.cs
|
using System;
using JoshuaKearney.Measurements;
using JoshuaKearney.Measurements.Parser;
using JoshuaKearney.Measurements.CsvConverters;
namespace JoshuaKearney.Measurements.Testing {
internal class Program {
public static void Main(string[] args) {
MeasurementParser<Density> parser = new MeasurementParser<Density>(Density.Provider);
Console.WriteLine(parser.Parse("8 * lb / [(3.1 m)**2 * ft]"));
Console.Read();
}
}
}
|
using System;
using JoshuaKearney.Measurements;
using JoshuaKearney.Measurements.Parser;
using JoshuaKearney.Measurements.CsvConverters;
namespace JoshuaKearney.Measurements.Testing {
internal class Program {
public static void Main(string[] args) {
Density d = null;
Ratio<Mass, Mass> a = null;
var q = d.DivideToRatio(a);
var x = new CsvAngleConverter();
MeasurementParser<Density> parser = new MeasurementParser<Density>(Density.Provider);
Console.WriteLine(parser.Parse("8 * lb / [(3.1 m)**2 * ft]"));
Console.Read();
}
}
}
|
mit
|
C#
|
5614c42ebf537def4ad397ace2aeda661c5913e9
|
Revert "Block Id in API responses"
|
coinfoundry/miningcore,coinfoundry/miningcore,coinfoundry/miningcore,coinfoundry/miningcore
|
src/Miningcore/Api/Responses/GetBlocksResponse.cs
|
src/Miningcore/Api/Responses/GetBlocksResponse.cs
|
/*
Copyright 2017 Coin Foundry (coinfoundry.org)
Authors: Oliver Weichhold (oliver@weichhold.com)
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 Miningcore.Api.Responses
{
public class Block
{
public string PoolId { get; set; }
public ulong BlockHeight { get; set; }
public double NetworkDifficulty { get; set; }
public string Status { get; set; }
public string Type { get; set; }
public double ConfirmationProgress { get; set; }
public double? Effort { get; set; }
public string TransactionConfirmationData { get; set; }
public decimal Reward { get; set; }
public string InfoLink { get; set; }
public string Hash { get; set; }
public string Miner { get; set; }
public string Source { get; set; }
public DateTime Created { get; set; }
}
}
|
/*
Copyright 2017 Coin Foundry (coinfoundry.org)
Authors: Oliver Weichhold (oliver@weichhold.com)
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 Miningcore.Api.Responses
{
public class Block
{
public string Id { get; set; }
public string PoolId { get; set; }
public ulong BlockHeight { get; set; }
public double NetworkDifficulty { get; set; }
public string Status { get; set; }
public string Type { get; set; }
public double ConfirmationProgress { get; set; }
public double? Effort { get; set; }
public string TransactionConfirmationData { get; set; }
public decimal Reward { get; set; }
public string InfoLink { get; set; }
public string Hash { get; set; }
public string Miner { get; set; }
public string Source { get; set; }
public DateTime Created { get; set; }
}
}
|
mit
|
C#
|
99a7beb17cc6208a72aa0bd3aa1f4b2cb9a76932
|
add DropTable method for mysql
|
borisdj/EFCore.BulkExtensions
|
EFCore.BulkExtensions/SQLAdapters/MySql/SqlQueryBuilderMySql.cs
|
EFCore.BulkExtensions/SQLAdapters/MySql/SqlQueryBuilderMySql.cs
|
using System.Collections.Generic;
using System.Linq;
using Microsoft.Data.SqlClient;
namespace EFCore.BulkExtensions.SqlAdapters.MySql;
/// <summary>
/// Contains a list of methods to generate SQL queries required by EFCore
/// </summary>
public static class SqlQueryBuilderMySql
{
/// <summary>
/// Generates SQL query to create table copy
/// </summary>
/// <param name="existingTableName"></param>
/// <param name="newTableName"></param>
/// <param name="useTempDb"></param>
public static string CreateTableCopy(string existingTableName, string newTableName, bool useTempDb)
{
string keywordTEMP = useTempDb ? "TEMPORARY" : "";
var query = $"CREATE {keywordTEMP} TABLE {newTableName} " +
$"SELECT * FROM {existingTableName} " +
"LIMIT 0;";
query = query.Replace("[", "").Replace("]", "");
return query;
}
/// <summary>
/// Generates SQL query to drop table
/// </summary>
/// <param name="tableName"></param>
/// <param name="isTempTable"></param>
/// <returns></returns>
public static string DropTable(string tableName, bool isTempTable)
{
string query;
if (isTempTable)
{
query = $"DROP TEMPORARY TABLE IF EXISTS {tableName}";
}
else
{
query = $"DROP TABLE IF EXISTS {tableName}";
}
query = query.Replace("[", "").Replace("]", "");
return query;
}
}
|
using System.Collections.Generic;
using System.Linq;
using Microsoft.Data.SqlClient;
namespace EFCore.BulkExtensions.SqlAdapters.MySql;
/// <summary>
/// Contains a list of methods to generate SQL queries required by EFCore
/// </summary>
public static class SqlQueryBuilderMySql
{
/// <summary>
/// Generates SQL query to create table copy
/// </summary>
/// <param name="existingTableName"></param>
/// <param name="newTableName"></param>
/// <param name="useTempDb"></param>
public static string CreateTableCopy(string existingTableName, string newTableName, bool useTempDb)
{
string keywordTEMP = useTempDb ? "TEMPORARY " : "";
var query = $"CREATE {keywordTEMP} TABLE {newTableName} " +
$"SELECT * FROM {existingTableName} " +
"LIMIT 0;";
query = query.Replace("[", @"""").Replace("]", @"""");
return query;
}
}
|
mit
|
C#
|
2c97c5859d260847d2220657e8946484784e5ea7
|
fix 1045
|
geffzhang/Ocelot,TomPallister/Ocelot,TomPallister/Ocelot,geffzhang/Ocelot
|
src/Ocelot/Requester/HttpExeptionToErrorMapper.cs
|
src/Ocelot/Requester/HttpExeptionToErrorMapper.cs
|
namespace Ocelot.Requester
{
using Ocelot.Errors;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
public class HttpExeptionToErrorMapper : IExceptionToErrorMapper
{
private readonly Dictionary<Type, Func<Exception, Error>> _mappers;
public HttpExeptionToErrorMapper(IServiceProvider serviceProvider)
{
_mappers = serviceProvider.GetService<Dictionary<Type, Func<Exception, Error>>>();
}
public Error Map(Exception exception)
{
var type = exception.GetType();
if (_mappers != null && _mappers.ContainsKey(type))
{
return _mappers[type](exception);
}
if (type == typeof(OperationCanceledException) || type.IsSubclassOf(typeof(OperationCanceledException)))
{
return new RequestCanceledError(exception.Message);
}
return new UnableToCompleteRequestError(exception);
}
}
}
|
namespace Ocelot.Requester
{
using Errors;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
public class HttpExeptionToErrorMapper : IExceptionToErrorMapper
{
private readonly Dictionary<Type, Func<Exception, Error>> _mappers;
public HttpExeptionToErrorMapper(IServiceProvider serviceProvider)
{
_mappers = serviceProvider.GetService<Dictionary<Type, Func<Exception, Error>>>();
}
public Error Map(Exception exception)
{
var type = exception.GetType();
if (_mappers != null && _mappers.ContainsKey(type))
{
return _mappers[type](exception);
}
if (type == typeof(OperationCanceledException))
{
return new RequestCanceledError(exception.Message);
}
return new UnableToCompleteRequestError(exception);
}
}
}
|
mit
|
C#
|
2c42bfa1f6eecd0b6f1154aed12faf7f9fda4c33
|
Disable .sav tests for now
|
feliwir/openSage,feliwir/openSage
|
src/OpenSage.Game.Tests/Data/Sav/SaveFileTests.cs
|
src/OpenSage.Game.Tests/Data/Sav/SaveFileTests.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using OpenSage.Data;
using OpenSage.Data.Sav;
using OpenSage.Mods.Generals;
using Veldrid;
using Xunit;
namespace OpenSage.Tests.Data.Sav
{
public class SaveFileTests
{
private static readonly string RootFolder = Path.Combine(Environment.CurrentDirectory, "Data", "Sav", "Assets");
[Theory(Skip = "Not working yet")]
[MemberData(nameof(GetSaveFiles))]
public void CanLoadSaveFiles(string relativePath)
{
var rootFolder = InstalledFilesTestData.GetInstallationDirectory(SageGame.CncGenerals);
var installation = new GameInstallation(new GeneralsDefinition(), rootFolder);
Platform.Start();
using (var game = new Game(installation, GraphicsBackend.Direct3D11))
{
var fullPath = Path.Combine(RootFolder, relativePath);
using (var stream = File.OpenRead(fullPath))
{
SaveFile.LoadFromStream(stream, game);
}
}
Platform.Stop();
}
public static IEnumerable<object[]> GetSaveFiles()
{
foreach (var file in Directory.GetFiles(RootFolder, "*.sav", SearchOption.AllDirectories))
{
var relativePath = file.Substring(RootFolder.Length + 1);
yield return new object[] { relativePath };
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using OpenSage.Data;
using OpenSage.Data.Sav;
using OpenSage.Mods.Generals;
using Veldrid;
using Xunit;
namespace OpenSage.Tests.Data.Sav
{
public class SaveFileTests
{
private static readonly string RootFolder = Path.Combine(Environment.CurrentDirectory, "Data", "Sav", "Assets");
[Theory]
[MemberData(nameof(GetSaveFiles))]
public void CanLoadSaveFiles(string relativePath)
{
var rootFolder = InstalledFilesTestData.GetInstallationDirectory(SageGame.CncGenerals);
var installation = new GameInstallation(new GeneralsDefinition(), rootFolder);
Platform.Start();
using (var game = new Game(installation, GraphicsBackend.Direct3D11))
{
var fullPath = Path.Combine(RootFolder, relativePath);
using (var stream = File.OpenRead(fullPath))
{
SaveFile.LoadFromStream(stream, game);
}
}
Platform.Stop();
}
public static IEnumerable<object[]> GetSaveFiles()
{
foreach (var file in Directory.GetFiles(RootFolder, "*.sav", SearchOption.AllDirectories))
{
var relativePath = file.Substring(RootFolder.Length + 1);
yield return new object[] { relativePath };
}
}
}
}
|
mit
|
C#
|
f401b69a0826714bc129ff35b38f979907e2447f
|
Optimize CssUrlValue.ToString()
|
Carbon/Css
|
src/Carbon.Css/Ast/Values/CssUrlValue.cs
|
src/Carbon.Css/Ast/Values/CssUrlValue.cs
|
using System;
using System.Text;
namespace Carbon.Css
{
public readonly struct CssUrlValue
{
// url('')
public CssUrlValue(string value)
{
Value = value ?? throw new ArgumentNullException(nameof(value));
}
public CssUrlValue(byte[] data, string contentType)
{
// Works for resources only up to 32k in size in IE8.
var sb = new StringBuilder();
sb.Append("data:");
sb.Append(contentType);
sb.Append(";base64,");
sb.Append(Convert.ToBase64String(data));
Value = sb.ToString();
}
public string Value { get; }
public override string ToString() => $"url('{Value}')";
#region Helpers
public bool IsPath => Value.IndexOf(':') == -1; // ! https://
public bool IsExternal => !IsPath;
public string GetAbsolutePath(string basePath) /* /styles/ */
{
if (!IsPath)
{
throw new ArgumentException("Has scheme:" + Value.Split(Seperators.Colon)[0]);
}
// Already absolute
if (Value.Length > 0 && Value[0] == '/')
{
return Value;
}
if (basePath[0] == '/')
{
basePath = basePath.Substring(1);
}
// http://dev/styles/
var baseUri = new Uri("http://dev/" + basePath);
// Absolute path
return new Uri(baseUri, relativeUri: Value).AbsolutePath;
}
#endregion
private static readonly char[] trimChars = { '\'', '\"', '(', ')' };
public static CssUrlValue Parse(string text)
{
var value = text.Replace("url", string.Empty).Trim(trimChars);
return new CssUrlValue(value);
}
}
}
|
using System;
namespace Carbon.Css
{
public readonly struct CssUrlValue
{
// url('')
public CssUrlValue(string value)
{
Value = value ?? throw new ArgumentNullException(nameof(value));
}
public CssUrlValue(byte[] data, string contentType)
{
// Works for resources only up to 32k in size in IE8.
Value = "data:" + contentType + ";base64," + Convert.ToBase64String(data);
}
public string Value { get; }
public override string ToString() => $"url('{Value}')";
#region Helpers
public bool IsPath => !Value.Contains(":");
public bool IsExternal => !IsPath;
public string GetAbsolutePath(string basePath) /* /styles/ */
{
if (!IsPath)
{
throw new ArgumentException("Has scheme:" + Value.Split(Seperators.Colon)[0]);
}
// Already absolute
if (Value.Length > 0 && Value[0] == '/')
{
return Value;
}
if (basePath[0] == '/')
{
basePath = basePath.Substring(1);
}
// http://dev/styles/
var baseUri = new Uri("http://dev/" + basePath);
// Absolute path
return new Uri(baseUri, relativeUri: Value).AbsolutePath;
}
#endregion
private static readonly char[] trimChars = { '\'', '\"', '(', ')' };
public static CssUrlValue Parse(string text)
{
var value = text.Replace("url", string.Empty).Trim(trimChars);
return new CssUrlValue(value);
}
}
}
|
mit
|
C#
|
cce4d601b35e6cd68335f8e546141cfdc532a067
|
fix edge case in POST
|
plivo/plivo-dotnet,plivo/plivo-dotnet
|
src/Plivo/Utilities/XPlivoSignatureV3.cs
|
src/Plivo/Utilities/XPlivoSignatureV3.cs
|
using System;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace Plivo.Utilities {
public static class XPlivoSignatureV3 {
/// <summary>
/// Compute X-Plivo-Signature-V2
/// </summary>
/// <param name="uri"></param>
/// <param name="nonce"></param>
/// <param name="authToken"></param>
/// <returns></returns>
public static string GenerateUrl(string uri, Dictionary < string, string > parameters, string method) {
var url = new Uri(uri);
var paramString = "";
char[] charsToTrim = {
'&'
};
var keys = parameters.Keys.ToList();
keys.Sort();
if (method == "GET") {
foreach(string key in keys) {
paramString += key + "=" + parameters[key] + "&";
}
paramString = paramString.Trim(charsToTrim);
if (url.Query.Length != 0) {
uri += "&" + paramString;
} else {
uri += "/?" + paramString;
}
} else {
if(keys.Count() > 0){
foreach(string key in keys) {
paramString += key + parameters[key];
}
uri += "." + paramString;
}
}
return uri;
}
public static string ComputeSignature(string uri, string nonce, string authToken, Dictionary < string, string > parameters, string method) {
char[] charsToTrim = {
'/'
};
uri = uri.Trim(charsToTrim);
string payload = GenerateUrl(uri, parameters, method) + "." + nonce;
var hash = new HMACSHA256(Encoding.UTF8.GetBytes(authToken));
var computedHash = hash.ComputeHash(Encoding.UTF8.GetBytes(payload));
return Convert.ToBase64String(computedHash);
}
/// <summary>
/// Verify X-Plivo-Signature-V2
/// </summary>
/// <param name="uri"></param>
/// <param name="nonce"></param>
/// <param name="xPlivoSignature"></param>
/// <param name="authToken"></param>
/// <returns></returns>
public static bool VerifySignature(string uri, string nonce, string xPlivoSignature, string authToken, Dictionary < string, string > parameters, string method) {
string computedSignature = ComputeSignature(uri, nonce, authToken, parameters, method);
char[] separator = {
','
};
var signatures = xPlivoSignature.Split(separator);
foreach(string signature in signatures) {
if (computedSignature == signature) {
return true;
}
}
return false;
}
}
}
|
using System;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace Plivo.Utilities {
public static class XPlivoSignatureV3 {
/// <summary>
/// Compute X-Plivo-Signature-V2
/// </summary>
/// <param name="uri"></param>
/// <param name="nonce"></param>
/// <param name="authToken"></param>
/// <returns></returns>
public static string GenerateUrl(string uri, Dictionary < string, string > parameters, string method) {
var url = new Uri(uri);
var paramString = "";
char[] charsToTrim = {
'&'
};
var keys = parameters.Keys.ToList();
keys.Sort();
if (method == "GET") {
foreach(string key in keys) {
paramString += key + "=" + parameters[key] + "&";
}
paramString = paramString.Trim(charsToTrim);
if (url.Query.Length != 0) {
uri += "&" + paramString;
} else {
uri += "/?" + paramString;
}
} else {
foreach(string key in keys) {
paramString += key + parameters[key];
}
uri += "." + paramString;
}
return uri;
}
public static string ComputeSignature(string uri, string nonce, string authToken, Dictionary < string, string > parameters, string method) {
char[] charsToTrim = {
'/'
};
uri = uri.Trim(charsToTrim);
string payload = GenerateUrl(uri, parameters, method) + "." + nonce;
var hash = new HMACSHA256(Encoding.UTF8.GetBytes(authToken));
var computedHash = hash.ComputeHash(Encoding.UTF8.GetBytes(payload));
return Convert.ToBase64String(computedHash);
}
/// <summary>
/// Verify X-Plivo-Signature-V2
/// </summary>
/// <param name="uri"></param>
/// <param name="nonce"></param>
/// <param name="xPlivoSignature"></param>
/// <param name="authToken"></param>
/// <returns></returns>
public static bool VerifySignature(string uri, string nonce, string xPlivoSignature, string authToken, Dictionary < string, string > parameters, string method) {
string computedSignature = ComputeSignature(uri, nonce, authToken, parameters, method);
char[] separator = {
','
};
var signatures = xPlivoSignature.Split(separator);
foreach(string signature in signatures) {
if (computedSignature == signature) {
return true;
}
}
return false;
}
}
}
|
mit
|
C#
|
f1a40cc6d6b6c94fe55389ad818fb9402f8cefe5
|
move length size to const
|
OlegKleyman/Omego.Selenium
|
core/Omego.Selenium/Extensions/WebDriverExtensions.cs
|
core/Omego.Selenium/Extensions/WebDriverExtensions.cs
|
namespace Omego.Selenium.Extensions
{
using System;
using System.Diagnostics;
using System.Drawing.Imaging;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.Extensions;
public static class WebDriverExtensions
{
public static void SaveScreenshotAs(this IWebDriver driver, int timeLimit, ImageTarget target)
{
if (driver == null) throw new ArgumentNullException(nameof(driver));
var stopWatch = new Stopwatch();
stopWatch.Start();
Screenshot screenshot;
const int invalidScreenshotLength = 0;
do
{
screenshot = driver.TakeScreenshot();
}
while (stopWatch.ElapsedMilliseconds < timeLimit && screenshot?.AsByteArray?.Length == invalidScreenshotLength);
stopWatch.Stop();
if (screenshot?.AsByteArray?.Length == invalidScreenshotLength)
{
throw new TimeoutException(
$"Unable to get screenshot after trying for {stopWatch.ElapsedMilliseconds}ms.");
}
}
}
}
|
namespace Omego.Selenium.Extensions
{
using System;
using System.Diagnostics;
using System.Drawing.Imaging;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.Extensions;
public static class WebDriverExtensions
{
public static void SaveScreenshotAs(this IWebDriver driver, int timeLimit, ImageTarget target)
{
if (driver == null) throw new ArgumentNullException(nameof(driver));
var stopWatch = new Stopwatch();
stopWatch.Start();
Screenshot screenshot;
do
{
screenshot = driver.TakeScreenshot();
}
while (stopWatch.ElapsedMilliseconds < timeLimit && screenshot?.AsByteArray?.Length == 0);
stopWatch.Stop();
if (screenshot?.AsByteArray?.Length == 0)
{
throw new TimeoutException(
$"Unable to get screenshot after trying for {stopWatch.ElapsedMilliseconds}ms.");
}
}
}
}
|
unlicense
|
C#
|
813ab00b45c7bfb50c74d694191063e9efb46136
|
use NRT
|
dotnet/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,weltkante/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,mavasani/roslyn,dotnet/roslyn,sharwell/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,diryboy/roslyn,AmadeusW/roslyn,eriawan/roslyn,wvdd007/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,eriawan/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,physhi/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,mavasani/roslyn,wvdd007/roslyn,sharwell/roslyn,diryboy/roslyn,bartdesmet/roslyn,sharwell/roslyn,physhi/roslyn
|
src/Features/Core/Portable/GenerateFromMembers/AbstractGenerateFromMembersCodeRefactoringProvider.SelectedMemberInfo.cs
|
src/Features/Core/Portable/GenerateFromMembers/AbstractGenerateFromMembersCodeRefactoringProvider.SelectedMemberInfo.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CodeRefactorings;
namespace Microsoft.CodeAnalysis.GenerateFromMembers
{
internal abstract partial class AbstractGenerateFromMembersCodeRefactoringProvider : CodeRefactoringProvider
{
protected class SelectedMemberInfo
{
public readonly INamedTypeSymbol ContainingType;
public readonly ImmutableArray<SyntaxNode> SelectedDeclarations;
public readonly ImmutableArray<ISymbol> SelectedMembers;
public SelectedMemberInfo(
INamedTypeSymbol containingType,
ImmutableArray<SyntaxNode> selectedDeclarations,
ImmutableArray<ISymbol> selectedMembers)
{
ContainingType = containingType;
SelectedDeclarations = selectedDeclarations;
SelectedMembers = selectedMembers;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CodeRefactorings;
namespace Microsoft.CodeAnalysis.GenerateFromMembers
{
internal abstract partial class AbstractGenerateFromMembersCodeRefactoringProvider : CodeRefactoringProvider
{
protected class SelectedMemberInfo
{
public readonly INamedTypeSymbol ContainingType;
public readonly ImmutableArray<SyntaxNode> SelectedDeclarations;
public readonly ImmutableArray<ISymbol> SelectedMembers;
public SelectedMemberInfo(
INamedTypeSymbol containingType,
ImmutableArray<SyntaxNode> selectedDeclarations,
ImmutableArray<ISymbol> selectedMembers)
{
ContainingType = containingType;
SelectedDeclarations = selectedDeclarations;
SelectedMembers = selectedMembers;
}
}
}
}
|
mit
|
C#
|
fcbaa404f397dd1191642cc590db1c58e95ade4c
|
fix zoning
|
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
|
resharper/resharper-unity/src/Unity.Rider/ZoneMarker.cs
|
resharper/resharper-unity/src/Unity.Rider/ZoneMarker.cs
|
using JetBrains.Application.BuildScript.Application.Zones;
using JetBrains.RdBackend.Common.Env;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Feature.Services.ExternalSources;
using JetBrains.ReSharper.Plugins.Json;
using JetBrains.ReSharper.Plugins.Yaml;
using JetBrains.ReSharper.Psi;
using JetBrains.Rider.Backend.Env;
namespace JetBrains.ReSharper.Plugins.Unity.Rider
{
// Various features require IRiderProductEnvironmentZone, but we can't seem to use that in tests
// Same with IRiderFeatureZone
[ZoneDefinition]
public interface IRiderUnityPluginZone : IZone, IRequire<IRiderPlatformZone>, IRequire<IUnityShaderZone>, IRequire<IUnityPluginZone>
{
}
[ZoneMarker]
public class ZoneMarker : IRequire<IRiderUnityPluginZone>
{
}
}
|
using JetBrains.Application.BuildScript.Application.Zones;
using JetBrains.RdBackend.Common.Env;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Feature.Services.ExternalSources;
using JetBrains.ReSharper.Plugins.Json;
using JetBrains.ReSharper.Plugins.Yaml;
using JetBrains.ReSharper.Psi;
using JetBrains.Rider.Backend.Env;
namespace JetBrains.ReSharper.Plugins.Unity.Rider
{
// Various features require IRiderProductEnvironmentZone, but we can't seem to use that in tests
// Same with IRiderFeatureZone
[ZoneDefinition]
public interface IRiderUnityPluginZone : IZone, IRequire<IRiderPlatformZone>, IRequire<ILanguageCppZone>, IRequire<IUnityPluginZone>
{
}
[ZoneMarker]
public class ZoneMarker : IRequire<IRiderUnityPluginZone>
{
}
}
|
apache-2.0
|
C#
|
b97bf603867fb45e0725dfde4b299fb0b9bcb4f9
|
Fix change runtime target to Core50 (#1690)
|
adamsitnik/BenchmarkDotNet,Ky7m/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,Ky7m/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,Ky7m/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,Ky7m/BenchmarkDotNet
|
samples/BenchmarkDotNet.Samples/IntroEventPipeProfilerAdvanced.cs
|
samples/BenchmarkDotNet.Samples/IntroEventPipeProfilerAdvanced.cs
|
using System.Buffers;
using System.Diagnostics.Tracing;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.Tracing.Parsers;
namespace BenchmarkDotNet.Samples
{
[Config(typeof(CustomConfig))]
public class IntroEventPipeProfilerAdvanced
{
private class CustomConfig : ManualConfig
{
public CustomConfig()
{
AddJob(Job.ShortRun.WithRuntime(CoreRuntime.Core50));
var providers = new[]
{
new EventPipeProvider(ClrTraceEventParser.ProviderName, EventLevel.Verbose,
(long) (ClrTraceEventParser.Keywords.Exception
| ClrTraceEventParser.Keywords.GC
| ClrTraceEventParser.Keywords.Jit
| ClrTraceEventParser.Keywords.JitTracing // for the inlining events
| ClrTraceEventParser.Keywords.Loader
| ClrTraceEventParser.Keywords.NGen)),
new EventPipeProvider("System.Buffers.ArrayPoolEventSource", EventLevel.Informational, long.MaxValue),
};
AddDiagnoser(new EventPipeProfiler(providers: providers));
}
}
[Benchmark]
public void RentAndReturn_Shared()
{
var pool = ArrayPool<byte>.Shared;
byte[] array = pool.Rent(10000);
pool.Return(array);
}
}
}
|
using System.Buffers;
using System.Diagnostics.Tracing;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using Microsoft.Diagnostics.NETCore.Client;
using Microsoft.Diagnostics.Tracing.Parsers;
namespace BenchmarkDotNet.Samples
{
[Config(typeof(CustomConfig))]
public class IntroEventPipeProfilerAdvanced
{
private class CustomConfig : ManualConfig
{
public CustomConfig()
{
AddJob(Job.ShortRun.WithRuntime(CoreRuntime.Core30));
var providers = new[]
{
new EventPipeProvider(ClrTraceEventParser.ProviderName, EventLevel.Verbose,
(long) (ClrTraceEventParser.Keywords.Exception
| ClrTraceEventParser.Keywords.GC
| ClrTraceEventParser.Keywords.Jit
| ClrTraceEventParser.Keywords.JitTracing // for the inlining events
| ClrTraceEventParser.Keywords.Loader
| ClrTraceEventParser.Keywords.NGen)),
new EventPipeProvider("System.Buffers.ArrayPoolEventSource", EventLevel.Informational, long.MaxValue),
};
AddDiagnoser(new EventPipeProfiler(providers: providers));
}
}
[Benchmark]
public void RentAndReturn_Shared()
{
var pool = ArrayPool<byte>.Shared;
byte[] array = pool.Rent(10000);
pool.Return(array);
}
}
}
|
mit
|
C#
|
de1e4efc700b471e69f22466a2e2783dd46cebe3
|
update retrieve tests
|
ceee/PocketSharp
|
PocketSharp.Tests/RetrieveTests.cs
|
PocketSharp.Tests/RetrieveTests.cs
|
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Xunit;
using PocketSharp.Models;
namespace PocketSharp.Tests
{
public class RetrieveTests : TestsBase
{
public RetrieveTests() : base() { }
[Fact]
public async Task AreItemsRetrieved()
{
List<PocketItem> items = await client.Retrieve();
Assert.True(items.Count > 0);
}
[Fact]
public async Task AreFilteredItemsRetrieved()
{
List<PocketItem> items = await client.RetrieveByFilter(RetrieveFilter.Favorite);
Assert.True(items.Count > 0);
}
[Fact]
public async Task RetrieveWithMultipleFilters()
{
List<PocketItem> items = await client.Retrieve(
state: State.unread,
tag: "pocket",
contentType: ContentType.article,
since: new DateTime(2010, 12, 10),
count: 2
);
Assert.True(items.Count > 0);
}
[Fact]
public async Task ItemContainsUri()
{
List<PocketItem> items = await client.Retrieve(count: 1);
Assert.True(items.Count == 1);
Assert.True(items[0].Uri.ToString().StartsWith("http"));
}
[Fact]
public async Task SearchReturnsResult()
{
List<PocketItem> items = await client.Search("pocket");
Assert.True(items.Count > 0);
Assert.True(items[0].FullTitle.ToLower().Contains("pocket"));
}
[Fact]
public async Task SearchByTagsReturnsResult()
{
List<PocketItem> items = await client.SearchByTag("pocket");
Assert.True(items.Count == 1);
bool found = false;
items[0].Tags.ForEach(tag =>
{
if (tag.Name.Contains("pocket"))
{
found = true;
}
});
Assert.True(found);
}
}
}
|
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Xunit;
using PocketSharp.Models;
namespace PocketSharp.Tests
{
public class RetrieveTests : TestsBase
{
public RetrieveTests() : base() { }
[Fact]
public async Task AreItemsRetrieved()
{
List<PocketItem> items = await client.Retrieve();
Assert.True(items.Count > 0);
}
[Fact]
public async Task ItemContainsUri()
{
List<PocketItem> items = await client.Retrieve(count: 1);
Assert.True(items.Count == 1);
Assert.True(items[0].Uri.ToString().StartsWith("http"));
}
[Fact]
public async Task SearchReturnsResult()
{
List<PocketItem> items = await client.Search("pocket");
Assert.True(items.Count > 0);
Assert.True(items[0].FullTitle.ToLower().Contains("pocket"));
}
[Fact]
public async Task SearchByTagsReturnsResult()
{
List<PocketItem> items = await client.SearchByTag("pocket");
Assert.True(items.Count == 1);
bool found = false;
items[0].Tags.ForEach(tag =>
{
if (tag.Name.Contains("pocket"))
{
found = true;
}
});
Assert.True(found);
}
}
}
|
mit
|
C#
|
b51d2913878aa903ccbda9d531d537bd65dcddf5
|
update version number
|
unvell/ReoGrid,unvell/ReoGrid
|
ReoGrid/Properties/AssemblyInfo.cs
|
ReoGrid/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("ReoGrid")]
[assembly: AssemblyDescription(".NET Spreadsheet Control")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("unvell.com")]
[assembly: AssemblyProduct("ReoGrid")]
[assembly: AssemblyCopyright("Copyright © 2012-2016 unvell.com, All Rights Seserved.")]
[assembly: AssemblyTrademark("ReoGrid.NET")]
[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("a9997b8f-e41f-4358-98a9-876e2354c0b9")]
// 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.0.0")]
[assembly: AssemblyFileVersion("2.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("ReoGrid")]
[assembly: AssemblyDescription(".NET Spreadsheet Control")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("unvell.com")]
[assembly: AssemblyProduct("ReoGrid")]
[assembly: AssemblyCopyright("Copyright © 2012-2016 unvell.com, All Rights Seserved.")]
[assembly: AssemblyTrademark("ReoGrid.NET")]
[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("a9997b8f-e41f-4358-98a9-876e2354c0b9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2.0")]
[assembly: AssemblyFileVersion("2.0.2.0")]
|
mit
|
C#
|
2fc7e8c1c5cf77652791b39e1a62f5ed149dac19
|
Change IMapper visibility from private to protected
|
aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,luchaoshuai/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,carldai0106/aspnetboilerplate,ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate,verdentk/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,ilyhacker/aspnetboilerplate,luchaoshuai/aspnetboilerplate,verdentk/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,carldai0106/aspnetboilerplate
|
src/Abp.AutoMapper/AutoMapper/AutoMapperObjectMapper.cs
|
src/Abp.AutoMapper/AutoMapper/AutoMapperObjectMapper.cs
|
using System.Linq;
using AutoMapper;
using IObjectMapper = Abp.ObjectMapping.IObjectMapper;
namespace Abp.AutoMapper
{
public class AutoMapperObjectMapper : IObjectMapper
{
protected readonly IMapper _mapper;
public AutoMapperObjectMapper(IMapper mapper)
{
_mapper = mapper;
}
public TDestination Map<TDestination>(object source)
{
return _mapper.Map<TDestination>(source);
}
public TDestination Map<TSource, TDestination>(TSource source, TDestination destination)
{
return _mapper.Map(source, destination);
}
public IQueryable<TDestination> ProjectTo<TDestination>(IQueryable source)
{
return _mapper.ProjectTo<TDestination>(source);
}
}
}
|
using System.Linq;
using AutoMapper;
using IObjectMapper = Abp.ObjectMapping.IObjectMapper;
namespace Abp.AutoMapper
{
public class AutoMapperObjectMapper : IObjectMapper
{
private readonly IMapper _mapper;
public AutoMapperObjectMapper(IMapper mapper)
{
_mapper = mapper;
}
public TDestination Map<TDestination>(object source)
{
return _mapper.Map<TDestination>(source);
}
public TDestination Map<TSource, TDestination>(TSource source, TDestination destination)
{
return _mapper.Map(source, destination);
}
public IQueryable<TDestination> ProjectTo<TDestination>(IQueryable source)
{
return _mapper.ProjectTo<TDestination>(source);
}
}
}
|
mit
|
C#
|
cd2fc17fdff929cbad3a7c150a4b3063ec6e629e
|
Refactor FindByLabelStrategy to remove useless ExceptionFactory.CreateForNoSuchElement invocation
|
atata-framework/atata,YevgeniyShunevych/Atata,YevgeniyShunevych/Atata,atata-framework/atata
|
src/Atata/ScopeSearch/Strategies/FindByLabelStrategy.cs
|
src/Atata/ScopeSearch/Strategies/FindByLabelStrategy.cs
|
using OpenQA.Selenium;
namespace Atata
{
public class FindByLabelStrategy : IComponentScopeLocateStrategy
{
public ComponentScopeLocateResult Find(IWebElement scope, ComponentScopeLocateOptions options, SearchOptions searchOptions)
{
string labelXPath = new ComponentScopeXPathBuilder(options).
WrapWithIndex(x => x.OuterXPath._("label")[y => y.TermsConditionOfContent]);
IWebElement label = scope.Get(By.XPath(labelXPath).With(searchOptions).Label(options.GetTermsAsString()));
if (label == null)
return new MissingComponentScopeLocateResult();
string elementId = label.GetAttribute("for");
IdXPathForLabelAttribute idXPathForLabelAttribute;
if (string.IsNullOrEmpty(elementId))
{
return new SequalComponentScopeLocateResult(label, new FindFirstDescendantStrategy());
}
else if ((idXPathForLabelAttribute = options.Metadata.Get<IdXPathForLabelAttribute>(x => x.At(AttributeLevels.Component))) != null)
{
ComponentScopeLocateOptions idOptions = options.Clone();
idOptions.Terms = new[] { idXPathForLabelAttribute.XPathFormat.FormatWith(elementId) };
idOptions.Index = null;
return new SequalComponentScopeLocateResult(scope, new FindByXPathStrategy(), idOptions);
}
else
{
ComponentScopeLocateOptions idOptions = options.Clone();
idOptions.Terms = new[] { elementId };
idOptions.Index = null;
idOptions.Match = TermMatch.Equals;
return new SequalComponentScopeLocateResult(scope, new FindByIdStrategy(), idOptions);
}
}
}
}
|
using OpenQA.Selenium;
namespace Atata
{
public class FindByLabelStrategy : IComponentScopeLocateStrategy
{
public ComponentScopeLocateResult Find(IWebElement scope, ComponentScopeLocateOptions options, SearchOptions searchOptions)
{
string labelXPath = new ComponentScopeXPathBuilder(options).
WrapWithIndex(x => x.OuterXPath._("label")[y => y.TermsConditionOfContent]);
IWebElement label = scope.Get(By.XPath(labelXPath).With(searchOptions).Label(options.GetTermsAsString()));
if (label == null)
{
if (searchOptions.IsSafely)
return new MissingComponentScopeLocateResult();
else
throw ExceptionFactory.CreateForNoSuchElement(options.GetTermsAsString(), searchContext: scope);
}
string elementId = label.GetAttribute("for");
IdXPathForLabelAttribute idXPathForLabelAttribute;
if (string.IsNullOrEmpty(elementId))
{
return new SequalComponentScopeLocateResult(label, new FindFirstDescendantStrategy());
}
else if ((idXPathForLabelAttribute = options.Metadata.Get<IdXPathForLabelAttribute>(x => x.At(AttributeLevels.Component))) != null)
{
ComponentScopeLocateOptions idOptions = options.Clone();
idOptions.Terms = new[] { idXPathForLabelAttribute.XPathFormat.FormatWith(elementId) };
idOptions.Index = null;
return new SequalComponentScopeLocateResult(scope, new FindByXPathStrategy(), idOptions);
}
else
{
ComponentScopeLocateOptions idOptions = options.Clone();
idOptions.Terms = new[] { elementId };
idOptions.Index = null;
idOptions.Match = TermMatch.Equals;
return new SequalComponentScopeLocateResult(scope, new FindByIdStrategy(), idOptions);
}
}
}
}
|
apache-2.0
|
C#
|
3237737d8240085914e0c64cd86724cd5fd72aee
|
modify complex type parameter bind error.
|
dotnetcore/CAP,dotnetcore/CAP,ouraspnet/cap,dotnetcore/CAP
|
src/DotNetCore.CAP/Internal/IModelBinder.ComplexType.cs
|
src/DotNetCore.CAP/Internal/IModelBinder.ComplexType.cs
|
using System;
using System.Reflection;
using System.Threading.Tasks;
using DotNetCore.CAP.Abstractions.ModelBinding;
using DotNetCore.CAP.Infrastructure;
using DotNetCore.CAP.Models;
namespace DotNetCore.CAP.Internal
{
public class ComplexTypeModelBinder : IModelBinder
{
private readonly ParameterInfo _parameterInfo;
public ComplexTypeModelBinder(ParameterInfo parameterInfo)
{
_parameterInfo = parameterInfo;
}
public Task<ModelBindingResult> BindModelAsync(string content)
{
try
{
var type = _parameterInfo.ParameterType;
var value = Helper.FromJson(content, type);
return Task.FromResult(ModelBindingResult.Success(value));
}
catch (Exception)
{
return Task.FromResult(ModelBindingResult.Failed());
}
}
}
}
|
using System;
using System.Reflection;
using System.Threading.Tasks;
using DotNetCore.CAP.Abstractions.ModelBinding;
using DotNetCore.CAP.Infrastructure;
using DotNetCore.CAP.Models;
namespace DotNetCore.CAP.Internal
{
public class ComplexTypeModelBinder : IModelBinder
{
private readonly ParameterInfo _parameterInfo;
public ComplexTypeModelBinder(ParameterInfo parameterInfo)
{
_parameterInfo = parameterInfo;
}
public Task<ModelBindingResult> BindModelAsync(string content)
{
try
{
var type = _parameterInfo.ParameterType;
var message = Helper.FromJson<Message>(content);
var value = Helper.FromJson(message.Content.ToString(), type);
return Task.FromResult(ModelBindingResult.Success(value));
}
catch (Exception)
{
return Task.FromResult(ModelBindingResult.Failed());
}
}
}
}
|
mit
|
C#
|
f466dd7d9c9b607a88ecf7cf99dd841652d92e43
|
Read (but ignore) decimals value in column definition payload.
|
mysql-net/MySqlConnector,mysql-net/MySqlConnector,gitsno/MySqlConnector,gitsno/MySqlConnector
|
src/MySql.Data/Serialization/ColumnDefinitionPayload.cs
|
src/MySql.Data/Serialization/ColumnDefinitionPayload.cs
|
using System;
using System.Text;
namespace MySql.Data.Serialization
{
internal class ColumnDefinitionPayload
{
public string Name { get; }
public CharacterSet CharacterSet { get; }
public int ColumnLength { get; }
public ColumnType ColumnType { get; }
public ColumnFlags ColumnFlags { get; }
public static ColumnDefinitionPayload Create(PayloadData payload)
{
var reader = new ByteArrayReader(payload.ArraySegment);
var catalog = reader.ReadLengthEncodedByteString();
var schema = reader.ReadLengthEncodedByteString();
var table = reader.ReadLengthEncodedByteString();
var physicalTable = reader.ReadLengthEncodedByteString();
var name = Encoding.UTF8.GetString(reader.ReadLengthEncodedByteString());
var physicalName = reader.ReadLengthEncodedByteString();
reader.ReadByte(0x0C); // length of fixed-length fields, always 0x0C
var characterSet = (CharacterSet) reader.ReadUInt16();
var columnLength = (int) reader.ReadUInt32();
var columnType = (ColumnType) reader.ReadByte();
var columnFlags = (ColumnFlags) reader.ReadUInt16();
var decimals = reader.ReadByte(); // 0x00 for integers and static strings, 0x1f for dynamic strings, double, float, 0x00 to 0x51 for decimals
reader.ReadByte(0);
if (reader.BytesRemaining > 0)
{
int defaultValuesCount = checked((int) reader.ReadLengthEncodedInteger());
for (int i = 0; i < defaultValuesCount; i++)
reader.ReadLengthEncodedByteString();
}
if (reader.BytesRemaining != 0)
throw new FormatException("Extra bytes at end of payload.");
return new ColumnDefinitionPayload(name, characterSet, columnLength, columnType, columnFlags);
}
private ColumnDefinitionPayload(string name, CharacterSet characterSet, int columnLength, ColumnType columnType, ColumnFlags columnFlags)
{
Name = name;
CharacterSet = characterSet;
ColumnLength = columnLength;
ColumnType = columnType;
ColumnFlags = columnFlags;
}
}
}
|
using System;
using System.Text;
namespace MySql.Data.Serialization
{
internal class ColumnDefinitionPayload
{
public string Name { get; }
public CharacterSet CharacterSet { get; }
public int ColumnLength { get; }
public ColumnType ColumnType { get; }
public ColumnFlags ColumnFlags { get; }
public static ColumnDefinitionPayload Create(PayloadData payload)
{
var reader = new ByteArrayReader(payload.ArraySegment);
var catalog = reader.ReadLengthEncodedByteString();
var schema = reader.ReadLengthEncodedByteString();
var table = reader.ReadLengthEncodedByteString();
var physicalTable = reader.ReadLengthEncodedByteString();
var name = Encoding.UTF8.GetString(reader.ReadLengthEncodedByteString());
var physicalName = reader.ReadLengthEncodedByteString();
reader.ReadByte(0x0C); // length of fixed-length fields, always 0x0C
var characterSet = (CharacterSet) reader.ReadUInt16();
var columnLength = (int) reader.ReadUInt32();
var columnType = (ColumnType) reader.ReadByte();
var columnFlags = (ColumnFlags) reader.ReadUInt16();
reader.ReadByte(0);
reader.ReadByte(0);
if (reader.BytesRemaining > 0)
{
int defaultValuesCount = checked((int) reader.ReadLengthEncodedInteger());
for (int i = 0; i < defaultValuesCount; i++)
reader.ReadLengthEncodedByteString();
}
if (reader.BytesRemaining != 0)
throw new FormatException("Extra bytes at end of payload.");
return new ColumnDefinitionPayload(name, characterSet, columnLength, columnType, columnFlags);
}
private ColumnDefinitionPayload(string name, CharacterSet characterSet, int columnLength, ColumnType columnType, ColumnFlags columnFlags)
{
Name = name;
CharacterSet = characterSet;
ColumnLength = columnLength;
ColumnType = columnType;
ColumnFlags = columnFlags;
}
}
}
|
mit
|
C#
|
ca7438fbf118b8c6479484c966193f7797bd5618
|
Change log timestamps to utc for better performance
|
Klocman/Bulk-Crap-Uninstaller,Klocman/Bulk-Crap-Uninstaller,Klocman/Bulk-Crap-Uninstaller
|
source/BulkCrapUninstaller/LogWriter.cs
|
source/BulkCrapUninstaller/LogWriter.cs
|
/*
Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/)
Apache License Version 2.0
*/
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace BulkCrapUninstaller
{
internal sealed class LogWriter : StreamWriter
{
public LogWriter(string path) : base(path, true, Encoding.UTF8)
{
}
public static LogWriter StartLogging(string logPath)
{
try
{
// Limit log size to 100 kb
var fileInfo = new FileInfo(logPath);
if (fileInfo.Exists && fileInfo.Length > 1024 * 100)
fileInfo.Delete();
// Create new log writer
var logWriter = new LogWriter(logPath);
// Make sure we can write to the file
logWriter.WriteSeparator();
logWriter.WriteLine("Application startup");
logWriter.Flush();
Console.SetOut(logWriter);
Console.SetError(logWriter);
#if DEBUG
Debug.Listeners.Add(new ConsoleTraceListener(false));
#endif
return logWriter;
}
catch (Exception ex)
{
// Ignore logging errors
Console.WriteLine(ex);
return null;
}
}
public void WriteSeparator()
{
base.WriteLine("--------------------------------------------------");
}
public override void WriteLine(string value)
{
value = DateTime.UtcNow.ToLongTimeString() + " - " + value;
base.WriteLine(value);
}
}
}
|
/*
Copyright (c) 2017 Marcin Szeniak (https://github.com/Klocman/)
Apache License Version 2.0
*/
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace BulkCrapUninstaller
{
internal sealed class LogWriter : StreamWriter
{
public LogWriter(string path) : base(path, true, Encoding.UTF8)
{
}
public static LogWriter StartLogging(string logPath)
{
try
{
// Limit log size to 100 kb
var fileInfo = new FileInfo(logPath);
if (fileInfo.Exists && fileInfo.Length > 1024 * 100)
fileInfo.Delete();
// Create new log writer
var logWriter = new LogWriter(logPath);
// Make sure we can write to the file
logWriter.WriteSeparator();
logWriter.WriteLine("Application startup");
logWriter.Flush();
Console.SetOut(logWriter);
Console.SetError(logWriter);
#if DEBUG
Debug.Listeners.Add(new ConsoleTraceListener(false));
#endif
return logWriter;
}
catch (Exception ex)
{
// Ignore logging errors
Console.WriteLine(ex);
return null;
}
}
public void WriteSeparator()
{
base.WriteLine("--------------------------------------------------");
}
public override void WriteLine(string value)
{
value = DateTime.Now.ToLongTimeString() + " - " + value;
base.WriteLine(value);
}
}
}
|
apache-2.0
|
C#
|
ab6bfc8b4b36df05c203b92fe3c0bc47bd7188c4
|
Fix a typo
|
JetBrains/YouTrackSharp,JetBrains/YouTrackSharp
|
tests/YouTrackSharp.Tests/Integration/Issues/CreateIssue.cs
|
tests/YouTrackSharp.Tests/Integration/Issues/CreateIssue.cs
|
using System;
using System.Threading.Tasks;
using Xunit;
using YouTrackSharp.Issues;
using YouTrackSharp.Tests.Infrastructure;
namespace YouTrackSharp.Tests.Integration.Issues
{
public partial class IssuesServiceTests
{
public class CreateIssue
{
[Fact]
public async Task Valid_Connection_Creates_Issue()
{
// Arrange
var connection = Connections.Demo1Token;
var service = connection.CreateIssuesService();
var newIssue = new Issue
{
Summary = "Test issue - " + DateTime.UtcNow.ToString("U"),
Description = "This is a **test** issue created while running unit tests."
};
// Act
var result = await service.CreateIssue("DP1", newIssue);
// Assert
Assert.NotNull(result);
Assert.StartsWith("DP1", result);
dynamic createdIssue = await service.GetIssue(result);
Assert.Equal(newIssue.Summary, createdIssue.Summary);
Assert.Equal(newIssue.Description, createdIssue.Description);
Assert.Equal(newIssue.GetField("Assignee").Value, createdIssue.Assignee[0].UserName);
Assert.Equal(newIssue.GetField("Type").Value, createdIssue.Type[0]);
Assert.Equal(newIssue.GetField("State").Value, createdIssue.State[0]);
Assert.Equal(newIssue.GetField("Fix versions").Value, createdIssue.Fix_versions);
Assert.Equal(newIssue.GetField("Due Date").AsDateTime().ToString("d"), createdIssue.GetField("Due Date").AsDateTime().ToString("d"));
await service.DeleteIssue(result);
}
}
}
}
|
using System;
using System.Threading.Tasks;
using Xunit;
using YouTrackSharp.Issues;
using YouTrackSharp.Tests.Infrastructure;
namespace YouTrackSharp.Tests.Integration.Issues
{
public partial class IssuesServiceTests
{
public class CreateIssue
{
[Fact]
public async Task Valid_Connection_Creates_Issue()
{
// Arrange
var connection = Connections.Demo1Token;
var service = connection.CreateIssuesService();
var newIssue = new Issue
{
Summary = "Test issue - " + DateTime.UtcNow.ToString("U"),
Description = "This is a **test** issue created while running unit tests."
};
// Act
var result = await service.CreateIssue("DP1", newIssue);
// Assert
Assert.NotNull(result);
Assert.StartsWith("DP1", result);
dynamic createdIssue = await service.GetIssue(result);
Assert.Equal(newIssue.Summary, createdIssue.Summary);
Assert.Equal(newIssue.Description, createdIssue.Description);
Assert.Equal(newIssue.GetField("Assignee").Value, createdIssue.Assignee[0].UserName);
Assert.Equal(newIssue.GetField("Type").Value, createdIssue.Type[0]);
Assert.Equal(newIssue.GetField("State").Value, createdIssue.State[0]);
Assert.Equal(newIssue.GetField("Fix versions").Value, createdIssue.Fix_versions);
Assert.Equal(newIssue.GetField("Due Date").AsDateTime().ToString("d"), createdIssue.GetField("Due Date").AsDateTime().ToString("d"));
await service.DeleteIssue(result);
}
}
}
}
|
apache-2.0
|
C#
|
99837098ba510b9e4084ddccd2358b4f805e5d46
|
Test broker listens on all IPs
|
AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud
|
src/server/Adaptive.ReactiveTrader.MessageBroker/MessageBroker.cs
|
src/server/Adaptive.ReactiveTrader.MessageBroker/MessageBroker.cs
|
using System;
using WampSharp.Binding;
using WampSharp.Fleck;
using WampSharp.V2;
using WampSharp.V2.MetaApi;
namespace Adaptive.ReactiveTrader.MessageBroker
{
public class MessageBroker : IDisposable
{
private WampHost _router;
public void Dispose()
{
_router.Dispose();
}
public void Start()
{
_router = new WampHost();
var jsonBinding = new JTokenJsonBinding();
var msgPack = new JTokenMsgpackBinding();
_router.RegisterTransport(new FleckWebSocketTransport("ws://0.0.0.0:8080/ws"), jsonBinding, msgPack);
_router.Open();
var realm = _router.RealmContainer.GetRealmByName("com.weareadaptive.reactivetrader");
realm.HostMetaApiService();
}
}
}
|
using System;
using WampSharp.Binding;
using WampSharp.Fleck;
using WampSharp.V2;
using WampSharp.V2.MetaApi;
namespace Adaptive.ReactiveTrader.MessageBroker
{
public class MessageBroker : IDisposable
{
private WampHost _router;
public void Dispose()
{
_router.Dispose();
}
public void Start()
{
_router = new WampHost();
var jsonBinding = new JTokenJsonBinding();
var msgPack = new JTokenMsgpackBinding();
_router.RegisterTransport(new FleckWebSocketTransport("ws://127.0.0.1:8080/ws"), jsonBinding, msgPack);
_router.Open();
var realm = _router.RealmContainer.GetRealmByName("com.weareadaptive.reactivetrader");
realm.HostMetaApiService();
}
}
}
|
apache-2.0
|
C#
|
88719301051b3b62c326e8bc49cb4a279e025872
|
fix #100 fix #99
|
nerai/CMenu
|
src/ConsoleMenu/DefaultItems/MI_Help.cs
|
src/ConsoleMenu/DefaultItems/MI_Help.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NConsoleMenu.DefaultItems
{
public class MI_Help : CMenuItem
{
private readonly CMenu _Menu;
public MI_Help (CMenu menu)
: base ("help")
{
if (menu == null) {
throw new ArgumentNullException ("menu");
}
_Menu = menu;
HelpText = ""
+ "help [command]\n"
+ "Displays a help text for the specified command, or\n"
+ "Displays a list of all available commands.";
}
public override void Execute (string arg)
{
DisplayHelp (arg, _Menu, false);
}
private void DisplayHelp (string arg, CMenuItem context, bool isInner)
{
if (arg == null) {
throw new ArgumentNullException ("arg");
}
if (context == null) {
throw new ArgumentNullException ("context");
}
if (string.IsNullOrEmpty (arg)) {
if (!DisplayItemHelp (context, !context.Any ())) {
DisplayAvailableCommands (context, isInner);
}
return;
}
var cmd = arg;
var inner = context.GetMenuItem (ref cmd, out arg, true, false, false);
if (inner != null) {
DisplayHelp (arg, inner, true);
}
}
private bool DisplayItemHelp (CMenuItem item, bool force)
{
if (item == null) {
throw new ArgumentNullException ("item");
}
if (item.HelpText == null) {
if (force) {
OnWriteLine ("No help available for " + item.Selector);
}
return false;
}
else {
OnWriteLine (item.HelpText);
return true;
}
}
private void DisplayAvailableCommands (CMenuItem menu, bool inner)
{
if (menu == null) {
throw new ArgumentNullException ("menu");
}
if (!inner) {
OnWriteLine ("Available commands:");
}
var abbreviations = menu.CommandAbbreviations ().OrderBy (it => it.Key);
foreach (var ab in abbreviations) {
if (ab.Value == null) {
OnWrite (" ");
}
else {
OnWrite (ab.Value.PadRight (3) + " | ");
}
OnWriteLine (ab.Key);
}
if (!inner) {
OnWriteLine ("Type \"help <command>\" for individual command help.");
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NConsoleMenu.DefaultItems
{
public class MI_Help : CMenuItem
{
private readonly CMenu _Menu;
public MI_Help (CMenu menu)
: base ("help")
{
if (menu == null) {
throw new ArgumentNullException ("menu");
}
_Menu = menu;
HelpText = ""
+ "help [command]\n"
+ "Displays a help text for the specified command, or\n"
+ "Displays a list of all available commands.";
}
public override void Execute (string arg)
{
DisplayHelp (arg, _Menu, false);
}
private void DisplayHelp (string arg, CMenuItem context, bool isInner)
{
if (arg == null) {
throw new ArgumentNullException ("arg");
}
if (context == null) {
throw new ArgumentNullException ("context");
}
if (string.IsNullOrEmpty (arg)) {
if (!DisplayItemHelp (context, !context.Any ())) {
DisplayAvailableCommands (context, isInner);
}
return;
}
var cmd = arg;
var inner = context.GetMenuItem (ref cmd, out arg, false, false, false);
if (inner != null) {
DisplayHelp (arg, inner, true);
return;
}
OnWriteLine ("Could not find inner command \"" + cmd + "\".");
if (context.Selector != null) {
OnWriteLine ("Help for " + context.Selector + ":");
}
DisplayItemHelp (context, true);
}
private bool DisplayItemHelp (CMenuItem item, bool force)
{
if (item == null) {
throw new ArgumentNullException ("item");
}
if (item.HelpText == null) {
if (force) {
OnWriteLine ("No help available for " + item.Selector);
}
return false;
}
else {
OnWriteLine (item.HelpText);
return true;
}
}
private void DisplayAvailableCommands (CMenuItem menu, bool inner)
{
if (menu == null) {
throw new ArgumentNullException ("menu");
}
if (!inner) {
OnWriteLine ("Available commands:");
}
var abbreviations = menu.CommandAbbreviations ().OrderBy (it => it.Key);
foreach (var ab in abbreviations) {
if (ab.Value == null) {
OnWrite (" ");
}
else {
OnWrite (ab.Value.PadRight (3) + " | ");
}
OnWriteLine (ab.Key);
}
if (!inner) {
OnWriteLine ("Type \"help <command>\" for individual command help.");
}
}
}
}
|
mit
|
C#
|
caf5d56b400324248623c54c1a2e28b6e37a96e8
|
Update ToreGroneng.cs
|
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
|
src/Firehose.Web/Authors/ToreGroneng.cs
|
src/Firehose.Web/Authors/ToreGroneng.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class ToreGroneng : IAmACommunityMember
{
public string FirstName => "Tore";
public string LastName => "Groneng";
public string ShortBioOrTagLine => "Focus on Powershell, Azure, Cloud, System Center and Powershell DSC. Automate everything.";
public string StateOrRegion => "Bergen, Norway";
public string EmailAddress => "tore.groneng@gmail.com";
public string TwitterHandle => "ToreGroneng";
public string GitHubHandle => "torgro";
public string GravatarHash => "5179a5eb394ca18bf14daa4e3987989b";
public GeoPosition Position => new GeoPosition(60.4698789, 5.3307659);
public Uri WebSite => new Uri("https://asaconsultant.blogspot.no");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://asaconsultant.blogspot.com/feeds/posts/default/-/Powershell"); } }
public string FeedLanguageCode => "en";
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class ToreGroneng : IAmACommunityMember
{
public string FirstName => "Tore";
public string LastName => "Groneng";
public string ShortBioOrTagLine => "Focus on Powershell, Azure, Cloud, System Center and Powershell DSC. Automate everything.";
public string StateOrRegion => "Bergen, Norway";
public string EmailAddress => "tore.groneng@gmail.com";
public string TwitterHandle => "ToreGroneng";
public string GitHubHandle => "torgro";
public string GravatarHash => "";
public GeoPosition Position => new GeoPosition(60.4698789, 5.3307659);
public Uri WebSite => new Uri("https://asaconsultant.blogspot.no");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://asaconsultant.blogspot.com/feeds/posts/default/-/Powershell"); } }
public string FeedLanguageCode => "en";
}
}
|
mit
|
C#
|
847c0e73f117f5535e9e9afd402724c982731f90
|
Add SPModelExtension.GetVersions
|
misonou/codeless
|
src/Codeless.SharePoint/SharePoint/ObjectModel/SPModelExtension.cs
|
src/Codeless.SharePoint/SharePoint/ObjectModel/SPModelExtension.cs
|
using Microsoft.SharePoint;
using System.Collections;
using System.Collections.Generic;
namespace Codeless.SharePoint.ObjectModel {
/// <summary>
/// Provides extension methods to the <see cref="SPModel"/> class.
/// </summary>
public static class SPModelExtension {
/// <summary>
/// Gets the meta-data of the list item associated with an <see cref="SPModel"/> instance.
/// </summary>
public static ISPModelMetaData GetMetaData(this SPModel model) {
return model;
}
/// <summary>
/// Gets a specified major version of the list item.
/// </summary>
/// <typeparam name="T">Type of model.</typeparam>
/// <param name="model">A model object representing the list item.</param>
/// <param name="majorVersion">Major version number.</param>
/// <returns>A read-only model object of type <typeparamref name="T"/> if the specified version or *null* if such version does not exist.</returns>
public static T GetVersion<T>(this T model, int majorVersion) where T : SPModel {
return model.GetVersion(new SPItemVersion(majorVersion, 0));
}
/// <summary>
/// Gets a specified version of the list item.
/// </summary>
/// <typeparam name="T">Type of model.</typeparam>
/// <param name="model">A model object representing the list item.</param>
/// <param name="version">Version number.</param>
/// <returns>A read-only model object of type <typeparamref name="T"/> if the specified version or *null* if such version does not exist.</returns>
public static T GetVersion<T>(this T model, SPItemVersion version) where T : SPModel {
if (model.Adapter.Version == version) {
return model;
}
SPListItemVersion previousVersion = model.Adapter.ListItem.Versions.GetVersionFromLabel(version.ToString());
if (previousVersion != null) {
return (T)model.ParentCollection.Manager.TryCreateModel(new SPListItemVersionAdapter(previousVersion), true);
}
return null;
}
/// <summary>
/// Gets all versions of the list item.
/// </summary>
/// <typeparam name="T">Type of model.</typeparam>
/// <param name="model">A model object representing the list item.</param>
/// <returns>A enumerable collection containing read-only model objects of type <typeparamref name="T"/> representing different versions of the list item.</returns>
public static IEnumerable<T> GetVersions<T>(this T model) where T : SPModel {
foreach (SPListItemVersion version in model.Adapter.ListItem.Versions) {
yield return (T)model.ParentCollection.Manager.TryCreateModel(new SPListItemVersionAdapter(version), true);
}
}
}
}
|
using Microsoft.SharePoint;
namespace Codeless.SharePoint.ObjectModel {
/// <summary>
/// Provides extension methods to the <see cref="SPModel"/> class.
/// </summary>
public static class SPModelExtension {
/// <summary>
/// Gets the meta-data of the list item associated with an <see cref="SPModel"/> instance.
/// </summary>
public static ISPModelMetaData GetMetaData(this SPModel model) {
return model;
}
/// <summary>
/// Gets a specified major version of the list item.
/// </summary>
/// <typeparam name="T">Type of model.</typeparam>
/// <param name="model">A model object representing the list item.</param>
/// <param name="majorVersion">Major version number.</param>
/// <returns>A read-only model object of type <typeparamref name="T"/> if the specified version or *null* if such version does not exist.</returns>
public static T GetVersion<T>(this T model, int majorVersion) where T : SPModel {
return model.GetVersion(new SPItemVersion(majorVersion, 0));
}
/// <summary>
/// Gets a specified version of the list item.
/// </summary>
/// <typeparam name="T">Type of model.</typeparam>
/// <param name="model">A model object representing the list item.</param>
/// <param name="version">Version number.</param>
/// <returns>A read-only model object of type <typeparamref name="T"/> if the specified version or *null* if such version does not exist.</returns>
public static T GetVersion<T>(this T model, SPItemVersion version) where T : SPModel {
if (model.Adapter.Version == version) {
return model;
}
SPListItemVersion previousVersion = model.Adapter.ListItem.Versions.GetVersionFromLabel(version.ToString());
if (previousVersion != null) {
return (T)model.ParentCollection.Manager.TryCreateModel(new SPListItemVersionAdapter(previousVersion), true);
}
return null;
}
}
}
|
mit
|
C#
|
08edc69c64062144810f4051b35a3dd71defe568
|
add copyright notice from upstream
|
mans0954/f-spot,Sanva/f-spot,mono/f-spot,GNOME/f-spot,Sanva/f-spot,mono/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,Yetangitu/f-spot,mans0954/f-spot,GNOME/f-spot,nathansamson/F-Spot-Album-Exporter,mono/f-spot,dkoeb/f-spot,Sanva/f-spot,mono/f-spot,GNOME/f-spot,mans0954/f-spot,GNOME/f-spot,mans0954/f-spot,Yetangitu/f-spot,nathansamson/F-Spot-Album-Exporter,nathansamson/F-Spot-Album-Exporter,mans0954/f-spot,Yetangitu/f-spot,dkoeb/f-spot,mono/f-spot,dkoeb/f-spot,GNOME/f-spot,Yetangitu/f-spot,mans0954/f-spot,nathansamson/F-Spot-Album-Exporter,dkoeb/f-spot,mono/f-spot,Yetangitu/f-spot,NguyenMatthieu/f-spot,dkoeb/f-spot,Sanva/f-spot,dkoeb/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot
|
lib/gtk-sharp-beans/Shell.cs
|
lib/gtk-sharp-beans/Shell.cs
|
// GLib.Shell.cs
//
// Author(s):
// Stephane Delcroix <stephane@delcroix.org>
//
// Copyright (c) 2009 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
using System;
using System.Runtime.InteropServices;
namespace GLib
{
public class Shell
{
[DllImport ("libglib-2.0-0.dll")]
static extern IntPtr g_shell_quote (IntPtr unquoted_string);
public static string Quote (string unquoted)
{
IntPtr native_string = GLib.Marshaller.StringToPtrGStrdup (unquoted);
string quoted = GLib.Marshaller.PtrToStringGFree (g_shell_quote (native_string));
GLib.Marshaller.Free (native_string);
return quoted;
}
}
}
|
using System;
using System.Runtime.InteropServices;
namespace GLib
{
public class Shell
{
[DllImport ("libglib-2.0-0.dll")]
static extern IntPtr g_shell_quote (IntPtr unquoted_string);
public static string Quote (string unquoted)
{
IntPtr native_string = GLib.Marshaller.StringToPtrGStrdup (unquoted);
string quoted = GLib.Marshaller.PtrToStringGFree (g_shell_quote (native_string));
GLib.Marshaller.Free (native_string);
return quoted;
}
}
}
|
mit
|
C#
|
7c32cc03c951023cb6d6c4e7fbab1ab7bf0740b5
|
Update IAbpMongoDbModuleConfiguration.cs
|
carldai0106/aspnetboilerplate,carldai0106/aspnetboilerplate,ryancyq/aspnetboilerplate,beratcarsi/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ilyhacker/aspnetboilerplate,andmattia/aspnetboilerplate,carldai0106/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,verdentk/aspnetboilerplate,ilyhacker/aspnetboilerplate,luchaoshuai/aspnetboilerplate,beratcarsi/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,beratcarsi/aspnetboilerplate,carldai0106/aspnetboilerplate,verdentk/aspnetboilerplate,verdentk/aspnetboilerplate,ilyhacker/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,andmattia/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,andmattia/aspnetboilerplate
|
src/Abp.MongoDB/MongoDb/Configuration/IAbpMongoDbModuleConfiguration.cs
|
src/Abp.MongoDB/MongoDb/Configuration/IAbpMongoDbModuleConfiguration.cs
|
namespace Abp.MongoDb.Configuration
{
public interface IAbpMongoDbModuleConfiguration
{
string ConnectionString { get; set; }
string DatabaseName { get; set; }
}
}
|
namespace Abp.MongoDb.Configuration
{
public interface IAbpMongoDbModuleConfiguration
{
string ConnectionString { get; set; }
string DatatabaseName { get; set; }
}
}
|
mit
|
C#
|
e70a427d420a34d8e6ee92c1b345f6de532da71c
|
add simple recipe to simple model
|
isse-augsburg/ssharp,isse-augsburg/ssharp,maul-esel/ssharp,isse-augsburg/ssharp,maul-esel/ssharp,maul-esel/ssharp,isse-augsburg/ssharp,maul-esel/ssharp,isse-augsburg/ssharp
|
models/SelfOrganizingPillProduction/Modeling/Model.cs
|
models/SelfOrganizingPillProduction/Modeling/Model.cs
|
using SafetySharp.Modeling;
namespace SelfOrganizingPillProduction.Modeling
{
public class Model : ModelBase
{
public const int MaximumRecipeLength = 30;
public const int ContainerStorageSize = 30;
public const int MaximumRoleCount = 30;
public const int MaximumResourceCount = 30;
public Model(Station[] stations, ObserverController obsContr)
{
Stations = stations;
foreach (var station in stations)
{
station.Model = this;
}
ObserverController = obsContr;
}
[Root(RootKind.Controller)]
public Station[] Stations { get; }
[Root(RootKind.Controller)]
public ObserverController ObserverController { get; }
public static Model NoRedundancyCircularModel()
{
// create 3 stations
var producer = new ContainerLoader();
var dispenser = new ParticulateDispenser();
var stations = new Station[]
{
producer,
dispenser,
new PalletisationStation()
};
dispenser.Storage[IngredientType.BlueParticulate] = 50;
dispenser.Storage[IngredientType.RedParticulate] = 50;
dispenser.Storage[IngredientType.YellowParticulate] = 50;
// connect them to a circle
for (int i = 0; i < stations.Length; ++i)
{
var next = stations[(i + 1) % stations.Length];
stations[i].Outputs.Add(next);
next.Inputs.Add(stations[i]);
}
var recipe = new Recipe(new[] {
new Ingredient(IngredientType.BlueParticulate, 12),
new Ingredient(IngredientType.RedParticulate, 4),
new Ingredient(IngredientType.YellowParticulate, 5)
}, 3);
producer.AcceptProductionRequest(recipe);
return new Model(stations, new MiniZincObserverController(stations));
}
}
}
|
using SafetySharp.Modeling;
namespace SelfOrganizingPillProduction.Modeling
{
public class Model : ModelBase
{
public const int MaximumRecipeLength = 30;
public const int ContainerStorageSize = 30;
public const int MaximumRoleCount = 30;
public const int MaximumResourceCount = 30;
public Model(Station[] stations, ObserverController obsContr)
{
Stations = stations;
foreach (var station in stations)
{
station.Model = this;
}
ObserverController = obsContr;
}
[Root(RootKind.Controller)]
public Station[] Stations { get; }
[Root(RootKind.Controller)]
public ObserverController ObserverController { get; }
public static Model NoRedundancyCircularModel()
{
// create 3 stations
var dispenser = new ParticulateDispenser();
var stations = new Station[]
{
new ContainerLoader(),
dispenser,
new PalletisationStation()
};
dispenser.Storage[IngredientType.BlueParticulate] = 50;
dispenser.Storage[IngredientType.RedParticulate] = 50;
dispenser.Storage[IngredientType.YellowParticulate] = 50;
// connect them to a circle
for (int i = 0; i < stations.Length; ++i)
{
var next = stations[(i + 1) % stations.Length];
stations[i].Outputs.Add(next);
next.Inputs.Add(stations[i]);
}
return new Model(stations, new MiniZincObserverController(stations));
}
}
}
|
mit
|
C#
|
dc7c8b208e0a057772c0d0dd60b2c80fb00337f2
|
Resolve #AG29 - Remove some obsolete code for binding
|
csf-dev/agiil,csf-dev/agiil,csf-dev/agiil,csf-dev/agiil
|
Agiil.Web.Models/Tickets/NewTicketSpecification.cs
|
Agiil.Web.Models/Tickets/NewTicketSpecification.cs
|
using System;
using Agiil.Domain.Sprints;
using Agiil.Domain.Tickets;
using CSF.Entities;
namespace Agiil.Web.Models.Tickets
{
public class NewTicketSpecification
{
public string Title { get; set; }
public string Description { get; set; }
public IIdentity<Sprint> SprintIdentity { get; set; }
public IIdentity<TicketType> TicketTypeIdentity { get; set; }
}
}
|
using System;
using Agiil.Domain.Sprints;
using Agiil.Domain.Tickets;
using CSF.Entities;
namespace Agiil.Web.Models.Tickets
{
public class NewTicketSpecification
{
public string Title { get; set; }
public string Description { get; set; }
public IIdentity<Sprint> SprintIdentity { get; set; }
public IIdentity<TicketType> TicketTypeIdentity { get; set; }
public long? SprintId
{
get { return (long?) SprintIdentity?.Value; }
set {
if(!value.HasValue)
SprintIdentity = null;
SprintIdentity = Identity.Create<Sprint>(value.Value);
}
}
public long? TicketTypeId
{
get { return (long?) TicketTypeIdentity?.Value; }
set {
if(!value.HasValue)
TicketTypeIdentity = null;
TicketTypeIdentity = Identity.Create<TicketType>(value.Value);
}
}
}
}
|
mit
|
C#
|
63e627f79ce8aca5aa8c72d25893d4f855f2f7de
|
fix cw/ccw-detection for ClosedWalls with 3 vertices
|
accu-rate/SumoVizUnity,accu-rate/SumoVizUnity
|
Assets/Scripts/Geometry/ObstacleExtrudeGeometry.cs
|
Assets/Scripts/Geometry/ObstacleExtrudeGeometry.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ObstacleExtrudeGeometry : ExtrudeGeometry { // walls
public static void create (string name, List<Vector2> verticesList, float height) {
GeometryLoader gl = GameObject.Find("GeometryLoader").GetComponent<GeometryLoader>();
Material topMaterial;
Material sideMaterial;
/*if (name.Contains ("_house")) {
topMaterial = gl.theme.getRoofMaterial ();
sideMaterial = gl.theme.getHouseMaterial ();
sideMaterial.SetTextureScale ("_MainTex", gl.theme.getTextureScaleForHeight (4f));
height = 6f;
} else {*/
topMaterial = gl.theme.getWallMaterial();
sideMaterial = topMaterial;
height = 1f;//2.2f + Random.value * 1.2f;
//}
if(verticesList[verticesList.Count - 1] == verticesList[0])
verticesList.RemoveAt (verticesList.Count - 1);
/* doesn't work for objects with 3 vertices ~ BD 27.8.2018
// http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/clockwise.htm (found by @Lesya91)
int n = verticesList.Count;
int i, j, k;
int count = 0;
float val;
if (n > 3) {
for (i = 0; i < n; i ++) {
j = (i + 1) % n;
k = (i + 2) % n;
val = (verticesList [j].x - verticesList [i].x) * (verticesList [k].y - verticesList [j].y);
val -= (verticesList [j].y - verticesList [i].y) * (verticesList [k].x - verticesList [j].x);
if (val < 0)
count --;
if (val > 0)
count ++;
}
if (count > 0) // CCW
verticesList.Reverse ();
}*/
// via https://stackoverflow.com/a/1165943
double edgeValSum = 0;
for (int i = 0; i < verticesList.Count - 1; i++) {
edgeValSum += getEdgeValue(verticesList, i, i + 1);
}
// must be connected back to the first point
edgeValSum += getEdgeValue(verticesList, verticesList.Count - 1, 0);
if (edgeValSum < 0) {
verticesList.Reverse();
}
ExtrudeGeometry.create (name, verticesList, height, topMaterial, sideMaterial);
}
private static double getEdgeValue(List<Vector2> verticesList, int thisIdx, int nextIdx) {
Vector2 thisPoint = verticesList[thisIdx];
Vector2 nextPoint = verticesList[nextIdx];
return (nextPoint.x - thisPoint.x) * (nextPoint.y + thisPoint.y);
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ObstacleExtrudeGeometry : ExtrudeGeometry { // walls
public static void create (string name, List<Vector2> verticesList, float height) {
GeometryLoader gl = GameObject.Find("GeometryLoader").GetComponent<GeometryLoader>();
Material topMaterial;
Material sideMaterial;
/*if (name.Contains ("_house")) {
topMaterial = gl.theme.getRoofMaterial ();
sideMaterial = gl.theme.getHouseMaterial ();
sideMaterial.SetTextureScale ("_MainTex", gl.theme.getTextureScaleForHeight (4f));
height = 6f;
} else {*/
topMaterial = gl.theme.getWallMaterial();
sideMaterial = topMaterial;
height = 1f;//2.2f + Random.value * 1.2f;
//}
if(verticesList[verticesList.Count - 1] == verticesList[0])
verticesList.RemoveAt (verticesList.Count - 1);
// http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/clockwise.htm (found by @Lesya91)
int n = verticesList.Count;
int i, j, k;
int count = 0;
float val;
if (n > 3) {
for (i = 0; i < n; i ++) {
j = (i + 1) % n;
k = (i + 2) % n;
val = (verticesList [j].x - verticesList [i].x) * (verticesList [k].y - verticesList [j].y);
val -= (verticesList [j].y - verticesList [i].y) * (verticesList [k].x - verticesList [j].x);
if (val < 0)
count --;
if (val > 0)
count ++;
}
if (count > 0) // CCW
verticesList.Reverse ();
}
ExtrudeGeometry.create (name, verticesList, height, topMaterial, sideMaterial);
}
}
|
mit
|
C#
|
e9473db77c61ce3e7b15f7f770634c5665b50d2d
|
Reorder to have video settings next to renderer
|
ppy/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipooo/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,ppy/osu,ppy/osu
|
osu.Game/Overlays/Settings/Sections/GraphicsSection.cs
|
osu.Game/Overlays/Settings/Sections/GraphicsSection.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Localisation;
using osu.Game.Overlays.Settings.Sections.Graphics;
namespace osu.Game.Overlays.Settings.Sections
{
public class GraphicsSection : SettingsSection
{
public override LocalisableString Header => GraphicsSettingsStrings.GraphicsSectionHeader;
public override Drawable CreateIcon() => new SpriteIcon
{
Icon = FontAwesome.Solid.Laptop
};
public GraphicsSection()
{
Children = new Drawable[]
{
new LayoutSettings(),
new RendererSettings(),
new VideoSettings(),
new ScreenshotSettings(),
};
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Localisation;
using osu.Game.Overlays.Settings.Sections.Graphics;
namespace osu.Game.Overlays.Settings.Sections
{
public class GraphicsSection : SettingsSection
{
public override LocalisableString Header => GraphicsSettingsStrings.GraphicsSectionHeader;
public override Drawable CreateIcon() => new SpriteIcon
{
Icon = FontAwesome.Solid.Laptop
};
public GraphicsSection()
{
Children = new Drawable[]
{
new LayoutSettings(),
new RendererSettings(),
new ScreenshotSettings(),
new VideoSettings(),
};
}
}
}
|
mit
|
C#
|
d2780c2c50557b1bdbfc1bec444ae9814dd08e80
|
Add a touch more detail to the unsupported skin component exception
|
NeoAdonis/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu
|
osu.Game/Skinning/UnsupportedSkinComponentException.cs
|
osu.Game/Skinning/UnsupportedSkinComponentException.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;
namespace osu.Game.Skinning
{
public class UnsupportedSkinComponentException : Exception
{
public UnsupportedSkinComponentException(ISkinComponent component)
: base($@"Unsupported component type: {component.GetType()} (lookup: ""{component.LookupName}"").")
{
}
}
}
|
// 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;
namespace osu.Game.Skinning
{
public class UnsupportedSkinComponentException : Exception
{
public UnsupportedSkinComponentException(ISkinComponent component)
: base($@"Unsupported component type: {component.GetType()}(""{component.LookupName}"").")
{
}
}
}
|
mit
|
C#
|
319ac1ba6e302c29a64fc908cd85baab71ea405b
|
Add missing IsDisposed.
|
atsushieno/mono-reactive,jorik041/mono-reactive,paulcbetts/mono-reactive
|
System.Reactive/System.Reactive.Disposables/CompositeDisposable.cs
|
System.Reactive/System.Reactive.Disposables/CompositeDisposable.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Reactive.Concurrency;
namespace System.Reactive.Disposables
{
public sealed class CompositeDisposable
: ICollection<IDisposable>, IEnumerable<IDisposable>, IEnumerable, IDisposable
{
// FIXME: not sure if simple stupid List is applicable...
List<IDisposable> items;
public CompositeDisposable (IEnumerable<IDisposable> disposables)
{
items = new List<IDisposable> (disposables);
}
public CompositeDisposable (params IDisposable[] disposables)
{
if (disposables == null)
throw new ArgumentNullException ("disposables");
if (disposables.Any (d => d == null))
throw new ArgumentNullException ("disposables", "Argument disposable parameter contains null");
items = new List<IDisposable> (disposables);
}
public CompositeDisposable (int capacity)
{
items = new List<IDisposable> (capacity);
}
public int Count {
get { return items.Count (); }
}
bool disposed;
public bool IsDisposed {
get { return disposed; }
}
public bool IsReadOnly {
get { throw new NotImplementedException (); }
}
IEnumerator IEnumerable.GetEnumerator ()
{
foreach (var i in items)
yield return i;
}
public void Add (IDisposable item)
{
if (item == null)
throw new ArgumentNullException ("item");
if (disposed)
item.Dispose ();
else
items.Add (item);
}
public void Clear ()
{
items.Clear ();
}
public bool Contains (IDisposable item)
{
return items.Contains (item);
}
public void CopyTo (IDisposable [] array, int arrayIndex)
{
items.CopyTo (array, arrayIndex);
}
public void Dispose ()
{
if (disposed)
return;
disposed = true;
foreach (var item in items)
item.Dispose ();
items.Clear ();
}
public IEnumerator<IDisposable> GetEnumerator ()
{
foreach (var i in items)
yield return i;
}
public bool Remove (IDisposable item)
{
return items.Remove (item);
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Reactive.Concurrency;
namespace System.Reactive.Disposables
{
public sealed class CompositeDisposable
: ICollection<IDisposable>, IEnumerable<IDisposable>, IEnumerable, IDisposable
{
// FIXME: not sure if simple stupid List is applicable...
List<IDisposable> items;
public CompositeDisposable (IEnumerable<IDisposable> disposables)
{
items = new List<IDisposable> (disposables);
}
public CompositeDisposable (params IDisposable[] disposables)
{
if (disposables == null)
throw new ArgumentNullException ("disposables");
if (disposables.Any (d => d == null))
throw new ArgumentNullException ("disposables", "Argument disposable parameter contains null");
items = new List<IDisposable> (disposables);
}
public CompositeDisposable (int capacity)
{
items = new List<IDisposable> (capacity);
}
public int Count {
get { return items.Count (); }
}
public bool IsReadOnly {
get { throw new NotImplementedException (); }
}
IEnumerator IEnumerable.GetEnumerator ()
{
foreach (var i in items)
yield return i;
}
public void Add (IDisposable item)
{
if (item == null)
throw new ArgumentNullException ("item");
if (disposed)
item.Dispose ();
else
items.Add (item);
}
public void Clear ()
{
items.Clear ();
}
public bool Contains (IDisposable item)
{
return items.Contains (item);
}
public void CopyTo (IDisposable [] array, int arrayIndex)
{
items.CopyTo (array, arrayIndex);
}
bool disposed;
public void Dispose ()
{
if (disposed)
return;
disposed = true;
foreach (var item in items)
item.Dispose ();
items.Clear ();
}
public IEnumerator<IDisposable> GetEnumerator ()
{
foreach (var i in items)
yield return i;
}
public bool Remove (IDisposable item)
{
return items.Remove (item);
}
}
}
|
mit
|
C#
|
232c5cd4e2596768979455b8a21b439f5362ce96
|
Use same namespace for serializers
|
davetimmins/ArcGIS.PCL,davetimmins/ArcGIS.PCL
|
ArcGIS.ServiceModel.Serializers.ServiceStackV3/ServiceStackSerializer.cs
|
ArcGIS.ServiceModel.Serializers.ServiceStackV3/ServiceStackSerializer.cs
|
using ArcGIS.ServiceModel.Operation;
using System;
using System.Collections.Generic;
namespace ArcGIS.ServiceModel.Serializers
{
public class ServiceStackSerializer : ISerializer
{
static ISerializer _serializer = null;
public static void Init()
{
_serializer = new ServiceStackSerializer();
SerializerFactory.Get = (() => _serializer ?? new ServiceStackSerializer());
}
public ServiceStackSerializer()
{
ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;
ServiceStack.Text.JsConfig.IncludeTypeInfo = false;
ServiceStack.Text.JsConfig.ConvertObjectTypesIntoStringDictionary = true;
ServiceStack.Text.JsConfig.IncludeNullValues = false;
}
public Dictionary<String, String> AsDictionary<T>(T objectToConvert) where T : CommonParameters
{
return ServiceStack.Text.TypeSerializer.ToStringDictionary<T>(objectToConvert);
}
public T AsPortalResponse<T>(String dataToConvert) where T : IPortalResponse
{
return ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(dataToConvert);
}
}
}
|
using ArcGIS.ServiceModel.Operation;
using System;
using System.Collections.Generic;
namespace ArcGIS.ServiceModel.Serializers.ServiceStackV3
{
public class ServiceStackSerializer : ISerializer
{
static ISerializer _serializer = null;
public static void Init()
{
_serializer = new ServiceStackSerializer();
SerializerFactory.Get = (() => _serializer ?? new ServiceStackSerializer());
}
public ServiceStackSerializer()
{
ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;
ServiceStack.Text.JsConfig.IncludeTypeInfo = false;
ServiceStack.Text.JsConfig.ConvertObjectTypesIntoStringDictionary = true;
ServiceStack.Text.JsConfig.IncludeNullValues = false;
}
public Dictionary<String, String> AsDictionary<T>(T objectToConvert) where T : CommonParameters
{
return ServiceStack.Text.TypeSerializer.ToStringDictionary<T>(objectToConvert);
}
public T AsPortalResponse<T>(String dataToConvert) where T : IPortalResponse
{
return ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(dataToConvert);
}
}
}
|
mit
|
C#
|
f44689a0a2152b5d49f9559de7f1ffb4bb2f58f3
|
Update ModifyThroughStyleObject.cs
|
aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/CSharp/Articles/ModifyExistingStyle/ModifyThroughStyleObject.cs
|
Examples/CSharp/Articles/ModifyExistingStyle/ModifyThroughStyleObject.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles.ModifyExistingStyle
{
public class ModifyThroughStyleObject
{
public static void Main()
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Create a workbook.
Workbook workbook = new Workbook();
//Create a new style object.
Style style = workbook.Styles[workbook.Styles.Add()];
//Set the number format.
style.Number = 14;
//Set the font color to red color.
style.Font.Color = System.Drawing.Color.Red;
//Name the style.
style.Name = "Date1";
//Get the first worksheet cells.
Cells cells = workbook.Worksheets[0].Cells;
//Specify the style (described above) to A1 cell.
cells["A1"].SetStyle(style);
//Create a range (B1:D1).
Range range = cells.CreateRange("B1", "D1");
//Initialize styleflag object.
StyleFlag flag = new StyleFlag();
//Set all formatting attributes on.
flag.All = true;
//Apply the style (described above)to the range.
range.ApplyStyle(style, flag);
//Modify the style (described above) and change the font color from red to black.
style.Font.Color = System.Drawing.Color.Black;
//Done! Since the named style (described above) has been set to a cell and range,
//the change would be Reflected(new modification is implemented) to cell(A1) and //range (B1:D1).
style.Update();
//Save the excel file.
workbook.Save(dataDir+ "book_styles.out.xls");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles.ModifyExistingStyle
{
public class ModifyThroughStyleObject
{
public static void Main()
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Create a workbook.
Workbook workbook = new Workbook();
//Create a new style object.
Style style = workbook.Styles[workbook.Styles.Add()];
//Set the number format.
style.Number = 14;
//Set the font color to red color.
style.Font.Color = System.Drawing.Color.Red;
//Name the style.
style.Name = "Date1";
//Get the first worksheet cells.
Cells cells = workbook.Worksheets[0].Cells;
//Specify the style (described above) to A1 cell.
cells["A1"].SetStyle(style);
//Create a range (B1:D1).
Range range = cells.CreateRange("B1", "D1");
//Initialize styleflag object.
StyleFlag flag = new StyleFlag();
//Set all formatting attributes on.
flag.All = true;
//Apply the style (described above)to the range.
range.ApplyStyle(style, flag);
//Modify the style (described above) and change the font color from red to black.
style.Font.Color = System.Drawing.Color.Black;
//Done! Since the named style (described above) has been set to a cell and range,
//the change would be Reflected(new modification is implemented) to cell(A1) and //range (B1:D1).
style.Update();
//Save the excel file.
workbook.Save(dataDir+ "book_styles.out.xls");
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.