commit
stringlengths 40
40
| old_file
stringlengths 4
237
| new_file
stringlengths 4
237
| old_contents
stringlengths 1
4.24k
| new_contents
stringlengths 1
4.87k
| subject
stringlengths 15
778
| message
stringlengths 15
8.75k
| lang
stringclasses 266
values | license
stringclasses 13
values | repos
stringlengths 5
127k
|
|---|---|---|---|---|---|---|---|---|---|
dc7e6da36f6d7dea97da811ac22d56adab389ea4
|
ChildProcessUtil/Program.cs
|
ChildProcessUtil/Program.cs
|
using System;
using System.Collections.Generic;
using Nancy;
using Nancy.Hosting.Self;
namespace ChildProcessUtil
{
public class Program
{
private const string HttpAddress = "http://localhost:";
private static NancyHost host;
private static void Main(string[] args)
{
StartServer(30197);
new MainProcessWatcher(int.Parse(args[0]));
Console.Read();
}
public static void StartServer(int port)
{
var hostConfigs = new HostConfiguration
{
UrlReservations = new UrlReservations {CreateAutomatically = true}
};
var uriString = HttpAddress + port;
ProcessModule.ActiveProcesses = new List<int>();
host = new NancyHost(new Uri(uriString), new DefaultNancyBootstrapper(), hostConfigs);
host.Start();
}
public static void StopServer(int port)
{
host.Stop();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Threading;
using Nancy;
using Nancy.Hosting.Self;
namespace ChildProcessUtil
{
public class Program
{
private const string HttpAddress = "http://localhost:";
private static NancyHost host;
private static void Main(string[] args)
{
StartServer(30197, int.Parse(args[0]));
}
public static void StartServer(int port, int mainProcessId)
{
var hostConfigs = new HostConfiguration
{
UrlReservations = new UrlReservations {CreateAutomatically = true}
};
var uriString = HttpAddress + port;
ProcessModule.ActiveProcesses = new List<int>();
host = new NancyHost(new Uri(uriString), new DefaultNancyBootstrapper(), hostConfigs);
host.Start();
new MainProcessWatcher(mainProcessId);
Thread.Sleep(Timeout.Infinite);
}
internal static void StopServer(int port)
{
host.Stop();
}
}
}
|
Change StartServer signature to take mainprocess's id as parameter
|
Change StartServer signature to take mainprocess's id as parameter
|
C#
|
mit
|
ramik/ChildProcessUtil
|
7f37e810e2489b059ee2b52997e9655711b33012
|
PinSharp/Api/PathBuilder.cs
|
PinSharp/Api/PathBuilder.cs
|
using System.Linq;
namespace PinSharp.Api
{
internal class PathBuilder
{
public static string BuildPath(string basePath, RequestOptions options)
{
var path = basePath;
if (!path.EndsWith("/"))
path += "/";
if (options?.SearchQuery != null)
path = path.AddQueryParam("query", options.SearchQuery);
if (options?.Fields?.Any() == true)
{
var fields = string.Join(",", options.Fields);
path = path.AddQueryParam("fields", fields);
}
if (options?.Limit > 0)
path = path.AddQueryParam("limit", options.Limit);
if (options?.Cursor != null)
path = path.AddQueryParam("cursor", options.Cursor);
return path;
}
}
internal static class QueryStringExtensions
{
public static string AddQueryParam(this string original, string name, object value)
{
original += original.Contains("?") ? "&" : "?";
original += $"{name}={value}";
return original;
}
}
}
|
using System.Linq;
namespace PinSharp.Api
{
internal class PathBuilder
{
public static string BuildPath(string basePath, RequestOptions options)
{
var path = basePath;
if (!path.EndsWith("/"))
path += "/";
if (options?.SearchQuery != null)
path = path.AddQueryParam("query", options.SearchQuery);
if (options?.Fields?.Any() == true)
{
var fields = string.Join(",", options.Fields);
path = path.AddQueryParam("fields", fields);
}
if (options?.Cursor != null)
path = path.AddQueryParam("cursor", options.Cursor);
if (options?.Limit > 0)
path = path.AddQueryParam("limit", options.Limit);
return path;
}
}
internal static class QueryStringExtensions
{
public static string AddQueryParam(this string original, string name, object value)
{
original += original.Contains("?") ? "&" : "?";
original += $"{name}={value}";
return original;
}
}
}
|
Rearrange query string parameters limit and cursor
|
Rearrange query string parameters limit and cursor
|
C#
|
unlicense
|
Krusen/PinSharp
|
c8fb0f1df3a3e8f5788bcff8f54900e8bec5d2a2
|
src/ControlzEx/Internal/SelectorAutomationPeerExtensions.cs
|
src/ControlzEx/Internal/SelectorAutomationPeerExtensions.cs
|
namespace ControlzEx.Internal
{
using System.Reflection;
using System.Windows.Automation.Peers;
using System.Windows.Controls;
internal static class SelectorAutomationPeerExtensions
{
private static readonly MethodInfo RaiseSelectionEventsMethodInfo = typeof(SelectorAutomationPeer).GetMethod("RaiseSelectionEventsMethodInfo", BindingFlags.NonPublic | BindingFlags.Instance);
internal static void RaiseSelectionEvents(this SelectorAutomationPeer selectorAutomationPeer, SelectionChangedEventArgs e)
{
RaiseSelectionEventsMethodInfo.Invoke(selectorAutomationPeer, new[]
{
e
});
}
}
}
|
namespace ControlzEx.Internal
{
using System.Reflection;
using System.Windows.Automation.Peers;
using System.Windows.Controls;
internal static class SelectorAutomationPeerExtensions
{
private static readonly MethodInfo RaiseSelectionEventsMethodInfo = typeof(SelectorAutomationPeer).GetMethod("RaiseSelectionEvents", BindingFlags.NonPublic | BindingFlags.Instance);
internal static void RaiseSelectionEvents(this SelectorAutomationPeer selectorAutomationPeer, SelectionChangedEventArgs e)
{
RaiseSelectionEventsMethodInfo.Invoke(selectorAutomationPeer, new object[] {e});
}
}
}
|
Fix wrong method info for RaiseSelectionEvents
|
TabControlEx: Fix wrong method info for RaiseSelectionEvents
Fix getting the wrong method info for RaiseSelectionEvents.
|
C#
|
mit
|
punker76/Controlz,ControlzEx/ControlzEx
|
6377e565fb206c5d2a524d17a8940f880bebc143
|
osu.Framework/Allocation/AsyncDisposalQueue.cs
|
osu.Framework/Allocation/AsyncDisposalQueue.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace osu.Framework.Allocation
{
/// <summary>
/// A queue which batches object disposal on threadpool threads.
/// </summary>
internal static class AsyncDisposalQueue
{
private static readonly Queue<IDisposable> disposal_queue = new Queue<IDisposable>();
private static Task runTask;
public static void Enqueue(IDisposable disposable)
{
lock (disposal_queue)
disposal_queue.Enqueue(disposable);
if (runTask?.Status < TaskStatus.Running)
return;
runTask = Task.Run(() =>
{
lock (disposal_queue)
{
while (disposal_queue.Count > 0)
disposal_queue.Dequeue().Dispose();
}
});
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using osu.Framework.Statistics;
namespace osu.Framework.Allocation
{
/// <summary>
/// A queue which batches object disposal on threadpool threads.
/// </summary>
internal static class AsyncDisposalQueue
{
private static readonly GlobalStatistic<string> last_disposal = GlobalStatistics.Get<string>("Drawable", "Last disposal");
private static readonly Queue<IDisposable> disposal_queue = new Queue<IDisposable>();
private static Task runTask;
public static void Enqueue(IDisposable disposable)
{
lock (disposal_queue)
disposal_queue.Enqueue(disposable);
if (runTask?.Status < TaskStatus.Running)
return;
runTask = Task.Run(() =>
{
lock (disposal_queue)
{
while (disposal_queue.Count > 0)
{
var toDispose = disposal_queue.Dequeue();
toDispose.Dispose();
last_disposal.Value = toDispose.ToString();
}
}
});
}
}
}
|
Add last disposed drawable to global statistics
|
Add last disposed drawable to global statistics
|
C#
|
mit
|
peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework
|
760f7d02d9f757fb47002a4ea1c2b34699ccca84
|
osu.Game/Graphics/UserInterface/HoverSounds.cs
|
osu.Game/Graphics/UserInterface/HoverSounds.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Adds hover sounds to a drawable.
/// Does not draw anything.
/// </summary>
public class HoverSounds : CompositeDrawable
{
private SampleChannel sampleHover;
protected readonly HoverSampleSet SampleSet;
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
{
SampleSet = sampleSet;
RelativeSizeAxes = Axes.Both;
AlwaysPresent = true;
}
protected override bool OnHover(InputState state)
{
sampleHover?.Play();
return base.OnHover(state);
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
sampleHover = audio.Sample.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
}
}
public enum HoverSampleSet
{
[Description("")]
Loud,
[Description("-soft")]
Normal,
[Description("-softer")]
Soft
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Adds hover sounds to a drawable.
/// Does not draw anything.
/// </summary>
public class HoverSounds : CompositeDrawable
{
private SampleChannel sampleHover;
protected readonly HoverSampleSet SampleSet;
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
{
SampleSet = sampleSet;
RelativeSizeAxes = Axes.Both;
}
protected override bool OnHover(InputState state)
{
sampleHover?.Play();
return base.OnHover(state);
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
sampleHover = audio.Sample.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
}
}
public enum HoverSampleSet
{
[Description("")]
Loud,
[Description("-soft")]
Normal,
[Description("-softer")]
Soft
}
}
|
Remove AlwaysPresent (not actually required)
|
Remove AlwaysPresent (not actually required)
|
C#
|
mit
|
smoogipoo/osu,smoogipoo/osu,ZLima12/osu,DrabWeb/osu,2yangk23/osu,DrabWeb/osu,NeoAdonis/osu,smoogipoo/osu,ZLima12/osu,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,ppy/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,johnneijzen/osu,NeoAdonis/osu,2yangk23/osu,ppy/osu,peppy/osu,smoogipooo/osu,naoey/osu,ppy/osu,Nabile-Rahmani/osu,DrabWeb/osu,UselessToucan/osu,naoey/osu,peppy/osu-new,UselessToucan/osu,Frontear/osuKyzer,naoey/osu,peppy/osu
|
419c0a6659f8cad2c2dd5e89c0fc27cc88425638
|
Hearts/Extensions/CardListExtensions.cs
|
Hearts/Extensions/CardListExtensions.cs
|
using Hearts.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using Hearts.Scoring;
namespace Hearts.Extensions
{
public static class CardListExtensions
{
public static void Log(this IEnumerable<Card> self, string name)
{
int padToLength = 38;
Logging.Log.ToBlue();
Console.Write(" " + name.PadLeft(Logging.Log.Options.NamePad) + " ");
foreach (var suit in new List<Suit> { Suit.Hearts, Suit.Spades, Suit.Diamonds, Suit.Clubs })
{
var cardsOfSuit = self.Where(i => i.Suit == suit);
foreach (var card in cardsOfSuit.OrderBy(i => i.Kind))
{
Logging.Log.Card(card);
Console.Write(" ");
}
Console.Write(new string(' ', padToLength - cardsOfSuit.Count() * 3));
}
Logging.Log.NewLine();
}
public static int Score(this IEnumerable<Card> self)
{
return new ScoreEvaluator().CalculateScore(self);
}
public static string ToDebugString(this IEnumerable<Card> self)
{
return string.Join(",", self);
}
}
}
|
using Hearts.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using Hearts.Scoring;
namespace Hearts.Extensions
{
public static class CardListExtensions
{
public static void Log(this IEnumerable<Card> self, string name)
{
int padToLength = 38;
Logging.Log.ToBlue();
Console.Write(" " + name.PadLeft(Logging.Log.Options.NamePad) + " ");
foreach (var suit in new List<Suit> { Suit.Hearts, Suit.Spades, Suit.Diamonds, Suit.Clubs })
{
var cardsOfSuit = self.OfSuit(suit);
foreach (var card in cardsOfSuit.Ascending())
{
Logging.Log.Card(card);
Console.Write(" ");
}
Console.Write(new string(' ', padToLength - cardsOfSuit.Count() * 3));
}
Logging.Log.NewLine();
}
public static int Score(this IEnumerable<Card> self)
{
return new ScoreEvaluator().CalculateScore(self);
}
public static string ToDebugString(this IEnumerable<Card> self)
{
return string.Join(",", self);
}
}
}
|
Refactor to use card extensions
|
Refactor to use card extensions
|
C#
|
mit
|
Dootrix/Hearts
|
e01102543fb7278468f6a65ffcc6026449f3b712
|
Source/ParserTests/ParserTests.cs
|
Source/ParserTests/ParserTests.cs
|
using NUnit.Framework;
using Pash.ParserIntrinsics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ParserTests
{
[TestFixture]
public class ParserTests
{
[Test]
public void IfTest()
{
var parseTree = PowerShellGrammar.Parser.Parse(@"if ($true) {}");
if (parseTree.HasErrors())
{
Assert.Fail(parseTree.ParserMessages[0].ToString());
}
}
[Test]
public void IfElseTest()
{
var parseTree = PowerShellGrammar.Parser.Parse(@"if ($true) {} else {}");
if (parseTree.HasErrors())
{
Assert.Fail(parseTree.ParserMessages[0].ToString());
}
}
[Test]
public void IfElseIfTest()
{
var parseTree = PowerShellGrammar.Parser.Parse(@"if ($true) {} elseif ($true) {} ");
if (parseTree.HasErrors())
{
Assert.Fail(parseTree.ParserMessages[0].ToString());
}
}
[Test, Explicit("bug")]
public void IfElseIfElseTest()
{
var parseTree = PowerShellGrammar.Parser.Parse(@"if ($true) {} elseif {$true) {} else {}");
if (parseTree.HasErrors())
{
Assert.Fail(parseTree.ParserMessages[0].ToString());
}
}
[Test, Explicit("bug")]
public void IfElseifElseTest()
{
var parseTree = PowerShellGrammar.Parser.Parse(@"if ($true) {} elseif ($true) {} elseif ($true) else {}");
if (parseTree.HasErrors())
{
Assert.Fail(parseTree.ParserMessages[0].ToString());
}
}
}
}
|
using NUnit.Framework;
using Pash.ParserIntrinsics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ParserTests
{
[TestFixture]
public class ParserTests
{
[Test]
[TestCase(@"if ($true) {} else {}")]
[TestCase(@"if ($true) {} elseif ($true) {} ")]
[TestCase(@"if ($true) {} elseif {$true) {} else {}", Explicit = true)]
[TestCase(@"if ($true) {} elseif ($true) {} elseif ($true) else {}", Explicit = true)]
public void IfElseSyntax(string input)
{
var parseTree = PowerShellGrammar.Parser.Parse(input);
if (parseTree.HasErrors())
{
Assert.Fail(parseTree.ParserMessages[0].ToString());
}
}
}
}
|
Use `TestCase` attribute in parser tests.
|
TEST: Use `TestCase` attribute in parser tests.
|
C#
|
bsd-3-clause
|
mrward/Pash,sburnicki/Pash,mrward/Pash,Jaykul/Pash,Jaykul/Pash,sburnicki/Pash,JayBazuzi/Pash,ForNeVeR/Pash,Jaykul/Pash,ForNeVeR/Pash,Jaykul/Pash,JayBazuzi/Pash,mrward/Pash,WimObiwan/Pash,ForNeVeR/Pash,mrward/Pash,WimObiwan/Pash,ForNeVeR/Pash,WimObiwan/Pash,sillvan/Pash,sillvan/Pash,sburnicki/Pash,sillvan/Pash,JayBazuzi/Pash,sburnicki/Pash,JayBazuzi/Pash,WimObiwan/Pash,sillvan/Pash
|
8b14068712528e1253ff1d46d07656c4926109f9
|
src/FrontEnd/Pages/Session.cshtml
|
src/FrontEnd/Pages/Session.cshtml
|
@page "{id}"
@model SessionModel
<ol class="breadcrumb">
<li><a asp-page="/Index">Agenda</a></li>
<li><a asp-page="/Index" asp-route-day="@Model.DayOffset">Day @(Model.DayOffset + 1)</a></li>
<li class="active">@Model.Session.Title</li>
</ol>
<h1>@Model.Session.Title</h1>
<span class="label label-default">@Model.Session.Track?.Name</span>
@foreach (var speaker in Model.Session.Speakers)
{
<em><a asp-page="Speaker" asp-route-id="@speaker.ID">@speaker.Name</a></em>
}
<p>@Html.Raw(Model.Session.Abstract)</p>
<form method="post">
<input type="hidden" name="sessionId" value="@Model.Session.ID" />
<p>
<a authz-policy="Admin" asp-page="/Admin/EditSession" asp-route-id="@Model.Session.ID" class="btn btn-default btn-sm">Edit</a>
@if (Model.IsInPersonalAgenda)
{
<button authz="true" type="submit" asp-page-handler="Remove" class="btn btn-primary">Remove from My Agenda</button>
}
else
{
<button authz="true" type="submit" class="btn btn-primary">Add to My Agenda</button>
}
</p>
</form>
|
@page "{id}"
@model SessionModel
<ol class="breadcrumb">
<li><a asp-page="/Index">Agenda</a></li>
<li><a asp-page="/Index" asp-route-day="@Model.DayOffset">Day @(Model.DayOffset + 1)</a></li>
<li class="active">@Model.Session.Title</li>
</ol>
<h1>@Model.Session.Title</h1>
<span class="label label-default">@Model.Session.Track?.Name</span>
@foreach (var speaker in Model.Session.Speakers)
{
<em><a asp-page="Speaker" asp-route-id="@speaker.ID">@speaker.Name</a></em>
}
<p>@Html.Raw(Model.Session.Abstract)</p>
<form method="post">
<input type="hidden" name="sessionId" value="@Model.Session.ID" />
<p>
<a authz-policy="Admin" asp-page="/Admin/EditSession" asp-route-id="@Model.Session.ID" class="btn btn-default btn-sm">Edit</a>
@if (Model.IsInPersonalAgenda)
{
<button authz="true" type="submit" asp-page-handler="Remove" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-star" aria-hidden="true"></span></button>
}
else
{
<button authz="true" type="submit" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-star-empty" aria-hidden="true"></span></button>
}
</p>
</form>
|
Fix icons on session details page
|
Fix icons on session details page
|
C#
|
mit
|
anurse/ConferencePlanner,dotnet-presentations/aspnetcore-app-workshop,dotnet-presentations/aspnetcore-app-workshop,anurse/ConferencePlanner,csharpfritz/aspnetcore-app-workshop,csharpfritz/aspnetcore-app-workshop,dotnet-presentations/aspnetcore-app-workshop,csharpfritz/aspnetcore-app-workshop,jongalloway/aspnetcore-app-workshop,dotnet-presentations/aspnetcore-app-workshop,csharpfritz/aspnetcore-app-workshop,jongalloway/aspnetcore-app-workshop,anurse/ConferencePlanner
|
2d3a06c450df5497971dca020ac922ae633bbec8
|
Winston.Test/DebuggerShim.cs
|
Winston.Test/DebuggerShim.cs
|
using System.Linq;
using System.Reflection;
using NSpec;
using NSpec.Domain;
using NSpec.Domain.Formatters;
using Microsoft.VisualStudio.TestTools.UnitTesting;
/*
* Howdy,
*
* This is NSpec's DebuggerShim. It will allow you to use TestDriven.Net or Resharper's test runner to run
* NSpec tests that are in the same Assembly as this class.
*
* It's DEFINITELY worth trying specwatchr (http://nspec.org/continuoustesting). Specwatchr automatically
* runs tests for you.
*
* If you ever want to debug a test when using Specwatchr, simply put the following line in your test:
*
* System.Diagnostics.Debugger.Launch()
*
* Visual Studio will detect this and will give you a window which you can use to attach a debugger.
*/
[TestClass]
public class DebuggerShim
{
[TestMethod]
public void debug()
{
var tagOrClassName = "class_or_tag_you_want_to_debug";
var types = GetType().Assembly.GetTypes();
// OR
// var types = new Type[]{typeof(Some_Type_Containg_some_Specs)};
var finder = new SpecFinder(types, "");
var builder = new ContextBuilder(finder, new Tags().Parse(tagOrClassName), new DefaultConventions());
var runner = new ContextRunner(builder, new ConsoleFormatter(), false);
var results = runner.Run(builder.Contexts().Build());
//assert that there aren't any failures
Assert.AreEqual(0, results.Failures().Count());
}
}
|
using System.Linq;
using System.Reflection;
using NSpec;
using NSpec.Domain;
using NSpec.Domain.Formatters;
using Microsoft.VisualStudio.TestTools.UnitTesting;
/*
* Howdy,
*
* This is NSpec's DebuggerShim. It will allow you to use TestDriven.Net or Resharper's test runner to run
* NSpec tests that are in the same Assembly as this class.
*
* It's DEFINITELY worth trying specwatchr (http://nspec.org/continuoustesting). Specwatchr automatically
* runs tests for you.
*
* If you ever want to debug a test when using Specwatchr, simply put the following line in your test:
*
* System.Diagnostics.Debugger.Launch()
*
* Visual Studio will detect this and will give you a window which you can use to attach a debugger.
*/
[TestClass]
public class DebuggerShim
{
[TestMethod]
public void NSpec_Tests()
{
var tagOrClassName = "class_or_tag_you_want_to_debug";
var types = GetType().Assembly.GetTypes();
// OR
// var types = new Type[]{typeof(Some_Type_Containg_some_Specs)};
var finder = new SpecFinder(types, "");
var builder = new ContextBuilder(finder, new Tags().Parse(tagOrClassName), new DefaultConventions());
var runner = new ContextRunner(builder, new ConsoleFormatter(), false);
var results = runner.Run(builder.Contexts().Build());
//assert that there aren't any failures
Assert.AreEqual(0, results.Failures().Count());
}
}
|
Rename test shim method name
|
Rename test shim method name
Give it a more friendly name than "debug" so test output at least makes
sense
|
C#
|
mit
|
mattolenik/winston,mattolenik/winston,mattolenik/winston
|
000c288f83ba2114cdc6ec0d335c33de438c4296
|
src/Swashbuckle.AspNetCore.SwaggerUi/Application/SwaggerUiBuilderExtensions.cs
|
src/Swashbuckle.AspNetCore.SwaggerUi/Application/SwaggerUiBuilderExtensions.cs
|
using System;
using System.Reflection;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.FileProviders;
using Swashbuckle.AspNetCore.SwaggerUi;
namespace Microsoft.AspNetCore.Builder
{
public static class SwaggerUiBuilderExtensions
{
public static IApplicationBuilder UseSwaggerUi(
this IApplicationBuilder app,
Action<SwaggerUiOptions> setupAction = null)
{
var options = new SwaggerUiOptions();
setupAction?.Invoke(options);
// Enable redirect from basePath to indexPath
app.UseMiddleware<RedirectMiddleware>(options.BaseRoute, options.IndexPath);
// Serve indexPath via middleware
app.UseMiddleware<SwaggerUiMiddleware>(options);
// Serve everything else via static file server
var fileServerOptions = new FileServerOptions
{
RequestPath = $"/{options.BaseRoute}",
EnableDefaultFiles = false,
FileProvider = new EmbeddedFileProvider(typeof(SwaggerUiBuilderExtensions).GetTypeInfo().Assembly,
"Swashbuckle.SwaggerUi.bower_components.swagger_ui.dist")
};
fileServerOptions.StaticFileOptions.ContentTypeProvider = new FileExtensionContentTypeProvider();
app.UseFileServer(fileServerOptions);
return app;
}
}
}
|
using System;
using System.Reflection;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.FileProviders;
using Swashbuckle.AspNetCore.SwaggerUi;
namespace Microsoft.AspNetCore.Builder
{
public static class SwaggerUiBuilderExtensions
{
public static IApplicationBuilder UseSwaggerUi(
this IApplicationBuilder app,
Action<SwaggerUiOptions> setupAction = null)
{
var options = new SwaggerUiOptions();
setupAction?.Invoke(options);
// Enable redirect from basePath to indexPath
app.UseMiddleware<RedirectMiddleware>(options.BaseRoute, options.IndexPath);
// Serve indexPath via middleware
app.UseMiddleware<SwaggerUiMiddleware>(options);
// Serve everything else via static file server
var fileServerOptions = new FileServerOptions
{
RequestPath = $"/{options.BaseRoute}",
EnableDefaultFiles = false,
FileProvider = new EmbeddedFileProvider(typeof(SwaggerUiBuilderExtensions).GetTypeInfo().Assembly,
"Swashbuckle.AspNetCore.SwaggerUi.bower_components.swagger_ui.dist")
};
fileServerOptions.StaticFileOptions.ContentTypeProvider = new FileExtensionContentTypeProvider();
app.UseFileServer(fileServerOptions);
return app;
}
}
}
|
Update EmbeddedFileProvider to reflect project name change
|
Update EmbeddedFileProvider to reflect project name change
|
C#
|
mit
|
oconics/Ahoy,domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Ahoy,oconics/Ahoy,domaindrivendev/Ahoy
|
0dce155f59cad97e448eb2e2f7aa51d2e8f2302a
|
Framework/Lokad.Cqrs.Portable/Feature.StreamingStorage/StreamingWriteOptions.cs
|
Framework/Lokad.Cqrs.Portable/Feature.StreamingStorage/StreamingWriteOptions.cs
|
#region (c) 2010-2011 Lokad - CQRS for Windows Azure - New BSD License
// Copyright (c) Lokad 2010-2011, http://www.lokad.com
// This code is released as Open Source under the terms of the New BSD Licence
#endregion
using System;
namespace Lokad.Cqrs.Feature.StreamingStorage
{
[Flags]
public enum StreamingWriteOptions
{
None,
/// <summary>
/// We'll compress data if possible.
/// </summary>
CompressIfPossible = 0x01,
/// <summary>
/// Be default we are optimizing for small read operations. Use this as a hint
/// </summary>
OptimizeForLargeWrites = 0x02
}
}
|
#region (c) 2010-2011 Lokad - CQRS for Windows Azure - New BSD License
// Copyright (c) Lokad 2010-2011, http://www.lokad.com
// This code is released as Open Source under the terms of the New BSD Licence
#endregion
using System;
namespace Lokad.Cqrs.Feature.StreamingStorage
{
[Flags]
public enum StreamingWriteOptions
{
None,
/// <summary>
/// We'll compress data if possible.
/// </summary>
CompressIfPossible = 0x01,
}
}
|
Drop unused streaming write option.
|
Drop unused streaming write option.
|
C#
|
bsd-3-clause
|
modulexcite/lokad-cqrs
|
b6b131a16531ef5322127358454ed1e0d07d34a3
|
src/Library.Test/NullTests.cs
|
src/Library.Test/NullTests.cs
|
#region Copyright and license
// // <copyright file="NullTests.cs" company="Oliver Zick">
// // Copyright (c) 2016 Oliver Zick. All rights reserved.
// // </copyright>
// // <author>Oliver Zick</author>
// // <license>
// // 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.
// // </license>
#endregion
namespace Delizious.Filtering
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public sealed class NullTests
{
[TestMethod]
public void Succeed__When_Value_Is_Null()
{
Assert.IsTrue(Match.Null<GenericParameterHelper>().Matches(null));
}
[TestMethod]
public void Fail__When_Value_Is_An_Instance()
{
Assert.IsFalse(Match.Null<GenericParameterHelper>().Matches(new GenericParameterHelper()));
}
}
}
|
#region Copyright and license
// // <copyright file="NullTests.cs" company="Oliver Zick">
// // Copyright (c) 2016 Oliver Zick. All rights reserved.
// // </copyright>
// // <author>Oliver Zick</author>
// // <license>
// // 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.
// // </license>
#endregion
namespace Delizious.Filtering
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public sealed class NullTests
{
[TestMethod]
public void Match_Succeeds_When_Value_To_Match_Is_Null()
{
Assert.IsTrue(Match.Null<GenericParameterHelper>().Matches(null));
}
[TestMethod]
public void Match_Fails_When_Value_To_Match_Is_An_Instance()
{
Assert.IsFalse(Match.Null<GenericParameterHelper>().Matches(new GenericParameterHelper()));
}
}
}
|
Improve naming of tests to clearly indicate the feature to be tested
|
Improve naming of tests to clearly indicate the feature to be tested
|
C#
|
apache-2.0
|
oliverzick/Delizious-Filtering
|
182945a209fcd6b05c1829e21b983b0890072f06
|
tests/cs/extension-methods/ExtensionMethods.cs
|
tests/cs/extension-methods/ExtensionMethods.cs
|
using System;
public class Herp
{
public Herp(int X)
{
this.X = X;
}
public int X { get; private set; }
}
public static class HerpExtensions
{
public static void PrintX(this Herp Value)
{
Console.WriteLine(Value.X);
}
}
public static class Program
{
public static void Main()
{
var herp = new Herp(20);
herp.PrintX();
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Herp
{
public Herp(int X)
{
this.X = X;
}
public int X { get; private set; }
}
public static class HerpExtensions
{
public static void PrintX(this Herp Value)
{
Console.WriteLine(Value.X);
}
}
public static class Program
{
public static void Main()
{
var herp = new Herp(20);
herp.PrintX();
var items = new List<int>();
items.Add(10);
items.Add(20);
items.Add(30);
// Note that ToArray<int> is actually a generic extension method:
// Enumerable.ToArray<T>.
foreach (var x in items.ToArray<int>())
{
Console.WriteLine(x);
}
}
}
|
Update the extension method test case
|
Update the extension method test case
|
C#
|
mit
|
jonathanvdc/ecsc
|
9a62b3653f335f4e066b4dc542cd45aaf1a9a41f
|
WalletWasabi.Fluent/ViewModels/Dialogs/DialogScreenViewModel.cs
|
WalletWasabi.Fluent/ViewModels/Dialogs/DialogScreenViewModel.cs
|
using System;
using System.Reactive;
using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
public class DialogScreenViewModel : ViewModelBase, IScreen
{
private bool _isClosing;
private bool _isDialogVisible;
public DialogScreenViewModel()
{
Observable.FromEventPattern(Router.NavigationStack, nameof(Router.NavigationStack.CollectionChanged))
.Subscribe(_ =>
{
if (!_isClosing)
{
IsDialogVisible = Router.NavigationStack.Count >= 1;
}
});
this.WhenAnyValue(x => x.IsDialogVisible).Subscribe(x =>
{
if (!x)
{
// Reset navigation when Dialog is using IScreen for navigation instead of the default IDialogHost.
Close();
}
});
}
public RoutingState Router { get; } = new RoutingState();
public ReactiveCommand<Unit, Unit> GoBack => Router.NavigateBack;
public bool IsDialogVisible
{
get => _isDialogVisible;
set => this.RaiseAndSetIfChanged(ref _isDialogVisible, value);
}
public void Close()
{
if (!_isClosing)
{
_isClosing = true;
if (Router.NavigationStack.Count >= 1)
{
Router.NavigationStack.Clear();
}
_isClosing = false;
}
}
}
}
|
using System;
using System.Reactive;
using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
public class DialogScreenViewModel : ViewModelBase, IScreen
{
private bool _isClosing;
private bool _isDialogVisible;
public DialogScreenViewModel()
{
Observable.FromEventPattern(Router.NavigationStack, nameof(Router.NavigationStack.CollectionChanged))
.Subscribe(_ =>
{
if (!_isClosing)
{
IsDialogVisible = Router.NavigationStack.Count >= 1;
}
});
this.WhenAnyValue(x => x.IsDialogVisible).Subscribe(x =>
{
if (!x)
{
// Reset navigation when Dialog is using IScreen for navigation instead of the default IDialogHost.
Close();
}
});
}
public RoutingState Router { get; } = new RoutingState();
public ReactiveCommand<Unit, Unit> GoBack => Router.NavigateBack;
public bool IsDialogVisible
{
get => _isDialogVisible;
set => this.RaiseAndSetIfChanged(ref _isDialogVisible, value);
}
public void Close()
{
if (!_isClosing)
{
_isClosing = true;
if (Router.NavigationStack.Count >= 1)
{
Router.NavigationStack.Clear();
IsDialogVisible = false;
}
_isClosing = false;
}
}
}
}
|
Set dialog flag as Router.NavigationStack.CollectionChanged observable in blocked by _isClosing
|
Set dialog flag as Router.NavigationStack.CollectionChanged observable in blocked by _isClosing
|
C#
|
mit
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
a1dd09b877fad5a23c328cffa6d3ed5a978cb327
|
kh.tools.imgz/Models/ImageModel.cs
|
kh.tools.imgz/Models/ImageModel.cs
|
using kh.kh2;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Xe.Tools;
using Xe.Tools.Wpf;
namespace kh.tools.imgz.Models
{
public class ImageModel : BaseNotifyPropertyChanged
{
private Imgd imgd;
public ImageModel(Imgd imgd)
{
Imgd = imgd;
}
public Imgd Imgd
{
get => imgd;
set => LoadImgd(imgd = value);
}
public BitmapSource Image { get; set; }
public string DisplayName => $"{Image.PixelWidth}x{Image.PixelHeight}";
private void LoadImgd(Imgd imgd)
{
LoadImage(imgd.GetBitmap(), imgd.Size.Width, imgd.Size.Height);
}
private void LoadImage(byte[] data, int width, int height)
{
Image = BitmapSource.Create(width, height, 96.0, 96.0, PixelFormats.Bgra32, null, data, width * 4);
OnPropertyChanged(nameof(Image));
}
}
}
|
using kh.Imaging;
using kh.kh2;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Xe.Tools;
using Xe.Tools.Wpf;
namespace kh.tools.imgz.Models
{
public class ImageModel : BaseNotifyPropertyChanged
{
private Imgd imgd;
public ImageModel(Imgd imgd)
{
Imgd = imgd;
}
public Imgd Imgd
{
get => imgd;
set => LoadImgd(imgd = value);
}
public BitmapSource Image { get; set; }
public string DisplayName => $"{Image.PixelWidth}x{Image.PixelHeight}";
private void LoadImgd(Imgd imgd)
{
LoadImage(imgd);
}
private void LoadImage(IImageRead imageRead)
{
var size = imageRead.Size;
var data = imageRead.ToBgra32();
Image = BitmapSource.Create(size.Width, size.Height, 96.0, 96.0, PixelFormats.Bgra32, null, data, size.Width * 4);
OnPropertyChanged(nameof(Image));
}
}
}
|
Fix compilation error on kh.tools.imgz
|
Fix compilation error on kh.tools.imgz
|
C#
|
mit
|
Xeeynamo/KingdomHearts
|
1e617a8e0bcad09c7a2d385ab9a0d593419dd00c
|
Gherkin.AstGenerator/Program.cs
|
Gherkin.AstGenerator/Program.cs
|
using System;
using System.Linq;
namespace Gherkin.AstGenerator
{
class Program
{
static int Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("Usage: Gherkin.AstGenerator.exe test-feature-file.feature");
return 100;
}
var startTime = Environment.TickCount;
foreach (var featureFilePath in args)
{
try
{
var astText = AstGenerator.GenerateAst(featureFilePath);
Console.WriteLine(astText);
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
return 1;
}
}
var endTime = Environment.TickCount;
if (Environment.GetEnvironmentVariable("GHERKIN_PERF") != null)
{
Console.Error.WriteLine(endTime - startTime);
}
return 0;
}
}
}
|
using System;
using System.Linq;
namespace Gherkin.AstGenerator
{
class Program
{
static int Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("Usage: Gherkin.AstGenerator.exe test-feature-file.feature");
return 100;
}
var startTime = Environment.TickCount;
foreach (var featureFilePath in args)
{
try
{
var astText = AstGenerator.GenerateAst(featureFilePath);
Console.WriteLine(astText);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return 1;
}
}
var endTime = Environment.TickCount;
if (Environment.GetEnvironmentVariable("GHERKIN_PERF") != null)
{
Console.Error.WriteLine(endTime - startTime);
}
return 0;
}
}
}
|
Print to STDOUT - 2> is broken on Mono/OS X
|
Print to STDOUT - 2> is broken on Mono/OS X
|
C#
|
mit
|
chebizarro/gherkin3,curzona/gherkin3,vincent-psarga/gherkin3,SabotageAndi/gherkin,SabotageAndi/gherkin,amaniak/gherkin3,dg-ratiodata/gherkin3,SabotageAndi/gherkin,chebizarro/gherkin3,curzona/gherkin3,hayd/gherkin3,chebizarro/gherkin3,Zearin/gherkin3,araines/gherkin3,amaniak/gherkin3,dirkrombauts/gherkin3,thetutlage/gherkin3,SabotageAndi/gherkin,concertman/gherkin3,SabotageAndi/gherkin,cucumber/gherkin3,pjlsergeant/gherkin,curzona/gherkin3,pjlsergeant/gherkin,hayd/gherkin3,hayd/gherkin3,thiblahute/gherkin3,moreirap/gherkin3,curzona/gherkin3,moreirap/gherkin3,moreirap/gherkin3,dirkrombauts/gherkin3,amaniak/gherkin3,vincent-psarga/gherkin3,SabotageAndi/gherkin,Zearin/gherkin3,cucumber/gherkin3,concertman/gherkin3,vincent-psarga/gherkin3,thetutlage/gherkin3,thiblahute/gherkin3,SabotageAndi/gherkin,araines/gherkin3,concertman/gherkin3,pjlsergeant/gherkin,chebizarro/gherkin3,chebizarro/gherkin3,cucumber/gherkin3,thiblahute/gherkin3,cucumber/gherkin3,araines/gherkin3,moreirap/gherkin3,Zearin/gherkin3,thiblahute/gherkin3,curzona/gherkin3,dg-ratiodata/gherkin3,araines/gherkin3,moreirap/gherkin3,chebizarro/gherkin3,curzona/gherkin3,cucumber/gherkin3,araines/gherkin3,moreirap/gherkin3,curzona/gherkin3,dg-ratiodata/gherkin3,hayd/gherkin3,moreirap/gherkin3,concertman/gherkin3,Zearin/gherkin3,pjlsergeant/gherkin,Zearin/gherkin3,chebizarro/gherkin3,thetutlage/gherkin3,pjlsergeant/gherkin,Zearin/gherkin3,dirkrombauts/gherkin3,chebizarro/gherkin3,vincent-psarga/gherkin3,thiblahute/gherkin3,vincent-psarga/gherkin3,amaniak/gherkin3,dg-ratiodata/gherkin3,thiblahute/gherkin3,cucumber/gherkin3,pjlsergeant/gherkin,dirkrombauts/gherkin3,cucumber/gherkin3,dirkrombauts/gherkin3,thetutlage/gherkin3,thiblahute/gherkin3,concertman/gherkin3,pjlsergeant/gherkin,thetutlage/gherkin3,araines/gherkin3,hayd/gherkin3,cucumber/gherkin3,hayd/gherkin3,Zearin/gherkin3,dirkrombauts/gherkin3,amaniak/gherkin3,dg-ratiodata/gherkin3,cucumber/gherkin3,concertman/gherkin3,hayd/gherkin3,thetutlage/gherkin3,vincent-psarga/gherkin3,araines/gherkin3,araines/gherkin3,hayd/gherkin3,dirkrombauts/gherkin3,amaniak/gherkin3,concertman/gherkin3,pjlsergeant/gherkin,SabotageAndi/gherkin,vincent-psarga/gherkin3,amaniak/gherkin3,vincent-psarga/gherkin3,dg-ratiodata/gherkin3,concertman/gherkin3,amaniak/gherkin3,dg-ratiodata/gherkin3,thetutlage/gherkin3,moreirap/gherkin3,curzona/gherkin3,dirkrombauts/gherkin3,pjlsergeant/gherkin,SabotageAndi/gherkin,thiblahute/gherkin3,Zearin/gherkin3,dg-ratiodata/gherkin3,thetutlage/gherkin3
|
375dad087837ba6156be5ec629b0a370c19c7891
|
osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs
|
osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.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.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mania.Judgements
{
public class ManiaJudgement : Judgement
{
protected override int NumericResultFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Meh:
return 50;
case HitResult.Ok:
return 100;
case HitResult.Good:
return 200;
case HitResult.Great:
return 300;
case HitResult.Perfect:
return 320;
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mania.Judgements
{
public class ManiaJudgement : Judgement
{
protected override int NumericResultFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Meh:
return 50;
case HitResult.Ok:
return 100;
case HitResult.Good:
return 200;
case HitResult.Great:
return 300;
case HitResult.Perfect:
return 350;
}
}
}
}
|
Increase PERFECT from 320 to 350 score
|
Increase PERFECT from 320 to 350 score
|
C#
|
mit
|
NeoAdonis/osu,peppy/osu-new,smoogipoo/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,ppy/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu,ppy/osu
|
7b7458b7668d0a599391846fab3ce0579d2322b6
|
Src/ClojSharp.Core/Forms/Seq.cs
|
Src/ClojSharp.Core/Forms/Seq.cs
|
namespace ClojSharp.Core.Forms
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClojSharp.Core.Language;
public class Seq : BaseUnaryForm
{
public override object EvaluateForm(IContext context, IList<object> arguments)
{
var arg = arguments[0];
if (arg == null)
return null;
if (arg is Vector)
return List.FromEnumerable(((Vector)arg).Elements);
if (arg is EmptyList)
return null;
if (arg is List)
return arg;
return EnumerableSeq.MakeSeq((IEnumerable)arg);
}
}
}
|
namespace ClojSharp.Core.Forms
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClojSharp.Core.Language;
public class Seq : BaseUnaryForm
{
public override object EvaluateForm(IContext context, IList<object> arguments)
{
var arg = arguments[0];
if (arg == null)
return null;
if (arg is Vector)
{
var vector = (Vector)arg;
if (vector.Elements == null || vector.Elements.Count == 0)
return null;
return EnumerableSeq.MakeSeq(vector.Elements);
}
if (arg is EmptyList)
return null;
if (arg is List)
return arg;
return EnumerableSeq.MakeSeq((IEnumerable)arg);
}
}
}
|
Refactor seq for empty vectors
|
Refactor seq for empty vectors
|
C#
|
mit
|
ajlopez/ClojSharp
|
25623b8bbffd5e0223f43352c0406b29ee9beaea
|
src/Framework/Razor/Web/Mvc/ContentWebViewPageOfT.cs
|
src/Framework/Razor/Web/Mvc/ContentWebViewPageOfT.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace N2.Web.Mvc
{
/// <remarks>This code is here since it has dependencies on ASP.NET 3.0 which isn't a requirement for N2 in general.</remarks>
public abstract class ContentWebViewPage<TModel> : WebViewPage<TModel>, IContentView where TModel : class
{
private DynamicContentHelper content;
/// <summary>Provides access to a simplified API to access data.</summary>
public DynamicContentHelper Content
{
get { return content ?? (content = new DynamicContentHelper(Html)); }
set { content = value; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace N2.Web.Mvc
{
/// <remarks>This code is here since it has dependencies on ASP.NET 3.0 which isn't a requirement for N2 in general.</remarks>
public abstract class ContentWebViewPage<TModel> : WebViewPage<TModel>, IContentView
{
private DynamicContentHelper content;
/// <summary>Provides access to a simplified API to access data.</summary>
public DynamicContentHelper Content
{
get { return content ?? (content = new DynamicContentHelper(Html)); }
set { content = value; }
}
}
}
|
Enable use of value types as for models.
|
Enable use of value types as for models.
|
C#
|
lgpl-2.1
|
EzyWebwerkstaden/n2cms,nimore/n2cms,bussemac/n2cms,VoidPointerAB/n2cms,EzyWebwerkstaden/n2cms,SntsDev/n2cms,nicklv/n2cms,SntsDev/n2cms,VoidPointerAB/n2cms,bussemac/n2cms,SntsDev/n2cms,bussemac/n2cms,SntsDev/n2cms,nimore/n2cms,EzyWebwerkstaden/n2cms,nicklv/n2cms,n2cms/n2cms,EzyWebwerkstaden/n2cms,DejanMilicic/n2cms,bussemac/n2cms,VoidPointerAB/n2cms,nimore/n2cms,DejanMilicic/n2cms,n2cms/n2cms,n2cms/n2cms,VoidPointerAB/n2cms,EzyWebwerkstaden/n2cms,bussemac/n2cms,DejanMilicic/n2cms,nicklv/n2cms,nicklv/n2cms,nicklv/n2cms,n2cms/n2cms,nimore/n2cms,DejanMilicic/n2cms
|
e70ce98213dcc10f7339e851be6b4c7281152a4e
|
src/Microsoft.AspNetCore.Razor.Language/RazorParserOptions.cs
|
src/Microsoft.AspNetCore.Razor.Language/RazorParserOptions.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.AspNetCore.Razor.Language
{
public abstract class RazorParserOptions
{
public static RazorParserOptions Create(IEnumerable<DirectiveDescriptor> directives, bool designTime)
{
if (directives == null)
{
throw new ArgumentNullException(nameof(directives));
}
return new DefaultRazorParserOptions(directives.ToArray(), designTime, parseOnlyLeadingDirectives: false);
}
public static RazorParserOptions Create(IEnumerable<DirectiveDescriptor> directives, bool designTime, bool parseOnlyLeadingDirectives)
{
if (directives == null)
{
throw new ArgumentNullException(nameof(directives));
}
return new DefaultRazorParserOptions(directives.ToArray(), designTime, parseOnlyLeadingDirectives);
}
public static RazorParserOptions CreateDefault()
{
return new DefaultRazorParserOptions(Array.Empty<DirectiveDescriptor>(), designTime: false, parseOnlyLeadingDirectives: false);
}
public abstract bool DesignTime { get; }
public abstract IReadOnlyCollection<DirectiveDescriptor> Directives { get; }
public abstract bool ParseOnlyLeadingDirectives { get; }
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.AspNetCore.Razor.Language
{
public abstract class RazorParserOptions
{
public static RazorParserOptions Create(IEnumerable<DirectiveDescriptor> directives, bool designTime)
{
if (directives == null)
{
throw new ArgumentNullException(nameof(directives));
}
return new DefaultRazorParserOptions(directives.ToArray(), designTime, parseOnlyLeadingDirectives: false);
}
public static RazorParserOptions Create(IEnumerable<DirectiveDescriptor> directives, bool designTime, bool parseOnlyLeadingDirectives)
{
if (directives == null)
{
throw new ArgumentNullException(nameof(directives));
}
return new DefaultRazorParserOptions(directives.ToArray(), designTime, parseOnlyLeadingDirectives);
}
public static RazorParserOptions CreateDefault()
{
return new DefaultRazorParserOptions(Array.Empty<DirectiveDescriptor>(), designTime: false, parseOnlyLeadingDirectives: false);
}
public abstract bool DesignTime { get; }
public abstract IReadOnlyCollection<DirectiveDescriptor> Directives { get; }
/// <summary>
/// Gets a value which indicates whether the parser will parse only the leading directives. If <c>true</c>
/// the parser will halt at the first HTML content or C# code block. If <c>false</c> the whole document is parsed.
/// </summary>
/// <remarks>
/// Currently setting this option to <c>true</c> will result in only the first line of directives being parsed.
/// In a future release this may be updated to include all leading directive content.
/// </remarks>
public abstract bool ParseOnlyLeadingDirectives { get; }
}
}
|
Add docs about limitation of this option
|
Add docs about limitation of this option
This is all the work we're planning to do for #1361 for 2.0.0. Will
revisit this functionality in 2.1.0.
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
62df82dc3ac35a01e8b6bce2cd81156ba3a74543
|
aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/Models/Account/RegisterViewModel.cs
|
aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/Models/Account/RegisterViewModel.cs
|
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
using Abp.Auditing;
using Abp.Authorization.Users;
using Abp.Extensions;
namespace AbpCompanyName.AbpProjectName.Web.Models.Account
{
public class RegisterViewModel : IValidatableObject
{
[Required]
[StringLength(AbpUserBase.MaxNameLength)]
public string Name { get; set; }
[Required]
[StringLength(AbpUserBase.MaxSurnameLength)]
public string Surname { get; set; }
[StringLength(AbpUserBase.MaxUserNameLength)]
public string UserName { get; set; }
[Required]
[EmailAddress]
[StringLength(AbpUserBase.MaxEmailAddressLength)]
public string EmailAddress { get; set; }
[StringLength(AbpUserBase.MaxPlainPasswordLength)]
[DisableAuditing]
public string Password { get; set; }
public bool IsExternalLogin { get; set; }
public string ExternalLoginAuthSchema { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (!UserName.IsNullOrEmpty())
{
var emailRegex = new Regex(@"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");
if (!UserName.Equals(EmailAddress) && emailRegex.IsMatch(UserName))
{
yield return new ValidationResult("Username cannot be an email address unless it's the same as your email address!");
}
}
}
}
}
|
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Abp.Auditing;
using Abp.Authorization.Users;
using Abp.Extensions;
using AbpCompanyName.AbpProjectName.Validation;
namespace AbpCompanyName.AbpProjectName.Web.Models.Account
{
public class RegisterViewModel : IValidatableObject
{
[Required]
[StringLength(AbpUserBase.MaxNameLength)]
public string Name { get; set; }
[Required]
[StringLength(AbpUserBase.MaxSurnameLength)]
public string Surname { get; set; }
[StringLength(AbpUserBase.MaxUserNameLength)]
public string UserName { get; set; }
[Required]
[EmailAddress]
[StringLength(AbpUserBase.MaxEmailAddressLength)]
public string EmailAddress { get; set; }
[StringLength(AbpUserBase.MaxPlainPasswordLength)]
[DisableAuditing]
public string Password { get; set; }
public bool IsExternalLogin { get; set; }
public string ExternalLoginAuthSchema { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (!UserName.IsNullOrEmpty())
{
if (!UserName.Equals(EmailAddress) && ValidationHelper.IsEmail(UserName))
{
yield return new ValidationResult("Username cannot be an email address unless it's the same as your email address!");
}
}
}
}
}
|
Use ValidationHelper for email regex
|
Use ValidationHelper for email regex
|
C#
|
mit
|
aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template
|
7441684e7d8bceda353b56ceac34e8c1672ddcb8
|
src/AppHarbor/Commands/LoginCommand.cs
|
src/AppHarbor/Commands/LoginCommand.cs
|
using System;
namespace AppHarbor.Commands
{
public class LoginCommand : ICommand
{
private const string TokenEnvironmentVariable = "AppHarborToken";
private readonly AccessTokenFetcher _accessTokenFetcher;
private readonly EnvironmentVariableConfiguration _environmentVariableConfiguration;
public LoginCommand(AccessTokenFetcher accessTokenFetcher, EnvironmentVariableConfiguration environmentVariableConfiguration)
{
_accessTokenFetcher = accessTokenFetcher;
_environmentVariableConfiguration = environmentVariableConfiguration;
}
public void Execute(string[] arguments)
{
if (_environmentVariableConfiguration.Get(TokenEnvironmentVariable, EnvironmentVariableTarget.User) != null)
{
throw new CommandException("You're already logged in");
}
Console.WriteLine("Username:");
var username = Console.ReadLine();
Console.WriteLine("Password:");
var password = Console.ReadLine();
var accessToken = _accessTokenFetcher.Get(username, password);
_environmentVariableConfiguration.Set(TokenEnvironmentVariable, accessToken, EnvironmentVariableTarget.User);
}
}
}
|
using System;
namespace AppHarbor.Commands
{
public class LoginCommand : ICommand
{
private const string TokenEnvironmentVariable = "AppHarborToken";
private const EnvironmentVariableTarget TokenEnvironmentVariableTarget = EnvironmentVariableTarget.User;
private readonly AccessTokenFetcher _accessTokenFetcher;
private readonly EnvironmentVariableConfiguration _environmentVariableConfiguration;
public LoginCommand(AccessTokenFetcher accessTokenFetcher, EnvironmentVariableConfiguration environmentVariableConfiguration)
{
_accessTokenFetcher = accessTokenFetcher;
_environmentVariableConfiguration = environmentVariableConfiguration;
}
public void Execute(string[] arguments)
{
if (_environmentVariableConfiguration.Get(TokenEnvironmentVariable, TokenEnvironmentVariableTarget) != null)
{
throw new CommandException("You're already logged in");
}
Console.WriteLine("Username:");
var username = Console.ReadLine();
Console.WriteLine("Password:");
var password = Console.ReadLine();
var accessToken = _accessTokenFetcher.Get(username, password);
_environmentVariableConfiguration.Set(TokenEnvironmentVariable, accessToken, TokenEnvironmentVariableTarget);
}
}
}
|
Move EnvironmentVariableTarget to const member
|
Move EnvironmentVariableTarget to const member
|
C#
|
mit
|
appharbor/appharbor-cli
|
291660805f501170229e8883bdc4fce07ba3f9d2
|
osu.Framework.Tests.Android/TestGameActivity.cs
|
osu.Framework.Tests.Android/TestGameActivity.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 Android.App;
using Android.Content.PM;
using osu.Framework.Android;
namespace osu.Framework.Tests.Android
{
[Activity(MainLauncher = true, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, Theme = "@android:style/Theme.NoTitleBar")]
public class TestGameActivity : AndroidGameActivity
{
protected override Game CreateGame()
=> new VisualTestGame();
}
}
|
// 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 Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;
using osu.Framework.Android;
namespace osu.Framework.Tests.Android
{
[Activity(MainLauncher = true, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, Theme = "@android:style/Theme.NoTitleBar")]
public class TestGameActivity : AndroidGameActivity
{
protected override Game CreateGame()
=> new VisualTestGame();
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Window.AddFlags(WindowManagerFlags.Fullscreen);
}
}
}
|
Hide titlebar in Android visual test activity
|
Hide titlebar in Android visual test activity
|
C#
|
mit
|
ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework
|
91ac1637e57b4b2a5acb380b113491b4ce3b55b1
|
Battery-Commander.Web/Controllers/APFTController.cs
|
Battery-Commander.Web/Controllers/APFTController.cs
|
using BatteryCommander.Web.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace BatteryCommander.Web.Controllers
{
[Authorize]
public class APFTController : Controller
{
private readonly Database db;
public APFTController(Database db)
{
this.db = db;
}
}
}
|
using BatteryCommander.Web.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Controllers
{
[Authorize]
public class APFTController : Controller
{
private readonly Database db;
public APFTController(Database db)
{
this.db = db;
}
public async Task<IActionResult> List()
{
throw new NotImplementedException();
}
public async Task<IActionResult> Details(int id)
{
throw new NotImplementedException();
}
public IActionResult New()
{
throw new NotImplementedException();
}
public async Task<IActionResult> Edit(int id)
{
throw new NotImplementedException();
}
public async Task<IActionResult> Save(dynamic model)
{
// If EXISTS, Update
// Else, Create New
await db.SaveChangesAsync();
return RedirectToAction(nameof(Details), model.Id);
}
}
}
|
Add stubs for APFT controller
|
Add stubs for APFT controller
|
C#
|
mit
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
055a48a21b9d7c024b356e547022fb197982f7f5
|
src/SlashTodo.Web/Api/DefaultSlashCommandHandler.cs
|
src/SlashTodo.Web/Api/DefaultSlashCommandHandler.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using SlashTodo.Core;
using SlashTodo.Infrastructure.Slack;
namespace SlashTodo.Web.Api
{
public class DefaultSlashCommandHandler : ISlashCommandHandler
{
private readonly IRepository<Core.Domain.Todo> _todoRepository;
private readonly ISlackIncomingWebhookApi _slackIncomingWebhookApi;
public DefaultSlashCommandHandler(
IRepository<Core.Domain.Todo> todoRepository,
ISlackIncomingWebhookApi slackIncomingWebhookApi)
{
_todoRepository = todoRepository;
_slackIncomingWebhookApi = slackIncomingWebhookApi;
}
public Task<string> Handle(SlashCommand command, Uri teamIncomingWebhookUrl)
{
_slackIncomingWebhookApi.Send(teamIncomingWebhookUrl, new SlackIncomingWebhookMessage
{
ConversationId = command.ConversationId,
Text = string.Format("*Echo:* {0} {1}", command.Command, command.Text)
});
return Task.FromResult<string>(null);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using SlashTodo.Core;
using SlashTodo.Infrastructure.Slack;
namespace SlashTodo.Web.Api
{
public class DefaultSlashCommandHandler : ISlashCommandHandler
{
private readonly IRepository<Core.Domain.Todo> _todoRepository;
private readonly ISlackIncomingWebhookApi _slackIncomingWebhookApi;
public DefaultSlashCommandHandler(
IRepository<Core.Domain.Todo> todoRepository,
ISlackIncomingWebhookApi slackIncomingWebhookApi)
{
_todoRepository = todoRepository;
_slackIncomingWebhookApi = slackIncomingWebhookApi;
}
public Task<string> Handle(SlashCommand command, Uri teamIncomingWebhookUrl)
{
_slackIncomingWebhookApi.Send(teamIncomingWebhookUrl, new SlackIncomingWebhookMessage
{
UserName = "/todo",
ConversationId = command.ConversationId,
Text = string.Format("*Echo:* {0} {1}", command.Command, command.Text)
});
return Task.FromResult<string>(null);
}
}
}
|
Set incoming webhook usename to /todo.
|
Set incoming webhook usename to /todo.
|
C#
|
mit
|
Hihaj/SlashTodo,Hihaj/SlashTodo
|
608958b18669277c9b306d03e7a21ce4746ba3ab
|
osu.Game/Users/IUser.cs
|
osu.Game/Users/IUser.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.Database;
namespace osu.Game.Users
{
public interface IUser : IHasOnlineID<int>
{
string Username { get; set; }
bool IsBot { get; }
}
}
|
// 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.Database;
namespace osu.Game.Users
{
public interface IUser : IHasOnlineID<int>
{
string Username { get; }
bool IsBot { get; }
}
}
|
Remove unused setter in interface type
|
Remove unused setter in interface type
|
C#
|
mit
|
ppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,ppy/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu
|
27a97f31cf6fbc1e6c40040aad1a4c506cd52528
|
src/ProjectEuler/Puzzles/Puzzle010.cs
|
src/ProjectEuler/Puzzles/Puzzle010.cs
|
// Copyright (c) Martin Costello, 2015. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.ProjectEuler.Puzzles
{
using System;
/// <summary>
/// A class representing the solution to <c>https://projecteuler.net/problem=10</c>. This class cannot be inherited.
/// </summary>
internal sealed class Puzzle010 : Puzzle
{
/// <inheritdoc />
public override string Question => "Find the sum of all the primes below the specified value.";
/// <inheritdoc />
protected override int MinimumArguments => 1;
/// <inheritdoc />
protected override int SolveCore(string[] args)
{
int max;
if (!TryParseInt32(args[0], out max) || max < 2)
{
Console.Error.WriteLine("The specified number is invalid.");
return -1;
}
long sum = 0;
for (int n = 2; n < max; n++)
{
if (Maths.IsPrime(n))
{
sum += n;
}
}
Answer = sum;
return 0;
}
}
}
|
// Copyright (c) Martin Costello, 2015. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.ProjectEuler.Puzzles
{
using System;
using System.Linq;
/// <summary>
/// A class representing the solution to <c>https://projecteuler.net/problem=10</c>. This class cannot be inherited.
/// </summary>
internal sealed class Puzzle010 : Puzzle
{
/// <inheritdoc />
public override string Question => "Find the sum of all the primes below the specified value.";
/// <inheritdoc />
protected override int MinimumArguments => 1;
/// <inheritdoc />
protected override int SolveCore(string[] args)
{
int max;
if (!TryParseInt32(args[0], out max) || max < 2)
{
Console.Error.WriteLine("The specified number is invalid.");
return -1;
}
Answer = Enumerable.Range(2, max - 2)
.AsParallel()
.Where((p) => Maths.IsPrime(p))
.Select((p) => (long)p)
.Sum();
return 0;
}
}
}
|
Use parallelism for puzzle 10
|
Use parallelism for puzzle 10
Use Parallel LINQ for the solution to puzzle 10 to improve the
throughput.
|
C#
|
apache-2.0
|
martincostello/project-euler
|
1bae23c584f517777489aef0cd23cfc7ff52107f
|
ApplicationInsightsXamarinSDK/DemoApp/XamarinTest.cs
|
ApplicationInsightsXamarinSDK/DemoApp/XamarinTest.cs
|
using System;
using Xamarin.Forms;
using AI.XamarinSDK.Abstractions;
namespace XamarinTest
{
public class App : Application
{
public App ()
{
var mainNav = new NavigationPage (new XamarinTestMasterView ());
MainPage = mainNav;
}
protected override void OnStart ()
{
ApplicationInsights.Setup ("");
//ApplicationInsights.Setup ("ijhch");
ApplicationInsights.Start ();
}
protected override void OnSleep ()
{
// Handle when your app sleeps
}
protected override void OnResume ()
{
// Handle when your app resumes
}
}
}
|
using System;
using Xamarin.Forms;
using AI.XamarinSDK.Abstractions;
namespace XamarinTest
{
public class App : Application
{
public App ()
{
var mainNav = new NavigationPage (new XamarinTestMasterView ());
MainPage = mainNav;
}
protected override void OnStart ()
{
ApplicationInsights.Setup ("<YOUR-INSTRUMENTATION-KEY>");
ApplicationInsights.Start ();
}
protected override void OnSleep ()
{
// Handle when your app sleeps
}
protected override void OnResume ()
{
// Handle when your app resumes
}
}
}
|
Add ikey placeholder to setup() call
|
Add ikey placeholder to setup() call
|
C#
|
mit
|
Microsoft/ApplicationInsights-Xamarin
|
5bb659e9e6200a342a9519b6bedb2b44ce57047d
|
Apps/BitChangeSetManager/Api/ChangeSetsController.cs
|
Apps/BitChangeSetManager/Api/ChangeSetsController.cs
|
using System.Linq;
using BitChangeSetManager.DataAccess;
using BitChangeSetManager.Dto;
using BitChangeSetManager.Model;
using Foundation.Api.ApiControllers;
using AutoMapper;
using AutoMapper.QueryableExtensions;
namespace BitChangeSetManager.Api
{
public class ChangeSetsController : DefaultDtoSetController<ChangeSet, ChangeSetDto>
{
private readonly IBitChangeSetManagerRepository<ChangeSet> _changeSetsRepository;
public ChangeSetsController(IBitChangeSetManagerRepository<ChangeSet> changeSetsRepository)
: base(changeSetsRepository)
{
_changeSetsRepository = changeSetsRepository;
}
public IMapper Mapper { get; set; }
public IBitChangeSetManagerRepository<Customer> CustomersRepository { get; set; }
public override IQueryable<ChangeSetDto> GetAll()
{
IQueryable<Customer> customersQuery = CustomersRepository.GetAll();
return _changeSetsRepository
.GetAll()
.ProjectTo<ChangeSetDto>(configuration: Mapper.ConfigurationProvider, parameters: new { customersQuery = customersQuery });
}
}
}
|
using System.Linq;
using BitChangeSetManager.DataAccess;
using BitChangeSetManager.Dto;
using BitChangeSetManager.Model;
using Foundation.Api.ApiControllers;
namespace BitChangeSetManager.Api
{
public class ChangeSetsController : DefaultDtoSetController<ChangeSet, ChangeSetDto>
{
private readonly IBitChangeSetManagerRepository<ChangeSet> _changeSetsRepository;
public ChangeSetsController(IBitChangeSetManagerRepository<ChangeSet> changeSetsRepository)
: base(changeSetsRepository)
{
_changeSetsRepository = changeSetsRepository;
}
public IBitChangeSetManagerRepository<Customer> CustomersRepository { get; set; }
public override IQueryable<ChangeSetDto> GetAll()
{
IQueryable<Customer> customersQuery = CustomersRepository.GetAll();
return DtoModelMapper.FromModelQueryToDtoQuery(_changeSetsRepository.GetAll(), parameters: new { customersQuery = customersQuery });
}
}
}
|
Use IDtoModelMapper instead of IMapper in change sets controller
|
Use IDtoModelMapper instead of IMapper in change sets controller
|
C#
|
mit
|
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
|
c7ec1df29c67f785e850447449ecd949ede58f16
|
src/HubSpotException.cs
|
src/HubSpotException.cs
|
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
namespace Skarp.HubSpotClient
{
[Serializable]
public class HubSpotException : Exception
{
private HttpResponseMessage response;
public string RawJsonResponse { get; set; }
public HubSpotException()
{
}
public HubSpotException(string message) : base(message)
{
}
public HubSpotException(string message, string jsonResponse) : base(message)
{
RawJsonResponse = jsonResponse;
}
public HubSpotException(string message, Exception innerException) : base(message, innerException)
{
}
public HubSpotException(string message, string jsonResponse, HttpResponseMessage response) : this(message, jsonResponse)
{
this.response = response;
}
public override String Message
{
get
{
return base.Message + $", JSONResponse={RawJsonResponse??"Empty"}";
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
namespace Skarp.HubSpotClient
{
[Serializable]
public class HubSpotException : Exception
{
public HttpResponseMessage Response { get; }
public string RawJsonResponse { get; }
public HubSpotException()
{
}
public HubSpotException(string message) : base(message)
{
}
public HubSpotException(string message, string jsonResponse) : base(message)
{
RawJsonResponse = jsonResponse;
}
public HubSpotException(string message, Exception innerException) : base(message, innerException)
{
}
public HubSpotException(string message, string jsonResponse, HttpResponseMessage response) : this(message, jsonResponse)
{
this.Response = response;
}
public override String Message
{
get
{
return base.Message + $", JSONResponse={RawJsonResponse??"Empty"}";
}
}
}
}
|
Change properties to getters only
|
Change properties to getters only
|
C#
|
mit
|
skarpdev/dotnetcore-hubspot-client
|
e66c966c0a163ea7010b0d7a7af46ce56ede0957
|
BmpListener/Bgp/PathAttributeLargeCommunities.cs
|
BmpListener/Bgp/PathAttributeLargeCommunities.cs
|
using System;
namespace BmpListener.Bgp
{
internal class PathAttributeLargeCommunities : PathAttribute
{
public PathAttributeLargeCommunities(ArraySegment<byte> data) : base(ref data)
{
}
}
}
|
using System;
namespace BmpListener.Bgp
{
internal class PathAttributeLargeCommunities : PathAttribute
{
private int asn;
private int data1;
private int data2;
public PathAttributeLargeCommunities(ArraySegment<byte> data) : base(ref data)
{
DecodeFromByes(data);
}
public void DecodeFromByes(ArraySegment<byte> data)
{
asn = data.ToInt32(0);
data1 = data.ToInt32(4);
data2 = data.ToInt32(8);
}
public override string ToString()
{
return ($"{asn}:{data1}:{data2}");
}
}
}
|
Add large BGP communities support
|
Add large BGP communities support
|
C#
|
mit
|
mstrother/BmpListener
|
0122092e98056228ff50fa86811a3a6d56c749fb
|
FunctionalitySamples/InitializerChangeBkColor.cs
|
FunctionalitySamples/InitializerChangeBkColor.cs
|
using CSharpTo2600.Framework;
using static CSharpTo2600.Framework.TIARegisters;
namespace CSharpTo2600.FunctionalitySamples
{
[Atari2600Game]
static class SingleChangeBkColor
{
[SpecialMethod(MethodType.Initialize)]
[System.Obsolete(CSharpTo2600.Framework.Assembly.Symbols.AUDC0, true)]
static void Initialize()
{
BackgroundColor = 0x5E;
}
}
}
|
using CSharpTo2600.Framework;
using static CSharpTo2600.Framework.TIARegisters;
namespace CSharpTo2600.FunctionalitySamples
{
[Atari2600Game]
static class SingleChangeBkColor
{
[SpecialMethod(MethodType.Initialize)]
static void Initialize()
{
BackgroundColor = 0x5E;
}
}
}
|
Remove pointless line from functionality test
|
Remove pointless line from functionality test
|
C#
|
mit
|
Yttrmin/CSharpTo2600,Yttrmin/CSharpTo2600,Yttrmin/CSharpTo2600
|
aa48264a342b8cd792d2f781611278aed9d898dc
|
BlogTemplate/Services/SlugGenerator.cs
|
BlogTemplate/Services/SlugGenerator.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BlogTemplate._1.Models;
namespace BlogTemplate._1.Services
{
public class SlugGenerator
{
private BlogDataStore _dataStore;
private static Regex AllowList = new Regex("([^A-Za-z0-9-])", RegexOptions.None, TimeSpan.FromSeconds(1));
public SlugGenerator(BlogDataStore dataStore)
{
_dataStore = dataStore;
}
public string CreateSlug(string title)
{
string tempTitle = title;
tempTitle = tempTitle.Replace(" ", "-");
string slug = AllowList.Replace(tempTitle, "");
return slug;
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BlogTemplate._1.Models;
namespace BlogTemplate._1.Services
{
public class SlugGenerator
{
private BlogDataStore _dataStore;
public SlugGenerator(BlogDataStore dataStore)
{
_dataStore = dataStore;
}
public string CreateSlug(string title)
{
string tempTitle = title;
tempTitle = tempTitle.Replace(" ", "-");
Regex allowList = new Regex("([^A-Za-z0-9-])");
string slug = allowList.Replace(tempTitle, "");
return slug;
}
}
}
|
Revert "Created the Regex outside of the method, with a MatchTimeout property."
|
Revert "Created the Regex outside of the method, with a MatchTimeout property."
This reverts commit c8f6d57b05adf83a25052c661542cc92a410d57a.
|
C#
|
mit
|
VenusInterns/BlogTemplate,VenusInterns/BlogTemplate,VenusInterns/BlogTemplate
|
68582f69738d0722e40ec365aef788af46da6db6
|
Browser/Handling/KeyboardHandlerBase.cs
|
Browser/Handling/KeyboardHandlerBase.cs
|
using System.Windows.Forms;
using CefSharp;
using TweetDuck.Utils;
namespace TweetDuck.Browser.Handling {
class KeyboardHandlerBase : IKeyboardHandler {
protected virtual bool HandleRawKey(IWebBrowser browserControl, Keys key, CefEventFlags modifiers) {
if (modifiers == (CefEventFlags.ControlDown | CefEventFlags.ShiftDown) && key == Keys.I) {
browserControl.OpenDevToolsCustom();
return true;
}
return false;
}
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut) {
if (type == KeyType.RawKeyDown && !browser.FocusedFrame.Url.StartsWith("devtools://")) {
return HandleRawKey(browserControl, (Keys) windowsKeyCode, modifiers);
}
return false;
}
bool IKeyboardHandler.OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey) {
return false;
}
}
}
|
using System.Windows.Forms;
using CefSharp;
using TweetDuck.Utils;
namespace TweetDuck.Browser.Handling {
class KeyboardHandlerBase : IKeyboardHandler {
protected virtual bool HandleRawKey(IWebBrowser browserControl, Keys key, CefEventFlags modifiers) {
if (modifiers == (CefEventFlags.ControlDown | CefEventFlags.ShiftDown) && key == Keys.I) {
browserControl.OpenDevToolsCustom();
return true;
}
return false;
}
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut) {
if (type == KeyType.RawKeyDown) {
using var frame = browser.FocusedFrame;
if (!frame.Url.StartsWith("devtools://")) {
return HandleRawKey(browserControl, (Keys) windowsKeyCode, modifiers);
}
}
return false;
}
bool IKeyboardHandler.OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey) {
return false;
}
}
}
|
Fix not disposing frame object when handling key events
|
Fix not disposing frame object when handling key events
|
C#
|
mit
|
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
|
b4f282cad96e0f59c28e4859448a89c4cab6714e
|
src/Mox/DbSetMockingExtensions.cs
|
src/Mox/DbSetMockingExtensions.cs
|
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using Moq;
namespace Mox
{
public static class DbSetMockingExtensions
{
public static DbSet<T> MockWithList<T>(this DbSet<T> dbSet, IList<T> data) where T : class
{
var queryable = data.AsQueryable();
Mock.Get(dbSet).As<IQueryable<T>>().Setup(m => m.Provider).Returns(queryable.Provider);
Mock.Get(dbSet).As<IQueryable<T>>().Setup(m => m.Expression).Returns(queryable.Expression);
Mock.Get(dbSet).As<IQueryable<T>>().Setup(m => m.ElementType).Returns(queryable.ElementType);
Mock.Get(dbSet).As<IQueryable<T>>().Setup(m => m.GetEnumerator()).Returns(queryable.GetEnumerator());
return dbSet;
}
}
}
|
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using Moq;
namespace Mox
{
public static class DbSetMockingExtensions
{
public static DbSet<T> MockWithList<T>(this DbSet<T> dbSet, IList<T> data) where T : class
{
var queryable = data.AsQueryable();
Mock.Get(dbSet).As<IQueryable<T>>().Setup(m => m.Provider).Returns(queryable.Provider);
Mock.Get(dbSet).As<IQueryable<T>>().Setup(m => m.Expression).Returns(queryable.Expression);
Mock.Get(dbSet).As<IQueryable<T>>().Setup(m => m.ElementType).Returns(queryable.ElementType);
Mock.Get(dbSet).As<IQueryable<T>>().Setup(m => m.GetEnumerator()).Returns(() => queryable.GetEnumerator());
return dbSet;
}
}
}
|
Update GetEnumerator binding for more one run support.
|
Update GetEnumerator binding for more one run support.
|
C#
|
mit
|
mfilippov/mox
|
781faae98a5bb1609b50991a547f008f8a428b02
|
Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs
|
Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs
|
using Content.Server.GameObjects.Components.GUI;
using Content.Shared.GameObjects.Components;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
public class PlaceableSurfaceComponent : SharedPlaceableSurfaceComponent, IInteractUsing
{
private bool _isPlaceable;
public bool IsPlaceable { get => _isPlaceable; set => _isPlaceable = value; }
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _isPlaceable, "IsPlaceable", true);
}
public bool InteractUsing(InteractUsingEventArgs eventArgs)
{
if (!IsPlaceable)
return false;
if(!eventArgs.User.TryGetComponent<HandsComponent>(out var handComponent))
{
return false;
}
handComponent.Drop(eventArgs.Using);
eventArgs.Using.Transform.WorldPosition = eventArgs.ClickLocation.Position;
return true;
}
}
}
|
using Content.Server.GameObjects.Components.GUI;
using Content.Shared.GameObjects.Components;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
public class PlaceableSurfaceComponent : SharedPlaceableSurfaceComponent, IInteractUsing
{
private bool _isPlaceable;
public bool IsPlaceable { get => _isPlaceable; set => _isPlaceable = value; }
int IInteractUsing.Priority { get => 1; }
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _isPlaceable, "IsPlaceable", true);
}
public bool InteractUsing(InteractUsingEventArgs eventArgs)
{
if (!IsPlaceable)
return false;
if(!eventArgs.User.TryGetComponent<HandsComponent>(out var handComponent))
{
return false;
}
handComponent.Drop(eventArgs.Using);
eventArgs.Using.Transform.WorldPosition = eventArgs.ClickLocation.Position;
return true;
}
}
}
|
Set interaction priority of PlacableSurfaceComponent to 1
|
Set interaction priority of PlacableSurfaceComponent to 1
|
C#
|
mit
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
|
1e151baae8cbf2e0c6dc60e20aa8dd90658a290f
|
osu.Game/Models/RealmUser.cs
|
osu.Game/Models/RealmUser.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Database;
using osu.Game.Users;
using osu.Game.Utils;
using Realms;
namespace osu.Game.Models
{
public class RealmUser : EmbeddedObject, IUser, IEquatable<RealmUser>, IDeepCloneable<RealmUser>
{
public int OnlineID { get; set; } = 1;
public string Username { get; set; } = string.Empty;
[Ignored]
public CountryCode CountryCode
{
get => Enum.TryParse(CountryString, out CountryCode country) ? country : default;
set => CountryString = value.ToString();
}
[MapTo(nameof(CountryCode))]
public string CountryString { get; set; } = default(CountryCode).ToString();
public bool IsBot => false;
public bool Equals(RealmUser other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return OnlineID == other.OnlineID && Username == other.Username;
}
public RealmUser DeepClone() => (RealmUser)this.Detach().MemberwiseClone();
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Database;
using osu.Game.Users;
using osu.Game.Utils;
using Realms;
namespace osu.Game.Models
{
public class RealmUser : EmbeddedObject, IUser, IEquatable<RealmUser>, IDeepCloneable<RealmUser>
{
public int OnlineID { get; set; } = 1;
public string Username { get; set; } = string.Empty;
[Ignored]
public CountryCode CountryCode
{
get => Enum.TryParse(CountryString, out CountryCode country) ? country : CountryCode.Unknown;
set => CountryString = value.ToString();
}
[MapTo(nameof(CountryCode))]
public string CountryString { get; set; } = default(CountryCode).ToString();
public bool IsBot => false;
public bool Equals(RealmUser other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return OnlineID == other.OnlineID && Username == other.Username;
}
public RealmUser DeepClone() => (RealmUser)this.Detach().MemberwiseClone();
}
}
|
Use `Unknown` instead of `default`
|
Use `Unknown` instead of `default`
|
C#
|
mit
|
peppy/osu,peppy/osu,ppy/osu,ppy/osu,ppy/osu,peppy/osu
|
f73b629d9402455bc68ad472d06b0a08ce4e8c46
|
Messaging/Lotz.Xam.Messaging.iOSUnified/PhoneCallTask.cs
|
Messaging/Lotz.Xam.Messaging.iOSUnified/PhoneCallTask.cs
|
using System;
#if __UNIFIED__
using Foundation;
using UIKit;
#else
using MonoTouch.Foundation;
using MonoTouch.UIKit;
#endif
namespace Plugin.Messaging
{
internal class PhoneCallTask : IPhoneCallTask
{
public PhoneCallTask()
{
}
#region IPhoneCallTask Members
public bool CanMakePhoneCall
{
get { return true; }
}
public void MakePhoneCall(string number, string name = null)
{
if (string.IsNullOrWhiteSpace(number))
throw new ArgumentNullException("number");
if (CanMakePhoneCall)
{
var nsurl = new NSUrl("tel://" + number);
UIApplication.SharedApplication.OpenUrl(nsurl);
}
}
#endregion
}
}
|
using System;
#if __UNIFIED__
using Foundation;
using UIKit;
#else
using MonoTouch.Foundation;
using MonoTouch.UIKit;
#endif
namespace Plugin.Messaging
{
internal class PhoneCallTask : IPhoneCallTask
{
public PhoneCallTask()
{
}
#region IPhoneCallTask Members
public bool CanMakePhoneCall
{
get { return true; }
}
public void MakePhoneCall(string number, string name = null)
{
if (string.IsNullOrWhiteSpace(number))
throw new ArgumentNullException("number");
if (CanMakePhoneCall)
{
var nsurl = CreateNSUrl(number);
UIApplication.SharedApplication.OpenUrl(nsurl);
}
}
private NSUrl CreateNSUrl(string number)
{
return new NSUrl(new Uri($"tel:{number}").AbsoluteUri);
}
#endregion
}
}
|
Allow formatted telephone numbers on iOS (e.g. 1800 111 222 333 instead of 1800111222333)
|
Allow formatted telephone numbers on iOS (e.g. 1800 111 222 333 instead of 1800111222333)
|
C#
|
mit
|
cjlotz/Xamarin.Plugins,cjlotz/Xamarin.Plugins,BSVN/Xamarin.Plugins,BSVN/Xamarin.Plugins
|
fb08f9cfca3938be1b4636f9d1dc26661abc3fd1
|
Orationi.CommunicationCore/Model/SlaveConfiguration.cs
|
Orationi.CommunicationCore/Model/SlaveConfiguration.cs
|
using System.Runtime.Serialization;
namespace Orationi.CommunicationCore.Model
{
/// <summary>
/// Provide information about slave configuration.
/// </summary>
[DataContract]
public class SlaveConfiguration
{
/// <summary>
/// Versions of slave-assigned modules.
/// </summary>
[DataMember]
public ModuleVersionItem[] Modules { get; set; }
}
}
|
using System;
using System.Runtime.Serialization;
namespace Orationi.CommunicationCore.Model
{
/// <summary>
/// Provide information about slave configuration.
/// </summary>
[DataContract]
public class SlaveConfiguration
{
/// <summary>
/// Global slave Id.
/// </summary>
[DataMember]
public Guid Id { get; set; }
/// <summary>
/// Versions of slave-assigned modules.
/// </summary>
[DataMember]
public ModuleVersionItem[] Modules { get; set; }
}
}
|
Add id of slave to slave configuration.
|
Add id of slave to slave configuration.
|
C#
|
mit
|
Orationi/CommunicationCore
|
1496d57b47b2ea87228ca0eb7fc1dd37e65deb77
|
src/AutoMapper/Internal/FeatureCollectionBase.cs
|
src/AutoMapper/Internal/FeatureCollectionBase.cs
|
using AutoMapper.Configuration;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace AutoMapper.Internal
{
public class FeatureCollectionBase<TValue> : IEnumerable<KeyValuePair<Type, TValue>>
{
private IDictionary<Type, TValue> _features = new Dictionary<Type, TValue>();
public TValue this[Type key]
{
get => _features.GetOrDefault(key);
set
{
if (value == null)
{
_features.Remove(key);
}
else
{
_features[key] = value;
}
}
}
/// <summary>
/// Gets the feature of type <typeparamref name="TFeature"/>.
/// </summary>
/// <typeparam name="TFeature">The type of the feature.</typeparam>
/// <returns>The feature or null if feature not exists.</returns>
public TFeature Get<TFeature>() where TFeature : TValue => (TFeature)this[typeof(TFeature)];
/// <summary>
/// Add the feature for type <typeparamref name="TFeature"/>. Existing feature of the same type will be replaces.
/// </summary>
/// <typeparam name="TFeature">The type of the feature.</typeparam>
/// <param name="feature">The feature.</param>
public void Add<TFeature>(TFeature feature) where TFeature : TValue => this[typeof(TFeature)] = feature;
public IEnumerator<KeyValuePair<Type, TValue>> GetEnumerator() => _features.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
protected void MakeReadOnly() => _features = new ReadOnlyDictionary<Type, TValue>(_features);
}
}
|
using AutoMapper.Configuration;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace AutoMapper.Internal
{
public class FeatureCollectionBase<TValue> : IEnumerable<KeyValuePair<Type, TValue>>
{
private IDictionary<Type, TValue> _features = new Dictionary<Type, TValue>();
public TValue this[Type key]
{
get => _features.GetOrDefault(key);
set
{
if (value == null)
{
_features.Remove(key);
}
else
{
_features[key] = value;
}
}
}
/// <summary>
/// Gets the feature of type <typeparamref name="TFeature"/>.
/// </summary>
/// <typeparam name="TFeature">The type of the feature.</typeparam>
/// <returns>The feature or null if feature not exists.</returns>
public TFeature Get<TFeature>() where TFeature : TValue => (TFeature)this[typeof(TFeature)];
/// <summary>
/// Add or update the feature for type <typeparamref name="TFeature"/>. Existing feature of the same type will be replaces.
/// </summary>
/// <typeparam name="TFeature">The type of the feature.</typeparam>
/// <param name="feature">The feature.</param>
public void AddOrUpdate<TFeature>(TFeature feature) where TFeature : TValue => this[typeof(TFeature)] = feature;
public IEnumerator<KeyValuePair<Type, TValue>> GetEnumerator() => _features.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
protected void MakeReadOnly() => _features = new ReadOnlyDictionary<Type, TValue>(_features);
}
}
|
Change to AddOrUpdate for the feature to make it visible what the method is doing
|
Change to AddOrUpdate for the feature to make it visible what the method is doing
|
C#
|
mit
|
BlaiseD/AutoMapper,AutoMapper/AutoMapper,lbargaoanu/AutoMapper,AutoMapper/AutoMapper
|
418e15718d4e18ff50f7d608494931b082ee6fb8
|
JabbR/Infrastructure/StringExtensions.cs
|
JabbR/Infrastructure/StringExtensions.cs
|
using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace JabbR.Infrastructure
{
public static class StringExtensions
{
public static string ToMD5(this string value)
{
if (String.IsNullOrEmpty(value))
{
return null;
}
return String.Join("", MD5.Create()
.ComputeHash(Encoding.Default.GetBytes(value))
.Select(b => b.ToString("x2")));
}
public static string ToSha256(this string value, string salt)
{
string saltedValue = ((salt ?? "") + value);
return String.Join("", SHA256.Create()
.ComputeHash(Encoding.Default.GetBytes(saltedValue))
.Select(b => b.ToString("x2")));
}
}
}
|
using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
namespace JabbR.Infrastructure
{
public static class StringExtensions
{
public static string ToMD5(this string value)
{
if (String.IsNullOrEmpty(value))
{
return null;
}
return String.Join("", MD5.Create()
.ComputeHash(Encoding.Default.GetBytes(value))
.Select(b => b.ToString("x2")));
}
public static string ToSha256(this string value, string salt)
{
string saltedValue = ((salt ?? "") + value);
return String.Join("", SHA256.Create()
.ComputeHash(Encoding.Default.GetBytes(saltedValue))
.Select(b => b.ToString("x2")));
}
public static string ToSlug(this string value)
{
string result = value;
// Remove non-ASCII characters
result = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(result));
result = result.Trim();
// Remove Invalid Characters
result = Regex.Replace(result, @"[^A-z0-9\s-]", string.Empty);
// Reduce spaces and convert to underscore
result = Regex.Replace(result, @"\s+", "_");
return result;
}
public static string ToFileNameSlug(this string value)
{
string result = value;
// Trim Slashes
result = result.TrimEnd('/', '\\', '.');
// Remove Path (included by IE in Intranet Mode)
result = result.Contains(@"/") ? result.Substring(result.LastIndexOf(@"/") + 1) : result;
result = result.Contains(@"\") ? result.Substring(result.LastIndexOf(@"\") + 1) : result;
if (result.Contains('.'))
{
// ToSlug Filename Component
string fileNameSlug = result.Substring(0, result.LastIndexOf('.')).ToSlug();
// ToSlug Extension Component
string fileExtensionSlug = result.Substring(result.LastIndexOf('.') + 1).ToSlug();
// Combine Filename Slug
result = string.Concat(fileNameSlug, ".", fileExtensionSlug);
}
else
{
// No Extension
result = result.ToSlug();
}
return result;
}
}
}
|
Add ToSlug and ToFileNameSlug string extensions
|
Add ToSlug and ToFileNameSlug string extensions
|
C#
|
mit
|
M-Zuber/JabbR,borisyankov/JabbR,lukehoban/JabbR,timgranstrom/JabbR,SonOfSam/JabbR,18098924759/JabbR,LookLikeAPro/JabbR,fuzeman/vox,JabbR/JabbR,JabbR/JabbR,borisyankov/JabbR,yadyn/JabbR,e10/JabbR,CrankyTRex/JabbRMirror,CrankyTRex/JabbRMirror,18098924759/JabbR,lukehoban/JabbR,e10/JabbR,borisyankov/JabbR,ajayanandgit/JabbR,yadyn/JabbR,mzdv/JabbR,fuzeman/vox,timgranstrom/JabbR,yadyn/JabbR,lukehoban/JabbR,CrankyTRex/JabbRMirror,ajayanandgit/JabbR,SonOfSam/JabbR,mzdv/JabbR,LookLikeAPro/JabbR,LookLikeAPro/JabbR,fuzeman/vox,M-Zuber/JabbR
|
ecc69a519afb807beefb8c860865d59164b6750b
|
src/MvcRouteTester.Test/Areas/SomeArea/SomeAreaAreaRegistration.cs
|
src/MvcRouteTester.Test/Areas/SomeArea/SomeAreaAreaRegistration.cs
|
using System.Web.Mvc;
using NUnit.Framework.Constraints;
namespace MvcRouteTester.Test.Areas.SomeArea
{
public class SomeAreaAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "SomeArea";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"SomeArea_TestController",
"SomeArea/{action}/{id}",
defaults: new { action = "Index", controller = "Test", id = UrlParameter.Optional },
constraints: new { action = "Index|About" }
);
context.MapRoute(
"SomeArea_default",
"SomeArea/{controller}/{action}/{id}",
new { action = "Index", controller = "Test", id = UrlParameter.Optional }
);
}
}
}
|
using System.Web.Mvc;
namespace MvcRouteTester.Test.Areas.SomeArea
{
public class SomeAreaAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "SomeArea";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"SomeArea_TestController",
"SomeArea/{action}/{id}",
defaults: new { action = "Index", controller = "Test", id = UrlParameter.Optional },
constraints: new { action = "Index|About" }
);
context.MapRoute(
"SomeArea_default",
"SomeArea/{controller}/{action}/{id}",
new { action = "Index", controller = "Test", id = UrlParameter.Optional }
);
}
}
}
|
Remove NUnit.Framework.Constraint (unused - accident)
|
Remove NUnit.Framework.Constraint (unused - accident)
|
C#
|
apache-2.0
|
AlexisArce/MvcRouteTester,AnthonySteele/MvcRouteTester
|
59e3edd66d815735a13b88c52abf5ae9bac77a71
|
src/Dangl.WebDocumentation/Views/Home/Privacy.cshtml
|
src/Dangl.WebDocumentation/Views/Home/Privacy.cshtml
|
<h1>Legal Notice & Privacy</h1>
<p>Dangl.<strong>Docu</strong> hosts all documentation and help pages for products and services offered by Dangl<strong>IT</strong> as well as for multiple open source projects.</p>
<p>
This website is operated and hosted by <a href="https://www.dangl-it.com/legal-notice/">Dangl<strong>IT</strong> GmbH</a>.
Please <a href="mailto:info@dangl-it.com">contact us</a> for any further questions.
</p>
<p>
<strong>
The source code for this website is completely open and available at
<a href="https://github.com/GeorgDangl/WebDocu">GitHub</a>.
</strong>
</p>
<h2>Privacy Information</h2>
<p>If you have no user account, no information about you is stored.</p>
<p>
For user accounts, the only personal identifiable information stored about you
is your email address. You will not receive automated newsletters, we will not
give your information to anyone and we will not use your information for anything
else than providing this documentation website.
</p>
<p>
You only need your own user account if you are a customer of Dangl<strong>IT</strong>
and want to get access to internal, non-public information.
</p>
|
<h1>Legal Notice & Privacy</h1>
<p>Dangl.<strong>Docu</strong> hosts all documentation and help pages for products and services offered by Dangl<strong>IT</strong> as well as for multiple open source projects.</p>
<p>
This website is operated and hosted by <a href="https://www.dangl-it.com/legal-notice/">Dangl<strong>IT</strong> GmbH</a>.
Please <a href="mailto:info@dangl-it.com">contact us</a> for any further questions.
</p>
<p>
<strong>
The source code for this website is completely open and available at
<a href="https://github.com/GeorgDangl/WebDocu">GitHub</a>.
</strong>
</p>
<h2>Privacy Information</h2>
<p>If you have no user account, no information about you is stored.</p>
<p>
For user accounts, the only personal identifiable information stored about you
is your email address. You will not receive automated newsletters, we will not
give your information to anyone and we will not use your information for anything
else than providing this documentation website.
</p>
<p>
You only need your own user account if you are a customer of Dangl<strong>IT</strong>
and want to get access to internal, non-public information.
</p>
<hr />
<p>Dangl<strong>Docu</strong> @Dangl.WebDocumentation.Services.VersionsService.Version, built @Dangl.WebDocumentation.Services.VersionsService.BuildDateUtc.ToString("dd.MM.yyyy HH:mm") (UTC)</p>
|
Include app info in legal notice and privacy page
|
Include app info in legal notice and privacy page
|
C#
|
mit
|
GeorgDangl/WebDocu,GeorgDangl/WebDocu,GeorgDangl/WebDocu
|
df9c996a3c772971ac5889413c24c06d5fa7bbae
|
Assets/Scripts/Player/Autopilot.cs
|
Assets/Scripts/Player/Autopilot.cs
|
using System.Collections;
using System.Collections.Generic;
using System.Net;
using UnityEngine;
using UnityEngine.Networking;
public class Autopilot : NetworkBehaviour {
public string serverUrl;
public float smoothing;
private SerializableTransform targetTransform;
private void Start ()
{
if (isLocalPlayer)
StartCoroutine(SendTransformToServer ());
else
StartCoroutine(UpdateTransformFromServer ());
}
private void Update ()
{
if (isLocalPlayer)
return;
if (targetTransform != null)
{
transform.position = Vector3.Lerp (transform.position, targetTransform.position, smoothing);
transform.rotation = Quaternion.Lerp (transform.rotation, targetTransform.rotation, smoothing);
}
}
private IEnumerator SendTransformToServer()
{
while (true)
{
WWWForm form = new WWWForm ();
form.AddField("transform", SerializableTransform.ToJson (transform));
WWW postRequest = new WWW(serverUrl + netId, form);
yield return postRequest;
}
}
private IEnumerator UpdateTransformFromServer()
{
while (true)
{
WWW getRequest = new WWW(serverUrl + netId);
yield return getRequest;
targetTransform = SerializableTransform.FromJson (getRequest.text);
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using System.Net;
using UnityEngine;
using UnityEngine.Networking;
public class Autopilot : NetworkBehaviour {
public string serverUrl;
public float smoothing;
private SerializableTransform targetTransform;
private void Start ()
{
if (isLocalPlayer)
StartCoroutine(SendTransformToServer ());
else
StartCoroutine(UpdateTransformFromServer ());
}
private void Update ()
{
if (isLocalPlayer)
return;
if (targetTransform != null)
{
transform.position = Vector3.Lerp (transform.position, targetTransform.position, smoothing);
transform.rotation = Quaternion.Lerp (transform.rotation, targetTransform.rotation, smoothing);
}
}
private IEnumerator SendTransformToServer()
{
while (true)
{
WWWForm form = new WWWForm ();
form.AddField("transform", SerializableTransform.ToJson (transform));
WWW postRequest = new WWW(serverUrl + netId, form);
yield return postRequest;
}
}
private IEnumerator UpdateTransformFromServer()
{
while (true)
{
WWW getRequest = new WWW(serverUrl + netId);
yield return getRequest;
if (string.IsNullOrEmpty (getRequest.error))
{
targetTransform = SerializableTransform.FromJson (getRequest.text);
}
}
}
}
|
Check before trying to deserialize transform
|
Check before trying to deserialize transform
|
C#
|
mit
|
Nagasaki45/UnsocialVR,Nagasaki45/UnsocialVR
|
c6e3a6f7669b395af5f5945e899b2b31b7f7d0bf
|
Paymetheus/ViewModels/CreateAccountDialogViewModel.cs
|
Paymetheus/ViewModels/CreateAccountDialogViewModel.cs
|
// Copyright (c) 2016 The btcsuite developers
// Copyright (c) 2016 The Decred developers
// Licensed under the ISC license. See LICENSE file in the project root for full license information.
using Paymetheus.Framework;
using System;
using System.Windows;
using System.Windows.Input;
namespace Paymetheus.ViewModels
{
public sealed class CreateAccountDialogViewModel : DialogViewModelBase
{
public CreateAccountDialogViewModel(ShellViewModel shell) : base(shell)
{
Execute = new DelegateCommand(ExecuteAction);
}
public string AccountName { get; set; } = "";
public string Passphrase { private get; set; } = "";
public ICommand Execute { get; }
private async void ExecuteAction()
{
try
{
await App.Current.Synchronizer.WalletRpcClient.NextAccountAsync(Passphrase, AccountName);
HideDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
|
// Copyright (c) 2016 The btcsuite developers
// Copyright (c) 2016 The Decred developers
// Licensed under the ISC license. See LICENSE file in the project root for full license information.
using Grpc.Core;
using Paymetheus.Framework;
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace Paymetheus.ViewModels
{
public sealed class CreateAccountDialogViewModel : DialogViewModelBase
{
public CreateAccountDialogViewModel(ShellViewModel shell) : base(shell)
{
Execute = new DelegateCommandAsync(ExecuteAction);
}
public string AccountName { get; set; } = "";
public string Passphrase { private get; set; } = "";
public ICommand Execute { get; }
private async Task ExecuteAction()
{
try
{
await App.Current.Synchronizer.WalletRpcClient.NextAccountAsync(Passphrase, AccountName);
HideDialog();
}
catch (RpcException ex) when (ex.Status.StatusCode == StatusCode.AlreadyExists)
{
MessageBox.Show("Account name already exists");
}
catch (RpcException ex) when (ex.Status.StatusCode == StatusCode.InvalidArgument)
{
// Since there is no client-side validation of account name user input, this might be an
// invalid account name or the wrong passphrase. Just show the detail for now.
MessageBox.Show(ex.Status.Detail);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error");
}
}
}
}
|
Make "add account" button nonexecutable when running.
|
Make "add account" button nonexecutable when running.
Prevents double clicking the button to send the CreateAccount RPC
twice, the second time failing with errors due to already having an
account by that name.
While here, improve the error handling slightly.
Fixes #113.
|
C#
|
isc
|
decred/Paymetheus,jrick/Paymetheus
|
bac1b6cf5df4a2b3d08ad0c9804178bce15fd6e3
|
src/RestfulRouting.Sample/Controllers/BlogsController.cs
|
src/RestfulRouting.Sample/Controllers/BlogsController.cs
|
using System.Web.Mvc;
using RestfulRouting.Sample.Infrastructure;
using RestfulRouting.Sample.Models;
namespace RestfulRouting.Sample.Controllers
{
public class BlogsController : Controller
{
public ActionResult Index()
{
return View(SampleData.Blogs());
}
public ActionResult New()
{
return View(new Blog());
}
public ActionResult Test(int id, string t)
{
var c = ControllerContext.RouteData.Values.Count;
return Content("t: " + t);
}
public ActionResult Create()
{
TempData["notice"] = "Created";
return RedirectToAction("Index");
}
public ActionResult Edit(int id)
{
return View(SampleData.Blog(id));
}
public ActionResult Update(int id, Blog blog)
{
TempData["notice"] = "Updated " + id;
return RedirectToAction("Index");
}
public ActionResult Delete(int id)
{
return View(SampleData.Blog(id));
}
public ActionResult Destroy(int id)
{
TempData["notice"] = "Deleted " + id;
return RedirectToAction("Index");
}
public ActionResult Show(int id)
{
return View(SampleData.Blog(id));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using RestfulRouting.Sample.Infrastructure;
using RestfulRouting.Sample.Models;
namespace RestfulRouting.Sample.Controllers
{
public class BlogsController : Controller
{
protected ActionResult RespondTo(Action<FormatCollection> format)
{
return new FormatResult(format);
}
public ActionResult Index()
{
// return View(SampleData.Blogs());
return RespondTo(format =>
{
format.Html = View(SampleData.Blogs());
format.Xml = Content("Not exactly");
});
}
public ActionResult New()
{
return View(new Blog());
}
public ActionResult Test(int id, string t)
{
var c = ControllerContext.RouteData.Values.Count;
return Content("t: " + t);
}
public ActionResult Create()
{
TempData["notice"] = "Created";
return RedirectToAction("Index");
}
public ActionResult Edit(int id)
{
return View(SampleData.Blog(id));
}
public ActionResult Update(int id, Blog blog)
{
TempData["notice"] = "Updated " + id;
return RedirectToAction("Index");
}
public ActionResult Delete(int id)
{
return View(SampleData.Blog(id));
}
public ActionResult Destroy(int id)
{
TempData["notice"] = "Deleted " + id;
return RedirectToAction("Index");
}
public ActionResult Show(int id)
{
return View(SampleData.Blog(id));
}
}
}
|
Add sample to blogs index
|
Add sample to blogs index
|
C#
|
mit
|
restful-routing/restful-routing,restful-routing/restful-routing,stevehodgkiss/restful-routing,stevehodgkiss/restful-routing,stevehodgkiss/restful-routing,restful-routing/restful-routing
|
af8972c85c60db4f360bc2dd3d28427940a4e2b7
|
MAB.PCAPredictCapturePlus.TestHarness/Controllers/HomeController.cs
|
MAB.PCAPredictCapturePlus.TestHarness/Controllers/HomeController.cs
|
using System.Configuration;
using System.Linq;
using System.Web.Mvc;
namespace MAB.PCAPredictCapturePlus.TestHarness.Controllers
{
public class HomeController : Controller
{
private CapturePlusClient _client = new CapturePlusClient(
apiVersion: "2.10",
key: ConfigurationManager.AppSettings["PCAPredictCapturePlusKey"],
defaultFindCountry: "GBR",
defaultLanguage: "EN"
);
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Find(string term)
{
var result = _client.Find(term);
if(result.Error != null)
return Json(result.Error);
return Json(result.Items);
}
[HttpPost]
public ActionResult Retrieve(string id)
{
var result = _client.Retrieve(id);
if(result.Error != null)
return Json(result.Error);
var model = result.Items.Select(a => new {
Company = a.Company,
BuildingName = a.BuildingName,
Street = a.Street,
Line1 = a.Line1,
Line2 = a.Line2,
Line3 = a.Line3,
Line4 = a.Line4,
Line5 = a.Line5,
City = a.City,
County = a.Province,
Postcode = a.PostalCode
}).First();
return Json(model);
}
}
}
|
using System.Configuration;
using System.Linq;
using System.Web.Mvc;
namespace MAB.PCAPredictCapturePlus.TestHarness.Controllers
{
public class HomeController : Controller
{
private CapturePlusClient _client = new CapturePlusClient(
apiVersion: "2.10",
key: ConfigurationManager.AppSettings["PCAPredictCapturePlusKey"],
defaultFindCountry: "GB",
defaultLanguage: "EN"
);
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Find(string term)
{
var result = _client.Find(term);
if(result.Error != null)
return Json(result.Error);
return Json(result.Items);
}
[HttpPost]
public ActionResult Retrieve(string id)
{
var result = _client.Retrieve(id);
if(result.Error != null)
return Json(result.Error);
var model = result.Items.Select(a => new {
Company = a.Company,
BuildingName = a.BuildingName,
Street = a.Street,
Line1 = a.Line1,
Line2 = a.Line2,
Line3 = a.Line3,
Line4 = a.Line4,
Line5 = a.Line5,
City = a.City,
County = a.Province,
Postcode = a.PostalCode
}).First();
return Json(model);
}
}
}
|
Change default find country code
|
Change default find country code
|
C#
|
mit
|
markashleybell/MAB.PCAPredictCapturePlus,markashleybell/MAB.PCAPredictCapturePlus,markashleybell/MAB.PCAPredictCapturePlus
|
3933dd2138fbf9d7af8ce49144574da58251df7b
|
Game_Algo/Game_Algo/Tile.cs
|
Game_Algo/Game_Algo/Tile.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Game_Algo
{
class Tile
{
/// <summary>
/// 0 - Floor
/// 1 - Wall
/// </summary>
public int TypeId { get; set; }
public Tile(int MapCellId)
{
this.TypeId = MapCellId;
}
public bool Walkable
{
get
{
return (TypeId == GameSetting.TileType.Wall) ? false : true;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Game_Algo
{
class Tile
{
/// <summary>
/// 0 - Floor
/// 1 - Wall
/// </summary>
public int TypeId { get; set; }
public Tile(int MapCellId)
{
this.TypeId = MapCellId;
}
public bool Walkable
{
get
{
return (TypeId == GameSetting.TileType.Floor || TypeId == GameSetting.TileType.DoorUnlocked);
}
}
}
}
|
Allow player to walk through unlocked doors
|
Allow player to walk through unlocked doors
|
C#
|
mit
|
jooeycheng/xna-prison-break-game,hhoulin94/game-algo-assignment,jooeycheng/game-algo-assignment
|
063e0d460182cbaea49cf8f161c14c0f395102a2
|
QuantConnect.ToolBox/Log.cs
|
QuantConnect.ToolBox/Log.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QuantConnect.ToolBox
{
/// <summary>
/// Provides time stamped writing to the console
/// </summary>
public static class Log
{
/// <summary>
/// Writes the message in normal text
/// </summary>
public static void Trace(string format, params object[] args)
{
Console.WriteLine("{0}: {1}", DateTime.UtcNow.ToString("o"), string.Format(format, args));
}
/// <summary>
/// Writes the message in red
/// </summary>
public static void Error(string format, params object[] args)
{
var foregroundColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;
Console.Error.WriteLine("{0}: ERROR:: {1}", DateTime.UtcNow.ToString("o"), string.Format(format, args));
Console.ForegroundColor = foregroundColor;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QuantConnect.ToolBox
{
/// <summary>
/// Provides time stamped writing to the console
/// </summary>
public static class Log
{
/// <summary>
/// Defines the delegate used to perform trace logging, this allows other application
/// users of the toolbox projects to intercept their logging
/// </summary>
public static Action<string> TraceHandler = TraceHandlerImpl;
/// <summary>
/// Defines the delegate used to perform error logging, this allows other application
/// users of the toolbox projects to intercept their logging
/// </summary>
public static Action<string> ErrorHandler = ErrorHandlerImpl;
/// <summary>
/// Writes the message in normal text
/// </summary>
public static void Trace(string format, params object[] args)
{
TraceHandler(string.Format(format, args));
}
/// <summary>
/// Writes the message in red
/// </summary>
public static void Error(string format, params object[] args)
{
ErrorHandler(string.Format(format, args));
}
private static void TraceHandlerImpl(string msg)
{
Console.WriteLine("{0}: {1}", DateTime.UtcNow.ToString("o"), msg);
}
private static void ErrorHandlerImpl(string msg)
{
var foregroundColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;
Console.Error.WriteLine("{0}: ERROR:: {1}", DateTime.UtcNow.ToString("o"), msg);
Console.ForegroundColor = foregroundColor;
}
}
}
|
Make logging configurable by external consumers
|
Make logging configurable by external consumers
|
C#
|
apache-2.0
|
young-zhang/Lean,young-zhang/Lean,bizcad/LeanJJN,devalkeralia/Lean,bdilber/Lean,Mendelone/forex_trading,Jay-Jay-D/LeanSTP,jameschch/Lean,redmeros/Lean,Mendelone/forex_trading,Jay-Jay-D/LeanSTP,bizcad/Lean,Obawoba/Lean,bdilber/Lean,kaffeebrauer/Lean,AnObfuscator/Lean,bizcad/Lean,QuantConnect/Lean,tomhunter-gh/Lean,bizcad/Lean,mabeale/Lean,QuantConnect/Lean,AnshulYADAV007/Lean,devalkeralia/Lean,AnObfuscator/Lean,bizcad/LeanJJN,FrancisGauthier/Lean,Mendelone/forex_trading,Obawoba/Lean,JKarathiya/Lean,QuantConnect/Lean,Phoenix1271/Lean,mabeale/Lean,tzaavi/Lean,jameschch/Lean,Obawoba/Lean,dpavlenkov/Lean,kaffeebrauer/Lean,jameschch/Lean,redmeros/Lean,AnshulYADAV007/Lean,kaffeebrauer/Lean,young-zhang/Lean,squideyes/Lean,redmeros/Lean,AnshulYADAV007/Lean,mabeale/Lean,young-zhang/Lean,jameschch/Lean,dpavlenkov/Lean,tzaavi/Lean,AnshulYADAV007/Lean,bdilber/Lean,jameschch/Lean,andrewhart098/Lean,devalkeralia/Lean,Jay-Jay-D/LeanSTP,AnshulYADAV007/Lean,QuantConnect/Lean,bdilber/Lean,kaffeebrauer/Lean,StefanoRaggi/Lean,bizcad/Lean,StefanoRaggi/Lean,Phoenix1271/Lean,Jay-Jay-D/LeanSTP,JKarathiya/Lean,FrancisGauthier/Lean,tomhunter-gh/Lean,andrewhart098/Lean,AlexCatarino/Lean,JKarathiya/Lean,tzaavi/Lean,andrewhart098/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,AnObfuscator/Lean,bizcad/LeanJJN,kaffeebrauer/Lean,tzaavi/Lean,Phoenix1271/Lean,mabeale/Lean,dpavlenkov/Lean,AlexCatarino/Lean,squideyes/Lean,andrewhart098/Lean,redmeros/Lean,FrancisGauthier/Lean,Jay-Jay-D/LeanSTP,Obawoba/Lean,Mendelone/forex_trading,AnObfuscator/Lean,AlexCatarino/Lean,tomhunter-gh/Lean,dpavlenkov/Lean,FrancisGauthier/Lean,tomhunter-gh/Lean,squideyes/Lean,Phoenix1271/Lean,StefanoRaggi/Lean,squideyes/Lean,AlexCatarino/Lean,devalkeralia/Lean,bizcad/LeanJJN,JKarathiya/Lean
|
b6b7e17fc63abbfcad8ba3587c27cd4263cf5cdd
|
Source/EventFlow/EventStores/ICommittedDomainEvent.cs
|
Source/EventFlow/EventStores/ICommittedDomainEvent.cs
|
// The MIT License (MIT)
//
// Copyright (c) 2015 Rasmus Mikkelsen
// https://github.com/rasmus/EventFlow
//
// 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.
namespace EventFlow.EventStores
{
public interface ICommittedDomainEvent
{
string AggregateId { get; set; }
string Data { get; set; }
string Metadata { get; set; }
int AggregateSequenceNumber { get; set; }
}
}
|
// The MIT License (MIT)
//
// Copyright (c) 2015 Rasmus Mikkelsen
// https://github.com/rasmus/EventFlow
//
// 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.
namespace EventFlow.EventStores
{
public interface ICommittedDomainEvent
{
string Data { get; set; }
string Metadata { get; set; }
}
}
|
Remove properties from interface as they are no longer needed
|
Remove properties from interface as they are no longer needed
|
C#
|
mit
|
liemqv/EventFlow,AntoineGa/EventFlow,rasmus/EventFlow
|
bee49608f61ce18e68d54ff2c4ba6e42d2a3f51e
|
src/ExcelFormsTest/ExcelFormsTest/ExcelFormsTest.iOS/AppDelegate.cs
|
src/ExcelFormsTest/ExcelFormsTest/ExcelFormsTest.iOS/AppDelegate.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace ExcelFormsTest.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace ExcelFormsTest.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
new FreshEssentials.iOS.AdvancedFrameRendereriOS();
return base.FinishedLaunching(app, options);
}
}
}
|
Update the appdelegate to make sure FreshEssentials is deployed
|
Update the appdelegate to make sure FreshEssentials is deployed
|
C#
|
mit
|
coatsy/xplat-graph
|
bc5596e81eb68b981db6e9aab72a0f2a4e823d8f
|
HermaFx.SimpleConfig/CompositeConfigurationValidator.cs
|
HermaFx.SimpleConfig/CompositeConfigurationValidator.cs
|
using System;
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using System.Linq;
using System.Text;
namespace HermaFx.SimpleConfig
{
internal class CompositeConfigurationValidator : ConfigurationValidatorBase
{
private readonly ValidationAttribute[] _validationAttributes;
private readonly string _propertyName;
public CompositeConfigurationValidator(ValidationAttribute[] validationAttributes, string propertyName)
{
_validationAttributes = validationAttributes;
_propertyName = propertyName;
}
public override bool CanValidate(Type type)
{
return true;
}
public override void Validate(object value)
{
var validationErrors = (from validation in _validationAttributes
where validation.IsValid(value) == false
select validation.FormatErrorMessage(_propertyName)).ToList();
if(validationErrors.Any())
{
var errorMsgs = new StringBuilder("Validation Errors:");
var fullMsg = validationErrors.Aggregate(errorMsgs, (sb, cur) => sb.AppendLine(cur)).ToString();
throw new ArgumentException(fullMsg);
}
}
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using System.Linq;
using System.Text;
namespace HermaFx.SimpleConfig
{
internal class CompositeConfigurationValidator : ConfigurationValidatorBase
{
private readonly ValidationAttribute[] _validationAttributes;
private readonly string _propertyName;
public CompositeConfigurationValidator(ValidationAttribute[] validationAttributes, string propertyName)
{
_validationAttributes = validationAttributes;
_propertyName = propertyName;
}
public override bool CanValidate(Type type)
{
return true;
}
public override void Validate(object value)
{
var context = new ValidationContext(value) { MemberName = _propertyName };
var errors = _validationAttributes
.Select(x => x.GetValidationResult(value, context))
.Where(x => x != ValidationResult.Success)
.ToArray();
if(errors.Any())
{
var errorMsgs = new StringBuilder("Validation Errors:");
var fullMsg = errors.Select(x => x.ErrorMessage).Aggregate(errorMsgs, (sb, cur) => sb.AppendLine(cur)).ToString();
throw new ArgumentException(fullMsg);
}
}
}
}
|
Use net4+ validation API on SimpleConfig, so we have detailed error messages.
|
Use net4+ validation API on SimpleConfig, so we have detailed error messages.
|
C#
|
mit
|
evicertia/HermaFx,evicertia/HermaFx,evicertia/HermaFx
|
40b0e04e3e78e97ba4b27706e28cab9f13e32a57
|
Schedutalk/Schedutalk/Schedutalk/Logic/KTHPlaces/RoomDataContract.cs
|
Schedutalk/Schedutalk/Schedutalk/Logic/KTHPlaces/RoomDataContract.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Schedutalk.Logic.KTHPlaces
{
[DataContract]
public class RoomDataContract
{
[DataMember(Name = "floorUid")]
public string FloorUId { get; set; }
[DataMember(Name = "buildingName")]
public string BuildingName { get; set; }
[DataMember(Name = "campus")]
public string Campus { get; set; }
[DataMember(Name = "typeName")]
public string TypeName { get; set; }
[DataMember(Name = "placeName")]
public string PlaceName { get; set; }
[DataMember(Name = "uid")]
public string UId { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Schedutalk.Logic.KTHPlaces
{
[DataContract]
public class RoomDataContract
{
[DataMember(Name = "floorUid")]
public string FloorUId { get; set; }
[DataMember(Name = "buildingName")]
public string BuildingName { get; set; }
[DataMember(Name = "campus")]
public string Campus { get; set; }
[DataMember(Name = "typeName")]
public string TypeName { get; set; }
[DataMember(Name = "placeName")]
public string PlaceName { get; set; }
[DataMember(Name = "uid")]
public string UId { get; set; }
[DataMember(Name = "equipment")]
public Equipment[] Equipment { get; set; }
}
[DataContract]
public class Equipment
{
[DataMember(Name = "name")]
public Name Name { get; set; }
}
[DataContract]
public class Name
{
[DataMember(Name = "en")]
public string En { get; set; }
}
}
|
Add fields related to 5b3c493
|
Add fields related to 5b3c493
|
C#
|
mit
|
Zalodu/Schedutalk,Zalodu/Schedutalk
|
0eb82c3cb69be9d6d5a48158b70056ca31f3d0a7
|
Source/ChromeCast.Desktop.AudioStreamer/Discover/DiscoveredDevice.cs
|
Source/ChromeCast.Desktop.AudioStreamer/Discover/DiscoveredDevice.cs
|
using ChromeCast.Desktop.AudioStreamer.Application;
namespace ChromeCast.Desktop.AudioStreamer.Discover
{
public class DiscoveredDevice
{
private const string GroupIdentifier = "\"md=Google Cast Group\"";
public string Name { get; set; }
public string IPAddress { get; set; }
public int Port { get; set; }
public string Protocol { get; set; }
public string Usn { get; set; }
public string Headers { get; set; }
public bool AddedByDeviceInfo { get; internal set; }
public DeviceEureka Eureka { get; internal set; }
public Group Group { get; internal set; }
public bool IsGroup {
get
{
if (Headers != null && Headers.IndexOf(GroupIdentifier) >= 0)
return true;
return false;
}
set
{
if (value)
Headers = GroupIdentifier;
}
}
}
}
|
using ChromeCast.Desktop.AudioStreamer.Application;
using System.Xml.Serialization;
namespace ChromeCast.Desktop.AudioStreamer.Discover
{
public class DiscoveredDevice
{
private const string GroupIdentifier = "\"md=Google Cast Group\"";
public string Name { get; set; }
public string IPAddress { get; set; }
public int Port { get; set; }
public string Protocol { get; set; }
public string Usn { get; set; }
public string Headers { get; set; }
public bool AddedByDeviceInfo { get; set; }
[XmlIgnore]
public DeviceEureka Eureka { get; set; }
[XmlIgnore]
public Group Group { get; set; }
public bool IsGroup {
get
{
if (Headers != null && Headers.IndexOf(GroupIdentifier) >= 0)
return true;
return false;
}
set
{
if (value)
Headers = GroupIdentifier;
}
}
}
}
|
Fix for persisting the known devices.
|
Fix for persisting the known devices.
|
C#
|
mit
|
SamDel/ChromeCast-Desktop-Audio-Streamer
|
388679a20f2e7ce7446c9d03fb88a912ff401a3b
|
StructuredXmlEditor/App.xaml.cs
|
StructuredXmlEditor/App.xaml.cs
|
using StructuredXmlEditor.View;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace StructuredXmlEditor
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public App()
{
if (!Debugger.IsAttached) this.Dispatcher.UnhandledException += OnDispatcherUnhandledException;
VersionInfo.DeleteUpdater();
}
void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
string errorMessage = "An unhandled exception occurred!\n" + e.Exception.Message + "\n\nThe app has attempted to recover and carry on, but you may experience some weirdness. Report error?.";
File.WriteAllText("error.log", e.Exception.ToString());
var choice = Message.Show(errorMessage, "Error", "Report", "Ignore");
if (choice == "Report")
{
Email.SendEmail("Crash Report", "Editor crashed on " + DateTime.Now + ".\nEditor Version: " + VersionInfo.Version, e.Exception.ToString());
Message.Show("Error Reported, I shall fix as soon as possible.", "Error reported", "Ok");
}
e.Handled = true;
}
}
}
|
using StructuredXmlEditor.View;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace StructuredXmlEditor
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public App()
{
if (!Debugger.IsAttached) this.Dispatcher.UnhandledException += OnDispatcherUnhandledException;
VersionInfo.DeleteUpdater();
}
void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
string errorMessage = "An unhandled exception occurred!\n\n" + e.Exception.Message + "\n\nThe app has attempted to recover and carry on, but you may experience some weirdness. Report error?";
File.WriteAllText("error.log", e.Exception.ToString());
var choice = Message.Show(errorMessage, "Error", "Report", "Ignore");
if (choice == "Report")
{
Email.SendEmail("Crash Report", "Editor crashed on " + DateTime.Now + ".\nEditor Version: " + VersionInfo.Version, e.Exception.ToString());
Message.Show("Error Reported, I shall fix as soon as possible.", "Error reported", "Ok");
}
e.Handled = true;
}
}
}
|
Change the padding on the exception message
|
Change the padding on the exception message
|
C#
|
apache-2.0
|
infinity8/StructuredXmlEditor
|
805d72a7d89d5c64788a13e84af3d1de62977851
|
templates/footer.cs
|
templates/footer.cs
|
<script type="text/javascript">searchHighlight()</script>
<?cs if:len(links.alternate) ?>
<div id="altlinks">
<h3>Download in other formats:</h3>
<ul><?cs each:link = links.alternate ?>
<li<?cs if:name(link) == len(links.alternate) - #1 ?> class="last"<?cs /if ?>>
<a href="<?cs var:link.href ?>"<?cs if:link.class ?> class="<?cs
var:link.class ?>"<?cs /if ?>><?cs var:link.title ?></a>
</li><?cs /each ?>
</ul>
</div>
<?cs /if ?>
</div>
<div id="footer">
<hr />
<a id="tracpowered" href="http://trac.edgewall.com/"><img src="<?cs
var:$htdocs_location ?>trac_logo_mini.png" height="30" width="107"
alt="Trac Powered"/></a>
<p class="left">
Powered by <strong>Trac <?cs var:trac.version ?></strong><br />
By <a href="http://www.edgewall.com/">Edgewall Software</a>.
</p>
<p class="right">
<?cs var $project.footer ?>
</p>
</div>
<?cs include "site_footer.cs" ?>
</body>
</html>
|
<script type="text/javascript">searchHighlight()</script>
<?cs if:len(links.alternate) ?>
<div id="altlinks">
<h3>Download in other formats:</h3>
<ul><?cs each:link = links.alternate ?>
<li<?cs if:name(link) == len(links.alternate) - #1 ?> class="last"<?cs /if ?>>
<a href="<?cs var:link.href ?>"<?cs if:link.class ?> class="<?cs
var:link.class ?>"<?cs /if ?>><?cs var:link.title ?></a>
</li><?cs /each ?>
</ul>
</div>
<?cs /if ?>
</div>
<div id="footer">
<hr />
<a id="tracpowered" href="http://trac.edgewall.com/"><img src="<?cs
var:$htdocs_location ?>trac_logo_mini.png" height="30" width="107"
alt="Trac Powered"/></a>
<p class="left">
Powered by <a href="<?cs var:trac.href.about ?>"><strong>Trac <?cs
var:trac.version ?></strong></a><br />
By <a href="http://www.edgewall.com/">Edgewall Software</a>.
</p>
<p class="right">
<?cs var $project.footer ?>
</p>
</div>
<?cs include "site_footer.cs" ?>
</body>
</html>
|
Add a link to "about trac" on the trac version number at the end
|
Add a link to "about trac" on the trac version number at the end
git-svn-id: 0d96b0c1a6983ccc08b3732614f4d6bfcf9cbb42@883 af82e41b-90c4-0310-8c96-b1721e28e2e2
|
C#
|
bsd-3-clause
|
rbaumg/trac,rbaumg/trac,rbaumg/trac,rbaumg/trac
|
a71519da9d249003f52a7e2dc1087da2a1238a96
|
WebServer/RequestInformation.cs
|
WebServer/RequestInformation.cs
|
using System;
using System.Collections.Specialized;
using System.IO;
using System.Web;
using Newtonsoft.Json;
namespace WebServer
{
public class RequestInformation
{
public NameValueCollection Headers { get; private set; }
public string BodyContent { get; private set; }
public int BodyLength { get; private set; }
public bool SecureConnection { get; private set; }
public bool ClientCertificatePresent { get; private set; }
public HttpClientCertificate ClientCertificate { get; private set; }
public static RequestInformation Create(HttpRequest request)
{
var info = new RequestInformation();
info.Headers = request.Headers;
Stream stream = request.GetBufferedInputStream();
using (var reader = new StreamReader(stream))
{
string body = reader.ReadToEnd();
info.BodyContent = body;
info.BodyLength = body.Length;
}
info.SecureConnection = request.IsSecureConnection;
var cs = request.ClientCertificate;
info.ClientCertificatePresent = cs.IsPresent;
if (cs.IsPresent)
{
info.ClientCertificate = request.ClientCertificate;
}
return info;
}
public static RequestInformation DeSerializeFromJson(string json)
{
return (RequestInformation)JsonConvert.DeserializeObject(
json,
typeof(RequestInformation),
new NameValueCollectionConverter());
}
public string SerializeToJson()
{
return JsonConvert.SerializeObject(this, new NameValueCollectionConverter());
}
private RequestInformation()
{
}
}
}
|
using System;
using System.Collections.Specialized;
using System.IO;
using System.Web;
using Newtonsoft.Json;
namespace WebServer
{
public class RequestInformation
{
public string Verb { get; private set; }
public string Url { get; private set; }
public NameValueCollection Headers { get; private set; }
public string BodyContent { get; private set; }
public int BodyLength { get; private set; }
public bool SecureConnection { get; private set; }
public bool ClientCertificatePresent { get; private set; }
public HttpClientCertificate ClientCertificate { get; private set; }
public static RequestInformation Create(HttpRequest request)
{
var info = new RequestInformation();
info.Verb = request.HttpMethod;
info.Url = request.RawUrl;
info.Headers = request.Headers;
Stream stream = request.GetBufferedInputStream();
using (var reader = new StreamReader(stream))
{
string body = reader.ReadToEnd();
info.BodyContent = body;
info.BodyLength = body.Length;
}
info.SecureConnection = request.IsSecureConnection;
var cs = request.ClientCertificate;
info.ClientCertificatePresent = cs.IsPresent;
if (cs.IsPresent)
{
info.ClientCertificate = request.ClientCertificate;
}
return info;
}
public static RequestInformation DeSerializeFromJson(string json)
{
return (RequestInformation)JsonConvert.DeserializeObject(
json,
typeof(RequestInformation),
new NameValueCollectionConverter());
}
public string SerializeToJson()
{
return JsonConvert.SerializeObject(this, new NameValueCollectionConverter());
}
private RequestInformation()
{
}
}
}
|
Add HTTP request verb and url to echo response
|
Add HTTP request verb and url to echo response
|
C#
|
mit
|
davidsh/NetworkingTestServer,davidsh/NetworkingTestServer,davidsh/NetworkingTestServer
|
8acb6de497996ed4126765c7b592beb5fa1e5728
|
src/DotVVM.Framework/Diagnostics/Models/HttpHeaderItem.cs
|
src/DotVVM.Framework/Diagnostics/Models/HttpHeaderItem.cs
|
using System.Collections.Generic;
namespace DotVVM.Framework.Diagnostics.Models
{
public class HttpHeaderItem
{
public string Key { get; set; }
public string Value { get; set; }
public static HttpHeaderItem FromKeyValuePair(KeyValuePair<string, string[]> pair)
{
return new HttpHeaderItem
{
Key = pair.Key,
Value = pair.Value[0]
};
}
}
}
|
using System.Collections.Generic;
namespace DotVVM.Framework.Diagnostics.Models
{
public class HttpHeaderItem
{
public string Key { get; set; }
public string Value { get; set; }
public static HttpHeaderItem FromKeyValuePair(KeyValuePair<string, string[]> pair)
{
return new HttpHeaderItem
{
Key = pair.Key,
Value = string.Join("; ", pair.Value)
};
}
}
}
|
Add sending of all http header values
|
Add sending of all http header values
|
C#
|
apache-2.0
|
riganti/dotvvm,riganti/dotvvm,riganti/dotvvm,riganti/dotvvm
|
716affb33ed53daff02e69e8e7c2152cd9250eba
|
src/AmplaWeb.Sample/Views/shared/_LoginPartial.cshtml
|
src/AmplaWeb.Sample/Views/shared/_LoginPartial.cshtml
|
@if (Request.IsAuthenticated)
{
<div class="btn-group">
<a class="btn btn-inverse" href="#"><i class="icon-user icon-white"></i> @User.Identity.Name</a>
<a class="btn btn-inverse dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Details", "User", "Account")</li>
<li><a href="javascript:document.getElementById('logoutMenuForm').submit()">Logout</a></li>
</ul>
</div>
using (Html.BeginForm("Logout", "Account", FormMethod.Post, new { id = "logoutMenuForm", @class="hidden" }))
{
@Html.AntiForgeryToken()
}
}
else
{
<a class="btn btn-info" href="@Url.Action("Login", "Account")" > <i class="icon-user icon-white"></i> Login</a>
}
|
@if (Request.IsAuthenticated)
{
<li>
<div class="btn-group">
<a class="btn btn-inverse" href="#"><i class="icon-user icon-white"></i> @User.Identity.Name</a>
<a class="btn btn-inverse dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Details", "User", "Account")</li>
<li><a href="javascript:document.getElementById('logoutMenuForm').submit()">Logout</a></li>
</ul>
</div>
</li>
using (Html.BeginForm("Logout", "Account", FormMethod.Post, new { id = "logoutMenuForm", @class="hidden" }))
{
@Html.AntiForgeryToken()
}
}
else
{
<li><a class="btn btn-info" href="@Url.Action("Login", "Account")" > <i class="icon-user icon-white"></i> Login</a></li>
}
|
Fix up menu for IE
|
Fix up menu for IE
|
C#
|
mit
|
Ampla/Ampla-Data,Ampla/Ampla-Data
|
a2239c3d411eec6ed86f94469612206ae86bd79e
|
src/Glimpse.Agent.AspNet.Mvc/ActionSelectedMessage.cs
|
src/Glimpse.Agent.AspNet.Mvc/ActionSelectedMessage.cs
|
using System;
using System.Collections.Generic;
namespace Glimpse.Agent.AspNet.Mvc
{
internal class ActionSelectedMessage : IMessage
{
public Guid Id { get; } = Guid.NewGuid();
public DateTime Time { get; } = DateTime.Now;
public string ActionId { get; set; }
public string DisplayName { get; set; }
public RouteData RouteData { get; set; }
}
internal class RouteData
{
public string Name { get; set; }
public string Pattern { get; set; }
public IList<RouteResolutionData> Data { get; set; }
}
internal class RouteResolutionData
{
public string Tag { get; set; }
public string Match { get; set; }
}
}
|
using System;
using System.Collections.Generic;
namespace Glimpse.Agent.AspNet.Mvc
{
internal class ActionSelectedMessage : IMessage
{
public Guid Id { get; } = Guid.NewGuid();
public DateTime Time { get; } = DateTime.Now;
public string ActionId { get; set; }
public string DisplayName { get; set; }
public RouteData RouteData { get; set; }
}
internal class RouteData
{
public string Name { get; set; }
public string Pattern { get; set; }
public IList<RouteResolutionData> Data { get; set; }
}
internal class RouteResolutionData
{
public string Tag { get; set; }
public string Match { get; set; }
}
}
|
Fix some spacing in class
|
Fix some spacing in class
|
C#
|
mit
|
Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype
|
e0636a8276788473ec1148516c2bf0a07f660cc3
|
PhotoLife/PhotoLife.Services.Tests/UserServiceTests/GetById_Should.cs
|
PhotoLife/PhotoLife.Services.Tests/UserServiceTests/GetById_Should.cs
|
using Moq;
using NUnit.Framework;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
namespace PhotoLife.Services.Tests.UserServiceTests
{
[TestFixture]
public class GetById_Should
{
[TestCase("some id")]
[TestCase("other id")]
public void _CallRepository_GetByIdMethod(string id)
{
//Arrange
var mockedRepository = new Mock<IRepository<User>>();
var mockedUnitOfWork = new Mock<IUnitOfWork>();
var userService = new UserService(mockedRepository.Object, mockedUnitOfWork.Object);
//Act
userService.GetUserById(id);
//Assert
mockedRepository.Verify(r => r.GetById(id), Times.Once);
}
}
}
|
using Moq;
using NUnit.Framework;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
namespace PhotoLife.Services.Tests.UserServiceTests
{
[TestFixture]
public class GetById_Should
{
[TestCase("some id")]
[TestCase("other id")]
public void _CallRepository_GetByIdMethod(string id)
{
//Arrange
var mockedRepository = new Mock<IRepository<User>>();
var mockedUnitOfWork = new Mock<IUnitOfWork>();
var userService = new UserService(mockedRepository.Object, mockedUnitOfWork.Object);
//Act
userService.GetUserById(id);
//Assert
mockedRepository.Verify(r => r.GetById(id), Times.Once);
}
[TestCase("some id")]
[TestCase("other id")]
public void _Return_Correctly(string id)
{
//Arrange
var mockedUser = new Mock<User>();
var mockedRepository = new Mock<IRepository<User>>();
mockedRepository.Setup(r=>r.GetById(It.IsAny<string>())).Returns(mockedUser.Object);
var mockedUnitOfWork = new Mock<IUnitOfWork>();
var userService = new UserService(mockedRepository.Object, mockedUnitOfWork.Object);
//Act
var res = userService.GetUserById(id);
//Assert
Assert.AreSame(mockedUser.Object, res);
}
}
}
|
Add more tests for get by id
|
Add more tests for get by id
|
C#
|
mit
|
Branimir123/PhotoLife,Branimir123/PhotoLife,Branimir123/PhotoLife
|
07a1c39fe525dc11f06917fc3d7f3510c21e4d27
|
osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs
|
osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Threading;
using osu.Game.Graphics.Backgrounds;
namespace osu.Game.Screens.Backgrounds
{
public class BackgroundScreenDefault : BackgroundScreen
{
private int currentDisplay;
private const int background_count = 5;
private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}";
private Background current;
[BackgroundDependencyLoader]
private void load()
{
display(new Background(backgroundName));
}
private void display(Background newBackground)
{
current?.FadeOut(800, Easing.InOutSine);
current?.Expire();
Add(current = newBackground);
currentDisplay++;
}
private ScheduledDelegate nextTask;
public void Next()
{
nextTask?.Cancel();
nextTask = Scheduler.AddDelayed(() =>
{
LoadComponentAsync(new Background(backgroundName) { Depth = currentDisplay }, display);
}, 100);
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Threading;
using osu.Game.Graphics.Backgrounds;
namespace osu.Game.Screens.Backgrounds
{
public class BackgroundScreenDefault : BackgroundScreen
{
private int currentDisplay;
private const int background_count = 5;
private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}";
private Background current;
[BackgroundDependencyLoader]
private void load()
{
currentDisplay = RNG.Next(0, background_count);
display(new Background(backgroundName));
}
private void display(Background newBackground)
{
current?.FadeOut(800, Easing.InOutSine);
current?.Expire();
Add(current = newBackground);
currentDisplay++;
}
private ScheduledDelegate nextTask;
public void Next()
{
nextTask?.Cancel();
nextTask = Scheduler.AddDelayed(() =>
{
LoadComponentAsync(new Background(backgroundName) { Depth = currentDisplay }, display);
}, 100);
}
}
}
|
Use random default background on starting the game
|
Use random default background on starting the game
|
C#
|
mit
|
peppy/osu,2yangk23/osu,DrabWeb/osu,NeoAdonis/osu,naoey/osu,ppy/osu,johnneijzen/osu,ZLima12/osu,peppy/osu,NeoAdonis/osu,ZLima12/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,naoey/osu,ppy/osu,DrabWeb/osu,smoogipooo/osu,peppy/osu-new,EVAST9919/osu,johnneijzen/osu,smoogipoo/osu,DrabWeb/osu,EVAST9919/osu,naoey/osu,UselessToucan/osu,ppy/osu,peppy/osu,2yangk23/osu
|
0017d1a2e41fe7bc0f58489ade7ebec3b6cb3d99
|
source/SylphyHorn/UI/Controls/UnlockImageConverter.cs
|
source/SylphyHorn/UI/Controls/UnlockImageConverter.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media.Imaging;
using SylphyHorn.Services;
namespace SylphyHorn.UI.Controls
{
public class UnlockImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
try
{
if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) return null;
using (var stream = new FileStream((string)value, FileMode.Open))
{
var decoder = BitmapDecoder.Create(
stream,
BitmapCreateOptions.None,
BitmapCacheOption.OnLoad);
var bitmap = new WriteableBitmap(decoder.Frames[0]);
bitmap.Freeze();
return bitmap;
}
}
catch (Exception ex)
{
LoggingService.Instance.Register(ex);
return null;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media.Imaging;
using SylphyHorn.Services;
namespace SylphyHorn.UI.Controls
{
public class UnlockImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
try
{
if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) return null;
var filename = (string)value;
if (string.IsNullOrEmpty(filename)) return null;
using (var stream = new FileStream(filename, FileMode.Open))
{
var decoder = BitmapDecoder.Create(
stream,
BitmapCreateOptions.None,
BitmapCacheOption.OnLoad);
var bitmap = new WriteableBitmap(decoder.Frames[0]);
bitmap.Freeze();
return bitmap;
}
}
catch (Exception ex)
{
LoggingService.Instance.Register(ex);
return null;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
Fix issue to throw exception when wallpaper isn't set.
|
Fix issue to throw exception when wallpaper isn't set.
|
C#
|
mit
|
mntone/SylphyHorn
|
db4eea81a07b0a7fc93ae0d16657a85b2ef92459
|
GitTfs/GitTfsConstants.cs
|
GitTfs/GitTfsConstants.cs
|
using System.Text.RegularExpressions;
namespace Sep.Git.Tfs
{
public static class GitTfsConstants
{
public static readonly Regex Sha1 = new Regex("[a-f\\d]{40}", RegexOptions.IgnoreCase);
public static readonly Regex Sha1Short = new Regex("[a-f\\d]{4,40}", RegexOptions.IgnoreCase);
public static readonly Regex CommitRegex = new Regex("^commit (" + Sha1 + ")\\s*$");
public const string DefaultRepositoryId = "default";
public const string GitTfsPrefix = "git-tfs";
// e.g. git-tfs-id: [http://team:8080/]$/sandbox;C123
public const string TfsCommitInfoFormat = "git-tfs-id: [{0}]{1};C{2}";
public static readonly Regex TfsCommitInfoRegex =
new Regex("^\\s*" +
GitTfsPrefix +
"-id:\\s+" +
"\\[(?<url>.+)\\]" +
"(?<repository>.+);" +
"C(?<changeset>\\d+)" +
"\\s*$");
}
}
|
using System.Text.RegularExpressions;
namespace Sep.Git.Tfs
{
public static class GitTfsConstants
{
public static readonly Regex Sha1 = new Regex("[a-f\\d]{40}", RegexOptions.IgnoreCase);
public static readonly Regex Sha1Short = new Regex("[a-f\\d]{4,40}", RegexOptions.IgnoreCase);
public static readonly Regex CommitRegex = new Regex("^commit (" + Sha1 + ")\\s*$");
public const string DefaultRepositoryId = "default";
public const string GitTfsPrefix = "git-tfs";
// e.g. git-tfs-id: [http://team:8080/]$/sandbox;C123
public const string TfsCommitInfoFormat = "git-tfs-id: [{0}]{1};C{2}";
public static readonly Regex TfsCommitInfoRegex =
new Regex("^\\s*" +
GitTfsPrefix +
"-id:\\s+" +
"\\[(?<url>.+)\\]" +
"(?<repository>.+);" +
"C(?<changeset>\\d+)" +
"\\s*$");
// e.g. git-tfs-work-item: 24 associate
public static readonly Regex TfsWorkItemRegex =
new Regex(@"^\s*"+ GitTfsPrefix + @"-work-item:\s+(?<item_id>\d+)\s(?<action>.+)");
}
}
|
Add regex for associating work items
|
Add regex for associating work items
|
C#
|
apache-2.0
|
git-tfs/git-tfs,steveandpeggyb/Public,pmiossec/git-tfs,irontoby/git-tfs,irontoby/git-tfs,guyboltonking/git-tfs,allansson/git-tfs,hazzik/git-tfs,TheoAndersen/git-tfs,irontoby/git-tfs,allansson/git-tfs,adbre/git-tfs,modulexcite/git-tfs,WolfVR/git-tfs,guyboltonking/git-tfs,TheoAndersen/git-tfs,kgybels/git-tfs,modulexcite/git-tfs,guyboltonking/git-tfs,steveandpeggyb/Public,timotei/git-tfs,hazzik/git-tfs,bleissem/git-tfs,steveandpeggyb/Public,PKRoma/git-tfs,kgybels/git-tfs,timotei/git-tfs,allansson/git-tfs,TheoAndersen/git-tfs,bleissem/git-tfs,NathanLBCooper/git-tfs,andyrooger/git-tfs,jeremy-sylvis-tmg/git-tfs,allansson/git-tfs,jeremy-sylvis-tmg/git-tfs,jeremy-sylvis-tmg/git-tfs,timotei/git-tfs,codemerlin/git-tfs,hazzik/git-tfs,WolfVR/git-tfs,adbre/git-tfs,modulexcite/git-tfs,spraints/git-tfs,vzabavnov/git-tfs,bleissem/git-tfs,NathanLBCooper/git-tfs,codemerlin/git-tfs,spraints/git-tfs,WolfVR/git-tfs,TheoAndersen/git-tfs,adbre/git-tfs,NathanLBCooper/git-tfs,kgybels/git-tfs,hazzik/git-tfs,codemerlin/git-tfs,spraints/git-tfs
|
a7bdb169fddc9c9b130055a6672dccdcd2435b2c
|
src/main/Plugins/ValidationPlugins/Dns/Manual/Manual.cs
|
src/main/Plugins/ValidationPlugins/Dns/Manual/Manual.cs
|
using PKISharp.WACS.Services;
namespace PKISharp.WACS.Plugins.ValidationPlugins.Dns
{
class Manual : DnsValidation<ManualOptions, Manual>
{
private IInputService _input;
public Manual(ILogService log, IInputService input, ManualOptions options, string identifier) : base(log, options, identifier)
{
// Usually it's a big no-no to rely on user input in validation plugin
// because this should be able to run unattended. This plugin is for testing
// only and therefor we will allow it. Future versions might be more advanced,
// e.g. shoot an email to an admin and complete the order later.
_input = input;
}
public override void CreateRecord(string recordName, string token)
{
_log.Warning("Create record {recordName} for domain {identifier} with content {token}", recordName, _identifier, token);
_input.Wait();
}
public override void DeleteRecord(string recordName, string token)
{
_log.Warning("Delete record {recordName} for domain {identifier}", recordName, _identifier);
_input.Wait();
}
}
}
|
using PKISharp.WACS.Services;
namespace PKISharp.WACS.Plugins.ValidationPlugins.Dns
{
class Manual : DnsValidation<ManualOptions, Manual>
{
private IInputService _input;
public Manual(ILogService log, IInputService input, ManualOptions options, string identifier) : base(log, options, identifier)
{
// Usually it's a big no-no to rely on user input in validation plugin
// because this should be able to run unattended. This plugin is for testing
// only and therefor we will allow it. Future versions might be more advanced,
// e.g. shoot an email to an admin and complete the order later.
_input = input;
}
public override void CreateRecord(string recordName, string token)
{
_input.Wait($"Create record {recordName} for domain {_identifier} with content {token} and press enter to continue...");
}
public override void DeleteRecord(string recordName, string token)
{
_input.Wait($"Delete record {recordName} for domain {_identifier}");
}
}
}
|
Use proper input instead of log message to request manual DNS change
|
Use proper input instead of log message to request manual DNS change
|
C#
|
apache-2.0
|
Lone-Coder/letsencrypt-win-simple
|
f5f102f09fd9cdf799b3fa99db777908cfebb828
|
MongoDB.Net-Tests/Connections/TestConnectionFactory.cs
|
MongoDB.Net-Tests/Connections/TestConnectionFactory.cs
|
using System;
using NUnit.Framework;
namespace MongoDB.Driver.Connections
{
[TestFixture]
public class TestConnectionFactory
{
[TearDown]
public void TearDown (){
ConnectionFactory.Shutdown ();
}
[Test]
public void TestGetConnection (){
var connection1 = ConnectionFactory.GetConnection (string.Empty);
var connection2 = ConnectionFactory.GetConnection (string.Empty);
Assert.IsNotNull (connection1);
Assert.IsNotNull (connection2);
Assert.AreEqual (1, ConnectionFactory.PoolCount);
}
[Test]
public void TestCreatePoolForEachUniqeConnectionString (){
ConnectionFactory.GetConnection (string.Empty);
ConnectionFactory.GetConnection (string.Empty);
ConnectionFactory.GetConnection ("Username=test");
ConnectionFactory.GetConnection ("Username=test");
ConnectionFactory.GetConnection ("Server=localhost");
Assert.AreEqual (3, ConnectionFactory.PoolCount);
}
[Test]
public void TestGetInvalidConnection (){
bool thrown = false;
try{
ConnectionFactory.GetConnection("MinimumPoolSize=50; MaximumPoolSize=10");
}catch(ArgumentException){
thrown = true;
}catch(Exception){
Assert.Fail("Wrong exception thrown");
}
}
}
}
|
using System;
using NUnit.Framework;
namespace MongoDB.Driver.Connections
{
[TestFixture]
public class TestConnectionFactory
{
[TearDown]
public void TearDown (){
ConnectionFactory.Shutdown ();
}
[Test]
public void TestGetConnection (){
var connection1 = ConnectionFactory.GetConnection (string.Empty);
var connection2 = ConnectionFactory.GetConnection (string.Empty);
Assert.IsNotNull (connection1);
Assert.IsNotNull (connection2);
Assert.AreEqual (1, ConnectionFactory.PoolCount);
}
[Test]
public void TestCreatePoolForEachUniqeConnectionString (){
ConnectionFactory.GetConnection (string.Empty);
ConnectionFactory.GetConnection (string.Empty);
ConnectionFactory.GetConnection ("Username=test");
ConnectionFactory.GetConnection ("Username=test");
ConnectionFactory.GetConnection ("Server=localhost");
Assert.AreEqual (3, ConnectionFactory.PoolCount);
}
[Test]
public void TestExceptionWhenMinimumPoolSizeIsGreaterThenMaximumPoolSize (){
try{
ConnectionFactory.GetConnection("MinimumPoolSize=50; MaximumPoolSize=10");
}catch(ArgumentException){
}catch(Exception){
Assert.Fail("Wrong exception thrown");
}
}
}
}
|
Fix compiler warning and rename test to be more clear.
|
Fix compiler warning and rename test to be more clear.
|
C#
|
apache-2.0
|
samus/mongodb-csharp,mongodb-csharp/mongodb-csharp,zh-huan/mongodb
|
52a9e81dc0592d5ccbb329f5acda9d0eb6c1148f
|
src/OneWayMirror/ReportingConsoleHost.cs
|
src/OneWayMirror/ReportingConsoleHost.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using OneWayMirror.Core;
namespace OneWayMirror
{
internal sealed class ReportingConsoleHost : ConsoleHost
{
private readonly string _reportEmailAddress;
internal ReportingConsoleHost(bool verbose, string reportEmailAddress) : base(verbose)
{
_reportEmailAddress = reportEmailAddress;
}
private void SendMail(string body)
{
using (var msg = new MailMessage())
{
msg.To.Add(new MailAddress(_reportEmailAddress));
msg.From = new MailAddress(Environment.UserDomainName + @"@microsoft.com");
msg.IsBodyHtml = false;
msg.Subject = "Git to TFS Mirror Error";
msg.Body = body;
var client = new SmtpClient("smtphost");
client.UseDefaultCredentials = true;
client.Send(msg);
}
}
public override void Error(string format, params object[] args)
{
base.Error(format, args);
SendMail(string.Format(format, args));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using OneWayMirror.Core;
namespace OneWayMirror
{
internal sealed class ReportingConsoleHost : ConsoleHost
{
private readonly string _reportEmailAddress;
internal ReportingConsoleHost(bool verbose, string reportEmailAddress) : base(verbose)
{
_reportEmailAddress = reportEmailAddress;
}
private void SendMail(string body)
{
using (var msg = new MailMessage())
{
msg.To.Add(new MailAddress(_reportEmailAddress));
msg.From = new MailAddress(Environment.UserName + @"@microsoft.com");
msg.IsBodyHtml = false;
msg.Subject = "Git to TFS Mirror Error";
msg.Body = body;
var client = new SmtpClient("smtphost");
client.UseDefaultCredentials = true;
client.Send(msg);
}
}
public override void Error(string format, params object[] args)
{
base.Error(format, args);
SendMail(string.Format(format, args));
}
}
}
|
Use UserName instead of UserDomainName
|
Use UserName instead of UserDomainName
|
C#
|
apache-2.0
|
jaredpar/ConversionTools
|
388991336c0b3956a7624e171c915ef0e7a9ac98
|
Fotografix/DelegateCommand.cs
|
Fotografix/DelegateCommand.cs
|
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows.Input;
namespace Fotografix
{
public sealed class DelegateCommand : ICommand
{
private readonly Func<bool> canExecute;
private readonly Func<Task> execute;
private bool executing;
public DelegateCommand(Action execute) : this(() => true, () => { execute(); return Task.CompletedTask; })
{
}
public DelegateCommand(Func<Task> execute) : this(() => true, execute)
{
}
public DelegateCommand(Func<bool> canExecute, Func<Task> execute)
{
this.canExecute = canExecute;
this.execute = execute;
}
public event EventHandler CanExecuteChanged
{
add { }
remove { }
}
public bool CanExecute(object parameter)
{
return canExecute();
}
public async void Execute(object parameter)
{
if (executing)
{
/*
* This scenario can occur in two situations:
* 1. The user invokes the command again before the previous async execution has completed.
* 2. A bug in the XAML framework that sometimes triggers a command twice when using a keyboard accelerator.
*/
Debug.WriteLine("Skipping command execution since previous execution has not completed yet");
return;
}
try
{
this.executing = true;
await execute();
}
finally
{
this.executing = false;
}
}
}
}
|
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows.Input;
namespace Fotografix
{
public sealed class DelegateCommand : ICommand
{
private readonly Func<bool> canExecute;
private readonly Func<Task> execute;
private bool executing;
public DelegateCommand(Action execute) : this(() => true, () => { execute(); return Task.CompletedTask; })
{
}
public DelegateCommand(Func<Task> execute) : this(() => true, execute)
{
}
public DelegateCommand(Func<bool> canExecute, Func<Task> execute)
{
this.canExecute = canExecute;
this.execute = execute;
}
public bool IsExecuting
{
get => executing;
private set
{
this.executing = value;
RaiseCanExecuteChanged();
}
}
public event EventHandler CanExecuteChanged;
public void RaiseCanExecuteChanged()
{
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
public bool CanExecute(object parameter)
{
return !executing && canExecute();
}
public async void Execute(object parameter)
{
if (IsExecuting)
{
/*
* This scenario can occur in two situations:
* 1. The user invokes the command again before the previous async execution has completed.
* 2. A bug in the XAML framework that sometimes triggers a command twice when using a keyboard accelerator.
*/
Debug.WriteLine("Skipping command execution since previous execution has not completed yet");
return;
}
try
{
this.IsExecuting = true;
await execute();
}
finally
{
this.IsExecuting = false;
}
}
}
}
|
Disable commands while they are executing
|
Disable commands while they are executing
|
C#
|
mit
|
lmadhavan/fotografix
|
10ec4cd8e07950b8a48e8da8931e3e39b16559b8
|
osu.Game/Overlays/OnlineOverlay.cs
|
osu.Game/Overlays/OnlineOverlay.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.Graphics.UserInterface;
using osu.Game.Online;
namespace osu.Game.Overlays
{
public abstract class OnlineOverlay<T> : FullscreenOverlay<T>
where T : OverlayHeader
{
protected override Container<Drawable> Content => content;
protected readonly OverlayScrollContainer ScrollFlow;
protected readonly LoadingLayer Loading;
private readonly Container content;
protected OnlineOverlay(OverlayColourScheme colourScheme, bool requiresSignIn = true)
: base(colourScheme)
{
var mainContent = requiresSignIn
? new OnlineViewContainer($"Sign in to view the {Header.Title.Title}")
: new Container();
mainContent.RelativeSizeAxes = Axes.Both;
mainContent.AddRange(new Drawable[]
{
ScrollFlow = new OverlayScrollContainer
{
RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false,
Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
Header.With(h => h.Depth = float.MinValue),
content = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
}
}
}
},
Loading = new LoadingLayer()
});
base.Content.Add(mainContent);
}
}
}
|
// 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.Graphics.UserInterface;
using osu.Game.Online;
namespace osu.Game.Overlays
{
public abstract class OnlineOverlay<T> : FullscreenOverlay<T>
where T : OverlayHeader
{
protected override Container<Drawable> Content => content;
protected readonly OverlayScrollContainer ScrollFlow;
protected readonly LoadingLayer Loading;
private readonly Container content;
protected OnlineOverlay(OverlayColourScheme colourScheme, bool requiresSignIn = true)
: base(colourScheme)
{
var mainContent = requiresSignIn
? new OnlineViewContainer($"Sign in to view the {Header.Title.Title}")
: new Container();
mainContent.RelativeSizeAxes = Axes.Both;
mainContent.AddRange(new Drawable[]
{
ScrollFlow = new OverlayScrollContainer
{
RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false,
Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
Header.With(h => h.Depth = float.MinValue),
content = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
}
}
}
},
Loading = new LoadingLayer(true)
});
base.Content.Add(mainContent);
}
}
}
|
Revert change to loading layer's default state
|
Revert change to loading layer's default state
|
C#
|
mit
|
ppy/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipooo/osu
|
b6075c76ad6534d3b8767fb70fba01746207a6fa
|
osu.Framework/Localisation/LocalisableEnumAttribute.cs
|
osu.Framework/Localisation/LocalisableEnumAttribute.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Extensions.TypeExtensions;
namespace osu.Framework.Localisation
{
/// <summary>
/// Indicates that the members of an enum can be localised.
/// </summary>
[AttributeUsage(AttributeTargets.Enum)]
public sealed class LocalisableEnumAttribute : Attribute
{
/// <summary>
/// The <see cref="EnumLocalisationMapper{T}"/> type that maps enum values to <see cref="LocalisableString"/>s.
/// </summary>
public readonly Type MapperType;
/// <summary>
/// Creates a new <see cref="LocalisableEnumAttribute"/>.
/// </summary>
/// <param name="mapperType">The <see cref="EnumLocalisationMapper{T}"/> type that maps enum values to <see cref="LocalisableString"/>s.</param>
public LocalisableEnumAttribute(Type mapperType)
{
MapperType = mapperType;
if (!typeof(IEnumLocalisationMapper).IsAssignableFrom(mapperType))
throw new ArgumentException($"Type \"{mapperType.ReadableName()}\" must inherit from {nameof(EnumLocalisationMapper<Enum>)}.", nameof(mapperType));
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Extensions;
using osu.Framework.Extensions.TypeExtensions;
namespace osu.Framework.Localisation
{
/// <summary>
/// Indicates that the values of an enum have <see cref="LocalisableString"/> descriptions.
/// The descriptions can be returned through <see cref="ExtensionMethods.GetLocalisableDescription{T}"/>.
/// </summary>
[AttributeUsage(AttributeTargets.Enum)]
public sealed class LocalisableEnumAttribute : Attribute
{
/// <summary>
/// The <see cref="EnumLocalisationMapper{T}"/> type that maps enum values to <see cref="LocalisableString"/>s.
/// </summary>
public readonly Type MapperType;
/// <summary>
/// Creates a new <see cref="LocalisableEnumAttribute"/>.
/// </summary>
/// <param name="mapperType">The <see cref="EnumLocalisationMapper{T}"/> type that maps enum values to <see cref="LocalisableString"/>s.</param>
public LocalisableEnumAttribute(Type mapperType)
{
MapperType = mapperType;
if (!typeof(IEnumLocalisationMapper).IsAssignableFrom(mapperType))
throw new ArgumentException($"Type \"{mapperType.ReadableName()}\" must inherit from {nameof(EnumLocalisationMapper<Enum>)}.", nameof(mapperType));
}
}
}
|
Add description indicating retrieval method
|
Add description indicating retrieval method
|
C#
|
mit
|
peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework
|
b7edd7db54f9de2721ea0c793e33d26fb86355cd
|
src/Hosts/Hadouken.Hosts.WindowsService/HdknService.cs
|
src/Hosts/Hadouken.Hosts.WindowsService/HdknService.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using Hadouken.Common;
using Hadouken.Hosting;
namespace Hadouken.Hosts.WindowsService
{
public class HdknService : ServiceBase
{
private IHadoukenHost _host;
public HdknService()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.AutoLog = true;
this.ServiceName = "Hadouken";
}
protected override void OnStart(string[] args)
{
Task.Factory.StartNew(() =>
{
_host = Kernel.Get<IHadoukenHost>();
_host.Load();
});
}
protected override void OnStop()
{
if (_host != null)
_host.Unload();
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using Hadouken.Common;
using Hadouken.Hosting;
using System.Threading;
namespace Hadouken.Hosts.WindowsService
{
public class HdknService : ServiceBase
{
private IHadoukenHost _host;
public HdknService()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.AutoLog = true;
this.ServiceName = "Hadouken";
}
protected override void OnStart(string[] args)
{
Load();
}
private void Load()
{
_host = Kernel.Get<IHadoukenHost>();
_host.Load();
}
protected override void OnStop()
{
if (_host != null)
_host.Unload();
}
}
}
|
Load the service in the main thread, once more.
|
Load the service in the main thread, once more.
|
C#
|
mit
|
yonglehou/hadouken,Robo210/hadouken,vktr/hadouken,Robo210/hadouken,yonglehou/hadouken,Robo210/hadouken,vktr/hadouken,yonglehou/hadouken,Robo210/hadouken,vktr/hadouken,vktr/hadouken
|
6b271f8f54389022ecdf579ee69b9d87db63eb0e
|
src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs
|
src/Orchard.Web/Core/Common/Drivers/TextFieldDriver.cs
|
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Common.Fields;
namespace Orchard.Core.Common.Drivers {
[UsedImplicitly]
public class TextFieldDriver : ContentFieldDriver<TextField> {
public IOrchardServices Services { get; set; }
private const string TemplateName = "Fields/Common.TextField";
public TextFieldDriver(IOrchardServices services) {
Services = services;
}
private static string GetPrefix(TextField field, ContentPart part) {
return part.PartDefinition.Name + "." + field.Name;
}
protected override DriverResult Display(ContentPart part, TextField field, string displayType) {
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part));
}
protected override DriverResult Editor(ContentPart part, TextField field) {
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part)).Location("primary", "5");
}
protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater) {
updater.TryUpdateModel(field, GetPrefix(field, part), null, null);
return Editor(part, field);
}
}
}
|
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Common.Fields;
using Orchard.Core.Common.Settings;
namespace Orchard.Core.Common.Drivers {
[UsedImplicitly]
public class TextFieldDriver : ContentFieldDriver<TextField> {
public IOrchardServices Services { get; set; }
private const string TemplateName = "Fields/Common.TextField";
public TextFieldDriver(IOrchardServices services) {
Services = services;
}
private static string GetPrefix(TextField field, ContentPart part) {
return part.PartDefinition.Name + "." + field.Name;
}
protected override DriverResult Display(ContentPart part, TextField field, string displayType) {
var locationSettings =
field.PartFieldDefinition.Settings.GetModel<LocationSettings>("DisplayLocation") ??
new LocationSettings { Zone = "primary", Position = "5" };
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part))
.Location(locationSettings.Zone, locationSettings.Position);
}
protected override DriverResult Editor(ContentPart part, TextField field) {
var locationSettings =
field.PartFieldDefinition.Settings.GetModel<LocationSettings>("EditorLocation") ??
new LocationSettings { Zone = "primary", Position = "5" };
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part))
.Location(locationSettings.Zone, locationSettings.Position);
}
protected override DriverResult Editor(ContentPart part, TextField field, IUpdateModel updater) {
updater.TryUpdateModel(field, GetPrefix(field, part), null, null);
return Editor(part, field);
}
}
}
|
Create Display/Editor location settings for Parts and Fields
|
Create Display/Editor location settings for Parts and Fields
--HG--
branch : dev
|
C#
|
bsd-3-clause
|
DonnotRain/Orchard,OrchardCMS/Orchard-Harvest-Website,Morgma/valleyviewknolls,AdvantageCS/Orchard,Fogolan/OrchardForWork,jtkech/Orchard,rtpHarry/Orchard,IDeliverable/Orchard,tobydodds/folklife,dcinzona/Orchard-Harvest-Website,Praggie/Orchard,openbizgit/Orchard,qt1/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,Serlead/Orchard,oxwanawxo/Orchard,SouleDesigns/SouleDesigns.Orchard,LaserSrl/Orchard,omidnasri/Orchard,enspiral-dev-academy/Orchard,mgrowan/Orchard,JRKelso/Orchard,dozoft/Orchard,hbulzy/Orchard,yersans/Orchard,li0803/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,m2cms/Orchard,luchaoshuai/Orchard,kgacova/Orchard,geertdoornbos/Orchard,sfmskywalker/Orchard,Serlead/Orchard,enspiral-dev-academy/Orchard,hbulzy/Orchard,RoyalVeterinaryCollege/Orchard,AEdmunds/beautiful-springtime,jaraco/orchard,dburriss/Orchard,aaronamm/Orchard,fassetar/Orchard,enspiral-dev-academy/Orchard,jimasp/Orchard,arminkarimi/Orchard,harmony7/Orchard,DonnotRain/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,ehe888/Orchard,phillipsj/Orchard,andyshao/Orchard,Serlead/Orchard,oxwanawxo/Orchard,salarvand/Portal,Ermesx/Orchard,escofieldnaxos/Orchard,stormleoxia/Orchard,asabbott/chicagodevnet-website,SouleDesigns/SouleDesigns.Orchard,yersans/Orchard,Anton-Am/Orchard,vard0/orchard.tan,angelapper/Orchard,KeithRaven/Orchard,hhland/Orchard,bedegaming-aleksej/Orchard,sebastienros/msc,xiaobudian/Orchard,hhland/Orchard,harmony7/Orchard,vard0/orchard.tan,alejandroaldana/Orchard,SzymonSel/Orchard,gcsuk/Orchard,cooclsee/Orchard,TaiAivaras/Orchard,austinsc/Orchard,IDeliverable/Orchard,qt1/Orchard,geertdoornbos/Orchard,ehe888/Orchard,spraiin/Orchard,xiaobudian/Orchard,Serlead/Orchard,MetSystem/Orchard,neTp9c/Orchard,sfmskywalker/Orchard,dcinzona/Orchard-Harvest-Website,mvarblow/Orchard,sfmskywalker/Orchard,johnnyqian/Orchard,Praggie/Orchard,dcinzona/Orchard-Harvest-Website,aaronamm/Orchard,Dolphinsimon/Orchard,dcinzona/Orchard,SeyDutch/Airbrush,caoxk/orchard,xiaobudian/Orchard,huoxudong125/Orchard,gcsuk/Orchard,spraiin/Orchard,grapto/Orchard.CloudBust,phillipsj/Orchard,NIKASoftwareDevs/Orchard,vard0/orchard.tan,luchaoshuai/Orchard,OrchardCMS/Orchard,jtkech/Orchard,alejandroaldana/Orchard,JRKelso/Orchard,sfmskywalker/Orchard,hannan-azam/Orchard,harmony7/Orchard,yersans/Orchard,oxwanawxo/Orchard,yonglehou/Orchard,DonnotRain/Orchard,omidnasri/Orchard,jtkech/Orchard,hannan-azam/Orchard,Lombiq/Orchard,KeithRaven/Orchard,Anton-Am/Orchard,emretiryaki/Orchard,yonglehou/Orchard,MpDzik/Orchard,geertdoornbos/Orchard,TalaveraTechnologySolutions/Orchard,rtpHarry/Orchard,fortunearterial/Orchard,TalaveraTechnologySolutions/Orchard,johnnyqian/Orchard,MpDzik/Orchard,cooclsee/Orchard,yersans/Orchard,stormleoxia/Orchard,angelapper/Orchard,grapto/Orchard.CloudBust,TaiAivaras/Orchard,sebastienros/msc,vairam-svs/Orchard,bedegaming-aleksej/Orchard,jchenga/Orchard,jaraco/orchard,xkproject/Orchard,LaserSrl/Orchard,ehe888/Orchard,gcsuk/Orchard,andyshao/Orchard,qt1/orchard4ibn,TalaveraTechnologySolutions/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,omidnasri/Orchard,dcinzona/Orchard,dcinzona/Orchard,AndreVolksdorf/Orchard,hhland/Orchard,OrchardCMS/Orchard,johnnyqian/Orchard,asabbott/chicagodevnet-website,jerryshi2007/Orchard,planetClaire/Orchard-LETS,caoxk/orchard,cryogen/orchard,salarvand/orchard,AdvantageCS/Orchard,kgacova/Orchard,OrchardCMS/Orchard-Harvest-Website,Codinlab/Orchard,Ermesx/Orchard,bigfont/orchard-cms-modules-and-themes,huoxudong125/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,xkproject/Orchard,austinsc/Orchard,sebastienros/msc,AndreVolksdorf/Orchard,bigfont/orchard-continuous-integration-demo,OrchardCMS/Orchard-Harvest-Website,asabbott/chicagodevnet-website,patricmutwiri/Orchard,JRKelso/Orchard,qt1/Orchard,AEdmunds/beautiful-springtime,ehe888/Orchard,omidnasri/Orchard,JRKelso/Orchard,qt1/Orchard,RoyalVeterinaryCollege/Orchard,IDeliverable/Orchard,Sylapse/Orchard.HttpAuthSample,jagraz/Orchard,bigfont/orchard-continuous-integration-demo,IDeliverable/Orchard,tobydodds/folklife,SzymonSel/Orchard,NIKASoftwareDevs/Orchard,hannan-azam/Orchard,RoyalVeterinaryCollege/Orchard,salarvand/Portal,JRKelso/Orchard,jersiovic/Orchard,oxwanawxo/Orchard,stormleoxia/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,planetClaire/Orchard-LETS,jchenga/Orchard,openbizgit/Orchard,neTp9c/Orchard,spraiin/Orchard,planetClaire/Orchard-LETS,KeithRaven/Orchard,abhishekluv/Orchard,RoyalVeterinaryCollege/Orchard,phillipsj/Orchard,Cphusion/Orchard,Serlead/Orchard,SzymonSel/Orchard,arminkarimi/Orchard,fortunearterial/Orchard,SeyDutch/Airbrush,rtpHarry/Orchard,bigfont/orchard-cms-modules-and-themes,MetSystem/Orchard,Morgma/valleyviewknolls,jimasp/Orchard,LaserSrl/Orchard,abhishekluv/Orchard,Ermesx/Orchard,mgrowan/Orchard,cryogen/orchard,ericschultz/outercurve-orchard,angelapper/Orchard,caoxk/orchard,KeithRaven/Orchard,arminkarimi/Orchard,patricmutwiri/Orchard,neTp9c/Orchard,xkproject/Orchard,SouleDesigns/SouleDesigns.Orchard,fassetar/Orchard,bedegaming-aleksej/Orchard,Codinlab/Orchard,Lombiq/Orchard,Inner89/Orchard,fortunearterial/Orchard,aaronamm/Orchard,Fogolan/OrchardForWork,AndreVolksdorf/Orchard,Anton-Am/Orchard,Sylapse/Orchard.HttpAuthSample,qt1/orchard4ibn,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,alejandroaldana/Orchard,dcinzona/Orchard-Harvest-Website,AEdmunds/beautiful-springtime,sfmskywalker/Orchard,SeyDutch/Airbrush,jtkech/Orchard,infofromca/Orchard,johnnyqian/Orchard,jimasp/Orchard,enspiral-dev-academy/Orchard,cooclsee/Orchard,huoxudong125/Orchard,cryogen/orchard,mgrowan/Orchard,li0803/Orchard,planetClaire/Orchard-LETS,fassetar/Orchard,Fogolan/OrchardForWork,DonnotRain/Orchard,luchaoshuai/Orchard,Sylapse/Orchard.HttpAuthSample,jerryshi2007/Orchard,arminkarimi/Orchard,fortunearterial/Orchard,angelapper/Orchard,salarvand/orchard,Inner89/Orchard,huoxudong125/Orchard,aaronamm/Orchard,SouleDesigns/SouleDesigns.Orchard,escofieldnaxos/Orchard,qt1/orchard4ibn,bigfont/orchard-continuous-integration-demo,brownjordaninternational/OrchardCMS,marcoaoteixeira/Orchard,dcinzona/Orchard,TaiAivaras/Orchard,enspiral-dev-academy/Orchard,smartnet-developers/Orchard,angelapper/Orchard,brownjordaninternational/OrchardCMS,aaronamm/Orchard,NIKASoftwareDevs/Orchard,Cphusion/Orchard,patricmutwiri/Orchard,abhishekluv/Orchard,jagraz/Orchard,sfmskywalker/Orchard,Sylapse/Orchard.HttpAuthSample,caoxk/orchard,xkproject/Orchard,jersiovic/Orchard,AdvantageCS/Orchard,jimasp/Orchard,Morgma/valleyviewknolls,dozoft/Orchard,MpDzik/Orchard,vairam-svs/Orchard,AndreVolksdorf/Orchard,gcsuk/Orchard,Codinlab/Orchard,yonglehou/Orchard,rtpHarry/Orchard,grapto/Orchard.CloudBust,hbulzy/Orchard,dcinzona/Orchard-Harvest-Website,TalaveraTechnologySolutions/Orchard,SeyDutch/Airbrush,oxwanawxo/Orchard,ehe888/Orchard,infofromca/Orchard,grapto/Orchard.CloudBust,grapto/Orchard.CloudBust,stormleoxia/Orchard,dburriss/Orchard,RoyalVeterinaryCollege/Orchard,marcoaoteixeira/Orchard,asabbott/chicagodevnet-website,Morgma/valleyviewknolls,Ermesx/Orchard,escofieldnaxos/Orchard,dozoft/Orchard,TalaveraTechnologySolutions/Orchard,Praggie/Orchard,Ermesx/Orchard,alejandroaldana/Orchard,kouweizhong/Orchard,ericschultz/outercurve-orchard,dcinzona/Orchard-Harvest-Website,austinsc/Orchard,emretiryaki/Orchard,vard0/orchard.tan,andyshao/Orchard,Lombiq/Orchard,jtkech/Orchard,dcinzona/Orchard,OrchardCMS/Orchard-Harvest-Website,bigfont/orchard-cms-modules-and-themes,openbizgit/Orchard,kgacova/Orchard,neTp9c/Orchard,bedegaming-aleksej/Orchard,armanforghani/Orchard,dozoft/Orchard,mgrowan/Orchard,armanforghani/Orchard,tobydodds/folklife,Morgma/valleyviewknolls,rtpHarry/Orchard,vairam-svs/Orchard,jagraz/Orchard,smartnet-developers/Orchard,harmony7/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,Cphusion/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,abhishekluv/Orchard,qt1/orchard4ibn,OrchardCMS/Orchard-Harvest-Website,hbulzy/Orchard,spraiin/Orchard,brownjordaninternational/OrchardCMS,dmitry-urenev/extended-orchard-cms-v10.1,geertdoornbos/Orchard,yonglehou/Orchard,SzymonSel/Orchard,Anton-Am/Orchard,mvarblow/Orchard,jersiovic/Orchard,marcoaoteixeira/Orchard,emretiryaki/Orchard,qt1/orchard4ibn,luchaoshuai/Orchard,salarvand/orchard,cooclsee/Orchard,hhland/Orchard,marcoaoteixeira/Orchard,AdvantageCS/Orchard,mgrowan/Orchard,SzymonSel/Orchard,xiaobudian/Orchard,emretiryaki/Orchard,DonnotRain/Orchard,jerryshi2007/Orchard,andyshao/Orchard,Inner89/Orchard,xiaobudian/Orchard,m2cms/Orchard,jchenga/Orchard,patricmutwiri/Orchard,Dolphinsimon/Orchard,TalaveraTechnologySolutions/Orchard,MpDzik/Orchard,Codinlab/Orchard,dburriss/Orchard,jagraz/Orchard,emretiryaki/Orchard,abhishekluv/Orchard,hhland/Orchard,jaraco/orchard,m2cms/Orchard,omidnasri/Orchard,jchenga/Orchard,OrchardCMS/Orchard,TaiAivaras/Orchard,smartnet-developers/Orchard,escofieldnaxos/Orchard,salarvand/Portal,sebastienros/msc,jersiovic/Orchard,m2cms/Orchard,infofromca/Orchard,Praggie/Orchard,fortunearterial/Orchard,smartnet-developers/Orchard,mvarblow/Orchard,austinsc/Orchard,AEdmunds/beautiful-springtime,jerryshi2007/Orchard,patricmutwiri/Orchard,jersiovic/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,MpDzik/Orchard,salarvand/orchard,hannan-azam/Orchard,dozoft/Orchard,mvarblow/Orchard,bedegaming-aleksej/Orchard,bigfont/orchard-cms-modules-and-themes,sebastienros/msc,jchenga/Orchard,armanforghani/Orchard,ericschultz/outercurve-orchard,hbulzy/Orchard,omidnasri/Orchard,Sylapse/Orchard.HttpAuthSample,SouleDesigns/SouleDesigns.Orchard,fassetar/Orchard,huoxudong125/Orchard,MpDzik/Orchard,kouweizhong/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,qt1/Orchard,bigfont/orchard-cms-modules-and-themes,Lombiq/Orchard,luchaoshuai/Orchard,grapto/Orchard.CloudBust,Dolphinsimon/Orchard,vairam-svs/Orchard,gcsuk/Orchard,salarvand/Portal,neTp9c/Orchard,geertdoornbos/Orchard,cryogen/orchard,qt1/orchard4ibn,Fogolan/OrchardForWork,KeithRaven/Orchard,Fogolan/OrchardForWork,bigfont/orchard-continuous-integration-demo,dburriss/Orchard,omidnasri/Orchard,OrchardCMS/Orchard-Harvest-Website,vairam-svs/Orchard,li0803/Orchard,m2cms/Orchard,jerryshi2007/Orchard,harmony7/Orchard,jimasp/Orchard,yersans/Orchard,Dolphinsimon/Orchard,openbizgit/Orchard,dburriss/Orchard,xkproject/Orchard,armanforghani/Orchard,Codinlab/Orchard,mvarblow/Orchard,salarvand/Portal,LaserSrl/Orchard,TalaveraTechnologySolutions/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,andyshao/Orchard,IDeliverable/Orchard,vard0/orchard.tan,li0803/Orchard,kgacova/Orchard,Anton-Am/Orchard,kouweizhong/Orchard,AdvantageCS/Orchard,smartnet-developers/Orchard,MetSystem/Orchard,MetSystem/Orchard,OrchardCMS/Orchard,tobydodds/folklife,Praggie/Orchard,hannan-azam/Orchard,MetSystem/Orchard,infofromca/Orchard,ericschultz/outercurve-orchard,sfmskywalker/Orchard,brownjordaninternational/OrchardCMS,spraiin/Orchard,fassetar/Orchard,NIKASoftwareDevs/Orchard,omidnasri/Orchard,vard0/orchard.tan,sfmskywalker/Orchard,AndreVolksdorf/Orchard,Inner89/Orchard,jagraz/Orchard,infofromca/Orchard,stormleoxia/Orchard,kgacova/Orchard,TaiAivaras/Orchard,Cphusion/Orchard,kouweizhong/Orchard,omidnasri/Orchard,Dolphinsimon/Orchard,cooclsee/Orchard,arminkarimi/Orchard,jaraco/orchard,NIKASoftwareDevs/Orchard,johnnyqian/Orchard,brownjordaninternational/OrchardCMS,openbizgit/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,tobydodds/folklife,abhishekluv/Orchard,OrchardCMS/Orchard,LaserSrl/Orchard,tobydodds/folklife,Lombiq/Orchard,kouweizhong/Orchard,phillipsj/Orchard,salarvand/orchard,planetClaire/Orchard-LETS,armanforghani/Orchard,escofieldnaxos/Orchard,TalaveraTechnologySolutions/Orchard,Cphusion/Orchard,Inner89/Orchard,yonglehou/Orchard,alejandroaldana/Orchard,phillipsj/Orchard,marcoaoteixeira/Orchard,li0803/Orchard,austinsc/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,SeyDutch/Airbrush
|
15954d1dc5ac605863d01c104635286cccb6a004
|
tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs
|
tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs
|
// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
[assembly: AssemblyTitle("Perspex.Styling.UnitTests")]
|
// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
using Xunit;
[assembly: AssemblyTitle("Perspex.Styling.UnitTests")]
// Don't run tests in parallel.
[assembly: CollectionBehavior(DisableTestParallelization = true)]
|
Fix intermittent Style unit test failures.
|
Fix intermittent Style unit test failures.
|
C#
|
mit
|
Perspex/Perspex,AvaloniaUI/Avalonia,OronDF343/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,DavidKarlas/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,bbqchickenrobot/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,kekekeks/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,susloparovdenis/Avalonia,MrDaedra/Avalonia,grokys/Perspex,punker76/Perspex,danwalmsley/Perspex,jkoritzinsky/Avalonia,jazzay/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,kekekeks/Perspex,grokys/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,OronDF343/Avalonia,akrisiun/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,susloparovdenis/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,MrDaedra/Avalonia,tshcherban/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,susloparovdenis/Perspex,jkoritzinsky/Avalonia,susloparovdenis/Perspex,wieslawsoltes/Perspex
|
1a1f8b223500d5186b962fc94abbeab1d8441c9e
|
Torch.Mod/TorchModCore.cs
|
Torch.Mod/TorchModCore.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sandbox.ModAPI;
using VRage.Game.Components;
namespace Torch.Mod
{
[MySessionComponentDescriptor(MyUpdateOrder.AfterSimulation)]
public class TorchModCore : MySessionComponentBase
{
public const ulong MOD_ID = 1406994352;
private static bool _init;
public static bool Debug;
public override void UpdateAfterSimulation()
{
if (_init)
return;
_init = true;
ModCommunication.Register();
MyAPIGateway.Utilities.MessageEntered += Utilities_MessageEntered;
}
private void Utilities_MessageEntered(string messageText, ref bool sendToOthers)
{
if (messageText == "@!debug")
{
Debug = !Debug;
MyAPIGateway.Utilities.ShowMessage("Torch", $"Debug: {Debug}");
sendToOthers = false;
}
}
protected override void UnloadData()
{
try
{
ModCommunication.Unregister();
}
catch
{
//session unloading, don't care
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sandbox.ModAPI;
using VRage.Game.Components;
namespace Torch.Mod
{
[MySessionComponentDescriptor(MyUpdateOrder.AfterSimulation)]
public class TorchModCore : MySessionComponentBase
{
public const ulong MOD_ID = 1406994352;
private static bool _init;
public static bool Debug;
public override void UpdateAfterSimulation()
{
if (_init)
return;
_init = true;
ModCommunication.Register();
MyAPIGateway.Utilities.MessageEntered += Utilities_MessageEntered;
}
private void Utilities_MessageEntered(string messageText, ref bool sendToOthers)
{
if (messageText == "@!debug")
{
Debug = !Debug;
MyAPIGateway.Utilities.ShowMessage("Torch", $"Debug: {Debug}");
sendToOthers = false;
}
}
protected override void UnloadData()
{
try
{
MyAPIGateway.Utilities.MessageEntered -= Utilities_MessageEntered;
ModCommunication.Unregister();
}
catch
{
//session unloading, don't care
}
}
}
}
|
Fix dumb in torch mod
|
Fix dumb in torch mod
|
C#
|
apache-2.0
|
TorchAPI/Torch
|
9bf70e4e97ed84c95bb5d19eb4e7cf59391f7e8c
|
osu.Game.Tests/Visual/Gameplay/TestSceneStarCounter.cs
|
osu.Game.Tests/Visual/Gameplay/TestSceneStarCounter.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 NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Utils;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osuTK;
namespace osu.Game.Tests.Visual.Gameplay
{
[TestFixture]
public class TestSceneStarCounter : OsuTestScene
{
private readonly StarCounter starCounter;
private readonly OsuSpriteText starsLabel;
public TestSceneStarCounter()
{
starCounter = new StarCounter
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
};
Add(starCounter);
starsLabel = new OsuSpriteText
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Scale = new Vector2(2),
Y = 50,
};
Add(starsLabel);
setStars(5);
AddRepeatStep("random value", () => setStars(RNG.NextSingle() * (starCounter.StarCount + 1)), 10);
AddStep("stop animation", () => starCounter.StopAnimation());
AddStep("reset", () => setStars(0));
}
private void setStars(float stars)
{
starCounter.Current = stars;
starsLabel.Text = starCounter.Current.ToString("0.00");
}
}
}
|
// 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 NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Utils;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osuTK;
namespace osu.Game.Tests.Visual.Gameplay
{
[TestFixture]
public class TestSceneStarCounter : OsuTestScene
{
private readonly StarCounter starCounter;
private readonly OsuSpriteText starsLabel;
public TestSceneStarCounter()
{
starCounter = new StarCounter
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
};
Add(starCounter);
starsLabel = new OsuSpriteText
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Scale = new Vector2(2),
Y = 50,
};
Add(starsLabel);
setStars(5);
AddRepeatStep("random value", () => setStars(RNG.NextSingle() * (starCounter.StarCount + 1)), 10);
AddSliderStep("exact value", 0f, 10f, 5f, setStars);
AddStep("stop animation", () => starCounter.StopAnimation());
AddStep("reset", () => setStars(0));
}
private void setStars(float stars)
{
starCounter.Current = stars;
starsLabel.Text = starCounter.Current.ToString("0.00");
}
}
}
|
Add slider test step for visual inspection purposes
|
Add slider test step for visual inspection purposes
|
C#
|
mit
|
smoogipoo/osu,NeoAdonis/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu
|
ecbf4c95a72bb2ac844e1200f8af8692a78514b7
|
Toxy/Common/Winmm.cs
|
Toxy/Common/Winmm.cs
|
using System;
using System.Runtime.InteropServices;
using System.Resources;
using System.IO;
namespace Win32
{
public static class Winmm
{
public static void PlayMessageNotify()
{
if (_soundData == null)
{
using (UnmanagedMemoryStream sound = Toxy.Properties.Resources.Blop)
{
_soundData = new byte[sound.Length];
sound.Read(_soundData, 0, (int)sound.Length);
}
}
PlaySound(_soundData, IntPtr.Zero, SND_ASYNC | SND_MEMORY);
}
private static byte[] _soundData;
private const UInt32 SND_ASYNC = 1;
private const UInt32 SND_MEMORY = 4;
[DllImport("Winmm.dll")]
private static extern bool PlaySound(byte[] data, IntPtr hMod, UInt32 dwFlags);
}
}
|
using System;
using System.Runtime.InteropServices;
using System.Resources;
using System.IO;
namespace Win32
{
public static class Winmm
{
public static void PlayMessageNotify()
{
if (_soundData == null)
{
using (UnmanagedMemoryStream sound = Toxy.Properties.Resources.Blop)
{
_soundData = new byte[sound.Length];
sound.Read(_soundData, 0, (int)sound.Length);
}
}
if (_soundData != null)
{
PlaySound(_soundData, IntPtr.Zero, SND_ASYNC | SND_MEMORY);
}
}
private static byte[] _soundData;
private const UInt32 SND_ASYNC = 1;
private const UInt32 SND_MEMORY = 4;
[DllImport("Winmm.dll")]
private static extern bool PlaySound(byte[] data, IntPtr hMod, UInt32 dwFlags);
}
}
|
Check if _soundData is null before attempting to play the sound
|
Check if _soundData is null before attempting to play the sound
|
C#
|
mit
|
TimBo93/Toxy,Umriyaev/Toxy,Reverp/Toxy,Reverp/Toxy
|
3b9afd7ce4881f53dffcd4ad2b85b5f5061b9ee1
|
src/Arkivverket.Arkade/Metadata/MetsTranslationHelper.cs
|
src/Arkivverket.Arkade/Metadata/MetsTranslationHelper.cs
|
using System;
namespace Arkivverket.Arkade.Metadata
{
public static class MetsTranslationHelper
{
public static bool IsValidSystemType(string systemType)
{
// TODO: Use Enum ExternalModels.Mets.type (not ExternalModels.Info.type) when/if supported in built in mets schema
return Enum.IsDefined(typeof(ExternalModels.Info.type), systemType);
}
public static bool IsSystemTypeNoark5(string systemType)
{
// TODO: Use Enum ExternalModels.Mets.type (not ExternalModels.Info.type) when/if supported in built in mets schema
ExternalModels.Info.type enumSystemType;
bool isParsableSystemType = Enum.TryParse(systemType, out enumSystemType);
return isParsableSystemType && enumSystemType == ExternalModels.Info.type.Noark5;
}
}
}
|
using System;
using Arkivverket.Arkade.Core;
namespace Arkivverket.Arkade.Metadata
{
public static class MetsTranslationHelper
{
public static bool IsValidSystemType(string systemType)
{
return Enum.IsDefined(typeof(ArchiveType), systemType);
}
public static bool IsSystemTypeNoark5(string systemType)
{
ArchiveType archiveType;
bool isParsableSystemType = Enum.TryParse(systemType, out archiveType);
return isParsableSystemType && archiveType == ArchiveType.Noark5;
}
}
}
|
Use local definition of ArchiveTypes to validate metadata systemtypes
|
Use local definition of ArchiveTypes to validate metadata systemtypes
|
C#
|
agpl-3.0
|
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
|
9c39f4ba4061fae4e061d35c6f701e663308de23
|
PS.Mothership.Core/PS.Mothership.Core.Common/Contracts/IDiallerService.cs
|
PS.Mothership.Core/PS.Mothership.Core.Common/Contracts/IDiallerService.cs
|
using System;
using System.Collections.Generic;
using System.ServiceModel;
using PS.Mothership.Core.Common.Dto;
namespace PS.Mothership.Core.Common.Contracts
{
[ServiceContract(Name = "DiallerService")]
public interface IDiallerService
{
[OperationContract]
ValidUserInfoDto ValidateUser(Guid userGuid, Guid mothershipSessionGuid);
[OperationContract]
Guid LogDiallerSessionSubscribe(DiallerSessionSubscribeDto diallerSessionSubscribe);
[OperationContract]
Guid LogDiallerSessionUnsubscribe(DiallerSessionUnsubscribeDto diallerSessionUnsubscribe);
[OperationContract]
SipAccountDetailsDto GetSipAccountDetails(Guid userGuid);
[OperationContract(IsOneWay = true)]
List<InboundQueueDetailsDto> GetInboundQueueDetails();
[OperationContract(IsOneWay = true)]
List<MissingCallRecordingsDto> GetMissingCallRecordings(DateTime dateStart, DateTime dateEnd);
[OperationContract]
void UpdateRecorderCallIdForCallGuid(Guid callGuid, int recorderCallId, Guid userGuid);
}
}
|
using System;
using System.Collections.Generic;
using System.ServiceModel;
using PS.Mothership.Core.Common.Dto;
namespace PS.Mothership.Core.Common.Contracts
{
[ServiceContract(Name = "DiallerService")]
public interface IDiallerService
{
[OperationContract]
ValidUserInfoDto ValidateUser(Guid mothershipSessionGuid);
[OperationContract]
Guid LogDiallerSessionSubscribe(DiallerSessionSubscribeDto diallerSessionSubscribe);
[OperationContract]
Guid LogDiallerSessionUnsubscribe(DiallerSessionUnsubscribeDto diallerSessionUnsubscribe);
[OperationContract]
SipAccountDetailsDto GetSipAccountDetails(Guid userGuid);
[OperationContract(IsOneWay = true)]
List<InboundQueueDetailsDto> GetInboundQueueDetails();
[OperationContract(IsOneWay = true)]
List<MissingCallRecordingsDto> GetMissingCallRecordings(DateTime dateStart, DateTime dateEnd);
[OperationContract]
void UpdateRecorderCallIdForCallGuid(Guid callGuid, int recorderCallId, Guid userGuid);
}
}
|
Remove userGuid on ValidateUser method
|
Remove userGuid on ValidateUser method
git-svn-id: 0f264f6d45e0d91283c3b90d5150277c66769c5f@230 0f896bb5-3ab0-2d4e-82a7-85ef10020915
|
C#
|
mit
|
Paymentsense/Dapper.SimpleSave
|
575b3b8b8f58f5525968abd16ff407181c62ac27
|
src/Elders.Cronus/MessageProcessing/DynamicMessageHandle.cs
|
src/Elders.Cronus/MessageProcessing/DynamicMessageHandle.cs
|
using Elders.Cronus.Workflow;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.IO;
using System.Threading.Tasks;
namespace Elders.Cronus.MessageProcessing
{
/// <summary>
/// Work-flow which gets an object from the passed context and calls a method 'Handle' passing execution.Context.Message'
/// <see cref="HandlerContext"/> should have 'HandlerInstance' and 'Message' already set
/// </summary>
public class DynamicMessageHandle : Workflow<HandlerContext>
{
protected override Task RunAsync(Execution<HandlerContext> execution)
{
dynamic handler = execution.Context.HandlerInstance;
return handler.HandleAsync((dynamic)execution.Context.Message);
}
}
public class LogExceptionOnHandleError : Workflow<ErrorContext>
{
private static readonly ILogger logger = CronusLogger.CreateLogger(typeof(LogExceptionOnHandleError));
protected override async Task RunAsync(Execution<ErrorContext> execution)
{
var serializer = execution.Context.ServiceProvider.GetRequiredService<ISerializer>();
string messageContent = await MessageAsStringAsync(serializer, execution.Context.Message).ConfigureAwait(false);
logger.ErrorException(execution.Context.Error, () => $"There was an error in {execution.Context.HandlerType.Name} while handling message {messageContent}");
}
private Task<string> MessageAsStringAsync(ISerializer serializer, CronusMessage message)
{
using (var stream = new MemoryStream())
using (StreamReader reader = new StreamReader(stream))
{
serializer.Serialize(stream, message);
stream.Position = 0;
return reader.ReadToEndAsync();
}
}
}
}
|
using Elders.Cronus.Workflow;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.IO;
using System.Threading.Tasks;
namespace Elders.Cronus.MessageProcessing
{
/// <summary>
/// Work-flow which gets an object from the passed context and calls a method 'Handle' passing execution.Context.Message'
/// <see cref="HandlerContext"/> should have 'HandlerInstance' and 'Message' already set
/// </summary>
public class DynamicMessageHandle : Workflow<HandlerContext>
{
protected override async Task RunAsync(Execution<HandlerContext> execution)
{
dynamic handler = execution.Context.HandlerInstance;
await handler.HandleAsync((dynamic)execution.Context.Message);
}
}
public class LogExceptionOnHandleError : Workflow<ErrorContext>
{
private static readonly ILogger logger = CronusLogger.CreateLogger(typeof(LogExceptionOnHandleError));
protected override Task RunAsync(Execution<ErrorContext> execution)
{
var serializer = execution.Context.ServiceProvider.GetRequiredService<ISerializer>();
logger.ErrorException(execution.Context.Error, () => $"There was an error in {execution.Context.HandlerType.Name} while handling message {MessageAsString(serializer, execution.Context.Message)}");
return Task.CompletedTask;
}
private string MessageAsString(ISerializer serializer, CronusMessage message)
{
using (var stream = new MemoryStream())
using (StreamReader reader = new StreamReader(stream))
{
serializer.Serialize(stream, message);
stream.Position = 0;
return reader.ReadToEnd();
}
}
}
}
|
Revert "fix: Uses async to log an error message"
|
Revert "fix: Uses async to log an error message"
This reverts commit f1583924af8af681f8fca81ed13973996ec2b937.
|
C#
|
apache-2.0
|
Elders/Cronus,Elders/Cronus
|
5605759c826b1475e68b14115ccbba9cfd87bfd8
|
src/GiveCRM.Web/Views/Donation/DonationList.cshtml
|
src/GiveCRM.Web/Views/Donation/DonationList.cshtml
|
@model IEnumerable<GiveCRM.Models.Donation>
@{
Layout = null;
}
<table>
<tr>
<th>Date</th><th>Amount</th>
</tr>
@foreach (var donation in Model)
{
<tr>
<td>@donation.Date.ToLongDateString()</td>
<td>@donation.Amount</td>
</tr>
}
</table>
|
@using System.Globalization
@model IEnumerable<GiveCRM.Models.Donation>
@{
Layout = null;
}
<table>
<tr>
<th>Date</th><th>Amount</th>
</tr>
@foreach (var donation in Model)
{
<tr>
<td>@donation.Date.ToLongDateString()</td>
<td>@donation.Amount.ToString("C2", NumberFormatInfo.CurrentInfo)</td>
</tr>
}
</table>
|
Fix a niggle from the wiki: display donation amounts to two decimal places. Also format them as a currency, and respect the current culture.
|
Fix a niggle from the wiki: display donation amounts to two decimal places. Also format them as a currency, and respect the current culture.
|
C#
|
mit
|
GiveCampUK/GiveCRM,GiveCampUK/GiveCRM
|
637bc0f7afdfc29d4878f3a93a17ea5e1420e01e
|
src/System.ObjectModel/tests/KeyedCollection/Serialization.netstandard.cs
|
src/System.ObjectModel/tests/KeyedCollection/Serialization.netstandard.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.Generic;
using System.Runtime.Serialization.Formatters.Tests;
using Xunit;
namespace System.Collections.ObjectModel.Tests
{
public partial class KeyedCollection_Serialization
{
public static IEnumerable<object[]> SerializeDeserialize_Roundtrips_MemberData()
{
yield return new object[] { new TestCollection() };
yield return new object[] { new TestCollection() { "hello" } };
yield return new object[] { new TestCollection() { "hello", "world" } };
}
[ActiveIssue("https://github.com/dotnet/coreclr/pull/7966")]
[Theory]
[MemberData(nameof(SerializeDeserialize_Roundtrips_MemberData))]
public void SerializeDeserialize_Roundtrips(TestCollection c)
{
TestCollection clone = BinaryFormatterHelpers.Clone(c);
Assert.NotSame(c, clone);
Assert.Equal(c, clone);
}
[Serializable]
public sealed class TestCollection : KeyedCollection<string, string>
{
protected override string GetKeyForItem(string item) => item;
}
}
}
|
// 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.Generic;
using System.Runtime.Serialization.Formatters.Tests;
using Xunit;
namespace System.Collections.ObjectModel.Tests
{
public partial class KeyedCollection_Serialization
{
public static IEnumerable<object[]> SerializeDeserialize_Roundtrips_MemberData()
{
yield return new object[] { new TestCollection() };
yield return new object[] { new TestCollection() { "hello" } };
yield return new object[] { new TestCollection() { "hello", "world" } };
}
[Theory]
[MemberData(nameof(SerializeDeserialize_Roundtrips_MemberData))]
public void SerializeDeserialize_Roundtrips(TestCollection c)
{
TestCollection clone = BinaryFormatterHelpers.Clone(c);
Assert.NotSame(c, clone);
Assert.Equal(c, clone);
}
[Serializable]
public sealed class TestCollection : KeyedCollection<string, string>
{
protected override string GetKeyForItem(string item) => item;
}
}
}
|
Remove CoreCLR pull 6423, run msbuild System.ObjectModel.Tests.csproj /t:BuildAndTest, succeeded.
|
Remove CoreCLR pull 6423, run msbuild System.ObjectModel.Tests.csproj /t:BuildAndTest, succeeded.
|
C#
|
mit
|
wtgodbe/corefx,nchikanov/corefx,the-dwyer/corefx,Petermarcu/corefx,tijoytom/corefx,wtgodbe/corefx,tijoytom/corefx,rjxby/corefx,weltkante/corefx,rubo/corefx,nbarbettini/corefx,JosephTremoulet/corefx,rahku/corefx,billwert/corefx,Ermiar/corefx,axelheer/corefx,fgreinacher/corefx,DnlHarvey/corefx,krk/corefx,rahku/corefx,stephenmichaelf/corefx,stone-li/corefx,ericstj/corefx,Ermiar/corefx,jlin177/corefx,krytarowski/corefx,dhoehna/corefx,elijah6/corefx,nbarbettini/corefx,Jiayili1/corefx,mazong1123/corefx,zhenlan/corefx,ViktorHofer/corefx,YoupHulsebos/corefx,ravimeda/corefx,rjxby/corefx,rjxby/corefx,stone-li/corefx,mmitche/corefx,billwert/corefx,parjong/corefx,marksmeltzer/corefx,billwert/corefx,ravimeda/corefx,cydhaselton/corefx,krk/corefx,cydhaselton/corefx,YoupHulsebos/corefx,jlin177/corefx,krytarowski/corefx,marksmeltzer/corefx,rahku/corefx,yizhang82/corefx,Jiayili1/corefx,marksmeltzer/corefx,Petermarcu/corefx,krytarowski/corefx,dotnet-bot/corefx,elijah6/corefx,krytarowski/corefx,tijoytom/corefx,the-dwyer/corefx,billwert/corefx,alexperovich/corefx,parjong/corefx,richlander/corefx,Ermiar/corefx,axelheer/corefx,wtgodbe/corefx,fgreinacher/corefx,wtgodbe/corefx,richlander/corefx,ericstj/corefx,wtgodbe/corefx,dhoehna/corefx,twsouthwick/corefx,nbarbettini/corefx,weltkante/corefx,nchikanov/corefx,DnlHarvey/corefx,MaggieTsang/corefx,ViktorHofer/corefx,DnlHarvey/corefx,Ermiar/corefx,richlander/corefx,nbarbettini/corefx,axelheer/corefx,ravimeda/corefx,elijah6/corefx,fgreinacher/corefx,MaggieTsang/corefx,MaggieTsang/corefx,weltkante/corefx,zhenlan/corefx,stephenmichaelf/corefx,MaggieTsang/corefx,cydhaselton/corefx,yizhang82/corefx,parjong/corefx,billwert/corefx,mmitche/corefx,marksmeltzer/corefx,dotnet-bot/corefx,Jiayili1/corefx,dhoehna/corefx,Petermarcu/corefx,DnlHarvey/corefx,nbarbettini/corefx,jlin177/corefx,ptoonen/corefx,gkhanna79/corefx,weltkante/corefx,twsouthwick/corefx,alexperovich/corefx,stephenmichaelf/corefx,ravimeda/corefx,zhenlan/corefx,ptoonen/corefx,Petermarcu/corefx,seanshpark/corefx,ravimeda/corefx,rubo/corefx,mmitche/corefx,jlin177/corefx,marksmeltzer/corefx,ptoonen/corefx,elijah6/corefx,seanshpark/corefx,twsouthwick/corefx,ptoonen/corefx,krytarowski/corefx,gkhanna79/corefx,Jiayili1/corefx,Ermiar/corefx,mazong1123/corefx,ViktorHofer/corefx,rahku/corefx,ViktorHofer/corefx,shimingsg/corefx,dotnet-bot/corefx,the-dwyer/corefx,stone-li/corefx,Jiayili1/corefx,rahku/corefx,MaggieTsang/corefx,nbarbettini/corefx,twsouthwick/corefx,richlander/corefx,axelheer/corefx,cydhaselton/corefx,mmitche/corefx,tijoytom/corefx,krk/corefx,richlander/corefx,dhoehna/corefx,dotnet-bot/corefx,shimingsg/corefx,krk/corefx,krk/corefx,tijoytom/corefx,ravimeda/corefx,ericstj/corefx,parjong/corefx,parjong/corefx,nchikanov/corefx,zhenlan/corefx,YoupHulsebos/corefx,dotnet-bot/corefx,gkhanna79/corefx,mmitche/corefx,ptoonen/corefx,YoupHulsebos/corefx,jlin177/corefx,ericstj/corefx,alexperovich/corefx,wtgodbe/corefx,nbarbettini/corefx,stephenmichaelf/corefx,alexperovich/corefx,gkhanna79/corefx,JosephTremoulet/corefx,ravimeda/corefx,ericstj/corefx,JosephTremoulet/corefx,Petermarcu/corefx,cydhaselton/corefx,the-dwyer/corefx,mazong1123/corefx,yizhang82/corefx,rubo/corefx,zhenlan/corefx,krytarowski/corefx,dotnet-bot/corefx,rubo/corefx,dhoehna/corefx,cydhaselton/corefx,shimingsg/corefx,weltkante/corefx,gkhanna79/corefx,cydhaselton/corefx,billwert/corefx,weltkante/corefx,ericstj/corefx,twsouthwick/corefx,BrennanConroy/corefx,DnlHarvey/corefx,nchikanov/corefx,stone-li/corefx,yizhang82/corefx,MaggieTsang/corefx,Jiayili1/corefx,seanshpark/corefx,alexperovich/corefx,seanshpark/corefx,ptoonen/corefx,JosephTremoulet/corefx,stone-li/corefx,shimingsg/corefx,MaggieTsang/corefx,ViktorHofer/corefx,gkhanna79/corefx,nchikanov/corefx,YoupHulsebos/corefx,jlin177/corefx,krk/corefx,YoupHulsebos/corefx,mazong1123/corefx,stone-li/corefx,BrennanConroy/corefx,rubo/corefx,stone-li/corefx,zhenlan/corefx,rahku/corefx,rjxby/corefx,richlander/corefx,krk/corefx,Petermarcu/corefx,axelheer/corefx,stephenmichaelf/corefx,parjong/corefx,Ermiar/corefx,yizhang82/corefx,nchikanov/corefx,ViktorHofer/corefx,mazong1123/corefx,parjong/corefx,weltkante/corefx,DnlHarvey/corefx,alexperovich/corefx,nchikanov/corefx,zhenlan/corefx,JosephTremoulet/corefx,dhoehna/corefx,DnlHarvey/corefx,gkhanna79/corefx,seanshpark/corefx,stephenmichaelf/corefx,ViktorHofer/corefx,tijoytom/corefx,stephenmichaelf/corefx,twsouthwick/corefx,the-dwyer/corefx,rjxby/corefx,mazong1123/corefx,elijah6/corefx,elijah6/corefx,marksmeltzer/corefx,Petermarcu/corefx,yizhang82/corefx,shimingsg/corefx,jlin177/corefx,Jiayili1/corefx,JosephTremoulet/corefx,the-dwyer/corefx,tijoytom/corefx,wtgodbe/corefx,richlander/corefx,YoupHulsebos/corefx,mmitche/corefx,rahku/corefx,alexperovich/corefx,dotnet-bot/corefx,Ermiar/corefx,ptoonen/corefx,elijah6/corefx,twsouthwick/corefx,mazong1123/corefx,shimingsg/corefx,rjxby/corefx,dhoehna/corefx,rjxby/corefx,marksmeltzer/corefx,ericstj/corefx,yizhang82/corefx,BrennanConroy/corefx,the-dwyer/corefx,fgreinacher/corefx,krytarowski/corefx,JosephTremoulet/corefx,shimingsg/corefx,seanshpark/corefx,mmitche/corefx,billwert/corefx,seanshpark/corefx,axelheer/corefx
|
8cdf95c349b851c8709e50464b4a4c3f63c3b198
|
Contentful.Core/Models/Asset.cs
|
Contentful.Core/Models/Asset.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Contentful.Core.Models
{
/// <summary>
/// Represents a single asset of a <see cref="Space"/>.
/// </summary>
public class Asset : IContentfulResource
{
/// <summary>
/// Common system managed metadata properties.
/// </summary>
[JsonProperty("sys")]
public SystemProperties SystemProperties { get; set; }
/// <summary>
/// The description of the asset.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The title of the asset.
/// </summary>
public string Title { get; set; }
/// <summary>
/// Encapsulates information about the binary file of the asset.
/// </summary>
public File File { get; set; }
/// <summary>
/// The titles of the asset per locale.
/// </summary>
public Dictionary<string, string> TitleLocalized { get; set; }
/// <summary>
/// The descriptions of the asset per locale.
/// </summary>
public Dictionary<string, string> DescriptionLocalized { get; set; }
/// <summary>
/// Information about the file in respective language.
/// </summary>
[JsonProperty("file")]
public Dictionary<string, File> FilesLocalized { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Contentful.Core.Models
{
/// <summary>
/// Represents a single asset of a <see cref="Space"/>.
/// </summary>
public class Asset : IContentfulResource
{
/// <summary>
/// Common system managed metadata properties.
/// </summary>
[JsonProperty("sys")]
public SystemProperties SystemProperties { get; set; }
/// <summary>
/// The description of the asset.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The title of the asset.
/// </summary>
public string Title { get; set; }
/// <summary>
/// Encapsulates information about the binary file of the asset.
/// </summary>
public File File { get; set; }
/// <summary>
/// The titles of the asset per locale.
/// </summary>
public Dictionary<string, string> TitleLocalized { get; set; }
/// <summary>
/// The descriptions of the asset per locale.
/// </summary>
public Dictionary<string, string> DescriptionLocalized { get; set; }
/// <summary>
/// Information about the file in respective language.
/// </summary>
public Dictionary<string, File> FilesLocalized { get; set; }
}
}
|
Remove JsonProperty Mapping for "file"
|
Remove JsonProperty Mapping for "file"
This is an inconsistency as you either have all the fields mapped to the localized models like the following:
```
public class Asset : IContentfulResource
{
/// <summary>
/// Common system managed metadata properties.
/// </summary>
[JsonProperty("sys")]
public SystemProperties SystemProperties { get; set; }
/// <summary>
/// The description of the asset.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The title of the asset.
/// </summary>
public string Title { get; set; }
/// <summary>
/// Encapsulates information about the binary file of the asset.
/// </summary>
public File File { get; set; }
/// <summary>
/// The titles of the asset per locale.
/// </summary>
[JsonProperty("title")]
public Dictionary<string, string> TitleLocalized { get; set; }
/// <summary>
/// The descriptions of the asset per locale.
/// </summary>
[JsonProperty("description")]
public Dictionary<string, string> DescriptionLocalized { get; set; }
/// <summary>
/// Information about the file in respective language.
/// </summary>
[JsonProperty("file")]
public Dictionary<string, File> FilesLocalized { get; set; }
}
```
As currently only file is mapped to the localization property which is not really consistent.
|
C#
|
mit
|
contentful/contentful.net
|
480cdb2a5643c2892b9c294958be08bea30a615a
|
src/CypherTwo.Core/NeoClient.cs
|
src/CypherTwo.Core/NeoClient.cs
|
namespace CypherTwo.Core
{
using System;
using System.Linq;
using System.Threading.Tasks;
public class NeoClient : INeoClient
{
private readonly ISendRestCommandsToNeo neoApi;
public NeoClient(string baseUrl) : this(new ApiClientFactory(baseUrl, new JsonHttpClientWrapper()))
{
}
internal NeoClient(ISendRestCommandsToNeo neoApi)
{
this.neoApi = neoApi;
}
public async Task InitialiseAsync()
{
try
{
await this.neoApi.LoadServiceRootAsync();
}
catch (Exception ex)
{
throw new InvalidOperationException(ex.Message);
}
}
public async Task<ICypherDataReader> QueryAsync(string cypher)
{
var neoResponse = await this.neoApi.SendCommandAsync(cypher);
if (neoResponse.errors != null && neoResponse.errors.Any())
{
throw new Exception(string.Join(Environment.NewLine, neoResponse.errors.Select(error => error.ToObject<string>())));
}
return new CypherDataReader(neoResponse);
}
public async Task ExecuteAsync(string cypher)
{
await this.neoApi.SendCommandAsync(cypher);
}
}
}
|
namespace CypherTwo.Core
{
using System;
using System.Linq;
using System.Threading.Tasks;
public class NeoClient : INeoClient
{
private readonly ISendRestCommandsToNeo neoApi;
public NeoClient(string baseUrl) : this(new ApiClientFactory(baseUrl, new JsonHttpClientWrapper()))
{
}
internal NeoClient(ISendRestCommandsToNeo neoApi)
{
this.neoApi = neoApi;
}
public async Task InitialiseAsync()
{
try
{
await this.neoApi.LoadServiceRootAsync();
}
catch (Exception ex)
{
throw new InvalidOperationException(ex.Message);
}
}
public async Task<ICypherDataReader> QueryAsync(string cypher)
{
var neoResponse = await this.ExecuteCore(cypher);
return new CypherDataReader(neoResponse);
}
public async Task ExecuteAsync(string cypher)
{
await this.ExecuteCore(cypher);
}
private async Task<NeoResponse> ExecuteCore(string cypher)
{
var neoResponse = await this.neoApi.SendCommandAsync(cypher);
if (neoResponse.errors != null && neoResponse.errors.Any())
{
throw new Exception(string.Join(Environment.NewLine, neoResponse.errors.Select(error => error.ToObject<string>())));
}
return neoResponse;
}
}
}
|
Add throw error on Neo exception in ExecuteCore
|
Add throw error on Neo exception in ExecuteCore
|
C#
|
mit
|
mikehancock/CypherNetCore
|
772c6f066ac565ae98941a1c67371ab7a9fbb57f
|
hangman.cs
|
hangman.cs
|
using System;
namespace Hangman {
public class Hangman {
public static void Main(string[] args) {
Table table = new Table(2, 3);
string output = table.Draw();
Console.WriteLine(output);
}
}
}
|
using System;
namespace Hangman {
public class Hangman {
public static void Main(string[] args) {
// Table table = new Table(2, 3);
// string output = table.Draw();
// Console.WriteLine(output);
}
}
}
|
Comment out the code in Hangman that uses Table
|
Comment out the code in Hangman that uses Table
To focus on the development of game logic
|
C#
|
unlicense
|
12joan/hangman
|
dbe048cdc6b6d893e92109d50fd3fa5732fa294c
|
osu.Game/Online/RealtimeMultiplayer/ISpectatorClient.cs
|
osu.Game/Online/RealtimeMultiplayer/ISpectatorClient.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading.Tasks;
namespace osu.Game.Online.RealtimeMultiplayer
{
/// <summary>
/// An interface defining a spectator client instance.
/// </summary>
public interface IMultiplayerClient
{
/// <summary>
/// Signals that the room has changed state.
/// </summary>
/// <param name="state">The state of the room.</param>
Task RoomStateChanged(MultiplayerRoomState state);
/// <summary>
/// Signals that a user has joined the room.
/// </summary>
/// <param name="user">The user.</param>
Task UserJoined(MultiplayerRoomUser user);
/// <summary>
/// Signals that a user has left the room.
/// </summary>
/// <param name="user">The user.</param>
Task UserLeft(MultiplayerRoomUser user);
/// <summary>
/// Signals that the settings for this room have changed.
/// </summary>
/// <param name="newSettings">The updated room settings.</param>
Task SettingsChanged(MultiplayerRoomSettings newSettings);
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading.Tasks;
namespace osu.Game.Online.RealtimeMultiplayer
{
/// <summary>
/// An interface defining a spectator client instance.
/// </summary>
public interface IMultiplayerClient
{
/// <summary>
/// Signals that the room has changed state.
/// </summary>
/// <param name="state">The state of the room.</param>
Task RoomStateChanged(MultiplayerRoomState state);
/// <summary>
/// Signals that a user has joined the room.
/// </summary>
/// <param name="user">The user.</param>
Task UserJoined(MultiplayerRoomUser user);
/// <summary>
/// Signals that a user has left the room.
/// </summary>
/// <param name="user">The user.</param>
Task UserLeft(MultiplayerRoomUser user);
/// <summary>
/// Signal that the host of the room has changed.
/// </summary>
/// <param name="userId">The user ID of the new host.</param>
Task HostChanged(long userId);
/// <summary>
/// Signals that the settings for this room have changed.
/// </summary>
/// <param name="newSettings">The updated room settings.</param>
Task SettingsChanged(MultiplayerRoomSettings newSettings);
}
}
|
Add client method for notifying about host changes
|
Add client method for notifying about host changes
|
C#
|
mit
|
NeoAdonis/osu,ppy/osu,smoogipooo/osu,peppy/osu-new,peppy/osu,ppy/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu
|
6675f9dffbf32d9df2a2100973d7c3324a605a5e
|
HeartBeat.cs
|
HeartBeat.cs
|
using System;
using System.Threading;
using Microsoft.SPOT;
namespace AgentIntervals
{
public delegate void HeartBeatEventHandler(object sender, EventArgs e);
public class HeartBeat
{
private Timer _timer;
private int _period;
public event HeartBeatEventHandler OnHeartBeat;
public HeartBeat(int period)
{
_period = period;
}
private void TimerCallback(object state)
{
if (OnHeartBeat != null)
{
OnHeartBeat(this, new EventArgs());
}
}
public void Start(int delay)
{
if (_timer != null) return;
_timer = new Timer(TimerCallback, null, delay, _period);
}
public void Stop()
{
if (_timer == null) return;
_timer.Dispose();
_timer = null;
}
public bool Toggle(int delay)
{
bool started;
if (_timer == null)
{
Start(delay);
started = true;
}
else
{
Stop();
started = false;
}
return started;
}
public void Reset()
{
Stop();
Start(0);
}
public void ChangePeriod(int newPeriod)
{
_period = newPeriod;
}
}
}
|
using System;
using System.Threading;
using Microsoft.SPOT;
namespace AgentIntervals
{
public delegate void HeartBeatEventHandler(object sender, EventArgs e);
public class HeartBeat
{
private Timer _timer;
private int _period;
public event HeartBeatEventHandler OnHeartBeat;
public HeartBeat(int period)
{
_period = period;
}
private void TimerCallback(object state)
{
if (OnHeartBeat != null)
{
OnHeartBeat(this, new EventArgs());
}
}
public void Start()
{
Start(0);
}
public void Start(int delay)
{
if (_timer != null) return;
_timer = new Timer(TimerCallback, null, delay, _period);
}
public void Stop()
{
if (_timer == null) return;
_timer.Dispose();
_timer = null;
}
public bool Toggle()
{
return Toggle(0);
}
public bool Toggle(int delay)
{
bool started;
if (_timer == null)
{
Start(delay);
started = true;
}
else
{
Stop();
started = false;
}
return started;
}
public void Reset()
{
Reset(0);
}
public void Reset(int delay)
{
Stop();
Start(delay);
}
public void ChangePeriod(int newPeriod)
{
_period = newPeriod;
}
}
}
|
Add parameter-less defaults for Start, Toggle, Reset.
|
Add parameter-less defaults for Start, Toggle, Reset.
|
C#
|
mit
|
jcheng31/AgentIntervals
|
93b06dcbb3d0355ed355754fab316fdf3612b15f
|
FibCSharp/Program.cs
|
FibCSharp/Program.cs
|
using System;
using System.Linq;
namespace FibCSharp
{
class Program
{
static void Main(string[] args)
{
var max = 50;
Enumerable.Range(0, int.MaxValue)
.Select(Fib)
.TakeWhile(x => x <= 50)
.ToList()
.ForEach(Console.WriteLine);
}
static int Fib(int arg) =>
arg == 0 ? 0
: arg == 1 ? 1
: Fib(arg - 2) + Fib(arg - 1);
}
}
|
using System;
using System.Linq;
namespace FibCSharp
{
class Program
{
static void Main(string[] args)
{
var max = 50;
Enumerable.Range(0, int.MaxValue)
.Select(Fib)
.TakeWhile(x => x <= max)
.ToList()
.ForEach(Console.WriteLine);
}
static int Fib(int arg) =>
arg == 0 ? 0
: arg == 1 ? 1
: Fib(arg - 2) + Fib(arg - 1);
}
}
|
Use the defined max value
|
Use the defined max value
|
C#
|
unlicense
|
treymack/fibonacci
|
e3ddeec491dfc5944d4329444336ae84e8264b0e
|
IvionSoft/History.cs
|
IvionSoft/History.cs
|
using System;
using System.Collections.Generic;
namespace IvionSoft
{
public class History<T>
{
int length;
HashSet<T> hashes;
Queue<T> queue;
object _locker;
public History(int length)
{
if (length < 1)
throw new ArgumentException("Must be 1 or larger", "length");
this.length = length;
hashes = new HashSet<T>();
queue = new Queue<T>(length + 1);
_locker = new object();
}
public bool Contains(T item)
{
return hashes.Contains(item);
}
public bool Add(T item)
{
bool added;
lock (_locker)
{
added = hashes.Add(item);
if (added)
{
queue.Enqueue(item);
if (queue.Count > length)
{
T toRemove = queue.Dequeue();
hashes.Remove(toRemove);
}
}
}
return added;
}
}
}
|
using System;
using System.Collections.Generic;
namespace IvionSoft
{
public class History<T>
{
public int Length { get; private set; }
HashSet<T> hashes;
Queue<T> queue;
object _locker = new object();
public History(int length) : this(length, null)
{}
public History(int length, IEqualityComparer<T> comparer)
{
if (length < 1)
throw new ArgumentException("Must be 1 or larger", "length");
Length = length;
queue = new Queue<T>(length + 1);
if (comparer != null)
hashes = new HashSet<T>(comparer);
else
hashes = new HashSet<T>();
}
public bool Contains(T item)
{
return hashes.Contains(item);
}
public bool Add(T item)
{
bool added;
lock (_locker)
{
added = hashes.Add(item);
if (added)
{
queue.Enqueue(item);
if (queue.Count > Length)
{
T toRemove = queue.Dequeue();
hashes.Remove(toRemove);
}
}
}
return added;
}
}
}
|
Add the option of specifying a comparer.
|
Add the option of specifying a comparer.
|
C#
|
bsd-2-clause
|
IvionSauce/MeidoBot
|
883c6f1eb30f460790d4d74fbe16e96f08e866e6
|
osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs
|
osu.Game/Screens/OnlinePlay/Lounge/Components/RoomSpecialCategoryPill.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
public class RoomSpecialCategoryPill : OnlinePlayComposite
{
private SpriteText text;
public RoomSpecialCategoryPill()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
InternalChild = new PillContainer
{
Background =
{
Colour = colours.Pink,
Alpha = 1
},
Child = text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 12),
Colour = Color4.Black
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
Category.BindValueChanged(c => text.Text = c.NewValue.ToString(), true);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Rooms;
using osuTK.Graphics;
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
public class RoomSpecialCategoryPill : OnlinePlayComposite
{
private SpriteText text;
private PillContainer pill;
[Resolved]
private OsuColour colours { get; set; }
public RoomSpecialCategoryPill()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = pill = new PillContainer
{
Background =
{
Colour = colours.Pink,
Alpha = 1
},
Child = text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 12),
Colour = Color4.Black
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
Category.BindValueChanged(c =>
{
text.Text = c.NewValue.GetLocalisableDescription();
switch (c.NewValue)
{
case RoomCategory.Spotlight:
pill.Background.Colour = colours.Green2;
break;
case RoomCategory.FeaturedArtist:
pill.Background.Colour = colours.Blue2;
break;
}
}, true);
}
}
}
|
Update colour of spotlights playlist to match new specs
|
Update colour of spotlights playlist to match new specs
|
C#
|
mit
|
peppy/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu
|
eff88a66d1fab0189627cf758e4db321adf850bf
|
Src/PegSharp/External/BlockChain.cs
|
Src/PegSharp/External/BlockChain.cs
|
namespace PegSharp.External
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class BlockChain
{
private List<BlockData> blocks = new List<BlockData>();
private List<BlockData> others = new List<BlockData>();
public long Height { get { return blocks.Count; } }
public BlockData BestBlock
{
get
{
return this.blocks.Last();
}
}
public bool Add(BlockData block)
{
if ((this.blocks.Count == 0 && block.Number == 0) || (this.blocks.Count > 0 && this.BestBlock.Hash.Equals(block.ParentHash)))
{
this.blocks.Add(block);
var children = this.others.Where(b => b.ParentHash.Equals(block.Hash));
foreach (var child in children) {
this.others.Remove(child);
this.Add(child);
}
return true;
}
others.Add(block);
return false;
}
}
}
|
namespace PegSharp.External
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class BlockChain
{
private List<BlockData> blocks = new List<BlockData>();
private List<BlockData> others = new List<BlockData>();
public long Height { get { return blocks.Count; } }
public BlockData BestBlock
{
get
{
return this.blocks.Last();
}
}
public bool Add(BlockData block)
{
if ((this.blocks.Count == 0 && block.Number == 0) || (this.blocks.Count > 0 && this.BestBlock.Hash.Equals(block.ParentHash)))
{
this.blocks.Add(block);
var children = this.others.Where(b => b.ParentHash.Equals(block.Hash)).ToList();
foreach (var child in children) {
this.others.Remove(child);
this.Add(child);
}
return true;
}
others.Add(block);
return false;
}
}
}
|
Add blocks not in order
|
Add blocks not in order
|
C#
|
mit
|
ajlopez/PegSharp
|
0997077aa63252e211173de5de9cb34322791eec
|
BitCommitment/BitCommitmentEngine.cs
|
BitCommitment/BitCommitmentEngine.cs
|
using System;
namespace BitCommitment
{
/// <summary>
/// A class to perform bit commitment. It does not care what the input is; it's just a
/// facility for exchanging bit commitment messages.
/// </summary>
public class BitCommitmentEngine
{
#region properties
public byte[] BobRandBytesR { get; set; }
public byte[] AliceEncryptedMessage { get; set; }
#endregion
}
}
|
using System;
namespace BitCommitment
{
/// <summary>
/// A class to perform bit commitment. It does not care what the input is; it's just a
/// facility for exchanging bit commitment messages. Based on Bruce Schneier's one-way
/// function method for committing bits
/// </summary>
public class BitCommitmentEngine
{
public byte[] AliceRandBytes1 { get; set; }
public byte[] AliceRandBytes2 { get; set; }
public byte[] AliceMessageBytesBytes { get; set; }
public BitCommitmentEngine(byte[] one, byte[] two, byte[] messageBytes)
{
AliceRandBytes1 = one;
AliceRandBytes2 = two;
AliceMessageBytesBytes = messageBytes;
}
}
}
|
Use one way function protocol for bit commitment
|
Use one way function protocol for bit commitment
|
C#
|
mit
|
0culus/ElectronicCash
|
9c01585567431924cecb663016b36e334b13f7f8
|
webstats/Modules/RootMenuModule.cs
|
webstats/Modules/RootMenuModule.cs
|
/*
* Created by SharpDevelop.
* User: Lars Magnus
* Date: 12.06.2014
* Time: 20:54
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Text;
using Nancy;
using SubmittedData;
namespace Modules
{
/// <summary>
/// Description of WebService.
/// </summary>
public class RootMenuModule : NancyModule
{
private ITournament _tournament;
public RootMenuModule(ITournament tournament)
{
_tournament = tournament;
var groups = new Groups() { Tournament = _tournament.GetName() };
Get["/"] = _ => {
return View["groups.sshtml", groups];
};
}
private string PrintGroups()
{
StringBuilder s = new StringBuilder();
s.AppendFormat("Welcome to {0} betting scores\n", _tournament.GetName());
char gn = 'A';
foreach (object[] group in _tournament.GetGroups())
{
s.AppendLine("Group " + gn);
foreach (var team in group)
{
s.AppendLine(team.ToString());
}
gn++;
}
return s.ToString();
}
}
class Groups
{
public string Tournament { get; set; }
}
}
|
/*
* Created by SharpDevelop.
* User: Lars Magnus
* Date: 12.06.2014
* Time: 20:54
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Text;
using Nancy;
using SubmittedData;
namespace Modules
{
/// <summary>
/// Description of WebService.
/// </summary>
public class RootMenuModule : NancyModule
{
public RootMenuModule(ITournament tournament)
{
Get["/"] = _ => {
return View["groups.sshtml", new GroupsViewModel(tournament)];
};
}
}
public class GroupsViewModel
{
public string Tournament
{
get { return _tournament.GetName(); }
}
ITournament _tournament;
public GroupsViewModel(ITournament t)
{
_tournament = t;
}
private string PrintGroups()
{
StringBuilder s = new StringBuilder();
s.AppendFormat("Welcome to {0} betting scores\n", _tournament.GetName());
char gn = 'A';
foreach (object[] group in _tournament.GetGroups())
{
s.AppendLine("Group " + gn);
foreach (var team in group)
{
s.AppendLine(team.ToString());
}
gn++;
}
return s.ToString();
}
}
}
|
Make a proper view model
|
Make a proper view model
|
C#
|
mit
|
lmno/cupster,lmno/cupster,lmno/cupster
|
141976a9fb18aaeaac854f6116957d2a635c899e
|
DesktopWidgets/Classes/IntroData.cs
|
DesktopWidgets/Classes/IntroData.cs
|
using System.ComponentModel;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
namespace DesktopWidgets.Classes
{
[ExpandableObject]
[DisplayName("Intro Settings")]
public class IntroData
{
[DisplayName("Duration")]
public int Duration { get; set; } = -1;
[DisplayName("Reversable")]
public bool Reversable { get; set; } = false;
[DisplayName("Activate")]
public bool Activate { get; set; } = false;
[DisplayName("Hide On Finish")]
public bool HideOnFinish { get; set; } = true;
[DisplayName("Execute Finish Action")]
public bool ExecuteFinishAction { get; set; } = true;
}
}
|
using System.ComponentModel;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
namespace DesktopWidgets.Classes
{
[ExpandableObject]
[DisplayName("Intro Settings")]
public class IntroData
{
[DisplayName("Duration")]
public int Duration { get; set; } = -1;
[DisplayName("Reversable")]
public bool Reversable { get; set; } = false;
[DisplayName("Activate")]
public bool Activate { get; set; } = false;
[DisplayName("Hide On End")]
public bool HideOnFinish { get; set; } = true;
[DisplayName("Trigger End Event")]
public bool ExecuteFinishAction { get; set; } = true;
}
}
|
Change some intro settings property names
|
Change some intro settings property names
|
C#
|
apache-2.0
|
danielchalmers/DesktopWidgets
|
f3e533f2e33469fc917cac290ae7b41d459345aa
|
SignalRDemo/SignalRDemo/Hubs/Chat.cs
|
SignalRDemo/SignalRDemo/Hubs/Chat.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using Microsoft.AspNet.SignalR;
namespace SignalRDemo.Hubs
{
public class Chat : Hub
{
public void SayHello()
{
while (true)
{
Clients.All.addMessage("Date time : "+DateTime.Now);
Thread.Sleep(500);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Timers;
using System.Web;
using Microsoft.AspNet.SignalR;
using Timer = System.Timers.Timer;
namespace SignalRDemo.Hubs
{
public class Chat : Hub
{
static string messageToSend = DateTime.Now.ToString();
Timer t = new Timer(500);
public void SayHello()
{
t.Elapsed +=t_Elapsed;
t.Start();
}
private void t_Elapsed(object sender, ElapsedEventArgs e)
{
Clients.All.addMessage("Date time : " + messageToSend);
messageToSend = DateTime.Now.ToString();
}
}
}
|
Use timer rather than blocking sleep
|
Use timer rather than blocking sleep
|
C#
|
apache-2.0
|
wbsimms/SignalRDemo,wbsimms/SignalRDemo
|
34954000008e8e663bde584fd7ad55608cd03436
|
Battery-Commander.Web/Controllers/API/EmbedsController.cs
|
Battery-Commander.Web/Controllers/API/EmbedsController.cs
|
using BatteryCommander.Web.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Controllers.API
{
public class EmbedsController : ApiController
{
public EmbedsController(Database db) : base(db)
{
// Nothing to do here
}
[HttpGet]
public IEnumerable<Embed> List()
{
return db.Embeds.ToList();
}
[HttpPost]
public async Task<IActionResult> Create([FromBody]Embed embed)
{
db.Embeds.Add(embed);
await db.SaveChangesAsync();
return Ok();
}
[HttpDelete("{id}")]
public async Task<IActionResult> Delete(int id)
{
var embed = await db.Embeds.SingleOrDefaultAsync(_ => _.Id == id);
db.Embeds.Remove(embed);
await db.SaveChangesAsync();
return Ok();
}
}
}
|
using BatteryCommander.Web.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Controllers.API
{
public class EmbedsController : ApiController
{
public EmbedsController(Database db) : base(db)
{
// Nothing to do here
}
[HttpGet]
public async Task<IEnumerable<dynamic>> List()
{
return
await db
.Embeds
.Select(embed => new
{
embed.Id,
embed.UnitId,
embed.Name,
embed.Route,
embed.Source
})
.ToListAsync();
}
[HttpPost]
public async Task<IActionResult> Create([FromBody]Embed embed)
{
db.Embeds.Add(embed);
await db.SaveChangesAsync();
return Ok();
}
[HttpDelete("{id}")]
public async Task<IActionResult> Delete(int id)
{
var embed = await db.Embeds.SingleOrDefaultAsync(_ => _.Id == id);
db.Embeds.Remove(embed);
await db.SaveChangesAsync();
return Ok();
}
}
}
|
Switch to not serialize the full embed object
|
Switch to not serialize the full embed object
|
C#
|
mit
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
1d06a0ac9ae4ff123209206e83389a23650df07a
|
Roguelike/Roguelike/Entities/Components/FighterComponent.cs
|
Roguelike/Roguelike/Entities/Components/FighterComponent.cs
|
using Roguelike.UI;
using System;
namespace Roguelike.Entities.Components
{
public class FighterComponent : Component
{
public int MaximumHealth { get; set; }
public int CurrentHealth { get; set; }
public int Power { get; set; }
public int Defense { get; set; }
public Action<Entity> DeathFunction { get; set; }
public void Damage(int amount)
{
CurrentHealth -= amount;
if (CurrentHealth <= 0)
{
DeathFunction?.Invoke(Entity);
}
}
public void Attack(Entity target)
{
if (target.GetComponent<FighterComponent>() == null)
{
return;
}
var damage = Power - target.GetComponent<FighterComponent>().Defense;
if (damage > 0)
{
MessageLog.Add($"{Entity.Name} attacks {target.Name} for {damage} HP.");
target.GetComponent<FighterComponent>().Damage(damage);
}
else
{
MessageLog.Add($"{Entity.Name} attacks {target.Name} but it has no effect!");
}
}
}
}
|
using Roguelike.UI;
using System;
namespace Roguelike.Entities.Components
{
public class FighterComponent : Component
{
public const float CriticalHitChance = 0.05f;
public int MaximumHealth { get; set; }
public int CurrentHealth { get; set; }
public int Power { get; set; }
public int Defense { get; set; }
public Action<Entity> DeathFunction { get; set; }
public void Damage(int amount)
{
CurrentHealth -= amount;
if (CurrentHealth <= 0)
{
DeathFunction?.Invoke(Entity);
}
}
public void Attack(Entity target)
{
if (target.GetComponent<FighterComponent>() == null)
{
return;
}
int damage = 0;
if (Program.Random.NextDouble() < CriticalHitChance)
{
damage = Power;
}
else
{
damage = Power - target.GetComponent<FighterComponent>().Defense;
}
if (damage > 0)
{
MessageLog.Add($"{Entity.Name} attacks {target.Name} for {damage} HP.");
target.GetComponent<FighterComponent>().Damage(damage);
}
else
{
MessageLog.Add($"{Entity.Name} attacks {target.Name} but it has no effect!");
}
}
}
}
|
Add a 5% chance for attacks to be critical hits, which ignore defense.
|
Add a 5% chance for attacks to be critical hits, which ignore defense.
|
C#
|
mit
|
pjk21/roguelikedev-does-the-complete-roguelike-tutorial
|
58025b2f5c514ea2925336f174a683a573d4df55
|
CodeFirstMigrations/Address.cs
|
CodeFirstMigrations/Address.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeFirstMigrations
{
public class Address
{
public Int32 Id { get; set; }
public Int32 HouseNumber { get; set; }
public String Street { get; set; }
public String City { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeFirstMigrations
{
public class Address
{
public Int32 Id { get; set; }
public Int32 HouseNumber { get; set; }
public String Street { get; set; }
public String City { get; set; }
public String Postcode { get; set; }
}
}
|
Change model and EF errors with schema change
|
Change model and EF errors with schema change
|
C#
|
mit
|
johnproctor/EFMigrations
|
fbae4b2657c1780f979c9b889bf3e9f9eed85f07
|
BSParser/Writers/StrictCSVWriter.cs
|
BSParser/Writers/StrictCSVWriter.cs
|
using BSParser.Data;
using CsvHelper;
using System.IO;
using System.Text;
namespace BSParser.Writers
{
public class StrictCSVWriter : Writer
{
private string _fileName;
public StrictCSVWriter(string fileName)
{
_fileName = fileName;
}
public override bool Write(StatementTable data)
{
using (var sw = new StreamWriter(_fileName, false, Encoding.UTF8))
{
var csv = new CsvWriter(sw);
csv.Configuration.Delimiter = ";";
csv.WriteRecords(data);
}
return true;
}
}
}
|
using BSParser.Data;
using CsvHelper;
using System.IO;
using System.Linq;
using System.Text;
namespace BSParser.Writers
{
public class StrictCSVWriter : Writer
{
private string _fileName;
public StrictCSVWriter(string fileName)
{
_fileName = fileName;
}
public override bool Write(StatementTable data)
{
if (!data.Any()) return false;
var orderedData = data.Select(x => new
{
x.Category,
x.RefNum,
x.DocNum,
x.Amount,
x.Direction,
x.RegisteredOn,
x.Description,
x.PayerINN,
x.PayerName,
x.ReceiverINN,
x.ReceiverName
});
using (var sw = new StreamWriter(_fileName, false, Encoding.UTF8))
{
var csv = new CsvWriter(sw);
csv.Configuration.Delimiter = ";";
csv.WriteRecords(orderedData);
}
return true;
}
}
}
|
Change the order of the columns in CSV export
|
Change the order of the columns in CSV export
|
C#
|
mit
|
dodbrian/BSParser
|
9c712375a3449dba29d007b5eb59087fac7a3cc1
|
CompatBot/Utils/ResultFormatters/IrdSearchResultFormattercs.cs
|
CompatBot/Utils/ResultFormatters/IrdSearchResultFormattercs.cs
|
using CompatApiClient.Utils;
using DSharpPlus.Entities;
using IrdLibraryClient;
using IrdLibraryClient.POCOs;
namespace CompatBot.Utils.ResultFormatters
{
public static class IrdSearchResultFormattercs
{
public static DiscordEmbedBuilder AsEmbed(this SearchResult searchResult)
{
var result = new DiscordEmbedBuilder
{
//Title = "IRD Library Search Result",
Color = Config.Colors.DownloadLinks,
};
if (searchResult.Data.Count == 0)
{
result.Color = Config.Colors.LogResultFailed;
result.Description = "No matches were found";
return result;
}
foreach (var item in searchResult.Data)
{
var parts = item.Filename?.Split('-');
if (parts == null)
parts = new string[] {null, null};
else if (parts.Length == 1)
parts = new[] {null, item.Filename};
result.AddField(
$"[{parts?[0]}] {item.Title?.Sanitize().Trim(EmbedPager.MaxFieldTitleLength)}",
$"⏬ [`{parts[1]?.Sanitize().Trim(200)}`]({IrdClient.GetDownloadLink(item.Filename)}) ℹ [Info]({IrdClient.GetInfoLink(item.Filename)})"
);
}
return result;
}
}
}
|
using CompatApiClient.Utils;
using DSharpPlus.Entities;
using IrdLibraryClient;
using IrdLibraryClient.POCOs;
namespace CompatBot.Utils.ResultFormatters
{
public static class IrdSearchResultFormattercs
{
public static DiscordEmbedBuilder AsEmbed(this SearchResult searchResult)
{
var result = new DiscordEmbedBuilder
{
//Title = "IRD Library Search Result",
Color = Config.Colors.DownloadLinks,
};
if (searchResult.Data.Count == 0)
{
result.Color = Config.Colors.LogResultFailed;
result.Description = "No matches were found";
return result;
}
foreach (var item in searchResult.Data)
{
var parts = item.Filename?.Split('-');
if (parts == null)
parts = new string[] {null, null};
else if (parts.Length == 1)
parts = new[] {null, item.Filename};
result.AddField(
$"[{parts?[0]} v{item.GameVersion}] {item.Title?.Sanitize().Trim(EmbedPager.MaxFieldTitleLength)}",
$"⏬ [`{parts[1]?.Sanitize().Trim(200)}`]({IrdClient.GetDownloadLink(item.Filename)}) ℹ [Info]({IrdClient.GetInfoLink(item.Filename)})"
);
}
return result;
}
}
}
|
Add game version to the results (for e.g. heavy rain)
|
Add game version to the results (for e.g. heavy rain)
|
C#
|
lgpl-2.1
|
RPCS3/discord-bot,Nicba1010/discord-bot
|
7b878acc5d66660fcdd66e62972cedb21f5510e4
|
LivrariaTest/AutorTest.cs
|
LivrariaTest/AutorTest.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Livraria;
namespace LivrariaTest
{
[TestClass]
public class AutorTest
{
[TestMethod]
public void TestProperties()
{
Autor autor = new Autor();
autor.CodAutor = 999;
autor.Nome = "George R. R. Martin";
autor.Cpf = "012.345.678.90";
autor.DtNascimento = new DateTime(1948, 9, 20);
Assert.AreEqual(autor.CodAutor, 999);
Assert.AreEqual(autor.Nome, "George R. R. Martin");
Assert.AreEqual(autor.Cpf, "012.345.678.90");
Assert.AreEqual<DateTime>(autor.DtNascimento, new DateTime(1948, 9, 20));
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Livraria;
using System.Collections.Generic;
namespace LivrariaTest
{
[TestClass]
public class AutorTest
{
[TestMethod]
public void TestProperties()
{
Autor autor = new Autor();
autor.CodAutor = 999;
autor.Nome = "George R. R. Martin";
autor.Cpf = "012.345.678.90";
autor.DtNascimento = new DateTime(1948, 9, 20);
Assert.AreEqual(autor.CodAutor, 999);
Assert.AreEqual(autor.Nome, "George R. R. Martin");
Assert.AreEqual(autor.Cpf, "012.345.678.90");
Assert.AreEqual<DateTime>(autor.DtNascimento, new DateTime(1948, 9, 20));
}
[TestMethod]
public void TestListaAutores()
{
Autor autor = new Autor();
List<Autor> lstAutores = autor.ListaAutores();
foreach (var aut in lstAutores)
{
Assert.IsInstanceOfType(aut, typeof(Autor));
}
}
}
}
|
Add test for ListaAutores method
|
Add test for ListaAutores method
|
C#
|
mit
|
paulodiovani/feevale-cs-livraria-2015
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.