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
|
|---|---|---|---|---|---|---|---|---|---|
168fe28aec0c3b76e00722cd017f2ca4a18f4fb4
|
Battery-Commander.Web/Views/APFT/Edit.cshtml
|
Battery-Commander.Web/Views/APFT/Edit.cshtml
|
@model APFT
@using (Html.BeginForm("Edit", "APFT", FormMethod.Post, new { @class = "form-horizontal" role = "form" }))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.Id)
@Html.ValidationSummary()
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Soldier)
@Html.EditorFor(model => model.SoldierId)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Date)
@Html.EditorFor(model => model.Date)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.PushUps)
@Html.EditorFor(model => model.PushUps)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.SitUps)
@Html.EditorFor(model => model.SitUps)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Run)
@Html.EditorFor(model => model.Run)
</div>
<button type="submit">Save</button>
}
|
@model APFT
@using (Html.BeginForm("Edit", "APFT", FormMethod.Post, new { @class = "form-horizontal" role = "form" }))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.Id)
@Html.ValidationSummary()
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Soldier)
@Html.DropDownListFor(model => model.SoldierId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --")
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Date)
@Html.EditorFor(model => model.Date)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.PushUps)
@Html.EditorFor(model => model.PushUps)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.SitUps)
@Html.EditorFor(model => model.SitUps)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Run)
@Html.EditorFor(model => model.Run)
</div>
<button type="submit">Save</button>
}
|
Make soldier a dropdown list
|
Make soldier a dropdown list
|
C#
|
mit
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
4756056234f799b67f7b2f8404f07c14551e2243
|
UnitTestProject1/SimpleTests.cs
|
UnitTestProject1/SimpleTests.cs
|
#region copyright
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SimpleTests.cs" company="Stephen Reindl">
// Copyright (c) Stephen Reindl. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>
// <summary>
// Part of oberon0 - Oberon0Compiler.Tests/SimpleTests.cs
// </summary>
// --------------------------------------------------------------------------------------------------------------------
#endregion
namespace Oberon0.Compiler.Tests
{
using NUnit.Framework;
using Oberon0.Compiler.Definitions;
using Oberon0.TestSupport;
[TestFixture]
public class SimpleTests
{
[Test]
public void EmptyApplication()
{
Module m = Oberon0Compiler.CompileString("MODULE Test; END Test.");
Assert.AreEqual("Test", m.Name);
Assert.AreEqual(2, m.Block.Declarations.Count);
}
[Test]
public void EmptyApplication2()
{
Module m = TestHelper.CompileString(
@"MODULE Test; BEGIN END Test.");
Assert.AreEqual(0, m.Block.Statements.Count);
}
[Test]
public void ModuleMissingDot()
{
TestHelper.CompileString(
@"MODULE Test; END Test",
"missing '.' at '<EOF>'");
}
[Test]
public void ModuleMissingId()
{
TestHelper.CompileString(
@"MODULE ; BEGIN END Test.",
"missing ID at ';'",
"The name of the module does not match the end node");
}
}
}
|
#region copyright
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SimpleTests.cs" company="Stephen Reindl">
// Copyright (c) Stephen Reindl. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>
// <summary>
// Part of oberon0 - Oberon0Compiler.Tests/SimpleTests.cs
// </summary>
// --------------------------------------------------------------------------------------------------------------------
#endregion
namespace Oberon0.Compiler.Tests
{
using NUnit.Framework;
using Oberon0.Compiler.Definitions;
using Oberon0.TestSupport;
[TestFixture]
public class SimpleTests
{
[Test]
public void EmptyApplication()
{
Module m = Oberon0Compiler.CompileString("MODULE Test; END Test.");
Assert.AreEqual("Test", m.Name);
Assert.AreEqual(3, m.Block.Declarations.Count);
}
[Test]
public void EmptyApplication2()
{
Module m = TestHelper.CompileString(
@"MODULE Test; BEGIN END Test.");
Assert.AreEqual(0, m.Block.Statements.Count);
}
[Test]
public void ModuleMissingDot()
{
TestHelper.CompileString(
@"MODULE Test; END Test",
"missing '.' at '<EOF>'");
}
[Test]
public void ModuleMissingId()
{
TestHelper.CompileString(
@"MODULE ; BEGIN END Test.",
"missing ID at ';'",
"The name of the module does not match the end node");
}
}
}
|
Update unit test error for new const
|
Update unit test error for new const
|
C#
|
mit
|
steven-r/Oberon0Compiler
|
baadacc2a22ee0814473866b442b5d6af9e5958a
|
Source/CaliburnMicro/CaliburnMicro.WinForms/Logging.cs
|
Source/CaliburnMicro/CaliburnMicro.WinForms/Logging.cs
|
namespace MvvmFx.CaliburnMicro
{
using System;
/// <summary>
/// Used to manage logging.
/// </summary>
public static class LogManager
{
private static readonly Logging.ILog NullLogInstance = new Logging.NullLogger();
/// <summary>
/// Creates an <see cref="Logging.ILog"/> for the provided type.
/// </summary>
public static Func<Type, Logging.ILog> GetLog = type => NullLogInstance;
}
}
|
namespace MvvmFx.CaliburnMicro
{
using System;
/// <summary>
/// Used to manage logging.
/// </summary>
public static class LogManager
{
private static readonly Logging.ILog NullLogInstance = new Logging.NullLogger();
#pragma warning disable CS3003 // Type is not CLS-compliant
/// <summary>
/// Creates an <see cref="Logging.ILog"/> for the provided type.
/// </summary>
public static Func<Type, Logging.ILog> GetLog = type => NullLogInstance;
#pragma warning restore CS3003 // Type is not CLS-compliant
}
}
|
Disable warning "Type is not CLS-compliant"
|
Disable warning "Type is not CLS-compliant"
|
C#
|
mit
|
tfreitasleal/MvvmFx,MvvmFx/MvvmFx
|
839c1c772ec9a52ca7dfa4ce201f98bae16274b6
|
source/CsQuery/Implementation/TrueStringComparer.cs
|
source/CsQuery/Implementation/TrueStringComparer.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CsQuery.Implementation
{
public class TrueStringComparer : IComparer<string>, IEqualityComparer<string>
{
public int Compare(string x, string y)
{
int pos = 0;
int len = Math.Min(x.Length, y.Length);
while (pos < len)
{
var xi = (int)x[pos];
var yi = (int)y[pos];
if (xi < yi)
{
return -1;
}
else if (yi < xi)
{
return 1;
}
pos++;
}
if (x.Length < y.Length)
{
return -1;
}
else if (y.Length < x.Length)
{
return 1;
}
else
{
return 0;
}
}
public bool Equals(string x, string y)
{
return Compare(x, y) == 0;
}
public int GetHashCode(string obj)
{
return obj.GetHashCode();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CsQuery.Implementation
{
public class TrueStringComparer : IComparer<string>, IEqualityComparer<string>
{
public int Compare(string x, string y)
{
int pos = 0;
int len = Math.Min(x.Length, y.Length);
while (pos < len)
{
var xi = (int)x[pos];
var yi = (int)y[pos];
if (xi < yi)
{
return -1;
}
else if (yi < xi)
{
return 1;
}
pos++;
}
if (x.Length < y.Length)
{
return -1;
}
else if (y.Length < x.Length)
{
return 1;
}
else
{
return 0;
}
}
public bool Equals(string x, string y)
{
return x.Length == y.Length && Compare(x, y) == 0;
}
public int GetHashCode(string obj)
{
return obj.GetHashCode();
}
}
}
|
Use custom string comparer for RangeSortedDictionary
|
Use custom string comparer for RangeSortedDictionary
|
C#
|
mit
|
hn5092/CsQuery,rucila/CsQuery,prepare/CsQuery,modulexcite/CsQuery,prepare/CsQuery,rucila/CsQuery,modulexcite/CsQuery,rucila/CsQuery,hn5092/CsQuery,joelverhagen/CsQuery,hn5092/CsQuery,jamietre/CsQuery,prepare/DomQuery,prepare/DomQuery,jamietre/CsQuery,azraelrabbit/CsQuery,jamietre/CsQuery,joelverhagen/CsQuery,prepare/DomQuery,azraelrabbit/CsQuery,azraelrabbit/CsQuery,prepare/CsQuery,modulexcite/CsQuery,joelverhagen/CsQuery
|
e9e4a06d68ef7a6ef10f630fc2eb5441cfffb65f
|
src/Sakuno.Base/Collections/EnumerableExtensions.cs
|
src/Sakuno.Base/Collections/EnumerableExtensions.cs
|
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace Sakuno.Collections
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class EnumerableExtensions
{
public static bool AnyNull<T>(this IEnumerable<T> source) where T : class
{
foreach (var item in source)
if (item == null)
return true;
return false;
}
public static IEnumerable<TSource> NotOfType<TSource, TExclusion>(this IEnumerable<TSource> source)
{
foreach (var item in source)
{
if (item is TExclusion)
continue;
yield return item;
}
}
public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> source) => source.OrderBy(IdentityFunction<T>.Instance);
public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> items, IComparer<T> comparer) => items.OrderBy(IdentityFunction<T>.Instance, comparer);
public static IEnumerable<(T, bool)> EnumerateItemAndIfIsLast<T>(this IEnumerable<T> items)
{
using (var enumerator = items.GetEnumerator())
{
var last = default(T);
if (!enumerator.MoveNext())
yield break;
var shouldYield = false;
do
{
if (shouldYield)
yield return (last, false);
shouldYield = true;
last = enumerator.Current;
} while (enumerator.MoveNext());
yield return (last, true);
}
}
}
}
|
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace Sakuno.Collections
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class EnumerableExtensions
{
public static bool AnyNull<T>(this IEnumerable<T> source) where T : class
{
foreach (var item in source)
if (item == null)
return true;
return false;
}
public static IEnumerable<TSource> NotOfType<TSource, TExclusion>(this IEnumerable<TSource> source)
{
foreach (var item in source)
{
if (item is TExclusion)
continue;
yield return item;
}
}
public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> source) => source.OrderBy(IdentityFunction<T>.Instance);
public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> items, IComparer<T> comparer) => items.OrderBy(IdentityFunction<T>.Instance, comparer);
public static IEnumerable<(T Item, bool IsLast)> EnumerateItemAndIfIsLast<T>(this IEnumerable<T> items)
{
using (var enumerator = items.GetEnumerator())
{
var last = default(T);
if (!enumerator.MoveNext())
yield break;
var shouldYield = false;
do
{
if (shouldYield)
yield return (last, false);
shouldYield = true;
last = enumerator.Current;
} while (enumerator.MoveNext());
yield return (last, true);
}
}
}
}
|
Add field names in returned tuple of EnumerateItemAndIfIsLast()
|
Add field names in returned tuple of EnumerateItemAndIfIsLast()
|
C#
|
mit
|
KodamaSakuno/Sakuno.Base
|
178509c71a4de86b273ea78944b7fe99813d67d3
|
Code/OpenRealEstate.Services/ITransmorgrifier.cs
|
Code/OpenRealEstate.Services/ITransmorgrifier.cs
|
namespace OpenRealEstate.Services
{
public interface ITransmorgrifier
{
/// <summary>
/// Converts some given data into a listing instance.
/// </summary>
/// <param name="data">some data source, like Xml data or json data.</param>
/// <param name="isClearAllIsModified">After the data is loaded, do we clear all IsModified fields so it looks like the listing(s) are all ready to be used and/or compared against other listings.</param>
/// <param name="areBadCharactersRemoved">Help clean up the data.</param>
/// <returns>List of listings and any unhandled data.</returns>
/// <remarks>Why does <code>isClearAllIsModified</code> default to <code>false</code>? Because when you generally load some data into a new listing instance, you want to see which properties </remarks>
ConvertToResult ConvertTo(string data,
bool isClearAllIsModified = false,
bool areBadCharactersRemoved = false);
}
}
|
namespace OpenRealEstate.Services
{
public interface ITransmorgrifier
{
/// <summary>
/// Converts some given data into a listing instance.
/// </summary>
/// <param name="data">some data source, like Xml data or json data.</param>
/// <param name="areBadCharactersRemoved">Help clean up the data.</param>
/// <param name="isClearAllIsModified">After the data is loaded, do we clear all IsModified fields so it looks like the listing(s) are all ready to be used and/or compared against other listings.</param>
/// <returns>List of listings and any unhandled data.</returns>
/// <remarks>Why does <code>isClearAllIsModified</code> default to <code>false</code>? Because when you generally load some data into a new listing instance, you want to see which properties </remarks>
ConvertToResult ConvertTo(string data,
bool areBadCharactersRemoved = false,
bool isClearAllIsModified = false);
}
}
|
Correct ordering of method arguments.
|
Correct ordering of method arguments.
|
C#
|
mit
|
OpenRealEstate/OpenRealEstate.NET,FeodorFitsner/OpenRealEstate.NET,OpenRealEstate/OpenRealEstate.NET,FeodorFitsner/OpenRealEstate.NET
|
c6464b4194f1fa141fc9563ac65b8a18342d2691
|
src/Core2D.Avalonia/MainWindow.xaml.cs
|
src/Core2D.Avalonia/MainWindow.xaml.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Core2D.Avalonia
{
public class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
this.AttachDevTools();
Renderer.DrawDirtyRects = true;
Renderer.DrawFps = true;
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Core2D.Avalonia
{
public class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
this.AttachDevTools();
#if DEBUG
Renderer.DrawDirtyRects = true;
Renderer.DrawFps = true;
#endif
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
|
Enable only in debug mode
|
Enable only in debug mode
|
C#
|
mit
|
wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D
|
cb81928fee1c77867d611972d36902249ff91f1b
|
Scripts/GameApi/Attributes/SyncFieldAttribute.cs
|
Scripts/GameApi/Attributes/SyncFieldAttribute.cs
|
using LiteNetLib;
using System;
namespace LiteNetLibManager
{
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class SyncFieldAttribute : Attribute
{
/// <summary>
/// Sending method type
/// </summary>
public DeliveryMethod deliveryMethod;
/// <summary>
/// Interval to send network data (0.01f to 2f)
/// </summary>
public float sendInterval = 0.1f;
/// <summary>
/// If this is `TRUE` it will syncing although no changes
/// </summary>
public bool alwaysSync;
/// <summary>
/// If this is `TRUE` it will not sync initial data immdediately with spawn message (it will sync later)
/// </summary>
public bool doNotSyncInitialDataImmediately;
/// <summary>
/// How data changes handle and sync
/// </summary>
public LiteNetLibSyncField.SyncMode syncMode;
/// <summary>
/// Function name which will be invoked when data changed
/// </summary>
public string hook;
}
}
|
using LiteNetLib;
using System;
namespace LiteNetLibManager
{
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class SyncFieldAttribute : Attribute
{
/// <summary>
/// Sending method type
/// </summary>
public DeliveryMethod deliveryMethod = DeliveryMethod.ReliableOrdered;
/// <summary>
/// Interval to send network data (0.01f to 2f)
/// </summary>
public float sendInterval = 0.1f;
/// <summary>
/// If this is `TRUE` it will syncing although no changes
/// </summary>
public bool alwaysSync = false;
/// <summary>
/// If this is `TRUE` it will not sync initial data immdediately with spawn message (it will sync later)
/// </summary>
public bool doNotSyncInitialDataImmediately = false;
/// <summary>
/// How data changes handle and sync
/// </summary>
public LiteNetLibSyncField.SyncMode syncMode = LiteNetLibSyncField.SyncMode.ServerToClients;
/// <summary>
/// Function name which will be invoked when data changed
/// </summary>
public string hook = string.Empty;
}
}
|
Set default values to sync field attribute
|
Set default values to sync field attribute
|
C#
|
mit
|
insthync/LiteNetLibManager,insthync/LiteNetLibManager
|
3f185a44defeabc22d662e0938553cf594230098
|
osu.Game/Migrations/20181007180454_StandardizePaths.cs
|
osu.Game/Migrations/20181007180454_StandardizePaths.cs
|
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using System.IO;
namespace osu.Game.Migrations
{
public partial class StandardizePaths : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
string sanitized = Path.DirectorySeparatorChar.ToString();
string standardized = "/";
// Escaping \ does not seem to be needed.
migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{sanitized}', '{standardized}')");
migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{sanitized}', '{standardized}')");
migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `BackgroundFile` = REPLACE(`BackgroundFile`, '{sanitized}', '{standardized}')");
migrationBuilder.Sql($"UPDATE `BeatmapSetFileInfo` SET `Filename` = REPLACE(`Filename`, '{sanitized}', '{standardized}')");
migrationBuilder.Sql($"UPDATE `SkinFileInfo` SET `Filename` = REPLACE(`Filename`, '{sanitized}', '{standardized}')");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
|
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using System.IO;
namespace osu.Game.Migrations
{
public partial class StandardizePaths : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
string windowsStyle = @"\";
string standardized = "/";
// Escaping \ does not seem to be needed.
migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{windowsStyle}', '{standardized}')");
migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{windowsStyle}', '{standardized}')");
migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `BackgroundFile` = REPLACE(`BackgroundFile`, '{windowsStyle}', '{standardized}')");
migrationBuilder.Sql($"UPDATE `BeatmapSetFileInfo` SET `Filename` = REPLACE(`Filename`, '{windowsStyle}', '{standardized}')");
migrationBuilder.Sql($"UPDATE `SkinFileInfo` SET `Filename` = REPLACE(`Filename`, '{windowsStyle}', '{standardized}')");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
|
Fix Windows-style path separators not being migrated on Unix systems
|
Fix Windows-style path separators not being migrated on Unix systems
|
C#
|
mit
|
smoogipoo/osu,smoogipoo/osu,EVAST9919/osu,DrabWeb/osu,NeoAdonis/osu,ppy/osu,ZLima12/osu,ZLima12/osu,DrabWeb/osu,2yangk23/osu,naoey/osu,peppy/osu,DrabWeb/osu,2yangk23/osu,peppy/osu-new,smoogipooo/osu,peppy/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,johnneijzen/osu,naoey/osu,NeoAdonis/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,EVAST9919/osu,naoey/osu,ppy/osu,UselessToucan/osu
|
3ebd2c9c9259a77b18b15ce04b23563b5a0d59b1
|
src/Narvalo.Fx/Applicative/Qullable.cs
|
src/Narvalo.Fx/Applicative/Qullable.cs
|
// Copyright (c) Narvalo.Org. All rights reserved. See LICENSE.txt in the project root for license information.
namespace Narvalo.Applicative
{
using System;
using Narvalo;
// Query Expression Pattern for nullables.
public static class Qullable
{
public static TResult? Select<TSource, TResult>(this TSource? @this, Func<TSource, TResult> selector)
where TSource : struct
where TResult : struct
{
Require.NotNull(selector, nameof(selector));
return @this.HasValue ? (TResult?)selector(@this.Value) : null;
}
public static TSource? Where<TSource>(
this TSource? @this,
Func<TSource, bool> predicate)
where TSource : struct
{
Require.NotNull(predicate, nameof(predicate));
return @this.HasValue && predicate(@this.Value) ? @this : null;
}
public static TResult? SelectMany<TSource, TMiddle, TResult>(
this TSource? @this,
Func<TSource, TMiddle?> valueSelector,
Func<TSource, TMiddle, TResult> resultSelector)
where TSource : struct
where TMiddle : struct
where TResult : struct
{
Require.NotNull(valueSelector, nameof(valueSelector));
Require.NotNull(resultSelector, nameof(resultSelector));
if (!@this.HasValue) { return null; }
var middle = valueSelector(@this.Value);
if (!middle.HasValue) { return null; }
return resultSelector(@this.Value, middle.Value);
}
}
}
|
// Copyright (c) Narvalo.Org. All rights reserved. See LICENSE.txt in the project root for license information.
namespace Narvalo.Applicative
{
using System;
using Narvalo;
// Query Expression Pattern for nullables.
public static class Qullable
{
public static TResult? Select<TSource, TResult>(this TSource? @this, Func<TSource, TResult> selector)
where TSource : struct
where TResult : struct
{
Require.NotNull(selector, nameof(selector));
return @this is TSource v ? (TResult?)selector(v) : null;
}
public static TSource? Where<TSource>(
this TSource? @this,
Func<TSource, bool> predicate)
where TSource : struct
{
Require.NotNull(predicate, nameof(predicate));
return @this is TSource v && predicate(v) ? @this : null;
}
public static TResult? SelectMany<TSource, TResult>(
this TSource? @this,
Func<TSource, TResult?> selector)
where TSource : struct
where TResult : struct
{
Require.NotNull(selector, nameof(selector));
return @this is TSource v ? selector(v) : null;
}
public static TResult? SelectMany<TSource, TMiddle, TResult>(
this TSource? @this,
Func<TSource, TMiddle?> valueSelector,
Func<TSource, TMiddle, TResult> resultSelector)
where TSource : struct
where TMiddle : struct
where TResult : struct
{
Require.NotNull(valueSelector, nameof(valueSelector));
Require.NotNull(resultSelector, nameof(resultSelector));
return @this is TSource v && valueSelector(v) is TMiddle m
? resultSelector(v, m)
: (TResult?)null;
}
}
}
|
Add one overload for Nullable<T>.SelectMany.
|
Add one overload for Nullable<T>.SelectMany.
|
C#
|
bsd-2-clause
|
chtoucas/Narvalo.NET,chtoucas/Narvalo.NET
|
7fa1ccef47304f92fcf86a84c5d29df3e7472b1f
|
src/Engine/MvcTurbine/ComponentModel/CommonAssemblyFilter.cs
|
src/Engine/MvcTurbine/ComponentModel/CommonAssemblyFilter.cs
|
namespace MvcTurbine.ComponentModel {
using System;
/// <summary>
/// Defines common assemblies to filter. These assemblies are:
/// System, mscorlib, Microsoft, WebDev, CppCodeProvider).
/// </summary>
[Serializable]
public class CommonAssemblyFilter : AssemblyFilter {
/// <summary>
/// Creates an instance and applies the default filters.
/// Sets the following filters as default, (System, mscorlib, Microsoft, WebDev, CppCodeProvider).
/// </summary>
public CommonAssemblyFilter() {
AddDefaults();
}
/// <summary>
/// Sets the following filters as default, (System, mscorlib, Microsoft, WebDev, CppCodeProvider).
/// </summary>
private void AddDefaults() {
AddFilter("System");
AddFilter("mscorlib");
AddFilter("Microsoft");
AddFilter("MvcTurbine");
AddFilter("MvcTurbine.Web");
// Ignore the Visual Studio extra assemblies!
AddFilter("WebDev");
AddFilter("CppCodeProvider");
}
}
}
|
namespace MvcTurbine.ComponentModel {
using System;
/// <summary>
/// Defines common assemblies to filter. These assemblies are:
/// System, mscorlib, Microsoft, WebDev, CppCodeProvider).
/// </summary>
[Serializable]
public class CommonAssemblyFilter : AssemblyFilter {
/// <summary>
/// Creates an instance and applies the default filters.
/// Sets the following filters as default, (System, mscorlib, Microsoft, WebDev, CppCodeProvider).
/// </summary>
public CommonAssemblyFilter() {
AddDefaults();
}
/// <summary>
/// Sets the following filters as default, (System, mscorlib, Microsoft, WebDev, CppCodeProvider).
/// </summary>
private void AddDefaults() {
AddFilter("System");
AddFilter("mscorlib");
AddFilter("Microsoft");
AddFilter("MvcTurbine,");
AddFilter("MvcTurbine.Web");
// Ignore the Visual Studio extra assemblies!
AddFilter("WebDev");
AddFilter("CppCodeProvider");
}
}
}
|
Add a comma to the MvcTurbine filters, which will prevent MvcTurbine from being included but not block out MvcTurbine.*.
|
Add a comma to the MvcTurbine filters, which will prevent MvcTurbine from being included but not block out MvcTurbine.*.
|
C#
|
apache-2.0
|
lozanotek/mvcturbine,lozanotek/mvcturbine
|
f1d892b8c2d8d5ad2e54024728fa1f06f349d533
|
src/Hyde/Table/Memory/DynamicMemoryQuery.cs
|
src/Hyde/Table/Memory/DynamicMemoryQuery.cs
|
using System.Collections.Generic;
using TechSmith.Hyde.Table.Azure;
namespace TechSmith.Hyde.Table.Memory
{
internal class DynamicMemoryQuery : AbstractMemoryQuery<dynamic>
{
public DynamicMemoryQuery( IEnumerable<GenericTableEntity> entities )
: base( entities )
{
}
private DynamicMemoryQuery( DynamicMemoryQuery previous )
: base( previous )
{
}
protected override AbstractQuery<dynamic> CreateCopy()
{
return new DynamicMemoryQuery( this );
}
internal override dynamic Convert( GenericTableEntity e )
{
return e.ConvertToDynamic();
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using TechSmith.Hyde.Table.Azure;
namespace TechSmith.Hyde.Table.Memory
{
internal class DynamicMemoryQuery : AbstractMemoryQuery<dynamic>
{
public DynamicMemoryQuery( IEnumerable<GenericTableEntity> entities )
: base( entities )
{
}
private DynamicMemoryQuery( DynamicMemoryQuery previous )
: base( previous )
{
}
protected override AbstractQuery<dynamic> CreateCopy()
{
return new DynamicMemoryQuery( this );
}
internal override dynamic Convert( GenericTableEntity e )
{
return StripNullValues( e.ConvertToDynamic() );
}
private static dynamic StripNullValues( dynamic obj )
{
dynamic result = new ExpandoObject();
foreach ( var p in ( obj as IDictionary<string, object> ).Where( p => p.Value != null ) )
{
( (IDictionary<string, object>) result ).Add( p );
}
return result;
}
}
}
|
Fix issue with null values returned by Memory provider
|
Fix issue with null values returned by Memory provider
|
C#
|
bsd-3-clause
|
dontjee/hyde
|
e2282e30e5349b7b277977e3aa12a5f2d0cc4727
|
OptionsDisplay/HearthWindow.cs
|
OptionsDisplay/HearthWindow.cs
|
using Hearthstone_Deck_Tracker;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace OptionsDisplay
{
class HearthWindow : InfoWindow
{
private HearthstoneTextBlock info;
public HearthWindow()
{
info = new HearthstoneTextBlock();
info.Text = "";
info.FontSize = 12;
var canvas = Hearthstone_Deck_Tracker.API.Core.OverlayCanvas;
var fromTop = canvas.Height / 2;
var fromLeft = canvas.Width / 2;
Canvas.SetTop(info, fromTop);
Canvas.SetLeft(info, fromLeft);
canvas.Children.Add(info);
}
public void AppendWindowText(string text)
{
info.Text = info.Text + text;
}
public void ClearAll()
{
info.Text = "";
}
public void MoveToHistory()
{
return;
}
public void SetWindowText(string text)
{
info.Text = text;
}
}
}
|
using Hearthstone_Deck_Tracker;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace OptionsDisplay
{
class HearthWindow : InfoWindow
{
private HearthstoneTextBlock info;
public HearthWindow()
{
info = new HearthstoneTextBlock();
info.Text = "";
info.FontSize = 12;
var canvas = Hearthstone_Deck_Tracker.API.Core.OverlayCanvas;
var fromTop = canvas.Height / 2;
var fromLeft = canvas.Width / 2;
Canvas.SetTop(info, fromTop);
Canvas.SetLeft(info, fromLeft);
canvas.Children.Add(info);
}
public void AppendWindowText(string text)
{
info.Text = info.Text + text;
}
public void ClearAll()
{
info.Text = "";
}
public void MoveToHistory()
{
info.Text = "";
}
public void SetWindowText(string text)
{
info.Text = text;
}
}
}
|
Add trivial history programming to overlay window to clear each turn
|
Add trivial history programming to overlay window to clear each turn
|
C#
|
agpl-3.0
|
theAprel/OptionsDisplay
|
320634f42a8402967cb688104e4209df0ead1032
|
src/NetIRC/Messages/PingMessage.cs
|
src/NetIRC/Messages/PingMessage.cs
|
namespace NetIRC.Messages
{
public class PingMessage : IRCMessage, IServerMessage
{
public string Target { get; }
public PingMessage(ParsedIRCMessage parsedMessage)
{
Target = parsedMessage.Trailing ?? parsedMessage.Parameters[0];
}
}
}
|
namespace NetIRC.Messages
{
public class PingMessage : IRCMessage, IServerMessage
{
public string Target { get; }
public PingMessage(ParsedIRCMessage parsedMessage)
{
Target = parsedMessage.Trailing;
}
}
}
|
Remove unnecessary null coalescing operator
|
Remove unnecessary null coalescing operator
|
C#
|
mit
|
Fredi/NetIRC
|
1f4c17b8f856a1d010fd2e45345d199c51dfba14
|
osu.Game/Screens/Play/ScreenSuspensionHandler.cs
|
osu.Game/Screens/Play/ScreenSuspensionHandler.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.Diagnostics;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
namespace osu.Game.Screens.Play
{
/// <summary>
/// Ensures screen is not suspended / dimmed while gameplay is active.
/// </summary>
public class ScreenSuspensionHandler : Component
{
private readonly GameplayClockContainer gameplayClockContainer;
private Bindable<bool> isPaused;
[Resolved]
private GameHost host { get; set; }
public ScreenSuspensionHandler([NotNull] GameplayClockContainer gameplayClockContainer)
{
this.gameplayClockContainer = gameplayClockContainer ?? throw new ArgumentNullException(nameof(gameplayClockContainer));
}
protected override void LoadComplete()
{
base.LoadComplete();
// This is the only usage game-wide of suspension changes.
// Assert to ensure we don't accidentally forget this in the future.
Debug.Assert(host.AllowScreenSuspension.Value);
isPaused = gameplayClockContainer.IsPaused.GetBoundCopy();
isPaused.BindValueChanged(paused => host.AllowScreenSuspension.Value = paused.NewValue, true);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
isPaused?.UnbindAll();
if (host != null)
host.AllowScreenSuspension.Value = 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 System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
namespace osu.Game.Screens.Play
{
/// <summary>
/// Ensures screen is not suspended / dimmed while gameplay is active.
/// </summary>
public class ScreenSuspensionHandler : Component
{
private readonly GameplayClockContainer gameplayClockContainer;
private Bindable<bool> isPaused;
private readonly Bindable<bool> disableSuspensionBindable = new Bindable<bool>();
[Resolved]
private GameHost host { get; set; }
public ScreenSuspensionHandler([NotNull] GameplayClockContainer gameplayClockContainer)
{
this.gameplayClockContainer = gameplayClockContainer ?? throw new ArgumentNullException(nameof(gameplayClockContainer));
}
protected override void LoadComplete()
{
base.LoadComplete();
isPaused = gameplayClockContainer.IsPaused.GetBoundCopy();
isPaused.BindValueChanged(paused =>
{
if (paused.NewValue)
host.AllowScreenSuspension.RemoveSource(disableSuspensionBindable);
else
host.AllowScreenSuspension.AddSource(disableSuspensionBindable);
}, true);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
isPaused?.UnbindAll();
host?.AllowScreenSuspension.RemoveSource(disableSuspensionBindable);
}
}
}
|
Apply changes to AllowScreenSuspension bindable
|
Apply changes to AllowScreenSuspension bindable
|
C#
|
mit
|
UselessToucan/osu,peppy/osu-new,smoogipoo/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu
|
a5e9189f8a0234f082c65abfbc30e4ff04970e78
|
FalconHelper.cs
|
FalconHelper.cs
|
using System;
namespace FalconUDP
{
internal static class FalconHelper
{
internal static unsafe void WriteFalconHeader(byte[] dstBuffer,
int dstIndex,
PacketType type,
SendOptions opts,
ushort seq,
ushort payloadSize)
{
fixed (byte* ptr = &dstBuffer[dstIndex])
{
*ptr = (byte)((byte)opts | (byte)type);
*(ushort*)(ptr + 1) = seq;
*(ushort*)(ptr + 3) = payloadSize;
}
}
internal static unsafe void WriteAdditionalFalconHeader(byte[] dstBuffer,
int dstIndex,
PacketType type,
SendOptions opts,
ushort payloadSize)
{
fixed (byte* ptr = &dstBuffer[dstIndex])
{
*ptr = (byte)((byte)opts | (byte)type);
*(ushort*)(ptr + 1) = payloadSize;
}
}
internal static void WriteAck(AckDetail ack,
byte[] dstBuffer,
int dstIndex)
{
float ellapsedMilliseconds = ack.EllapsedSecondsSinceEnqueud * 1000;
ushort stopoverMilliseconds = ellapsedMilliseconds > ushort.MaxValue
? ushort.MaxValue
: (ushort)ellapsedMilliseconds; // TODO log warning if was greater than MaxValue
WriteFalconHeader(dstBuffer,
dstIndex,
ack.Type,
ack.Channel,
ack.Seq,
stopoverMilliseconds);
}
}
}
|
using System;
namespace FalconUDP
{
internal static class FalconHelper
{
internal static unsafe void WriteFalconHeader(byte[] dstBuffer,
int dstIndex,
PacketType type,
SendOptions opts,
ushort seq,
ushort payloadSize)
{
fixed (byte* ptr = &dstBuffer[dstIndex])
{
*ptr = (byte)((byte)opts | (byte)type);
*(ushort*)(ptr + 1) = seq;
*(ushort*)(ptr + 3) = payloadSize;
}
}
internal static unsafe void WriteAdditionalFalconHeader(byte[] dstBuffer,
int dstIndex,
PacketType type,
SendOptions opts,
ushort payloadSize)
{
fixed (byte* ptr = &dstBuffer[dstIndex])
{
*ptr = (byte)((byte)opts | (byte)type);
*(ushort*)(ptr + 1) = payloadSize;
}
}
internal static void WriteAck(AckDetail ack,
byte[] dstBuffer,
int dstIndex)
{
float ellapsedMilliseconds = ack.EllapsedSecondsSinceEnqueud * 1000.0f;
ushort stopoverMilliseconds = ellapsedMilliseconds > ushort.MaxValue
? ushort.MaxValue
: (ushort)ellapsedMilliseconds; // TODO log warning if was greater than MaxValue
WriteFalconHeader(dstBuffer,
dstIndex,
ack.Type,
ack.Channel,
ack.Seq,
stopoverMilliseconds);
}
}
}
|
Use float instead of int
|
Use float instead of int
|
C#
|
mit
|
markmnl/FalconUDP
|
46ce5cabbcbb1346d48588972a1bb35dc9d43758
|
cslalightcs/Csla/Security/MembershipIdentity.partial.cs
|
cslalightcs/Csla/Security/MembershipIdentity.partial.cs
|
using System;
using System.Security.Principal;
using Csla.Serialization;
using System.Collections.Generic;
using Csla.Core.FieldManager;
using System.Runtime.Serialization;
using Csla.DataPortalClient;
using Csla.Silverlight;
using Csla.Core;
namespace Csla.Security
{
public abstract partial class MembershipIdentity : ReadOnlyBase<MembershipIdentity>, IIdentity
{
public static void GetMembershipIdentity<T>(EventHandler<DataPortalResult<T>> completed, string userName, string password, bool isRunOnWebServer) where T : MembershipIdentity
{
DataPortal<T> dp = new DataPortal<T>();
dp.FetchCompleted += completed;
dp.BeginFetch(new Criteria(userName, password, typeof(T), isRunOnWebServer));
}
}
}
|
using System;
using System.Security.Principal;
using Csla.Serialization;
using System.Collections.Generic;
using Csla.Core.FieldManager;
using System.Runtime.Serialization;
using Csla.DataPortalClient;
using Csla.Silverlight;
using Csla.Core;
namespace Csla.Security
{
public partial class MembershipIdentity : ReadOnlyBase<MembershipIdentity>, IIdentity
{
public static void GetMembershipIdentity<T>(EventHandler<DataPortalResult<T>> completed, string userName, string password, bool isRunOnWebServer) where T : MembershipIdentity
{
DataPortal<T> dp = new DataPortal<T>();
dp.FetchCompleted += completed;
dp.BeginFetch(new Criteria(userName, password, typeof(T), isRunOnWebServer));
}
}
}
|
Change MembershipIdentity so it is not an abstract class. bugid: 153
|
Change MembershipIdentity so it is not an abstract class.
bugid: 153
|
C#
|
mit
|
rockfordlhotka/csla,BrettJaner/csla,MarimerLLC/csla,ronnymgm/csla-light,JasonBock/csla,MarimerLLC/csla,MarimerLLC/csla,ronnymgm/csla-light,jonnybee/csla,JasonBock/csla,jonnybee/csla,jonnybee/csla,rockfordlhotka/csla,JasonBock/csla,rockfordlhotka/csla,ronnymgm/csla-light,BrettJaner/csla,BrettJaner/csla
|
26f8ab75a7a3d8a9b2dbc7f0efed1fe97ade1b0d
|
src/Stripe.net/Constants/FilePurpose.cs
|
src/Stripe.net/Constants/FilePurpose.cs
|
namespace Stripe
{
public static class FilePurpose
{
public const string AdditionalVerification = "additional_verification";
public const string BusinessIcon = "business_icon";
public const string BusinessLogo = "business_logo";
public const string CustomerSignature = "customer_signature";
public const string DisputeEvidence = "dispute_evidence";
public const string DocumentProviderIdentityDocument = "document_provider_identity_document";
public const string FinanceReportRun = "finance_report_run";
public const string IdentityDocument = "identity_document";
public const string IncorporationArticle = "incorporation_article";
public const string IncorporationDocument = "incorporation_document";
public const string PaymentProviderTransfer = "payment_provider_transfer";
public const string PciDocument = "pci_document";
public const string ProductFeed = "product_feed";
public const string SigmaScheduledQuery = "sigma_scheduled_query";
public const string TaxDocumentUserUpload = "tax_document_user_upload";
}
}
|
namespace Stripe
{
public static class FilePurpose
{
public const string AccountRequirement = "account_requirement";
public const string AdditionalVerification = "additional_verification";
public const string BusinessIcon = "business_icon";
public const string BusinessLogo = "business_logo";
public const string CustomerSignature = "customer_signature";
public const string DisputeEvidence = "dispute_evidence";
public const string DocumentProviderIdentityDocument = "document_provider_identity_document";
public const string FinanceReportRun = "finance_report_run";
public const string IdentityDocument = "identity_document";
public const string IdentityDocumentDownloadable = "identity_document_downloadable";
public const string IncorporationArticle = "incorporation_article";
public const string IncorporationDocument = "incorporation_document";
public const string PaymentProviderTransfer = "payment_provider_transfer";
public const string PciDocument = "pci_document";
public const string Selfie = "selfie";
public const string ProductFeed = "product_feed";
public const string SigmaScheduledQuery = "sigma_scheduled_query";
public const string TaxDocumentUserUpload = "tax_document_user_upload";
}
}
|
Add missing enums for File purpose
|
Add missing enums for File purpose
|
C#
|
apache-2.0
|
stripe/stripe-dotnet
|
597b74c73ce6456a3f95883e3da1c082605a1ae5
|
Assets/Scripts/UI/ChangeOrderInLayer.cs
|
Assets/Scripts/UI/ChangeOrderInLayer.cs
|
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class ChangeOrderInLayer : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
private Renderer _renderer;
[SerializeField]
private int orderInLayer;
#pragma warning restore 0649
void Start()
{
if (_renderer == null)
_renderer = GetComponent<Renderer>();
_renderer.sortingOrder = orderInLayer;
}
void Update ()
{
if (orderInLayer != _renderer.sortingOrder)
_renderer.sortingOrder = orderInLayer;
}
}
|
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class ChangeOrderInLayer : MonoBehaviour
{
[SerializeField]
private Renderer _renderer;
[SerializeField]
private int orderInLayer;
[SerializeField]
private string sortingLayer = "Default";
[SerializeField]
private bool disableOnPlay = true;
private void Awake()
{
if (disableOnPlay && Application.isPlaying)
enabled = false;
}
void Start()
{
if (_renderer == null)
_renderer = GetComponent<Renderer>();
_renderer.sortingOrder = orderInLayer;
}
void Update ()
{
if (orderInLayer != _renderer.sortingOrder)
_renderer.sortingOrder = orderInLayer;
if (!string.IsNullOrEmpty(sortingLayer))
_renderer.sortingLayerName = sortingLayer;
}
}
|
Add disableOnPlay option to changeOrderInLayer
|
Add disableOnPlay option to changeOrderInLayer
|
C#
|
mit
|
NitorInc/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare,Barleytree/NitoriWare
|
c707c7a4f6216c46518e5079658438e13fda9e02
|
Bearded.Utilities.Testing/Core/MaybeAssertions.cs
|
Bearded.Utilities.Testing/Core/MaybeAssertions.cs
|
using FluentAssertions;
using FluentAssertions.Execution;
namespace Bearded.Utilities.Testing
{
public sealed class MaybeAssertions<T>
{
private readonly Maybe<T> subject;
public MaybeAssertions(Maybe<T> instance) => subject = instance;
[CustomAssertion]
public void BeJust(T value, string because = "", params object[] becauseArgs)
{
BeJust().Which.Should().BeEquivalentTo(value, because, becauseArgs);
}
[CustomAssertion]
public AndWhichConstraint<MaybeAssertions<T>, T> BeJust(string because = "", params object[] becauseArgs)
{
var onValueCalled = false;
var matched = default(T);
subject.Match(
onValue: actual =>
{
onValueCalled = true;
matched = actual;
}, onNothing: () => { });
Execute.Assertion
.BecauseOf(because, becauseArgs)
.ForCondition(onValueCalled)
.FailWith("Expected maybe to have value, but had none.");
return new AndWhichConstraint<MaybeAssertions<T>, T>(this, matched);
}
[CustomAssertion]
public void BeNothing(string because = "", params object[] becauseArgs)
{
var onNothingCalled = false;
subject.Match(onValue: _ => { }, onNothing: () => onNothingCalled = true);
Execute.Assertion
.BecauseOf(because, becauseArgs)
.ForCondition(onNothingCalled)
.FailWith("Expected maybe to be nothing, but had value.");
}
}
}
|
using FluentAssertions;
using FluentAssertions.Execution;
namespace Bearded.Utilities.Testing
{
public sealed class MaybeAssertions<T>
{
private readonly Maybe<T> subject;
public MaybeAssertions(Maybe<T> instance) => subject = instance;
[CustomAssertion]
public void BeJust(T value, string because = "", params object[] becauseArgs)
{
BeJust().Which.Should().Be(value, because, becauseArgs);
}
[CustomAssertion]
public AndWhichConstraint<MaybeAssertions<T>, T> BeJust(string because = "", params object[] becauseArgs)
{
var onValueCalled = false;
var matched = default(T);
subject.Match(
onValue: actual =>
{
onValueCalled = true;
matched = actual;
}, onNothing: () => { });
Execute.Assertion
.BecauseOf(because, becauseArgs)
.ForCondition(onValueCalled)
.FailWith("Expected maybe to have value, but had none.");
return new AndWhichConstraint<MaybeAssertions<T>, T>(this, matched);
}
[CustomAssertion]
public void BeNothing(string because = "", params object[] becauseArgs)
{
var onNothingCalled = false;
subject.Match(onValue: _ => { }, onNothing: () => onNothingCalled = true);
Execute.Assertion
.BecauseOf(because, becauseArgs)
.ForCondition(onNothingCalled)
.FailWith("Expected maybe to be nothing, but had value.");
}
}
}
|
Use Be instead of BeEquivalentTo
|
:bug: Use Be instead of BeEquivalentTo
|
C#
|
mit
|
beardgame/utilities
|
326a2c05eaf7ed2125642509327165ecb0cb5296
|
src/Procon.Setup.Test/Models/CertificateModelTest.cs
|
src/Procon.Setup.Test/Models/CertificateModelTest.cs
|
using System.Security.Cryptography.X509Certificates;
using NUnit.Framework;
using Procon.Service.Shared;
using Procon.Setup.Models;
namespace Procon.Setup.Test.Models {
[TestFixture]
public class CertificateModelTest {
/// <summary>
/// Tests a certificate will be generated and can be read by .NET
/// </summary>
[Test]
public void TestGenerate() {
CertificateModel model = new CertificateModel();
// Delete the certificate if it exists.
Defines.CertificatesDirectoryCommandServerPfx.Delete();
// Create a new certificate
model.Generate();
// Certificate exists
Assert.IsTrue(Defines.CertificatesDirectoryCommandServerPfx.Exists);
// Loads the certificates
var loadedCertificate = new X509Certificate2(Defines.CertificatesDirectoryCommandServerPfx.FullName, model.Password);
// Certificate can be loaded.
Assert.IsNotNull(loadedCertificate);
Assert.IsNotNull(loadedCertificate.PrivateKey);
}
}
}
|
using System.Security.Cryptography.X509Certificates;
using NUnit.Framework;
using Procon.Service.Shared;
using Procon.Setup.Models;
namespace Procon.Setup.Test.Models {
[TestFixture]
public class CertificateModelTest {
/// <summary>
/// Tests a certificate will be generated and can be read by .NET
/// </summary>
[Test]
public void TestGenerate() {
CertificateModel model = new CertificateModel();
// Delete the certificate if it exists.
Defines.CertificatesDirectoryCommandServerPfx.Delete();
// Create a new certificate
model.Generate();
// Certificate exists
Defines.CertificatesDirectoryCommandServerPfx.Refresh();
Assert.IsTrue(Defines.CertificatesDirectoryCommandServerPfx.Exists);
// Loads the certificates
var loadedCertificate = new X509Certificate2(Defines.CertificatesDirectoryCommandServerPfx.FullName, model.Password);
// Certificate can be loaded.
Assert.IsNotNull(loadedCertificate);
Assert.IsNotNull(loadedCertificate.PrivateKey);
}
}
}
|
Fix certificate generation not refreshing test
|
Fix certificate generation not refreshing test
|
C#
|
apache-2.0
|
phogue/Potato,phogue/Potato,phogue/Potato
|
90a3abb6aa442779090799448a831ffd8ea5c8fc
|
JsonComparer.Console/Parameters/SplitParameter.cs
|
JsonComparer.Console/Parameters/SplitParameter.cs
|
namespace BigEgg.Tools.JsonComparer.Parameters
{
using BigEgg.Tools.ConsoleExtension.Parameters;
[Command("split", "Split the big JSON file to multiple small files.")]
public class SplitParameter
{
[StringProperty("input", "i", "The path of JSON file to split.", Required = true)]
public string FileName { get; set; }
[StringProperty("output", "o", "The path to store the splited JSON files.", Required = true)]
public string OutputPath { get; set; }
[StringProperty("node_name", "n", "The name of node to split.", Required = true)]
public string NodeName { get; set; }
[StringProperty("output_pattern", "op", "The output file name pattern. Use '${name}' for node name, ${index} for the child index.")]
public string OutputFileNamePattern { get; set; }
}
}
|
namespace BigEgg.Tools.JsonComparer.Parameters
{
using BigEgg.Tools.ConsoleExtension.Parameters;
[Command("split", "Split the big JSON file to multiple small files.")]
public class SplitParameter
{
[StringProperty("input", "i", "The path of JSON file to split.", Required = true)]
public string FileName { get; set; }
[StringProperty("output", "o", "The path to store the splited JSON files.", Required = true)]
public string OutputPath { get; set; }
[StringProperty("node_name", "n", "The name of node to split.", Required = true)]
public string NodeName { get; set; }
[StringProperty("output_pattern", "op", "The output file name pattern. Use '${name}' for node name, '${index}' for the child index.")]
public string OutputFileNamePattern { get; set; }
}
}
|
Fix the help message of output_pattern
|
Fix the help message of output_pattern
|
C#
|
mit
|
BigEggTools/JsonComparer
|
fe947c2337990fb639e638e4357afa1654f92ee7
|
SpotifyRecorder/Core/SpotifyRecorder.Core.Implementations/Services/ID3TagService.cs
|
SpotifyRecorder/Core/SpotifyRecorder.Core.Implementations/Services/ID3TagService.cs
|
using System.IO;
using System.Linq;
using SpotifyRecorder.Core.Abstractions.Entities;
using SpotifyRecorder.Core.Abstractions.Services;
using TagLib;
using TagLib.Id3v2;
using File = TagLib.File;
namespace SpotifyRecorder.Core.Implementations.Services
{
public class ID3TagService : IID3TagService
{
public ID3Tags GetTags(RecordedSong song)
{
var tagFile = File.Create(new MemoryFileAbstraction(new MemoryStream(song.Data)));
return new ID3Tags
{
Title = tagFile.Tag.Title,
Artists = tagFile.Tag.Performers,
Picture = tagFile.Tag.Pictures.FirstOrDefault()?.Data.Data
};
}
public void UpdateTags(ID3Tags tags, RecordedSong song)
{
using (var stream = new MemoryStream(song.Data.Length + 1000))
{
stream.Write(song.Data, 0, song.Data.Length);
stream.Position = 0;
var tagFile = File.Create(new MemoryFileAbstraction(stream));
tagFile.Tag.Title = tags.Title;
tagFile.Tag.Performers = tags.Artists;
if (tags.Picture != null)
{
tagFile.Tag.Pictures = new IPicture[]
{
new Picture(new ByteVector(tags.Picture, tags.Picture.Length)),
};
}
tagFile.Save();
song.Data = stream.ToArray();
}
}
}
}
|
using System.IO;
using System.Linq;
using SpotifyRecorder.Core.Abstractions.Entities;
using SpotifyRecorder.Core.Abstractions.Services;
using TagLib;
using TagLib.Id3v2;
using File = TagLib.File;
namespace SpotifyRecorder.Core.Implementations.Services
{
public class ID3TagService : IID3TagService
{
public ID3Tags GetTags(RecordedSong song)
{
var tagFile = File.Create(new MemoryFileAbstraction(new MemoryStream(song.Data)));
return new ID3Tags
{
Title = tagFile.Tag.Title,
Artists = tagFile.Tag.Performers,
Picture = tagFile.Tag.Pictures.FirstOrDefault()?.Data.Data
};
}
public void UpdateTags(ID3Tags tags, RecordedSong song)
{
using (var stream = new MemoryStream(song.Data.Length * 2))
{
stream.Write(song.Data, 0, song.Data.Length);
stream.Position = 0;
var tagFile = File.Create(new MemoryFileAbstraction(stream));
tagFile.Tag.Title = tags.Title;
tagFile.Tag.Performers = tags.Artists;
if (tags.Picture != null)
{
tagFile.Tag.Pictures = new IPicture[]
{
new Picture(new ByteVector(tags.Picture, tags.Picture.Length)),
};
}
tagFile.Save();
song.Data = stream.ToArray();
}
}
}
}
|
Improve how much space we reserve for tag changes
|
Improve how much space we reserve for tag changes
|
C#
|
mit
|
haefele/SpotifyRecorder
|
5449ef951e2bad06a80aa15a492fdfcbceb28bc6
|
src/Autofac/ResolveRequest.cs
|
src/Autofac/ResolveRequest.cs
|
using System.Collections.Generic;
using Autofac.Core;
namespace Autofac
{
/// <summary>
/// The details of an individual request to resolve a service.
/// </summary>
public class ResolveRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="ResolveRequest"/> class.
/// </summary>
/// <param name="service">The service being resolved.</param>
/// <param name="registration">The component registration for the service.</param>
/// <param name="parameters">The parameters used when resolving the service.</param>
/// <param name="decoratorTarget">The target component to be decorated.</param>
public ResolveRequest(Service service, IComponentRegistration registration, IEnumerable<Parameter> parameters, IComponentRegistration? decoratorTarget = null)
{
Service = service;
Registration = registration;
Parameters = parameters;
DecoratorTarget = decoratorTarget;
}
/// <summary>
/// Gets the service being resolved.
/// </summary>
public Service Service { get; }
/// <summary>
/// Gets the component registration for the service being resolved.
/// </summary>
public IComponentRegistration Registration { get; }
/// <summary>
/// Gets the parameters used when resolving the service.
/// </summary>
public IEnumerable<Parameter> Parameters { get; }
/// <summary>
/// Gets the component registration for the decorator target if configured.
/// </summary>2
public IComponentRegistration? DecoratorTarget { get; }
}
}
|
using System.Collections.Generic;
using Autofac.Core;
namespace Autofac
{
/// <summary>
/// The details of an individual request to resolve a service.
/// </summary>
public class ResolveRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="ResolveRequest"/> class.
/// </summary>
/// <param name="service">The service being resolved.</param>
/// <param name="registration">The component registration for the service.</param>
/// <param name="parameters">The parameters used when resolving the service.</param>
/// <param name="decoratorTarget">The target component to be decorated.</param>
public ResolveRequest(Service service, IComponentRegistration registration, IEnumerable<Parameter> parameters, IComponentRegistration? decoratorTarget = null)
{
Service = service;
Registration = registration;
Parameters = parameters;
DecoratorTarget = decoratorTarget;
}
/// <summary>
/// Gets the service being resolved.
/// </summary>
public Service Service { get; }
/// <summary>
/// Gets the component registration for the service being resolved.
/// </summary>
public IComponentRegistration Registration { get; }
/// <summary>
/// Gets the parameters used when resolving the service.
/// </summary>
public IEnumerable<Parameter> Parameters { get; }
/// <summary>
/// Gets the component registration for the decorator target if configured.
/// </summary>
public IComponentRegistration? DecoratorTarget { get; }
}
}
|
Remove extra char that sneaked onto XML comment
|
Remove extra char that sneaked onto XML comment
|
C#
|
mit
|
autofac/Autofac
|
c101d629be13cc47a81b9d5776254cb140a6f812
|
CefSharp/InternalWebBrowserExtensions.cs
|
CefSharp/InternalWebBrowserExtensions.cs
|
// Copyright © 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using CefSharp.Internals;
namespace CefSharp
{
internal static class InternalWebBrowserExtensions
{
internal static void SetHandlersToNull(this IWebBrowserInternal browser)
{
browser.ResourceHandlerFactory = null;
browser.JsDialogHandler = null;
browser.DialogHandler = null;
browser.DownloadHandler = null;
browser.KeyboardHandler = null;
browser.LifeSpanHandler = null;
browser.MenuHandler = null;
browser.FocusHandler = null;
browser.RequestHandler = null;
browser.DragHandler = null;
browser.GeolocationHandler = null;
}
}
}
|
// Copyright © 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using CefSharp.Internals;
namespace CefSharp
{
internal static class InternalWebBrowserExtensions
{
internal static void SetHandlersToNull(this IWebBrowserInternal browser)
{
browser.DialogHandler = null;
browser.RequestHandler = null;
browser.DisplayHandler = null;
browser.LoadHandler = null;
browser.LifeSpanHandler = null;
browser.KeyboardHandler = null;
browser.JsDialogHandler = null;
browser.DragHandler = null;
browser.DownloadHandler = null;
browser.MenuHandler = null;
browser.FocusHandler = null;
browser.ResourceHandlerFactory = null;
browser.GeolocationHandler = null;
browser.RenderProcessMessageHandler = null;
}
}
}
|
Set RenderProcessMessageHandler and LoadHandler to null on Dispose Reoder so they match the order in IWebBrowser so they're easier to compare
|
Set RenderProcessMessageHandler and LoadHandler to null on Dispose
Reoder so they match the order in IWebBrowser so they're easier to compare
|
C#
|
bsd-3-clause
|
jamespearce2006/CefSharp,jamespearce2006/CefSharp,wangzheng888520/CefSharp,dga711/CefSharp,dga711/CefSharp,dga711/CefSharp,VioletLife/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,wangzheng888520/CefSharp,dga711/CefSharp,Livit/CefSharp,VioletLife/CefSharp,Livit/CefSharp,VioletLife/CefSharp,wangzheng888520/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,VioletLife/CefSharp,wangzheng888520/CefSharp
|
0850b533d8d4016b7200f84c491d5cfb407c5106
|
Src/Support/CommonAssemblyInfo.cs
|
Src/Support/CommonAssemblyInfo.cs
|
/*
Copyright 2015 Google Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.Reflection;
// Attributes common to all assemblies.
[assembly: AssemblyCompany("Google Inc")]
[assembly: AssemblyCopyright("Copyright 2016 Google Inc")]
[assembly: AssemblyVersion("1.11.0.*")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
|
/*
Copyright 2015 Google Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.Reflection;
// Attributes common to all assemblies.
[assembly: AssemblyCompany("Google Inc")]
[assembly: AssemblyCopyright("Copyright 2016 Google Inc")]
[assembly: AssemblyVersion("1.11.0.0")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
|
Fix revision number of support libraries to 0
|
Fix revision number of support libraries to 0
Otherwise the libraries built from the Net45 and Portable projects
end up with different versions and strongnames.
|
C#
|
apache-2.0
|
jskeet/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,jskeet/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,jskeet/google-api-dotnet-client,googleapis/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,googleapis/google-api-dotnet-client,googleapis/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client
|
7b7c631244de8430b92a31bb2ece3439e041a08d
|
Website/Infrastructure/Lucene/PerFieldAnalyzer.cs
|
Website/Infrastructure/Lucene/PerFieldAnalyzer.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
namespace NuGetGallery
{
public class PerFieldAnalyzer : PerFieldAnalyzerWrapper
{
public PerFieldAnalyzer()
: base(new StandardAnalyzer(LuceneCommon.LuceneVersion), CreateFieldAnalyzers())
{
}
private static IDictionary CreateFieldAnalyzers()
{
return new Dictionary<string, Analyzer>(StringComparer.OrdinalIgnoreCase)
{
{ "Title", new TitleAnalyzer() }
};
}
class TitleAnalyzer : Analyzer
{
private readonly Analyzer innerAnalyzer = new StandardAnalyzer(LuceneCommon.LuceneVersion);
public override TokenStream TokenStream(string fieldName, TextReader reader)
{
// Split the title based on IdSeparators, then run it through the standardAnalyzer
string title = reader.ReadToEnd();
string partiallyTokenized = String.Join(" ", title.Split(LuceneIndexingService.IdSeparators, StringSplitOptions.RemoveEmptyEntries));
return innerAnalyzer.TokenStream(fieldName, new StringReader(partiallyTokenized));
}
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
namespace NuGetGallery
{
public class PerFieldAnalyzer : PerFieldAnalyzerWrapper
{
public PerFieldAnalyzer()
: base(new StandardAnalyzer(LuceneCommon.LuceneVersion), CreateFieldAnalyzers())
{
}
private static IDictionary CreateFieldAnalyzers()
{
// For idAnalyzer we use the 'standard analyzer' but with no stop words (In, Of, The, etc are indexed).
var stopWords = new Hashtable();
StandardAnalyzer idAnalyzer = new StandardAnalyzer(LuceneCommon.LuceneVersion, stopWords);
return new Dictionary<string, Analyzer>(StringComparer.OrdinalIgnoreCase)
{
{ "Id", idAnalyzer },
{ "Title", new TitleAnalyzer() },
};
}
class TitleAnalyzer : Analyzer
{
private readonly StandardAnalyzer innerAnalyzer;
public TitleAnalyzer()
{
// For innerAnalyzer we use the 'standard analyzer' but with no stop words (In, Of, The, etc are indexed).
var stopWords = new Hashtable();
innerAnalyzer = new StandardAnalyzer(LuceneCommon.LuceneVersion, stopWords);
}
public override TokenStream TokenStream(string fieldName, TextReader reader)
{
// Split the title based on IdSeparators, then run it through the innerAnalyzer
string title = reader.ReadToEnd();
string partiallyTokenized = String.Join(" ", title.Split(LuceneIndexingService.IdSeparators, StringSplitOptions.RemoveEmptyEntries));
return innerAnalyzer.TokenStream(fieldName, new StringReader(partiallyTokenized));
}
}
}
}
|
Stop filtering out stop words in package ids and titles.
|
Stop filtering out stop words in package ids and titles.
|
C#
|
apache-2.0
|
KuduApps/NuGetGallery,KuduApps/NuGetGallery,KuduApps/NuGetGallery,mtian/SiteExtensionGallery,ScottShingler/NuGetGallery,projectkudu/SiteExtensionGallery,JetBrains/ReSharperGallery,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch,projectkudu/SiteExtensionGallery,grenade/NuGetGallery_download-count-patch,JetBrains/ReSharperGallery,KuduApps/NuGetGallery,skbkontur/NuGetGallery,skbkontur/NuGetGallery,mtian/SiteExtensionGallery,JetBrains/ReSharperGallery,skbkontur/NuGetGallery,mtian/SiteExtensionGallery,projectkudu/SiteExtensionGallery,KuduApps/NuGetGallery
|
b61d8563c19f0d0e45ebc3ae6435598d5fd0bfd0
|
slang/Lexing/Trees/Transformers/OptionRuleExtensions.cs
|
slang/Lexing/Trees/Transformers/OptionRuleExtensions.cs
|
using slang.Lexing.Rules.Extensions;
using slang.Lexing.Trees.Nodes;
namespace slang.Lexing.Trees.Transformers
{
public static class OptionRuleExtensions
{
public static Node Transform (this Option rule, Node parent)
{
var option = rule.Value.Transform (parent);
return option;
}
}
}
|
using slang.Lexing.Rules.Extensions;
using slang.Lexing.Trees.Nodes;
namespace slang.Lexing.Trees.Transformers
{
public static class OptionRuleExtensions
{
public static Tree Transform (this Option rule, Node parent)
{
return new Tree ();
}
}
}
|
Implement transform to tree for option as skeleton only
|
Implement transform to tree for option as skeleton only
|
C#
|
mit
|
jagrem/slang,jagrem/slang,jagrem/slang
|
b9a5e984f1b5cbc13ce7266bd17f908ea924315d
|
APIClient.Tests/QueryTests/QueryFindTester.cs
|
APIClient.Tests/QueryTests/QueryFindTester.cs
|
using NUnit.Framework;
namespace VersionOne.SDK.APIClient.Tests.QueryTests
{
[TestFixture]
public class QueryFindTester
{
private EnvironmentContext _context;
[TestFixtureSetUp]
public void TestFixtureSetup()
{
_context = new EnvironmentContext();
}
[TestFixtureTearDown]
public void TestFixtureTearDown()
{
_context = null;
}
[Test]
public void FindMemberTest()
{
var assetType = _context.MetaModel.GetAssetType("Member");
var query = new Query(assetType);
var nameAttribute = assetType.GetAttributeDefinition("Username");
query.Selection.Add(nameAttribute);
query.Find = new QueryFind("admin", new AttributeSelection("Username", assetType));
QueryResult result = _context.Services.Retrieve(query);
Assert.AreEqual(1, result.TotalAvaliable);
}
}
}
|
using NUnit.Framework;
namespace VersionOne.SDK.APIClient.Tests.QueryTests
{
[TestFixture]
public class QueryFindTester
{
private EnvironmentContext _context;
[TestFixtureSetUp]
public void TestFixtureSetup()
{
_context = new EnvironmentContext();
}
[TestFixtureTearDown]
public void TestFixtureTearDown()
{
_context = null;
}
[Test]
public void FindMemberTest()
{
var memberType = _context.MetaModel.GetAssetType("Member");
var memberQuery = new Query(memberType);
var userNameAttr = memberType.GetAttributeDefinition("Username");
memberQuery.Selection.Add(userNameAttr);
memberQuery.Find = new QueryFind("admin", new AttributeSelection("Username", memberType));
QueryResult result = _context.Services.Retrieve(memberQuery);
foreach (var member in result.Assets)
{
var name = member.GetAttribute(userNameAttr).Value as string;
Assert.IsNotNullOrEmpty(name);
if (name != null) Assert.That(name.IndexOf("admin") > -1);
}
}
}
}
|
Test that finds members with "admin" in username now works when there's more than one.
|
Test that finds members with "admin" in username now works when there's more than one.
|
C#
|
bsd-3-clause
|
versionone/VersionOne.SDK.NET.APIClient,versionone/VersionOne.SDK.NET.APIClient
|
3c3948bf8d0e26ef54de76165aeb67f80a8920f1
|
src/Gui/App.xaml.cs
|
src/Gui/App.xaml.cs
|
using System;
using System.IO;
using System.Windows;
using System.Windows.Threading;
using Pingy.Common;
namespace Pingy.Gui
{
public partial class App : Application
{
private readonly static string defaultDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
private readonly static string defaultFileName = "Pingy.txt";
private readonly static string defaultFilePath = Path.Combine(defaultDirectory, defaultFileName);
public App()
: this(defaultFilePath)
{ }
public App(string path)
{
if (String.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException(nameof(path));
}
InitializeComponent();
MainWindowViewModel viewModel = new MainWindowViewModel(path);
MainWindow = new MainWindow(viewModel);
MainWindow.Show();
}
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
if (e.Exception is Exception ex)
{
Log.Exception(ex, true);
}
else
{
Log.Message("an empty unhandled exception occurred");
}
}
}
}
|
using System;
using System.IO;
using System.Windows;
using System.Windows.Threading;
using Pingy.Common;
namespace Pingy.Gui
{
public partial class App : Application
{
private static readonly string defaultDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
private const string defaultFileName = "Pingy.txt";
private readonly static string defaultFilePath = Path.Combine(defaultDirectory, defaultFileName);
public App()
: this(defaultFilePath)
{ }
public App(string path)
{
if (String.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException(nameof(path));
}
InitializeComponent();
MainWindowViewModel viewModel = new MainWindowViewModel(path);
MainWindow = new MainWindow(viewModel);
MainWindow.Show();
}
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
if (e.Exception is Exception ex)
{
Log.Exception(ex, true);
}
else
{
Log.Message("an empty unhandled exception occurred");
}
}
}
}
|
Mark field as const instead of static readonly
|
Mark field as const instead of static readonly
|
C#
|
unlicense
|
Kingloo/Pingy
|
c04f2b0840ded76704dc37210273285d2bf8200a
|
osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs
|
osu.Game.Rulesets.Taiko/UI/TaikoPlayfieldAdjustmentContainer.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Taiko.UI
{
public class TaikoPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer
{
private const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
private const float default_aspect = 16f / 9f;
public TaikoPlayfieldAdjustmentContainer()
{
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
}
protected override void Update()
{
base.Update();
float aspectAdjust = Math.Clamp(Parent.ChildSize.X / Parent.ChildSize.Y, 0.4f, 4) / default_aspect;
Size = new Vector2(1, default_relative_height * aspectAdjust);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Taiko.UI
{
public class TaikoPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer
{
private const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
private const float default_aspect = 16f / 9f;
protected override void Update()
{
base.Update();
float aspectAdjust = Math.Clamp(Parent.ChildSize.X / Parent.ChildSize.Y, 0.4f, 4) / default_aspect;
Size = new Vector2(1, default_relative_height * aspectAdjust);
// Position the taiko playfield exactly one playfield from the top of the screen.
RelativePositionAxes = Axes.Y;
Y = Size.Y;
}
}
}
|
Reposition taiko playfield to be closer to the top of the screen
|
Reposition taiko playfield to be closer to the top of the screen
|
C#
|
mit
|
UselessToucan/osu,NeoAdonis/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,peppy/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu-new,ppy/osu
|
f11bca733aa0b8b85ec9cdecb59b2c2d371e8e12
|
DgmlColorConfiguration.cs
|
DgmlColorConfiguration.cs
|
namespace NuGetPackageVisualizer
{
public class DgmlColorConfiguration : IColorConfiguration
{
public string VersionMismatchPackageColor
{
get { return "#FF0000"; }
}
public string PackageHasDifferentVersionsColor
{
get { return "#FCE428"; }
}
public string DefaultColor
{
get { return "#15FF00"; }
}
}
}
|
namespace NuGetPackageVisualizer
{
public class DgmlColorConfiguration : IColorConfiguration
{
public string VersionMismatchPackageColor
{
get { return "#FF0000"; }
}
public string PackageHasDifferentVersionsColor
{
get { return "#FCE428"; }
}
public string DefaultColor
{
get { return "#339933"; }
}
}
}
|
Make the green slightly darker, so that the text is readable.
|
Make the green slightly darker, so that the text is readable.
|
C#
|
apache-2.0
|
ThomasArdal/NuGetPackageVisualizer
|
512cc835a4919fe0cac9676c2b5c048ec10c48c7
|
src/Slp.Evi.Storage/Slp.Evi.Test.System/Sparql/SparqlFixture.cs
|
src/Slp.Evi.Storage/Slp.Evi.Test.System/Sparql/SparqlFixture.cs
|
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
using Slp.Evi.Storage;
using Slp.Evi.Storage.Bootstrap;
using Slp.Evi.Storage.Database;
namespace Slp.Evi.Test.System.Sparql
{
public abstract class SparqlFixture
{
private readonly ConcurrentDictionary<string, EviQueryableStorage> _storages = new ConcurrentDictionary<string, EviQueryableStorage>();
private IEviQueryableStorageFactory GetStorageFactory()
{
var loggerFactory = new LoggerFactory();
if (Environment.GetEnvironmentVariable("APPVEYOR") != "True")
{
loggerFactory.AddConsole(LogLevel.Trace);
}
return new DefaultEviQueryableStorageFactory(loggerFactory);
}
public EviQueryableStorage GetStorage(string storageName)
{
return _storages.GetOrAdd(storageName, CreateStorage);
}
private EviQueryableStorage CreateStorage(string storageName)
{
return SparqlTestHelpers.InitializeDataset(storageName, GetSqlDb(), GetStorageFactory());
}
protected abstract ISqlDatabase GetSqlDb();
}
}
|
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
using Slp.Evi.Storage;
using Slp.Evi.Storage.Bootstrap;
using Slp.Evi.Storage.Database;
namespace Slp.Evi.Test.System.Sparql
{
public abstract class SparqlFixture
{
private readonly ConcurrentDictionary<string, EviQueryableStorage> _storages = new ConcurrentDictionary<string, EviQueryableStorage>();
private IEviQueryableStorageFactory GetStorageFactory()
{
var loggerFactory = new LoggerFactory();
//if (Environment.GetEnvironmentVariable("APPVEYOR") != "True")
//{
// loggerFactory.AddConsole(LogLevel.Trace);
//}
return new DefaultEviQueryableStorageFactory(loggerFactory);
}
public EviQueryableStorage GetStorage(string storageName)
{
return _storages.GetOrAdd(storageName, CreateStorage);
}
private EviQueryableStorage CreateStorage(string storageName)
{
return SparqlTestHelpers.InitializeDataset(storageName, GetSqlDb(), GetStorageFactory());
}
protected abstract ISqlDatabase GetSqlDb();
}
}
|
Disable logging so the performance profiling is more accurate.
|
Disable logging so the performance profiling is more accurate.
|
C#
|
mit
|
mchaloupka/DotNetR2RMLStore,mchaloupka/EVI
|
219e696ef701090df2e88a1435b1c13ce9a45940
|
LazyLibraryTests/Storage/Memory/MemoryRepositoryTests.cs
|
LazyLibraryTests/Storage/Memory/MemoryRepositoryTests.cs
|
using LazyLibrary.Storage;
using LazyLibrary.Storage.Memory;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;
namespace LazyLibrary.Tests.Storage.Memory
{
[TestClass]
public class MemoryRepositoryTests
{
[TestMethod]
public void CanAdd()
{
var repo = new MemoryRepository<TestObject>();
var obj = new TestObject();
repo.Upsert(obj);
Assert.IsTrue(repo.Get().Any(), "The object could not be added to the repository");
}
[TestMethod]
public void CanGetById()
{
var repo = new MemoryRepository<TestObject>();
var obj = new TestObject();
repo.Upsert(obj);
Assert.IsNotNull(repo.GetById(1), "The object could not be retrieved from the repository");
}
}
}
|
using LazyLibrary.Storage;
using LazyLibrary.Storage.Memory;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;
namespace LazyLibrary.Tests.Storage.Memory
{
[TestClass]
public class MemoryRepositoryTests
{
[TestMethod]
public void CanAdd()
{
var repo = new MemoryRepository<TestObject>();
var obj = new TestObject();
repo.Upsert(obj);
Assert.IsTrue(repo.Get().Any(), "The object could not be added to the repository");
}
[TestMethod]
public void CanGetById()
{
var repo = new MemoryRepository<TestObject>();
var obj = new TestObject();
repo.Upsert(obj);
Assert.IsNotNull(repo.GetById(1), "The object could not be retrieved from the repository");
}
[TestMethod]
public void CanGetByLINQ()
{
var repo = new MemoryRepository<TestObject>();
var objOne = new TestObject() { Name = "one" };
var objTwo = new TestObject() { Name = "two" };
repo.Upsert(objOne);
repo.Upsert(objTwo);
var result = repo.Get(x => x.Name == "one").SingleOrDefault();
Assert.IsNotNull(result, "The object could not be retrieved from the repository");
Assert.IsTrue(result.Equals(objOne), "The object could not be retrieved from the repository");
}
}
}
|
Test can get by LINQ statement
|
Test can get by LINQ statement
|
C#
|
mit
|
TheEadie/LazyLibrary,TheEadie/LazyStorage,TheEadie/LazyStorage
|
b28e3aa7d32db4d4e3e05d1f623c1b2bf9194272
|
src/NUnitFramework/tests/Api/NUnitIssue52.cs
|
src/NUnitFramework/tests/Api/NUnitIssue52.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using NUnit.Framework.Constraints;
namespace NUnit.Framework.Api
{
[TestFixture]
public class NUnitIssue52
{
class SelfContainer : IEnumerable
{
public IEnumerator GetEnumerator() { yield return this; }
}
[Test]
public void SelfContainedItemFoundInArray()
{
var item = new SelfContainer();
var items = new SelfContainer[] { new SelfContainer(), item };
// work around
//Assert.True(((ICollection<SelfContainer>)items).Contains(item));
// causes StackOverflowException
//Assert.Contains(item, items);
var equalityComparer = new NUnitEqualityComparer();
var tolerance = Tolerance.Default;
var equal = equalityComparer.AreEqual(item, items, ref tolerance);
Assert.IsFalse(equal);
//Console.WriteLine("test completed");
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using NUnit.Framework.Constraints;
namespace NUnit.Framework.Api
{
[TestFixture]
public class NUnitIssue52
{
[TestCaseSource(nameof(GetTestCases))]
public void SelfContainedItemFoundInCollection<T>(T x, ICollection y)
{
var equalityComparer = new NUnitEqualityComparer();
var tolerance = Tolerance.Default;
var actualResult = equalityComparer.AreEqual(x, y, ref tolerance);
Assert.IsFalse(actualResult);
Assert.Contains(x, y);
}
[TestCaseSource(nameof(GetTestCases))]
public void SelfContainedItemDoesntRecurseForever<T>(T x, ICollection y)
{
var equalityComparer = new NUnitEqualityComparer();
var tolerance = Tolerance.Default;
equalityComparer.ExternalComparers.Add(new DetectRecursionComparer(30));
Assert.DoesNotThrow(() =>
{
var equality = equalityComparer.AreEqual(x, y, ref tolerance);
Assert.IsFalse(equality);
Assert.Contains(x, y);
});
}
public static IEnumerable<TestCaseData> GetTestCases()
{
var item = new SelfContainer();
var items = new SelfContainer[] { new SelfContainer(), item };
yield return new TestCaseData(item, items);
}
private class DetectRecursionComparer : EqualityAdapter
{
private readonly int maxRecursion;
[MethodImpl(MethodImplOptions.NoInlining)]
public DetectRecursionComparer(int maxRecursion)
{
var callerDepth = new StackTrace().FrameCount - 1;
this.maxRecursion = callerDepth + maxRecursion;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public override bool CanCompare(object x, object y)
{
var currentDepth = new StackTrace().FrameCount - 1;
return currentDepth >= maxRecursion;
}
public override bool AreEqual(object x, object y)
{
throw new InvalidOperationException("Recurses");
}
}
private class SelfContainer : IEnumerable
{
public IEnumerator GetEnumerator() { yield return this; }
}
}
}
|
Add test explicitly checking recursion
|
Add test explicitly checking recursion
|
C#
|
mit
|
nunit/nunit,mjedrzejek/nunit,nunit/nunit,mjedrzejek/nunit
|
63c36013142aba3b13e7cd38ec470eb5f87aeb8a
|
src/Serilog.Sinks.File/FileLifecycleHooks.cs
|
src/Serilog.Sinks.File/FileLifecycleHooks.cs
|
namespace Serilog
{
using System.IO;
/// <summary>
/// Enables hooking into log file lifecycle events
/// </summary>
public abstract class FileLifecycleHooks
{
/// <summary>
/// Wraps <paramref name="sourceStream"/> in another stream, such as a GZipStream, then returns the wrapped stream
/// </summary>
/// <param name="sourceStream">The source log file stream</param>
/// <returns>The wrapped stream</returns>
public abstract Stream Wrap(Stream sourceStream);
}
}
|
namespace Serilog
{
using System.IO;
/// <summary>
/// Enables hooking into log file lifecycle events
/// </summary>
public abstract class FileLifecycleHooks
{
/// <summary>
/// Wraps <paramref name="underlyingStream"/> in another stream, such as a GZipStream, then returns the wrapped stream
/// </summary>
/// <remarks>
/// Serilog is responsible for disposing of the wrapped stream
/// </remarks>
/// <param name="underlyingStream">The underlying log file stream</param>
/// <returns>The wrapped stream</returns>
public abstract Stream Wrap(Stream underlyingStream);
}
}
|
Add docs re wrapped stream ownership
|
Add docs re wrapped stream ownership
|
C#
|
apache-2.0
|
serilog/serilog-sinks-file,serilog/serilog-sinks-file
|
0cfd73dd264caad30186eb7a3e549ae266510621
|
Manatee.Json/Serialization/Internal/AutoRegistration/ArraySerializationDelegateProvider.cs
|
Manatee.Json/Serialization/Internal/AutoRegistration/ArraySerializationDelegateProvider.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Manatee.Json.Serialization.Internal.AutoRegistration
{
internal class ArraySerializationDelegateProvider : SerializationDelegateProviderBase
{
public override bool CanHandle(Type type)
{
return type.IsArray;
}
protected override Type[] GetTypeArguments(Type type)
{
return new[] { type.GetElementType() };
}
private static JsonValue _Encode<T>(T[] array, JsonSerializer serializer)
{
var json = new JsonArray();
json.AddRange(array.Select(serializer.Serialize));
return json;
}
private static T[] _Decode<T>(JsonValue json, JsonSerializer serializer)
{
var list = new List<T>();
list.AddRange(json.Array.Select(serializer.Deserialize<T>));
return list.ToArray();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Manatee.Json.Serialization.Internal.AutoRegistration
{
internal class ArraySerializationDelegateProvider : SerializationDelegateProviderBase
{
public override bool CanHandle(Type type)
{
return type.IsArray;
}
protected override Type[] GetTypeArguments(Type type)
{
return new[] { type.GetElementType() };
}
private static JsonValue _Encode<T>(T[] array, JsonSerializer serializer)
{
var values = new JsonValue[array.Length];
for (int ii = 0; ii < array.Length; ++ii)
{
values[ii] = serializer.Serialize(array[ii]);
}
return new JsonArray(values);
}
private static T[] _Decode<T>(JsonValue json, JsonSerializer serializer)
{
var array = json.Array;
var values = new T[array.Count];
for (int ii = 0; ii < array.Count; ++ii)
{
values[ii] = serializer.Deserialize<T>(array[ii]);
}
return values;
}
}
}
|
Decrease allocations during array serialization/deserialization
|
Decrease allocations during array serialization/deserialization
|
C#
|
mit
|
gregsdennis/Manatee.Json,gregsdennis/Manatee.Json
|
6dc2840cbf5bd9764a7090aa85c4b6bdc664fae0
|
Core/Services/CSharpExecutor.cs
|
Core/Services/CSharpExecutor.cs
|
using System;
using System.IO;
using Compilify.Models;
namespace Compilify.Services
{
public class CSharpExecutor
{
public CSharpExecutor()
: this(new CSharpCompilationProvider()) { }
public CSharpExecutor(ICSharpCompilationProvider compilationProvider)
{
compiler = compilationProvider;
}
private readonly ICSharpCompilationProvider compiler;
public object Execute(Post post)
{
var compilation = compiler.Compile(post);
byte[] compiledAssembly;
using (var stream = new MemoryStream())
{
var emitResult = compilation.Emit(stream);
if (!emitResult.Success)
{
return "[Compilation failed]";
}
compiledAssembly = stream.ToArray();
}
object result;
using (var sandbox = new Sandbox("Sandbox", compiledAssembly))
{
result = sandbox.Run("EntryPoint", "Result", TimeSpan.FromSeconds(5));
}
return result;
}
}
}
|
using System;
using System.IO;
using Compilify.Models;
namespace Compilify.Services
{
public class CSharpExecutor
{
public CSharpExecutor()
: this(new CSharpCompilationProvider()) { }
public CSharpExecutor(ICSharpCompilationProvider compilationProvider)
{
compiler = compilationProvider;
}
private readonly ICSharpCompilationProvider compiler;
public object Execute(Post post)
{
var compilation = compiler.Compile(post);
byte[] compiledAssembly;
using (var stream = new MemoryStream())
{
var emitResult = compilation.Emit(stream);
if (!emitResult.Success)
{
return "[Compilation failed]";
}
compiledAssembly = stream.ToArray();
}
object result;
using (var sandbox = new Sandbox(compiledAssembly))
{
result = sandbox.Run("EntryPoint", "Result", TimeSpan.FromSeconds(5));
}
return result;
}
}
}
|
Use simpler constructor when instantiating the Sandbox
|
Use simpler constructor when instantiating the Sandbox
|
C#
|
mit
|
jrusbatch/compilify,vendettamit/compilify,vendettamit/compilify,appharbor/ConsolR,jrusbatch/compilify,appharbor/ConsolR
|
b07cd2da9959f5f5f5c02a83ac5290268be069da
|
Source/AuthenticationServer/Properties/AssemblyInfo.cs
|
Source/AuthenticationServer/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Affecto Authentication Server")]
[assembly: AssemblyProduct("Affecto Authentication Server")]
[assembly: AssemblyCompany("Affecto")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0-prerelease01")]
[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Tests")]
[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Configuration.Tests")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Affecto Authentication Server")]
[assembly: AssemblyProduct("Affecto Authentication Server")]
[assembly: AssemblyCompany("Affecto")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0-prerelease02")]
[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Tests")]
[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Configuration.Tests")]
|
Raise authentication server prerelease version number.
|
Raise authentication server prerelease version number.
|
C#
|
mit
|
affecto/dotnet-AuthenticationServer
|
eedf15a621e0898e19ca4931532c891acae0c7ed
|
Assets/RainbowFolders/Editor/RainbowFoldersMenu.cs
|
Assets/RainbowFolders/Editor/RainbowFoldersMenu.cs
|
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
using Borodar.RainbowFolders.Editor.Settings;
using UnityEditor;
namespace Borodar.RainbowFolders.Editor
{
public static class RainbowFoldersMenu
{
[MenuItem("Rainbow Folders/Show Settings")]
public static void OpenSettings()
{
var settings = RainbowFoldersSettings.Load();
Selection.activeObject = settings;
}
}
}
|
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
using Borodar.RainbowFolders.Editor.Settings;
using UnityEditor;
namespace Borodar.RainbowFolders.Editor
{
public static class RainbowFoldersMenu
{
[MenuItem("Edit/Rainbow Folders Settings", false, 500)]
public static void OpenSettings()
{
var settings = RainbowFoldersSettings.Load();
Selection.activeObject = settings;
}
}
}
|
Move settings menu to the "Edit" category
|
Move settings menu to the "Edit" category
|
C#
|
apache-2.0
|
PhannGor/unity3d-rainbow-folders
|
f8e2931e60f885f618cd3a679cc51174c83d9948
|
Source/SnowyImageCopy/Common/NotificationObject.cs
|
Source/SnowyImageCopy/Common/NotificationObject.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace SnowyImageCopy.Common
{
public abstract class NotificationObject : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void SetPropertyValue<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(storage, value))
return;
storage = value;
RaisePropertyChanged(propertyName);
}
protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
{
if (propertyExpression is null)
throw new ArgumentNullException(nameof(propertyExpression));
if (!(propertyExpression.Body is MemberExpression memberExpression))
throw new ArgumentException("The expression is not a member access expression.", nameof(propertyExpression));
RaisePropertyChanged(memberExpression.Member.Name);
}
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace SnowyImageCopy.Common
{
public abstract class NotificationObject : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetPropertyValue<T>(ref T storage, in T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(storage, value))
return false;
storage = value;
RaisePropertyChanged(propertyName);
return true;
}
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
protected static bool SetPropertyValue<T>(ref T storage, in T value, EventHandler<PropertyChangedEventArgs> handler, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(storage, value))
return false;
storage = value;
RaisePropertyChanged(handler, propertyName);
return true;
}
protected static void RaisePropertyChanged(EventHandler<PropertyChangedEventArgs> handler, [CallerMemberName] string propertyName = null) =>
handler?.Invoke(null, new PropertyChangedEventArgs(propertyName));
}
}
|
Refactor notification object and add methods for static property changed event
|
Refactor notification object and add methods for static property changed event
|
C#
|
mit
|
emoacht/SnowyImageCopy
|
746058ff6da172951d7b346085f7f44b023ff679
|
Weave/Program.cs
|
Weave/Program.cs
|
// -----------------------------------------------------------------------
// <copyright file="Program.cs" company="(none)">
// Copyright © 2013 John Gietzen. All Rights Reserved.
// This source is subject to the MIT license.
// Please see license.txt for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Weave
{
using System.IO;
using Weave.Compiler;
using Weave.Parser;
internal class Program
{
private static void Main(string[] args)
{
var input = File.ReadAllText(args[0]);
var parser = new WeaveParser();
var parsed = parser.Parse(input);
var output = WeaveCompiler.Compile(parsed);
File.WriteAllText(args[0] + ".cs", output.Code);
}
}
}
|
// -----------------------------------------------------------------------
// <copyright file="Program.cs" company="(none)">
// Copyright © 2013 John Gietzen. All Rights Reserved.
// This source is subject to the MIT license.
// Please see license.txt for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Weave
{
using System.IO;
using Weave.Compiler;
using Weave.Parser;
internal class Program
{
private static void Main(string[] args)
{
foreach (var arg in args)
{
var input = File.ReadAllText(arg);
var parser = new WeaveParser();
var parsed = parser.Parse(input, arg);
var output = WeaveCompiler.Compile(parsed);
File.WriteAllText(arg + ".cs", output.Code);
}
}
}
}
|
Allow multiple files on the command line.
|
Allow multiple files on the command line.
|
C#
|
mit
|
otac0n/Weave
|
6ba82ececf2a2543cfcc9c970e0e2ddb4a8ce78f
|
Assets/ArabicSupport/Scripts/Samples/FixArabic3DText.cs
|
Assets/ArabicSupport/Scripts/Samples/FixArabic3DText.cs
|
using UnityEngine;
using System.Collections;
using ArabicSupport;
public class FixArabic3DText : MonoBehaviour {
public bool showTashkeel = true;
public bool useHinduNumbers = true;
// Use this for initialization
void Start () {
TextMesh textMesh = gameObject.GetComponent<TextMesh>();
string fixedFixed = ArabicFixer.Fix(textMesh.text, showTashkeel, useHinduNumbers);
gameObject.GetComponent<TextMesh>().text = fixedFixed;
Debug.Log(fixedFixed);
}
}
|
using UnityEngine;
using System.Collections;
using ArabicSupport;
public class FixArabic3DText : MonoBehaviour {
public bool showTashkeel = true;
public bool useHinduNumbers = true;
// Use this for initialization
void Start () {
TextMesh textMesh = gameObject.GetComponent<TextMesh>();
string fixedText = ArabicFixer.Fix(textMesh.text, showTashkeel, useHinduNumbers);
gameObject.GetComponent<TextMesh>().text = fixedText;
Debug.Log(fixedFixed);
}
}
|
Make var name more descriptive
|
Make var name more descriptive
* Fix some whitespace issues (there was a mix of spaces and tabs).
|
C#
|
mit
|
Konash/arabic-support-unity
|
7b1d0c3b2d98f92e5df8714519b62b0fe263cd4f
|
src/PvcLess.cs
|
src/PvcLess.cs
|
using PvcCore;
using System.Collections.Generic;
using System.IO;
namespace PvcPlugins
{
public class PvcLess : PvcPlugin
{
public override string[] SupportedTags
{
get
{
return new string[] { ".less" };
}
}
public override IEnumerable<PvcStream> Execute(IEnumerable<PvcStream> inputStreams)
{
var lessEngine = new dotless.Core.LessEngine();
var resultStreams = new List<PvcStream>();
foreach (var inputStream in inputStreams)
{
var lessContent = inputStream.ToString();
var cssContent = lessEngine.TransformToCss(lessContent, "");
var resultStream = PvcUtil.StringToStream(cssContent, inputStream.StreamName);
resultStreams.Add(resultStream);
}
return resultStreams;
}
}
}
|
using PvcCore;
using System.Collections.Generic;
using System.IO;
namespace PvcPlugins
{
public class PvcLess : PvcPlugin
{
public override string[] SupportedTags
{
get
{
return new string[] { ".less" };
}
}
public override IEnumerable<PvcStream> Execute(IEnumerable<PvcStream> inputStreams)
{
var lessEngine = new dotless.Core.LessEngine();
var resultStreams = new List<PvcStream>();
foreach (var inputStream in inputStreams)
{
var lessContent = inputStream.ToString();
var cssContent = lessEngine.TransformToCss(lessContent, "");
var newStreamName = Path.Combine(Path.GetDirectoryName(inputStream.StreamName), Path.GetFileNameWithoutExtension(inputStream.StreamName) + ".css");
var resultStream = PvcUtil.StringToStream(cssContent, newStreamName);
resultStreams.Add(resultStream);
}
return resultStreams;
}
}
}
|
Rename file to .css for new stream
|
Rename file to .css for new stream
|
C#
|
mit
|
pvcbuild/pvc-less
|
fe5589ed16e5c229990d5c12b28d0165f4001d4b
|
src/Abp/Reflection/ProxyHelper.cs
|
src/Abp/Reflection/ProxyHelper.cs
|
using System.Linq;
using System.Reflection;
namespace Abp.Reflection
{
public static class ProxyHelper
{
/// <summary>
/// Returns dynamic proxy target object if this is a proxied object, otherwise returns the given object.
/// </summary>
public static object UnProxy(object obj)
{
if (obj.GetType().Namespace != "Castle.Proxies")
{
return obj;
}
var targetField = obj.GetType()
.GetFields(BindingFlags.Instance | BindingFlags.NonPublic)
.FirstOrDefault(f => f.Name == "__target");
if (targetField == null)
{
return obj;
}
return targetField.GetValue(obj);
}
}
}
|
using Castle.DynamicProxy;
namespace Abp.Reflection
{
public static class ProxyHelper
{
/// <summary>
/// Returns dynamic proxy target object if this is a proxied object, otherwise returns the given object.
/// </summary>
public static object UnProxy(object obj)
{
return ProxyUtil.GetUnproxiedInstance(obj);
}
}
}
|
Replace reflection to call API.
|
Replace reflection to call API.
|
C#
|
mit
|
zclmoon/aspnetboilerplate,zclmoon/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ilyhacker/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,beratcarsi/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,beratcarsi/aspnetboilerplate,carldai0106/aspnetboilerplate,verdentk/aspnetboilerplate,andmattia/aspnetboilerplate,carldai0106/aspnetboilerplate,virtualcca/aspnetboilerplate,andmattia/aspnetboilerplate,Nongzhsh/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,zclmoon/aspnetboilerplate,ryancyq/aspnetboilerplate,andmattia/aspnetboilerplate,ilyhacker/aspnetboilerplate,virtualcca/aspnetboilerplate,carldai0106/aspnetboilerplate,Nongzhsh/aspnetboilerplate,virtualcca/aspnetboilerplate,Nongzhsh/aspnetboilerplate,verdentk/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,beratcarsi/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate
|
6fb941289bcd7aa4300c9496bca29cebc51fe776
|
src/DrawIt/Helpers/FontHelpers.cs
|
src/DrawIt/Helpers/FontHelpers.cs
|
using System;
using System.Drawing;
namespace DrawIt
{
public static class FontHelpers
{
public static Font GetHeaderFont()
{
float fontSize = Configuration.GetSettingOrDefault<float>(Constants.Application.Header.FontSize, float.TryParse, Constants.Application.Defaults.HeaderTextSize);
string fontName = Configuration.GetSetting(Constants.Application.Header.FontName) ?? "Calibri";
FontStyle fontStyle = Configuration.GetSettingOrDefault<FontStyle>(Constants.Application.Header.FontStyle, Enum.TryParse<FontStyle>, FontStyle.Regular);
return new Font(fontName, fontSize, fontStyle);
}
}
}
|
using System;
using System.Drawing;
namespace DrawIt
{
public static class FontHelpers
{
public static Font GetHeaderFont()
{
float fontSize = Configuration.GetSettingOrDefault<float>(Constants.Application.Header.FontSize, float.TryParse, Constants.Application.Defaults.HeaderTextSize);
string fontName = Configuration.GetSetting(Constants.Application.Header.FontName) ?? "Segoe Script";
FontStyle fontStyle = Configuration.GetSettingOrDefault<FontStyle>(Constants.Application.Header.FontStyle, Enum.TryParse<FontStyle>, FontStyle.Regular);
return new Font(fontName, fontSize, fontStyle);
}
}
}
|
Change the default font for the header.
|
Change the default font for the header.
|
C#
|
mit
|
AlexGhiondea/DrawIt
|
2af0316fae76cecc805ffe4ca4b3fe0c187b4ad0
|
src/Runners/Giles.Runner.NUnit/NUnitRunner.cs
|
src/Runners/Giles.Runner.NUnit/NUnitRunner.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Giles.Core.Runners;
using Giles.Core.Utility;
using NUnit.Core;
using NUnit.Core.Filters;
namespace Giles.Runner.NUnit
{
public class NUnitRunner : IFrameworkRunner
{
IEnumerable<string> filters;
public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters)
{
this.filters = filters;
var remoteTestRunner = new RemoteTestRunner(0);
var package = SetupTestPackager(assembly);
remoteTestRunner.Load(package);
var listener = new GilesNUnitEventListener();
remoteTestRunner.Run(listener, GetFilters());
return listener.SessionResults;
}
ITestFilter GetFilters()
{
var simpleNameFilter = new SimpleNameFilter(filters.ToArray());
return simpleNameFilter;
}
public IEnumerable<string> RequiredAssemblies()
{
return new[]
{
Assembly.GetAssembly(typeof(NUnitRunner)).Location,
"nunit.core.dll", "nunit.core.interfaces.dll"
};
}
private static TestPackage SetupTestPackager(Assembly assembly)
{
return new TestPackage(assembly.FullName, new[] { assembly.Location });
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Giles.Core.Runners;
using NUnit.Core;
using NUnit.Core.Filters;
namespace Giles.Runner.NUnit
{
public class NUnitRunner : IFrameworkRunner
{
IEnumerable<string> filters;
public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters)
{
this.filters = filters;
var remoteTestRunner = new RemoteTestRunner(0);
var package = SetupTestPackager(assembly);
remoteTestRunner.Load(package);
var listener = new GilesNUnitEventListener();
if (filters.Count() == 0)
remoteTestRunner.Run(listener);
else
remoteTestRunner.Run(listener, GetFilters());
return listener.SessionResults;
}
ITestFilter GetFilters()
{
var simpleNameFilter = new SimpleNameFilter(filters.ToArray());
return simpleNameFilter;
}
public IEnumerable<string> RequiredAssemblies()
{
return new[]
{
Assembly.GetAssembly(typeof(NUnitRunner)).Location,
"nunit.core.dll", "nunit.core.interfaces.dll"
};
}
private static TestPackage SetupTestPackager(Assembly assembly)
{
return new TestPackage(assembly.FullName, new[] { assembly.Location });
}
}
}
|
Fix to not use a test filter in NUnit when no filters has been declared in Giles. This was causing NUnit to not run the tests
|
Fix to not use a test filter in NUnit when no filters has been declared in Giles. This was causing NUnit to not run the tests
|
C#
|
mit
|
michaelsync/Giles,michaelsync/Giles,michaelsync/Giles,codereflection/Giles,michaelsync/Giles,codereflection/Giles,codereflection/Giles
|
fb46a8d1db888b216aac3ddbe306d8c334c1035b
|
src/Arkivverket.Arkade.Core/Base/ArchiveXmlUnit.cs
|
src/Arkivverket.Arkade.Core/Base/ArchiveXmlUnit.cs
|
using System.Collections.Generic;
using System.Linq;
namespace Arkivverket.Arkade.Core.Base
{
public class ArchiveXmlUnit
{
public ArchiveXmlFile File { get; }
public List<ArchiveXmlSchema> Schemas { get; }
public ArchiveXmlUnit(ArchiveXmlFile file, List<ArchiveXmlSchema> schemas)
{
File = file;
Schemas = schemas;
}
public ArchiveXmlUnit(ArchiveXmlFile file, ArchiveXmlSchema schema)
: this(file, new List<ArchiveXmlSchema> {schema})
{
}
public bool AllFilesExists()
{
return !GetMissingFiles().Any();
}
public IEnumerable<string> GetMissingFiles()
{
var missingFiles = new List<string>();
if (!File.Exists)
missingFiles.Add(File.FullName);
missingFiles.AddRange(
from schema in
from schema in Schemas
where schema.IsUserProvided()
select (UserProvidedXmlSchema) schema
where !schema.FileExists
select schema.FullName
);
return missingFiles;
}
}
}
|
using System.Collections.Generic;
using System.Linq;
namespace Arkivverket.Arkade.Core.Base
{
public class ArchiveXmlUnit
{
public ArchiveXmlFile File { get; }
public List<ArchiveXmlSchema> Schemas { get; }
public ArchiveXmlUnit(ArchiveXmlFile file, List<ArchiveXmlSchema> schemas)
{
File = file;
Schemas = schemas;
}
public ArchiveXmlUnit(ArchiveXmlFile file, ArchiveXmlSchema schema)
: this(file, new List<ArchiveXmlSchema> {schema})
{
}
public bool AllFilesExists()
{
return !GetMissingFiles().Any();
}
public IEnumerable<string> GetMissingFiles()
{
var missingFiles = new List<string>();
if (!File.Exists)
missingFiles.Add(File.Name);
missingFiles.AddRange(
from schema in
from schema in Schemas
where schema.IsUserProvided()
select (UserProvidedXmlSchema) schema
where !schema.FileExists
select schema.FullName
);
return missingFiles;
}
}
}
|
Use name only for reporting missing file
|
Use name only for reporting missing file
|
C#
|
agpl-3.0
|
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
|
48fe6e2b8d053b884cfea4113b1bc4208bc2343c
|
src/MarkEmbling.Utils/Extensions/EnumExtensions.cs
|
src/MarkEmbling.Utils/Extensions/EnumExtensions.cs
|
using System;
using System.ComponentModel;
using System.Reflection;
namespace MarkEmbling.Utils.Extensions {
public static class EnumExtensions {
/// <summary>
/// Gets the description of a field in an enumeration. If there is no
/// description attribute, the raw name of the field is provided.
/// </summary>
/// <param name="value">Enum value</param>
/// <returns>Description or raw name</returns>
public static string GetDescription(this Enum value) {
var field = value.GetType().GetField(value.ToString());
var attribute = field.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
return attribute == null ? value.ToString() : attribute.Description;
}
}
}
|
using System;
using System.ComponentModel;
using System.Reflection;
namespace MarkEmbling.Utils.Extensions {
public static class EnumExtensions {
/// <summary>
/// Gets the description of a field in an enumeration. If there is no
/// description attribute, the raw name of the field is provided.
/// </summary>
/// <param name="value">Enum value</param>
/// <returns>Description or raw name</returns>
public static string GetDescription(this Enum value) {
var field = value.GetType().GetRuntimeField(value.ToString());
var attribute = field.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
return attribute == null ? value.ToString() : attribute.Description;
}
}
}
|
Tweak for .net Standard 1.1 compatibility
|
Tweak for .net Standard 1.1 compatibility
|
C#
|
mit
|
markembling/MarkEmbling.Utils,markembling/MarkEmbling.Utilities
|
fc4d7c0089d3df6c7a799c74381c79dde6ad4d87
|
Vikekh.Stepbot/Program.cs
|
Vikekh.Stepbot/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Vikekh.Stepbot
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
using SlackAPI;
using System;
using System.Threading;
namespace Vikekh.Stepbot
{
class Program
{
static void Main(string[] args)
{
var botAuthToken = "";
var userAuthToken = "";
var name = "@stepdot";
var age = (new DateTime(2017, 1, 18) - DateTime.Now).Days / 365.0;
var ageString = age.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture);
var version = "0.1.0";
var mommy = "@vem";
ManualResetEventSlim clientReady = new ManualResetEventSlim(false);
SlackSocketClient client = new SlackSocketClient(botAuthToken);
client.Connect((connected) =>
{
// This is called once the client has emitted the RTM start command
clientReady.Set();
}, () =>
{
// This is called once the RTM client has connected to the end point
});
client.OnMessageReceived += (message) =>
{
// Handle each message as you receive them
Console.WriteLine(message.text);
var textData = string.Format("hello w0rld my name is {0} I am {1} years old and my version is {2} and my mommy is {3}", name, ageString, version, mommy);
client.SendMessage((x) => { }, message.channel, textData);
};
clientReady.Wait();
Console.ReadLine();
}
}
}
|
Test receive and send message
|
Test receive and send message
|
C#
|
mit
|
vikekh/stepbot
|
7deffcb1b9c1ad202dbda734c2df241d7b92d48a
|
ClientServerMix/TimeSeriesService.Client/Program.cs
|
ClientServerMix/TimeSeriesService.Client/Program.cs
|
using System;
using System.Collections.Generic;
using TimeSeries;
using TimeSeriesService.Client.TimeSeriesReference;
namespace TimeSeriesService.Client
{
class Program
{
static void Main()
{
var proxy = new TimeSeriesServiceClient();
var oneDataPoint = new List<DataPoint>
{
new DataPoint()
}.ToArray();
var oneDataPointResult = proxy.New(oneDataPoint);
Console.WriteLine("Irregular: {0}", oneDataPointResult);
Console.WriteLine("Press <ENTER> to terminate client.");
Console.ReadLine();
}
}
}
|
using System;
using System.Collections.Generic;
using TimeSeries;
using TimeSeriesService.Client.TimeSeriesReference;
namespace TimeSeriesService.Client
{
class Program
{
static void Main()
{
var proxy = new TimeSeriesServiceClient();
var oneDataPoint = new List<DataPoint>
{
new DataPoint()
}.ToArray();
var oneDataPointResult = proxy.New(oneDataPoint);
Console.WriteLine("One data point: {0}", oneDataPointResult);
var twoDataPoints = new List<DataPoint>
{
new DataPoint(),
new DataPoint()
}.ToArray();
var twoDataPointsResult = proxy.New(twoDataPoints);
Console.WriteLine("Two data points: {0}", twoDataPointsResult);
var threeDataPoints = new List<DataPoint>
{
new DataPoint(),
new DataPoint(),
new DataPoint()
}.ToArray();
var threeDataPointsResult = proxy.New(threeDataPoints);
Console.WriteLine("Three data points: {0}",
threeDataPointsResult);
Console.WriteLine();
Console.WriteLine("--");
Console.WriteLine();
Console.WriteLine("Press <ENTER> to terminate client.");
Console.ReadLine();
}
}
}
|
Add additional functional test cases.
|
Add additional functional test cases.
Add code to test for two data points (returning a `RegularTimeSeries`)
and for three data points (returning a `SetPointTimeSeries`).
|
C#
|
epl-1.0
|
mrwizard82d1/wcf_migration
|
5da1b843655f1cb672acc8b916cb97b0bdaa6fd3
|
Source/Core.EntityFramework/ScopeStore.cs
|
Source/Core.EntityFramework/ScopeStore.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.Services;
namespace Thinktecture.IdentityServer.Core.EntityFramework
{
public class ScopeStore : IScopeStore
{
private readonly string _connectionString;
public ScopeStore(string connectionString)
{
_connectionString = connectionString;
}
public Task<IEnumerable<Models.Scope>> GetScopesAsync()
{
using (var db = new CoreDbContext(_connectionString))
{
var scopes = db.Scopes
.Include("ScopeClaims")
.ToArray();
var models = scopes.ToList().Select(x => x.ToModel());
return Task.FromResult(models);
}
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.Services;
namespace Thinktecture.IdentityServer.Core.EntityFramework
{
public class ScopeStore : IScopeStore
{
private readonly string _connectionString;
public ScopeStore(string connectionString)
{
_connectionString = connectionString;
}
public Task<IEnumerable<Models.Scope>> GetScopesAsync()
{
using (var db = new CoreDbContext(_connectionString))
{
var scopes = db.Scopes
.Include("ScopeClaims");
var models = scopes.ToList().Select(x => x.ToModel());
return Task.FromResult(models);
}
}
}
}
|
Remove redundant LINQ method call
|
Remove redundant LINQ method call
ToList() already forces the IQueryable to execute. No need to call
ToArray() beforehand.
|
C#
|
apache-2.0
|
faithword/IdentityServer3.EntityFramework,IdentityServer/IdentityServer3.EntityFramework,henkmeulekamp/IdentityServer3.EntityFramework,chwilliamson/IdentityServer3.EntityFramework,buybackoff/IdentityServer3.EntityFramework
|
de4dd353e065c5ceda6bbbe5c4ecc7ca502cf68d
|
Mappy/Util/ImageSampling/NearestNeighbourWrapper.cs
|
Mappy/Util/ImageSampling/NearestNeighbourWrapper.cs
|
namespace Mappy.Util.ImageSampling
{
using System.Drawing;
public class NearestNeighbourWrapper : IPixelImage
{
private readonly IPixelImage source;
public NearestNeighbourWrapper(IPixelImage source, int width, int height)
{
this.source = source;
this.Width = width;
this.Height = height;
}
public int Width { get; private set; }
public int Height { get; private set; }
public Color this[int x, int y]
{
get
{
int imageX = (int)((x / (float)this.Width) * this.source.Width);
int imageY = (int)((y / (float)this.Height) * this.source.Height);
return this.source[imageX, imageY];
}
}
}
}
|
namespace Mappy.Util.ImageSampling
{
using System.Drawing;
public class NearestNeighbourWrapper : IPixelImage
{
private readonly IPixelImage source;
public NearestNeighbourWrapper(IPixelImage source, int width, int height)
{
this.source = source;
this.Width = width;
this.Height = height;
}
public int Width { get; private set; }
public int Height { get; private set; }
public Color this[int x, int y]
{
get
{
// sample at the centre of each pixel
float ax = x + 0.5f;
float ay = y + 0.5f;
int imageX = (int)((ax / this.Width) * this.source.Width);
int imageY = (int)((ay / this.Height) * this.source.Height);
return this.source[imageX, imageY];
}
}
}
}
|
Fix small offset in low quality minimap image
|
Fix small offset in low quality minimap image
|
C#
|
mit
|
MHeasell/Mappy,MHeasell/Mappy
|
73d8ff02af320b8ef05156a4268f9996d2c6433b
|
SaferMutex.Tests/FileBased/ThreadedStressTestsV2.cs
|
SaferMutex.Tests/FileBased/ThreadedStressTestsV2.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NiceIO;
using NUnit.Framework;
using SaferMutex.Tests.BaseSuites;
namespace SaferMutex.Tests.FileBased
{
[TestFixture]
public class ThreadedStressTestsV2 : BaseThreadedStressTests
{
protected override ISaferMutexMutex CreateMutexImplementation(bool initiallyOwned, string name, out bool owned, out bool createdNew)
{
return new SaferMutex.FileBased(initiallyOwned, name, Scope.CurrentProcess, out owned, out createdNew, _tempDirectory.ToString());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NiceIO;
using NUnit.Framework;
using SaferMutex.Tests.BaseSuites;
namespace SaferMutex.Tests.FileBased
{
[TestFixture]
public class ThreadedStressTestsV2 : BaseThreadedStressTests
{
protected override ISaferMutexMutex CreateMutexImplementation(bool initiallyOwned, string name, out bool owned, out bool createdNew)
{
return new SaferMutex.FileBased2(initiallyOwned, name, Scope.CurrentProcess, out owned, out createdNew, _tempDirectory.ToString());
}
}
}
|
Fix stress test not creating v2
|
Fix stress test not creating v2
|
C#
|
mit
|
mrvoorhe/SaferMutex,mrvoorhe/SaferMutex
|
8ef49d527799d6580d3e8f1c1ab43b87794441ac
|
AspNetAPI/Options.cs
|
AspNetAPI/Options.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Hanc.AspNetAPI
{
/// <summary>
/// The options pattern uses custom options classes to represent a group of related settings.
/// See Startup.cs and ValuesController.cs for implimentation code
/// </summary>
public class SecretOptions
{
public SecretOptions()
{
MacSecret = "default_secret";
}
public string MacSecret { get; set; }
public string ApiKey { get; set; }
}
/// <summary>
/// The options pattern uses custom options classes to represent a group of related settings.
/// See Startup.cs and HelloController.cs for implimentation code
/// </summary>
public class HelloOptions
{
public HelloOptions()
{
HelloValue = "...";
}
public string HelloValue { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Hanc.AspNetAPI
{
/// <summary>
/// The options pattern uses custom options classes to represent a group of related settings.
/// See Startup.cs and ValuesController.cs for implimentation code
/// </summary>
public class SecretOptions
{
public SecretOptions()
{
MacSecret = "default_secret";
}
public string MacSecret { get; set; }
public string AppId { get; set; }
public bool RequireApiAuthToken { get; set; }
}
/// <summary>
/// The options pattern uses custom options classes to represent a group of related settings.
/// See Startup.cs and HelloController.cs for implimentation code
/// </summary>
public class HelloOptions
{
public HelloOptions()
{
HelloValue = "...";
}
public string HelloValue { get; set; }
}
}
|
Change ApiKey to AppId add RequireApiAuthToken
|
Change ApiKey to AppId add RequireApiAuthToken
|
C#
|
mit
|
thewizster/hanc,thewizster/hanc
|
3b56b93ba1822149d495d560263679d7d14ab80e
|
samples/Sandbox/Program.cs
|
samples/Sandbox/Program.cs
|
using Avalonia;
namespace Sandbox
{
public class Program
{
static void Main(string[] args)
{
AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace()
.StartWithClassicDesktopLifetime(args);
}
}
}
|
using Avalonia;
namespace Sandbox
{
public class Program
{
static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
}
|
Make the designer work in the sandbox project.
|
Make the designer work in the sandbox project.
|
C#
|
mit
|
wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Perspex
|
723799949217fea5438b8b8264a200eb1262a753
|
DataReader/DataReader/Controllers/NameQueryController.cs
|
DataReader/DataReader/Controllers/NameQueryController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using DataReader.BusinessLogic;
using DataReader.Models;
namespace DataReader.Controllers
{
[RoutePrefix("api")]
public class NameQueryController : ApiController
{
private readonly INameBusinessLogic _nameBusinessLogic;
public NameQueryController(INameBusinessLogic nameBusinessLogic)
{
_nameBusinessLogic = nameBusinessLogic;
}
[Route("fullName/{id}")]
[HttpGet]
public async Task<IHttpActionResult> GetData(string id)
{
var result = default(NameDTO);
try
{
result = _nameBusinessLogic.GetById(id);
}
catch (Exception ex)
{
return StatusCode(HttpStatusCode.ExpectationFailed);
}
return Ok(result);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using DataReader.BusinessLogic;
using DataReader.Models;
namespace DataReader.Controllers
{
[RoutePrefix("api")]
public class NameQueryController : ApiController
{
private readonly INameBusinessLogic _nameBusinessLogic;
public NameQueryController(INameBusinessLogic nameBusinessLogic)
{
_nameBusinessLogic = nameBusinessLogic;
}
[Route("fullName/{id}")]
[HttpGet]
public IHttpActionResult GetName(string id)
{
var result = default(NameDTO);
try
{
result = _nameBusinessLogic.GetById(id);
}
catch (Exception ex)
{
return StatusCode(HttpStatusCode.ExpectationFailed);
}
return Ok(result);
}
[Route("fullName")]
[HttpGet]
public IHttpActionResult GetAllNames()
{
var result = default(string[]);
try
{
result = _nameBusinessLogic.GetAllNameIds();
}
catch (Exception ex)
{
return StatusCode(HttpStatusCode.ExpectationFailed);
}
return Ok(result);
}
}
}
|
Add GET All Names endpoint
|
Add GET All Names endpoint
|
C#
|
mit
|
Salgat/EventSourcing-Demo
|
8a6849717897bafcfbc6e47d27cf065df1bd1f5d
|
SignInCheckIn/SignInCheckIn/Models/DTO/ParticipantDto.cs
|
SignInCheckIn/SignInCheckIn/Models/DTO/ParticipantDto.cs
|
using System;
using System.Linq;
using Microsoft.Practices.ObjectBuilder2;
namespace SignInCheckIn.Models.DTO
{
public class ParticipantDto
{
public int EventParticipantId { get; set; }
public int ParticipantId { get; set; }
public int ContactId { get; set; }
public int HouseholdId { get; set; }
public int HouseholdPositionId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime DateOfBirth { get; set; }
public bool Selected { get; set; } = false;
public int ParticipationStatusId { get; set; }
public int? AssignedRoomId { get; set; }
public string AssignedRoomName { get; set; }
public int? AssignedSecondaryRoomId { get; set; } // adventure club field
public string AssignedSecondaryRoomName { get; set; } // adventure club field
public string CallNumber
{
get
{
var c = $"0000{EventParticipantId}";
return c.Substring(c.Length - 4);
}
}
}
}
|
using System;
using System.Linq;
using Microsoft.Practices.ObjectBuilder2;
namespace SignInCheckIn.Models.DTO
{
public class ParticipantDto
{
public int EventParticipantId { get; set; }
public int ParticipantId { get; set; }
public int ContactId { get; set; }
public int HouseholdId { get; set; }
public int HouseholdPositionId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime DateOfBirth { get; set; }
public bool Selected { get; set; } = false;
public int ParticipationStatusId { get; set; }
public int? AssignedRoomId { get; set; }
public string AssignedRoomName { get; set; }
public int? AssignedSecondaryRoomId { get; set; } // adventure club field
public string AssignedSecondaryRoomName { get; set; } // adventure club field
public string CallNumber
{
// TODO Faking out a call number for now (last 4 of EventParticipantId), eventually need to store a real call number on Event Participant
get
{
var c = $"0000{EventParticipantId}";
return c.Substring(c.Length - 4);
}
}
}
}
|
Add TODO on fake CallNumber
|
US5688: Add TODO on fake CallNumber
|
C#
|
bsd-2-clause
|
crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin
|
31de56936f3e698284801b8144e63c15eef8d193
|
MultiMiner.Xgminer.Api/ApiContext.cs
|
MultiMiner.Xgminer.Api/ApiContext.cs
|
using MultiMiner.Xgminer.Api.Parsers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace MultiMiner.Xgminer.Api
{
public class ApiContext
{
private TcpClient tcpClient;
public ApiContext(int port)
{
tcpClient = new TcpClient("127.0.0.1", port);
}
public List<DeviceInformation> GetDeviceInformation()
{
string textResponse = GetResponse(ApiVerb.Devs);
List<DeviceInformation> result = new List<DeviceInformation>();
DeviceInformationParser.ParseTextForDeviceInformation(textResponse, result);
return result;
}
public void QuitMining()
{
GetResponse(ApiVerb.Quit);
}
private string GetResponse(string apiVerb)
{
NetworkStream stream = tcpClient.GetStream();
Byte[] request = System.Text.Encoding.ASCII.GetBytes(apiVerb);
stream.Write(request, 0, request.Length);
Byte[] responseBuffer = new Byte[4096];
string response = string.Empty;
int bytesRead = stream.Read(responseBuffer, 0, responseBuffer.Length);
response = System.Text.Encoding.ASCII.GetString(responseBuffer, 0, bytesRead);
return response;
}
}
}
|
using MultiMiner.Xgminer.Api.Parsers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace MultiMiner.Xgminer.Api
{
public class ApiContext
{
private TcpClient tcpClient;
public ApiContext(int port)
{
tcpClient = new TcpClient("127.0.0.1", port);
}
public List<DeviceInformation> GetDeviceInformation()
{
string textResponse = GetResponse(ApiVerb.Devs);
List<DeviceInformation> result = new List<DeviceInformation>();
DeviceInformationParser.ParseTextForDeviceInformation(textResponse, result);
return result;
}
public void QuitMining()
{
GetResponse(ApiVerb.Quit);
}
private string GetResponse(string apiVerb)
{
NetworkStream tcpStream = tcpClient.GetStream();
Byte[] request = Encoding.ASCII.GetBytes(apiVerb);
tcpStream.Write(request, 0, request.Length);
Byte[] responseBuffer = new Byte[4096];
string response = string.Empty;
do
{
int bytesRead = tcpStream.Read(responseBuffer, 0, responseBuffer.Length);
response = response + Encoding.ASCII.GetString(responseBuffer, 0, bytesRead);
} while (tcpStream.DataAvailable);
return response;
}
}
}
|
Improve TCP reading code to read more than 4096 bytes if available
|
Improve TCP reading code to read more than 4096 bytes if available
|
C#
|
mit
|
nwoolls/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner,IWBWbiz/MultiMiner
|
c963effd59e099cf9dc5ccc9c6120a6276ed57af
|
Mapsui/MPoint2.cs
|
Mapsui/MPoint2.cs
|
namespace Mapsui;
public class MPoint2
{
public double X { get; set; }
public double Y { get; set; }
}
|
using Mapsui.Utilities;
namespace Mapsui;
public class MPoint2
{
public double X { get; set; }
public double Y { get; set; }
/// <summary>
/// Calculates a new point by rotating this point clockwise about the specified center point
/// </summary>
/// <param name="degrees">Angle to rotate clockwise (degrees)</param>
/// <param name="centerX">X coordinate of point about which to rotate</param>
/// <param name="centerY">Y coordinate of point about which to rotate</param>
/// <returns>Returns the rotated point</returns>
public MPoint Rotate(double degrees, double centerX, double centerY)
{
// translate this point back to the center
var newX = X - centerX;
var newY = Y - centerY;
// rotate the values
var p = Algorithms.RotateClockwiseDegrees(newX, newY, degrees);
// translate back to original reference frame
newX = p.X + centerX;
newY = p.Y + centerY;
return new MPoint(newX, newY);
}
/// <summary>
/// Calculates a new point by rotating this point clockwise about the specified center point
/// </summary>
/// <param name="degrees">Angle to rotate clockwise (degrees)</param>
/// <param name="center">MPoint about which to rotate</param>
/// <returns>Returns the rotated point</returns>
public MPoint Rotate(double degrees, MPoint center)
{
return Rotate(degrees, center.X, center.Y);
}
}
|
Add Rotate methods contributed by CLA signers
|
Add Rotate methods contributed by CLA signers
|
C#
|
mit
|
charlenni/Mapsui,charlenni/Mapsui
|
29df2644e0c9f3af0b6be43dca75ca39e0714baf
|
src/Glimpse.Server/Resources/ClientResource.cs
|
src/Glimpse.Server/Resources/ClientResource.cs
|
using System.Reflection;
using Glimpse.Server.Web;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.StaticFiles;
namespace Glimpse.Server.Resources
{
public class ClientResource : IResourceStartup
{
public void Configure(IResourceBuilder resourceBuilder)
{
// TODO: Add HTTP Caching
var options = new FileServerOptions();
options.RequestPath = "/Client";
options.EnableDefaultFiles = false;
options.StaticFileOptions.ContentTypeProvider = new FileExtensionContentTypeProvider();
options.FileProvider = new EmbeddedFileProvider(typeof(ClientResource).GetTypeInfo().Assembly, "Glimpse.Server.Resources.Embed.Client");
resourceBuilder.AppBuilder.UseFileServer(options);
}
public ResourceType Type => ResourceType.Client;
}
}
|
using System.Reflection;
using Glimpse.Server.Web;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.StaticFiles;
namespace Glimpse.Server.Resources
{
public class ClientResource : IResourceStartup
{
public void Configure(IResourceBuilder resourceBuilder)
{
// TODO: Add HTTP Caching
var options = new FileServerOptions();
options.RequestPath = "/Client";
options.EnableDefaultFiles = false;
options.StaticFileOptions.ContentTypeProvider = new FileExtensionContentTypeProvider();
options.FileProvider = new EmbeddedFileProvider(typeof(ClientResource).GetTypeInfo().Assembly, "Glimpse.Server.Resources.Embeded.Client");
resourceBuilder.AppBuilder.UseFileServer(options);
}
public ResourceType Type => ResourceType.Client;
}
}
|
Fix internal path for embedded client
|
Fix internal path for embedded client
|
C#
|
mit
|
Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype
|
092a408911f53dab80a55b3e810b69fe8cb12221
|
Version.cs
|
Version.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Version.cs" company="">
// Copyright 2013 Thomas PIERRAIN
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Reflection;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.2.0")]
[assembly: AssemblyFileVersion("1.3.2.0")]
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Version.cs" company="">
// Copyright 2013 Thomas PIERRAIN
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Reflection;
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
|
Update the version number to 1.4.0
|
Update the version number to 1.4.0
|
C#
|
apache-2.0
|
tpierrain/NFluent,NFluent/NFluent,dupdob/NFluent,tpierrain/NFluent,NFluent/NFluent,dupdob/NFluent,tpierrain/NFluent,dupdob/NFluent
|
c3b3ebc40a47b3daa1151e06d82247d87585037c
|
src/Server/Bit.OData/ODataControllers/JobsInfoController.cs
|
src/Server/Bit.OData/ODataControllers/JobsInfoController.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Bit.Core.Contracts;
using Bit.Core.Models;
using Bit.Model.Dtos;
namespace Bit.OData.ODataControllers
{
public class JobsInfoController : DtoController<JobInfoDto>
{
public virtual IBackgroundJobWorker BackgroundJobWorker { get; set; }
[Get]
public virtual async Task<JobInfoDto> Get(string key, CancellationToken cancellationToken)
{
if (key == null)
throw new ArgumentNullException(nameof(key));
JobInfo jobInfo = await BackgroundJobWorker.GetJobInfoAsync(key, cancellationToken);
return new JobInfoDto
{
Id = jobInfo.Id,
CreatedAt = jobInfo.CreatedAt,
State = jobInfo.State
};
}
}
}
|
using Bit.Core.Contracts;
using Bit.Core.Models;
using Bit.Model.Dtos;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Bit.OData.ODataControllers
{
public class JobsInfoController : DtoController<JobInfoDto>
{
public virtual IBackgroundJobWorker BackgroundJobWorker { get; set; }
[Get]
public virtual async Task<JobInfoDto> Get(string key, CancellationToken cancellationToken)
{
if (key == null)
throw new ArgumentNullException(nameof(key));
if (BackgroundJobWorker == null)
throw new InvalidOperationException("No background job worker is configured");
JobInfo jobInfo = await BackgroundJobWorker.GetJobInfoAsync(key, cancellationToken);
return new JobInfoDto
{
Id = jobInfo.Id,
CreatedAt = jobInfo.CreatedAt,
State = jobInfo.State
};
}
}
}
|
Check background job worker before using that in jobs info controller
|
Check background job worker before using that in jobs info controller
|
C#
|
mit
|
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
|
9a3f9adfa218a67956afe2986ed34fe2d3944d18
|
Source/Kinugasa.UI/BindingProxy.cs
|
Source/Kinugasa.UI/BindingProxy.cs
|
using System.Windows;
namespace Kinugasa.UI
{
/// <summary>
/// Proxy class for binding sorce.
/// </summary>
public class BindingProxy : Freezable
{
/// <summary>
/// Define dependencyProperty.
/// </summary>
public static readonly DependencyProperty DataProperty =
DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null));
/// <summary>
/// Create freezable object's instance.
/// </summary>
/// <returns></returns>
protected override Freezable CreateInstanceCore()
{
return new BindingProxy();
}
/// <summary>
/// Proxy property.
/// </summary>
public object Data
{
get { return (object)GetValue(DataProperty); }
set { SetValue(DataProperty, value); }
}
}
}
|
using System.Windows;
/// <summary>
/// Provide userinterface components.
/// </summary>
namespace Kinugasa.UI
{
/// <summary>
/// Proxy class for binding sorce.
/// </summary>
public class BindingProxy : Freezable
{
/// <summary>
/// Define dependencyProperty.
/// </summary>
public static readonly DependencyProperty DataProperty =
DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null));
/// <summary>
/// Create freezable object's instance.
/// </summary>
/// <returns></returns>
protected override Freezable CreateInstanceCore()
{
return new BindingProxy();
}
/// <summary>
/// Proxy property.
/// </summary>
public object Data
{
get { return (object)GetValue(DataProperty); }
set { SetValue(DataProperty, value); }
}
}
}
|
Add xml comment on namespace.
|
Add xml comment on namespace.
|
C#
|
mit
|
YoshinoriN/Kinugasa
|
d3615d7deea12f8b2a8d863c6959003b624b5c72
|
src/Winium.Desktop.Driver/CommandExecutors/IsElementSelectedExecutor.cs
|
src/Winium.Desktop.Driver/CommandExecutors/IsElementSelectedExecutor.cs
|
namespace Winium.Desktop.Driver.CommandExecutors
{
#region using
using System.Windows.Automation;
using Winium.Cruciatus.Extensions;
using Winium.StoreApps.Common;
#endregion
internal class IsElementSelectedExecutor : CommandExecutorBase
{
#region Methods
protected override string DoImpl()
{
var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();
var element = this.Automator.Elements.GetRegisteredElement(registeredKey);
var controlType = element.GetAutomationPropertyValue<ControlType>(AutomationElement.ControlTypeProperty);
if (controlType.Equals(ControlType.CheckBox))
{
return this.JsonResponse(ResponseStatus.Success, element.ToCheckBox().IsToggleOn);
}
var property = SelectionItemPattern.IsSelectedProperty;
var isSelected = element.GetAutomationPropertyValue<bool>(property);
return this.JsonResponse(ResponseStatus.Success, isSelected);
}
#endregion
}
}
|
namespace Winium.Desktop.Driver.CommandExecutors
{
#region using
using System.Windows.Automation;
using Winium.Cruciatus.Exceptions;
using Winium.Cruciatus.Extensions;
using Winium.StoreApps.Common;
#endregion
internal class IsElementSelectedExecutor : CommandExecutorBase
{
#region Methods
protected override string DoImpl()
{
var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();
var element = this.Automator.Elements.GetRegisteredElement(registeredKey);
var isSelected = false;
try
{
var isTogglePattrenAvailable =
element.GetAutomationPropertyValue<bool>(AutomationElement.IsTogglePatternAvailableProperty);
if (isTogglePattrenAvailable)
{
var toggleStateProperty = TogglePattern.ToggleStateProperty;
var toggleState = element.GetAutomationPropertyValue<ToggleState>(toggleStateProperty);
isSelected = toggleState == ToggleState.On;
}
}
catch (CruciatusException)
{
var selectionItemProperty = SelectionItemPattern.IsSelectedProperty;
isSelected = element.GetAutomationPropertyValue<bool>(selectionItemProperty);
}
return this.JsonResponse(ResponseStatus.Success, isSelected);
}
#endregion
}
}
|
Check IsTogglePatternAvailable insted of using ControlType
|
Check IsTogglePatternAvailable insted of using ControlType
|
C#
|
mpl-2.0
|
jorik041/Winium.Desktop,2gis/Winium.Desktop,zebraxxl/Winium.Desktop
|
68b599fc96a4cf3b62b48abcc4708021767953cd
|
src/SharedAssemblyInfo.cs
|
src/SharedAssemblyInfo.cs
|
using System.Runtime.InteropServices;
using System.Reflection;
#if DEBUG
[assembly: AssemblyProduct("MeepMeep (Debug)")]
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyProduct("MeepMeep (Release)")]
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyDescription("MeepMeep - A super simple workload utility for the Couchbase .Net client.")]
[assembly: AssemblyCompany("Daniel Wertheim")]
[assembly: AssemblyCopyright("Copyright © 2013 Daniel Wertheim")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("0.1.0.*")]
[assembly: AssemblyFileVersion("0.1.0")]
|
using System.Reflection;
#if DEBUG
[assembly: AssemblyProduct("MeepMeep (Debug)")]
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyProduct("MeepMeep (Release)")]
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyDescription("MeepMeep - A super simple workload utility for the Couchbase .NET client.")]
[assembly: AssemblyCompany("Couchbase")]
[assembly: AssemblyCopyright("Copyright © 2017 Couchbase")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("0.1.0.*")]
[assembly: AssemblyFileVersion("0.1.0")]
|
Update AssemblyInfo to reference Couchbase as owner / copyright
|
Update AssemblyInfo to reference Couchbase as owner / copyright
|
C#
|
apache-2.0
|
couchbaselabs/meep-meep
|
17283a0844515e045329cf48b025aab5c4ab5059
|
src/ZBlog/Views/Shared/Components/Catalog/Default.cshtml
|
src/ZBlog/Views/Shared/Components/Catalog/Default.cshtml
|
@model List<Catalog>
<div class="am-panel-hd">Catalog</div>
<div class="am-panel-bd">
@foreach (var catalog in Model)
{
<a asp-controller="Home" asp-action="Catalog" asp-route-title="@catalog.Url">
@catalog.Title
<span class="am-badge am-badge-secondary am-round">@catalog.Posts.Count()</span>
</a>
}
</div>
|
@model List<Catalog>
<div class="am-panel-hd">Catalog</div>
<div class="am-panel-bd">
@foreach (var catalog in Model)
{
<a asp-controller="Home" asp-action="Catalog" asp-route-title="@catalog.Url">
@catalog.Title
<span class="am-badge am-badge-success am-round">@catalog.Posts.Count()</span>
</a>
}
</div>
|
Update catalog list item style
|
Update catalog list item style
make it different from tag list item style
|
C#
|
mit
|
Jeffiy/ZBlog-Net,Jeffiy/ZBlog-Net,Jeffiy/ZBlog-Net
|
d8c7a16aa1e40bea247787ec8dc943449cc395bc
|
trunk/DefaultCombat/Extensions/TorCharacterExtensions.cs
|
trunk/DefaultCombat/Extensions/TorCharacterExtensions.cs
|
using Buddy.Swtor.Objects;
namespace DefaultCombat.Extensions
{
public static class TorCharacterExtensions
{
public static bool ShouldDispel(this TorCharacter target, string debuffName)
{
if (target == null)
return false;
return target.HasDebuff(debuffName);
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Buddy.Swtor.Objects;
namespace DefaultCombat.Extensions
{
public static class TorCharacterExtensions
{
private static readonly IReadOnlyList<string> _dispellableDebuffs = new List<string>
{
"Hunting Trap",
"Burning (Physical)"
};
public static bool ShouldDispel(this TorCharacter target)
{
return target != null && _dispellableDebuffs.Any(target.HasDebuff);
}
}
}
|
Return whether the target has any dispellable debuff
|
Return whether the target has any dispellable debuff
|
C#
|
apache-2.0
|
BosslandGmbH/BuddyWing.DefaultCombat
|
894e90f485bd7c024e19152154d75e51c8883c83
|
src/Orchard.Web/Modules/Orchard.Lists/Views/Parts.Container.Manage.cshtml
|
src/Orchard.Web/Modules/Orchard.Lists/Views/Parts.Container.Manage.cshtml
|
@using Orchard.ContentManagement.MetaData.Models
@{
var containerId = (int) Model.ContainerId;
var itemContentTypes = (IList<ContentTypeDefinition>)Model.ItemContentTypes;
}
<div class="item-properties actions">
<p>
@Html.ActionLink(T("{0} Properties", Html.Raw((string)Model.ContainerDisplayName)).Text, "Edit", new { Area = "Contents", Id = (int)Model.ContainerId, ReturnUrl = Html.ViewContext.HttpContext.Request.RawUrl })
</p>
</div>
<div class="manage">
@if (itemContentTypes.Any()) {
foreach (var contentType in itemContentTypes) {
@Html.ActionLink(T("New {0}", Html.Raw(contentType.DisplayName)).Text, "Create", "Admin", new { area = "Contents", id = contentType.Name, containerId }, new { @class = "button primaryAction create-content" })
}
}
else {
@Html.ActionLink(T("New Content").ToString(), "Create", "Admin", new { area = "Contents", containerId }, new { @class = "button primaryAction create-content" })
}
<a id="chooseItems" href="#" class="button primaryAction">@T("Choose Items")</a>
</div>
|
@using Orchard.ContentManagement.MetaData.Models
@{
var containerId = (int) Model.ContainerId;
var itemContentTypes = (IList<ContentTypeDefinition>)Model.ItemContentTypes;
}
<div class="item-properties actions">
<p>
@Html.ActionLink(T("{0} Properties", (string)Model.ContainerDisplayName), "Edit", new { Area = "Contents", Id = (int)Model.ContainerId, ReturnUrl = Html.ViewContext.HttpContext.Request.RawUrl })
</p>
</div>
<div class="manage">
@if (itemContentTypes.Any()) {
foreach (var contentType in itemContentTypes) {
@Html.ActionLink(T("New {0}", contentType.DisplayName), "Create", "Admin", new { area = "Contents", id = contentType.Name, containerId }, new { @class = "button primaryAction create-content" })
}
}
else {
@Html.ActionLink(T("New Content"), "Create", "Admin", new { area = "Contents", containerId }, new { @class = "button primaryAction create-content" })
}
<a id="chooseItems" href="#" class="button primaryAction">@T("Choose Items")</a>
</div>
|
Use new ActionLink extension method.
|
Use new ActionLink extension method.
|
C#
|
bsd-3-clause
|
fortunearterial/Orchard,huoxudong125/Orchard,JRKelso/Orchard,li0803/Orchard,qt1/Orchard,qt1/Orchard,brownjordaninternational/OrchardCMS,Serlead/Orchard,SeyDutch/Airbrush,dmitry-urenev/extended-orchard-cms-v10.1,sfmskywalker/Orchard,alejandroaldana/Orchard,Fogolan/OrchardForWork,cooclsee/Orchard,aaronamm/Orchard,dcinzona/Orchard,emretiryaki/Orchard,aaronamm/Orchard,Fogolan/OrchardForWork,cooclsee/Orchard,qt1/Orchard,Ermesx/Orchard,bedegaming-aleksej/Orchard,geertdoornbos/Orchard,TalaveraTechnologySolutions/Orchard,Ermesx/Orchard,vairam-svs/Orchard,abhishekluv/Orchard,yersans/Orchard,fassetar/Orchard,rtpHarry/Orchard,SouleDesigns/SouleDesigns.Orchard,jimasp/Orchard,jagraz/Orchard,jtkech/Orchard,xiaobudian/Orchard,johnnyqian/Orchard,RoyalVeterinaryCollege/Orchard,vairam-svs/Orchard,hannan-azam/Orchard,Serlead/Orchard,yonglehou/Orchard,jersiovic/Orchard,escofieldnaxos/Orchard,jimasp/Orchard,SouleDesigns/SouleDesigns.Orchard,mvarblow/Orchard,geertdoornbos/Orchard,abhishekluv/Orchard,TalaveraTechnologySolutions/Orchard,xkproject/Orchard,rtpHarry/Orchard,huoxudong125/Orchard,Sylapse/Orchard.HttpAuthSample,alejandroaldana/Orchard,Lombiq/Orchard,vairam-svs/Orchard,kouweizhong/Orchard,jtkech/Orchard,Fogolan/OrchardForWork,Ermesx/Orchard,li0803/Orchard,openbizgit/Orchard,Codinlab/Orchard,brownjordaninternational/OrchardCMS,Dolphinsimon/Orchard,jtkech/Orchard,tobydodds/folklife,armanforghani/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,rtpHarry/Orchard,jagraz/Orchard,yonglehou/Orchard,SeyDutch/Airbrush,JRKelso/Orchard,kouweizhong/Orchard,TaiAivaras/Orchard,AdvantageCS/Orchard,hannan-azam/Orchard,neTp9c/Orchard,johnnyqian/Orchard,openbizgit/Orchard,hbulzy/Orchard,vairam-svs/Orchard,mvarblow/Orchard,huoxudong125/Orchard,huoxudong125/Orchard,neTp9c/Orchard,JRKelso/Orchard,openbizgit/Orchard,yersans/Orchard,Lombiq/Orchard,dburriss/Orchard,mvarblow/Orchard,bedegaming-aleksej/Orchard,LaserSrl/Orchard,jimasp/Orchard,jtkech/Orchard,yonglehou/Orchard,ehe888/Orchard,AdvantageCS/Orchard,jersiovic/Orchard,AdvantageCS/Orchard,omidnasri/Orchard,Ermesx/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,phillipsj/Orchard,johnnyqian/Orchard,johnnyqian/Orchard,jtkech/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,jersiovic/Orchard,Serlead/Orchard,Dolphinsimon/Orchard,planetClaire/Orchard-LETS,rtpHarry/Orchard,escofieldnaxos/Orchard,RoyalVeterinaryCollege/Orchard,xiaobudian/Orchard,grapto/Orchard.CloudBust,LaserSrl/Orchard,spraiin/Orchard,hbulzy/Orchard,dcinzona/Orchard,cooclsee/Orchard,kgacova/Orchard,sfmskywalker/Orchard,omidnasri/Orchard,spraiin/Orchard,li0803/Orchard,RoyalVeterinaryCollege/Orchard,Sylapse/Orchard.HttpAuthSample,rtpHarry/Orchard,LaserSrl/Orchard,abhishekluv/Orchard,geertdoornbos/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard,brownjordaninternational/OrchardCMS,hannan-azam/Orchard,spraiin/Orchard,Sylapse/Orchard.HttpAuthSample,jagraz/Orchard,jchenga/Orchard,IDeliverable/Orchard,bedegaming-aleksej/Orchard,TalaveraTechnologySolutions/Orchard,TaiAivaras/Orchard,jchenga/Orchard,Lombiq/Orchard,Sylapse/Orchard.HttpAuthSample,spraiin/Orchard,AdvantageCS/Orchard,abhishekluv/Orchard,bedegaming-aleksej/Orchard,ehe888/Orchard,armanforghani/Orchard,IDeliverable/Orchard,tobydodds/folklife,fassetar/Orchard,Lombiq/Orchard,grapto/Orchard.CloudBust,hannan-azam/Orchard,emretiryaki/Orchard,jagraz/Orchard,yersans/Orchard,jagraz/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,dcinzona/Orchard,Fogolan/OrchardForWork,IDeliverable/Orchard,OrchardCMS/Orchard,IDeliverable/Orchard,gcsuk/Orchard,neTp9c/Orchard,bedegaming-aleksej/Orchard,fortunearterial/Orchard,Serlead/Orchard,omidnasri/Orchard,cooclsee/Orchard,SzymonSel/Orchard,omidnasri/Orchard,emretiryaki/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Fogolan/OrchardForWork,TalaveraTechnologySolutions/Orchard,mvarblow/Orchard,infofromca/Orchard,xkproject/Orchard,emretiryaki/Orchard,jimasp/Orchard,omidnasri/Orchard,li0803/Orchard,omidnasri/Orchard,infofromca/Orchard,kgacova/Orchard,grapto/Orchard.CloudBust,planetClaire/Orchard-LETS,dburriss/Orchard,Dolphinsimon/Orchard,cooclsee/Orchard,hbulzy/Orchard,jchenga/Orchard,sfmskywalker/Orchard,dcinzona/Orchard,TalaveraTechnologySolutions/Orchard,phillipsj/Orchard,phillipsj/Orchard,LaserSrl/Orchard,OrchardCMS/Orchard,dburriss/Orchard,TaiAivaras/Orchard,aaronamm/Orchard,armanforghani/Orchard,li0803/Orchard,ehe888/Orchard,Dolphinsimon/Orchard,TaiAivaras/Orchard,kouweizhong/Orchard,IDeliverable/Orchard,tobydodds/folklife,sfmskywalker/Orchard,SzymonSel/Orchard,geertdoornbos/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,SeyDutch/Airbrush,openbizgit/Orchard,fassetar/Orchard,Dolphinsimon/Orchard,qt1/Orchard,TalaveraTechnologySolutions/Orchard,emretiryaki/Orchard,Codinlab/Orchard,Codinlab/Orchard,huoxudong125/Orchard,planetClaire/Orchard-LETS,escofieldnaxos/Orchard,yersans/Orchard,TalaveraTechnologySolutions/Orchard,SzymonSel/Orchard,hbulzy/Orchard,sfmskywalker/Orchard,alejandroaldana/Orchard,AdvantageCS/Orchard,armanforghani/Orchard,brownjordaninternational/OrchardCMS,kouweizhong/Orchard,yersans/Orchard,OrchardCMS/Orchard,brownjordaninternational/OrchardCMS,tobydodds/folklife,escofieldnaxos/Orchard,fortunearterial/Orchard,grapto/Orchard.CloudBust,planetClaire/Orchard-LETS,ehe888/Orchard,gcsuk/Orchard,xiaobudian/Orchard,geertdoornbos/Orchard,OrchardCMS/Orchard,Sylapse/Orchard.HttpAuthSample,xiaobudian/Orchard,kgacova/Orchard,sfmskywalker/Orchard,kouweizhong/Orchard,tobydodds/folklife,xkproject/Orchard,neTp9c/Orchard,SzymonSel/Orchard,LaserSrl/Orchard,qt1/Orchard,hbulzy/Orchard,OrchardCMS/Orchard,Codinlab/Orchard,openbizgit/Orchard,RoyalVeterinaryCollege/Orchard,aaronamm/Orchard,Praggie/Orchard,SeyDutch/Airbrush,Praggie/Orchard,kgacova/Orchard,infofromca/Orchard,hannan-azam/Orchard,tobydodds/folklife,jersiovic/Orchard,planetClaire/Orchard-LETS,vairam-svs/Orchard,SzymonSel/Orchard,SouleDesigns/SouleDesigns.Orchard,phillipsj/Orchard,fassetar/Orchard,yonglehou/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,fortunearterial/Orchard,johnnyqian/Orchard,jimasp/Orchard,mvarblow/Orchard,dcinzona/Orchard,jchenga/Orchard,abhishekluv/Orchard,kgacova/Orchard,Praggie/Orchard,gcsuk/Orchard,dburriss/Orchard,omidnasri/Orchard,Praggie/Orchard,JRKelso/Orchard,jchenga/Orchard,grapto/Orchard.CloudBust,fortunearterial/Orchard,Praggie/Orchard,TalaveraTechnologySolutions/Orchard,Lombiq/Orchard,ehe888/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,RoyalVeterinaryCollege/Orchard,JRKelso/Orchard,omidnasri/Orchard,Codinlab/Orchard,spraiin/Orchard,alejandroaldana/Orchard,infofromca/Orchard,yonglehou/Orchard,neTp9c/Orchard,xkproject/Orchard,jersiovic/Orchard,abhishekluv/Orchard,aaronamm/Orchard,Serlead/Orchard,xkproject/Orchard,alejandroaldana/Orchard,SouleDesigns/SouleDesigns.Orchard,SeyDutch/Airbrush,gcsuk/Orchard,Ermesx/Orchard,armanforghani/Orchard,escofieldnaxos/Orchard,gcsuk/Orchard,phillipsj/Orchard,grapto/Orchard.CloudBust,infofromca/Orchard,fassetar/Orchard,sfmskywalker/Orchard,omidnasri/Orchard,TaiAivaras/Orchard,dburriss/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,xiaobudian/Orchard
|
f4d7ba226d545b346d98054c87aa3e64bd8f5f02
|
src/FakeHttpContext/Properties/AssemblyInfo.cs
|
src/FakeHttpContext/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("FakeHttpContext.Tests")]
[assembly: AssemblyTitle("FakeHttpContext")]
[assembly: AssemblyDescription("Unit testing utilite for simulate HttpContext.Current.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Vadim Zozulya")]
[assembly: AssemblyProduct("FakeHttpContext")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("36df5624-6d1a-4c88-8ba2-cb63e6d5dd0e")]
[assembly: AssemblyVersion("0.1.0")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("FakeHttpContext.Tests")]
[assembly: AssemblyTitle("FakeHttpContext")]
[assembly: AssemblyDescription("Unit testing utilite for simulate HttpContext.Current.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Vadim Zozulya")]
[assembly: AssemblyProduct("FakeHttpContext")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("36df5624-6d1a-4c88-8ba2-cb63e6d5dd0e")]
[assembly: AssemblyVersion("0.1.1")]
[assembly: AssemblyFileVersion("0.1.1")]
[assembly: AssemblyInformationalVersion("0.1.1")]
|
Update package version to 0.1.1
|
Update package version to 0.1.1
|
C#
|
mit
|
vadimzozulya/FakeHttpContext
|
05bcde73d58f1396447ed9ecd09e81744c673cbd
|
src/Postal.AspNetCore/EmailServiceOptions.cs
|
src/Postal.AspNetCore/EmailServiceOptions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
namespace Postal.AspNetCore
{
public class EmailServiceOptions
{
public EmailServiceOptions()
{
CreateSmtpClient = () => new SmtpClient(Host, Port)
{
Credentials = new NetworkCredential(UserName, Password),
EnableSsl = EnableSSL
};
}
public string Host { get; set; }
public int Port { get; set; }
public bool EnableSSL { get; set; }
public string FromAddress { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public Func<SmtpClient> CreateSmtpClient { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
namespace Postal.AspNetCore
{
public class EmailServiceOptions
{
public EmailServiceOptions()
{
CreateSmtpClient = () => new SmtpClient(Host, Port)
{
UseDefaultCredentials = string.IsNullOrWhiteSpace(UserName),
Credentials = string.IsNullOrWhiteSpace(UserName) ? null : new NetworkCredential(UserName, Password),
EnableSsl = EnableSSL
};
}
public string Host { get; set; }
public int Port { get; set; }
public bool EnableSSL { get; set; }
public string FromAddress { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public Func<SmtpClient> CreateSmtpClient { get; set; }
}
}
|
Fix create smtpclient with UseDefaultCredentials
|
Fix create smtpclient with UseDefaultCredentials
|
C#
|
mit
|
hermanho/postal
|
0f2c49445bb42e16bd5d2569cd8754c31946e854
|
src/Microsoft.Cci.Extensions/Extensions/ApiKindExtensions.cs
|
src/Microsoft.Cci.Extensions/Extensions/ApiKindExtensions.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;
namespace Microsoft.Cci.Extensions
{
public static class ApiKindExtensions
{
public static bool IsInfrastructure(this ApiKind kind)
{
switch (kind)
{
case ApiKind.EnumField:
case ApiKind.DelegateMember:
case ApiKind.PropertyAccessor:
case ApiKind.EventAccessor:
return true;
default:
return false;
}
}
}
}
|
// 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;
namespace Microsoft.Cci.Extensions
{
public static class ApiKindExtensions
{
public static bool IsInfrastructure(this ApiKind kind)
{
switch (kind)
{
case ApiKind.EnumField:
case ApiKind.DelegateMember:
case ApiKind.PropertyAccessor:
case ApiKind.EventAccessor:
return true;
default:
return false;
}
}
public static bool IsNamespace(this ApiKind kind)
{
return kind == ApiKind.Namespace;
}
public static bool IsType(this ApiKind kind)
{
switch (kind)
{
case ApiKind.Interface:
case ApiKind.Delegate:
case ApiKind.Enum:
case ApiKind.Struct:
case ApiKind.Class:
return true;
default:
return false;
}
}
public static bool IsMember(this ApiKind kind)
{
switch (kind)
{
case ApiKind.EnumField:
case ApiKind.DelegateMember:
case ApiKind.Field:
case ApiKind.Property:
case ApiKind.Event:
case ApiKind.Constructor:
case ApiKind.PropertyAccessor:
case ApiKind.EventAccessor:
case ApiKind.Method:
return true;
default:
return false;
}
}
public static bool IsAccessor(this ApiKind kind)
{
switch (kind)
{
case ApiKind.PropertyAccessor:
case ApiKind.EventAccessor:
return true;
default:
return false;
}
}
}
}
|
Add helper functions for ApiKind
|
Add helper functions for ApiKind
|
C#
|
mit
|
ericstj/buildtools,crummel/dotnet_buildtools,AlexGhiondea/buildtools,ChadNedzlek/buildtools,mmitche/buildtools,jthelin/dotnet-buildtools,crummel/dotnet_buildtools,JeremyKuhne/buildtools,alexperovich/buildtools,joperezr/buildtools,tarekgh/buildtools,karajas/buildtools,nguerrera/buildtools,weshaggard/buildtools,tarekgh/buildtools,dotnet/buildtools,JeremyKuhne/buildtools,stephentoub/buildtools,tarekgh/buildtools,dotnet/buildtools,MattGal/buildtools,chcosta/buildtools,joperezr/buildtools,weshaggard/buildtools,dotnet/buildtools,joperezr/buildtools,chcosta/buildtools,stephentoub/buildtools,ChadNedzlek/buildtools,crummel/dotnet_buildtools,karajas/buildtools,jthelin/dotnet-buildtools,alexperovich/buildtools,joperezr/buildtools,alexperovich/buildtools,chcosta/buildtools,AlexGhiondea/buildtools,weshaggard/buildtools,ericstj/buildtools,alexperovich/buildtools,AlexGhiondea/buildtools,nguerrera/buildtools,karajas/buildtools,weshaggard/buildtools,MattGal/buildtools,ericstj/buildtools,jthelin/dotnet-buildtools,tarekgh/buildtools,jthelin/dotnet-buildtools,mmitche/buildtools,dotnet/buildtools,mmitche/buildtools,MattGal/buildtools,karajas/buildtools,JeremyKuhne/buildtools,mmitche/buildtools,alexperovich/buildtools,ericstj/buildtools,mmitche/buildtools,MattGal/buildtools,joperezr/buildtools,nguerrera/buildtools,ChadNedzlek/buildtools,stephentoub/buildtools,crummel/dotnet_buildtools,ChadNedzlek/buildtools,stephentoub/buildtools,JeremyKuhne/buildtools,tarekgh/buildtools,AlexGhiondea/buildtools,chcosta/buildtools,nguerrera/buildtools,MattGal/buildtools
|
634235af9871efd8a62b05f8d0cb1a1fcbbc3213
|
src/Nancy.JohnnyFive/Nancy.JohnnyFive.Sample/SampleModule.cs
|
src/Nancy.JohnnyFive/Nancy.JohnnyFive.Sample/SampleModule.cs
|
namespace Nancy.JohnnyFive.Sample
{
using System.Collections.Generic;
using System.IO;
using Circuits;
public class SampleModule : NancyModule
{
public SampleModule()
{
Get["/"] = _ =>
{
this.CanShortCircuit(new NoContentOnErrorCircuit()
.ForException<FileNotFoundException>()
.WithCircuitOpenTimeInSeconds(10));
this.CanShortCircuit(new NoContentOnErrorCircuit()
.ForException<KeyNotFoundException>()
.WithCircuitOpenTimeInSeconds(30));
if (this.Request.Query["fileNotFound"] != null)
throw new FileNotFoundException();
if (this.Request.Query["keyNotFound"] != null)
throw new KeyNotFoundException();
return "Hello, World!";
};
Get["/underload"] = _ =>
{
this.CanShortCircuit(new LastGoodResponseUnderLoad()
.WithRequestSampleTimeInSeconds(10)
.WithRequestThreshold(40));
};
}
}
}
|
namespace Nancy.JohnnyFive.Sample
{
using System;
using System.Collections.Generic;
using System.IO;
using Circuits;
public class SampleModule : NancyModule
{
public SampleModule()
{
Get["/"] = _ =>
{
this.CanShortCircuit(new NoContentOnErrorCircuit()
.ForException<FileNotFoundException>()
.WithCircuitOpenTimeInSeconds(10));
this.CanShortCircuit(new NoContentOnErrorCircuit()
.ForException<KeyNotFoundException>()
.WithCircuitOpenTimeInSeconds(30));
if (this.Request.Query["fileNotFound"] != null)
throw new FileNotFoundException();
if (this.Request.Query["keyNotFound"] != null)
throw new KeyNotFoundException();
return "Hello, World!";
};
Get["/underload"] = _ =>
{
this.CanShortCircuit(new NoContentUnderLoadCircuit()
.WithRequestSampleTimeInSeconds(10)
.WithRequestThreshold(5));
return "Under load " + DateTime.Now;
};
}
}
}
|
Add under load sample module
|
Add under load sample module
|
C#
|
mit
|
DSaunders/Nancy.JohnnyFive
|
d6a8ca15e2880edbaf9a4d3b66d8b5ee25e753b0
|
test/NEventSocket.Tests/TestSupport/TimeOut.cs
|
test/NEventSocket.Tests/TestSupport/TimeOut.cs
|
namespace NEventSocket.Tests.TestSupport
{
public class TimeOut
{
public const int TestTimeOutMs = 30 * 1000;
}
}
|
namespace NEventSocket.Tests.TestSupport
{
public class TimeOut
{
public const int TestTimeOutMs = 10000;
}
}
|
Revert "Try bumping up the test timeout"
|
Revert "Try bumping up the test timeout"
This reverts commit 7fa5df5923ceae2303ab73b88dc9eb6564d7590a.
|
C#
|
mpl-2.0
|
danbarua/NEventSocket,pragmatrix/NEventSocket,pragmatrix/NEventSocket,danbarua/NEventSocket
|
8ed9062d00843ab06f868bd6a885e6c1704dbcd6
|
sample/DokanNetMirror/Program.cs
|
sample/DokanNetMirror/Program.cs
|
using System;
using DokanNet;
namespace DokanNetMirror
{
internal class Program
{
private static void Main(string[] args)
{
try
{
bool unsafeReadWrite = args.Length > 0 && args[0].Equals("-unsafe", StringComparison.OrdinalIgnoreCase);
Console.WriteLine($"Using unsafe methods: {unsafeReadWrite}");
var mirror = unsafeReadWrite ? new UnsafeMirror("C:") : new Mirror("C:");
mirror.Mount("n:\\", DokanOptions.DebugMode, 5);
Console.WriteLine(@"Success");
}
catch (DokanException ex)
{
Console.WriteLine(@"Error: " + ex.Message);
}
}
}
}
|
using System;
using System.Linq;
using DokanNet;
namespace DokanNetMirror
{
internal class Program
{
private const string MirrorKey = "-what";
private const string MountKey = "-where";
private const string UseUnsafeKey = "-unsafe";
private static void Main(string[] args)
{
try
{
var arguments = args
.Select(x => x.Split(new char[] { '=' }, 2, StringSplitOptions.RemoveEmptyEntries))
.ToDictionary(x => x[0], x => x.Length > 1 ? x[1] as object : true, StringComparer.OrdinalIgnoreCase);
var mirrorPath = arguments.ContainsKey(MirrorKey)
? arguments[MirrorKey] as string
: @"C:\";
var mountPath = arguments.ContainsKey(MountKey)
? arguments[MountKey] as string
: @"N:\";
var unsafeReadWrite = arguments.ContainsKey(UseUnsafeKey);
Console.WriteLine($"Using unsafe methods: {unsafeReadWrite}");
var mirror = unsafeReadWrite
? new UnsafeMirror(mirrorPath)
: new Mirror(mirrorPath);
mirror.Mount(mountPath, DokanOptions.DebugMode, 5);
Console.WriteLine(@"Success");
}
catch (DokanException ex)
{
Console.WriteLine(@"Error: " + ex.Message);
}
}
}
}
|
Allow mirror to accept parameters to specify what to mount and where
|
Allow mirror to accept parameters to specify what to mount and where
|
C#
|
mit
|
TrabacchinLuigi/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,dokan-dev/dokan-dotnet,dokan-dev/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,dokan-dev/dokan-dotnet
|
722a0298f8f35603aaab0ae63247c0de610e62d4
|
Assets/Scripts/Enemies/MetallKeferController.cs
|
Assets/Scripts/Enemies/MetallKeferController.cs
|
using UnityEngine;
using System.Collections;
public class MetallKeferController : MonoBehaviour {
public GameObject gameControllerObject;
private GameController gameController;
private GameObject[] towerBasesBuildable;
void Start () {
this.gameController = this.gameControllerObject.GetComponent<GameController>();
this.FindInititalWaypoint ();
}
void FindInititalWaypoint() {
}
}
|
using UnityEngine;
using System.Collections;
public class MetallKeferController : MonoBehaviour {
public GameObject gameControllerObject;
private GameController gameController;
private GameObject[] towerBasesBuildable;
private GameObject nextWaypiont;
private int currentWaypointIndex = 0;
private int movementSpeed = 2;
private float step = 10f;
void Start () {
this.gameController = this.gameControllerObject.GetComponent<GameController>();
this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex];
}
void Update() {
this.moveToNextWaypoint ();
}
void SetNextWaypoint() {
if (this.currentWaypointIndex < this.gameController.getWaypoints ().Length - 1) {
this.currentWaypointIndex += 1;
this.nextWaypiont = this.gameController.getWaypoints () [this.currentWaypointIndex];
this.nextWaypiont.GetComponent<Renderer> ().material.color = this.getRandomColor();
}
}
private Color getRandomColor() {
Color newColor = new Color( Random.value, Random.value, Random.value, 1.0f );
return newColor;
}
private void moveToNextWaypoint() {
float step = movementSpeed * Time.deltaTime;
this.transform.LookAt (this.nextWaypiont.transform);
this.transform.position = Vector3.MoveTowards(transform.position, this.nextWaypiont.transform.position, step);
this.SetNextWaypoint ();
}
}
|
Add prototype movement for MetallKefer
|
Add prototype movement for MetallKefer
|
C#
|
mit
|
emazzotta/unity-tower-defense
|
9046002e20bc59511d48996d30c27e65509ed212
|
Plugins/MySQLLogger/MySQLLogger/SessionCache.cs
|
Plugins/MySQLLogger/MySQLLogger/SessionCache.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace pGina.Plugin.MySqlLogger
{
class SessionCache
{
private Dictionary<int, string> m_cache;
public SessionCache()
{
m_cache = new Dictionary<int, string>();
}
public void Add(int sessId, string userName)
{
lock(this)
{
if (!m_cache.ContainsKey(sessId))
m_cache.Add(sessId, userName);
else
m_cache[sessId] = userName;
}
}
public string Get(int sessId)
{
if (m_cache.ContainsKey(sessId))
return m_cache[sessId];
return "";
}
public void Clear()
{
lock (this)
{
m_cache.Clear();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace pGina.Plugin.MySqlLogger
{
class SessionCache
{
private Dictionary<int, string> m_cache;
public SessionCache()
{
m_cache = new Dictionary<int, string>();
}
public void Add(int sessId, string userName)
{
lock(this)
{
if (!m_cache.ContainsKey(sessId))
m_cache.Add(sessId, userName);
else
m_cache[sessId] = userName;
}
}
public string Get(int sessId)
{
string result = "--Unknown--";
lock (this)
{
if (m_cache.ContainsKey(sessId))
result = m_cache[sessId];
}
return result;
}
public void Clear()
{
lock (this)
{
m_cache.Clear();
}
}
}
}
|
Add lock around Get in session cache, and add default "unknown" username.
|
Add lock around Get in session cache, and add default "unknown" username.
|
C#
|
bsd-3-clause
|
pgina/pgina,pgina/pgina,daviddumas/pgina,daviddumas/pgina,pgina/pgina,daviddumas/pgina,stefanwerfling/pgina,MutonUfoAI/pgina,MutonUfoAI/pgina,MutonUfoAI/pgina,stefanwerfling/pgina,stefanwerfling/pgina
|
d0da000af9c5166afe3eb172c4124a616574a004
|
src/Shop.Core/Entites/Order.cs
|
src/Shop.Core/Entites/Order.cs
|
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Shop.Core.BaseObjects;
using Shop.Core.Interfaces;
namespace Shop.Core.Entites
{
public class Order : LifetimeBase, IReferenceable<Order>
{
[Key]
public int OrderId { get; set; }
public string OrderReference { get; set; }
public List<OrderProduct> Products { get; set; }
public DiscountCode DiscountCode { get; set; }
public ShippingDetails ShippingMethod { get; set; }
public Address ShippingAddress { get; set; }
public Address BillingAddress { get; set; }
public Order CreateReference(IReferenceGenerator referenceGenerator)
{
OrderReference = referenceGenerator.CreateReference("B-", Constants.Constants.ReferenceLength);
return this;
}
}
}
|
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Shop.Core.BaseObjects;
using Shop.Core.Interfaces;
namespace Shop.Core.Entites
{
public class Order : LifetimeBase, IReferenceable<Order>
{
[Key]
public int OrderId { get; set; }
public string OrderReference { get; set; }
public List<ProductConfiguration> Products { get; set; }
public DiscountCode DiscountCode { get; set; }
public ShippingDetails ShippingMethod { get; set; }
public Address ShippingAddress { get; set; }
public Address BillingAddress { get; set; }
public Payment Payment { get; set; }
public Order()
{
OrderId = 0;
OrderReference = string.Empty;
Products = new List<ProductConfiguration>();
}
public Order CreateReference(IReferenceGenerator referenceGenerator)
{
OrderReference = referenceGenerator.CreateReference("B-", Constants.Constants.ReferenceLength);
return this;
}
}
}
|
Add order constructor and Payment
|
Add order constructor and Payment
|
C#
|
mit
|
jontansey/.Net-Core-Ecommerce-Base,jontansey/.Net-Core-Ecommerce-Base
|
4c59925d4b4b11e0797f3c740764f8064ebdb448
|
Assets/UniVersionManager/UniVersionManager.cs
|
Assets/UniVersionManager/UniVersionManager.cs
|
using UnityEngine;
using System;
using System.Runtime.InteropServices;
#if UNITY_EDITOR
using UnityEditor;
#endif
public static class UniVersionManager
{
[DllImport("__Internal")]
private static extern string GetVersionName_();
[DllImport("__Internal")]
private static extern string GetBuildVersionName_ ();
public static string GetVersion ()
{
#if UNITY_EDITOR
return PlayerSettings.bundleVersion;
#elif UNITY_IOS
return GetVersionName_();
#elif UNITY_ANDROID
AndroidJavaObject ajo = new AndroidJavaObject("net.sanukin.UniVersionManager");
return ajo.CallStatic<string>("GetVersionName");
#else
return "0";
#endif
}
public static string GetBuildVersion(){
#if UNITY_EDITOR
return PlayerSettings.bundleVersion;
#elif UNITY_IOS
return GetBuildVersionName_();
#elif UNITY_ANDROID
AndroidJavaObject ajo = new AndroidJavaObject("net.sanukin.UniVersionManager");
return ajo.CallStatic<int>("GetVersionCode").ToString ();
#else
return "0";
#endif
}
public static bool IsNewVersion (string targetVersion)
{
var current = new Version(GetVersion());
var target = new Version(targetVersion);
return current.CompareTo(target) < 0;
}
}
|
using UnityEngine;
using System;
using System.Runtime.InteropServices;
#if UNITY_EDITOR
using UnityEditor;
#endif
public static class UniVersionManager
{
#if UNITY_IOS
[DllImport("__Internal")]
private static extern string GetVersionName_();
[DllImport("__Internal")]
private static extern string GetBuildVersionName_ ();
#endif
public static string GetVersion ()
{
#if UNITY_EDITOR
return PlayerSettings.bundleVersion;
#elif UNITY_IOS
return GetVersionName_();
#elif UNITY_ANDROID
AndroidJavaObject ajo = new AndroidJavaObject("net.sanukin.UniVersionManager");
return ajo.CallStatic<string>("GetVersionName");
#else
return "0";
#endif
}
public static string GetBuildVersion(){
#if UNITY_EDITOR
return PlayerSettings.bundleVersion;
#elif UNITY_IOS
return GetBuildVersionName_();
#elif UNITY_ANDROID
AndroidJavaObject ajo = new AndroidJavaObject("net.sanukin.UniVersionManager");
return ajo.CallStatic<int>("GetVersionCode").ToString ();
#else
return "0";
#endif
}
public static bool IsNewVersion (string targetVersion)
{
var current = new Version(GetVersion());
var target = new Version(targetVersion);
return current.CompareTo(target) < 0;
}
}
|
Make DllImport exclusive to iOS
|
Make DllImport exclusive to iOS
|
C#
|
mit
|
sanukin39/UniVersionManager
|
a8c09f8e76c06638e00f7bad7c6bcafaa73f00ec
|
DesignPatternsExercise/CreationalPatterns/FactoryMethod/FactoryMethodTest.cs
|
DesignPatternsExercise/CreationalPatterns/FactoryMethod/FactoryMethodTest.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DesignPatternsExercise.CreationalPatterns.FactoryMethod.Mocks;
namespace DesignPatternsExercise.CreationalPatterns.FactoryMethod
{
[TestClass]
public class FactoryMethodTest
{
[TestMethod]
public void TestProduction()
{
IFactoryMethod factory = new IncompleteFactory();
Assert.IsInstanceOfType(factory.Build(ProductType.Foo), typeof(IProduct));
Assert.IsInstanceOfType(factory.Build(ProductType.Bar), typeof(IProduct));
Assert.IsInstanceOfType(factory.Build(ProductType.Foo), typeof(FooProduct));
Assert.IsInstanceOfType(factory.Build(ProductType.Bar), typeof(BarProduct));
try
{
factory.Build(ProductType.Baz);
}
catch(Exception ex)
{
Assert.IsInstanceOfType(ex, typeof(NotImplementedException));
}
// Try again with a complete factory
factory = new CompleteFactory();
Assert.IsInstanceOfType(factory.Build(ProductType.Foo), typeof(IProduct));
Assert.IsInstanceOfType(factory.Build(ProductType.Bar), typeof(IProduct));
Assert.IsInstanceOfType(factory.Build(ProductType.Baz), typeof(IProduct));
Assert.IsInstanceOfType(factory.Build(ProductType.Foo), typeof(FooProduct));
Assert.IsInstanceOfType(factory.Build(ProductType.Bar), typeof(BarProduct));
Assert.IsInstanceOfType(factory.Build(ProductType.Baz), typeof(BazProduct));
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DesignPatternsExercise.CreationalPatterns.FactoryMethod.Mocks;
using System.Collections.Generic;
namespace DesignPatternsExercise.CreationalPatterns.FactoryMethod
{
[TestClass]
public class FactoryMethodTest
{
private Dictionary<ProductType, Type> ProductionProvider()
{
var products = new Dictionary<ProductType, Type>();
products.Add(ProductType.Foo, typeof(FooProduct));
products.Add(ProductType.Bar, typeof(BarProduct));
products.Add(ProductType.Baz, typeof(BazProduct));
return products;
}
[TestMethod]
public void TestFactoryProducesProducts()
{
var factory = new CompleteFactory();
foreach (var product in ProductionProvider())
{
Assert.IsInstanceOfType(factory.Build(product.Key), typeof(IProduct));
Assert.IsInstanceOfType(factory.Build(product.Key), product.Value);
}
}
[TestMethod]
public void TestIncompleteFactoryThrowsException()
{
IFactoryMethod factory = new IncompleteFactory();
try
{
foreach (var product in ProductionProvider())
{
Assert.IsInstanceOfType(factory.Build(product.Key), typeof(IProduct));
Assert.IsInstanceOfType(factory.Build(product.Key), product.Value);
}
// Must not get here
Assert.Fail();
}
catch(Exception ex)
{
Assert.IsInstanceOfType(ex, typeof(NotImplementedException));
}
}
}
}
|
Split tests and deduplicated code
|
Split tests and deduplicated code
|
C#
|
unlicense
|
Wolfolo/DesignPatternsCSharp
|
cac41997fc2a94b606541fcc0e5a76f5fe6ce6e4
|
InversionOfControl/Castle.MicroKernel/Lifestyle/SingletonLifestyleManager.cs
|
InversionOfControl/Castle.MicroKernel/Lifestyle/SingletonLifestyleManager.cs
|
// Copyright 2004-2008 Castle Project - http://www.castleproject.org/
//
// 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.
namespace Castle.MicroKernel.Lifestyle
{
using System;
/// <summary>
/// Summary description for SingletonLifestyleManager.
/// </summary>
[Serializable]
public class SingletonLifestyleManager : AbstractLifestyleManager
{
private Object instance;
public override void Dispose()
{
if (instance != null) base.Release( instance );
}
public override object Resolve(CreationContext context)
{
lock(ComponentActivator)
{
if (instance == null)
{
instance = base.Resolve(context);
}
}
return instance;
}
public override void Release( object instance )
{
// Do nothing
}
}
}
|
// Copyright 2004-2008 Castle Project - http://www.castleproject.org/
//
// 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.
namespace Castle.MicroKernel.Lifestyle
{
using System;
/// <summary>
/// Summary description for SingletonLifestyleManager.
/// </summary>
[Serializable]
public class SingletonLifestyleManager : AbstractLifestyleManager
{
private volatile Object instance;
public override void Dispose()
{
if (instance != null) base.Release( instance );
}
public override object Resolve(CreationContext context)
{
if (instance == null)
{
lock (ComponentActivator)
{
if (instance == null)
{
instance = base.Resolve(context);
}
}
}
return instance;
}
public override void Release( object instance )
{
// Do nothing
}
}
}
|
Use double checked lock to improve performance.
|
Use double checked lock to improve performance.
git-svn-id: bab0c2de90ee11a20376049c2cdee62584491f34@4729 73e77b4c-caa6-f847-a29a-24ab75ae54b6
|
C#
|
apache-2.0
|
castleproject/Castle.Transactions,castleproject/Castle.Facilities.Wcf-READONLY,codereflection/Castle.Components.Scheduler,castleproject/castle-READONLY-SVN-dump,castleproject/Castle.Transactions,castleproject/Castle.Facilities.Wcf-READONLY,carcer/Castle.Components.Validator,castleproject/castle-READONLY-SVN-dump,castleproject/Castle.Transactions,castleproject/castle-READONLY-SVN-dump
|
05e6c3ef6a0b030234922736c36b4f3cef8f097a
|
MovieTheater/MovieTheater.Framework/Core/Commands/CreateJsonReaderCommand.cs
|
MovieTheater/MovieTheater.Framework/Core/Commands/CreateJsonReaderCommand.cs
|
using System;
using System.Collections.Generic;
using MovieTheater.Framework.Core.Commands.Contracts;
namespace MovieTheater.Framework.Core.Commands
{
public class CreateJsonReaderCommand : ICommand
{
public string Execute(List<string> parameters)
{
throw new NotImplementedException();
}
}
}
|
using System.Collections.Generic;
using MovieTheater.Framework.Core.Commands.Contracts;
using MovieTheater.Framework.Core.Providers;
using MovieTheater.Framework.Core.Providers.Contracts;
namespace MovieTheater.Framework.Core.Commands
{
public class CreateJsonReaderCommand : ICommand
{
private IReader reader;
private IWriter writer;
public CreateJsonReaderCommand()
{
this.reader = new ConsoleReader();
this.writer = new ConsoleWriter();
}
public string Execute(List<string> parameters)
{
var jsonReader = new JsonReader(reader, writer);
jsonReader.Read();
return "Successfully read json file!";
}
}
}
|
Create JSon Reader command is ready
|
Create JSon Reader command is ready
|
C#
|
mit
|
olebg/Movie-Theater-Project
|
fc523bdbde7cfeaacce8f7128e775cf112745636
|
src/TehPers.FishingOverhaul.Api/Effects/IFishingEffect.cs
|
src/TehPers.FishingOverhaul.Api/Effects/IFishingEffect.cs
|
using StardewValley;
namespace TehPers.FishingOverhaul.Api.Effects
{
/// <summary>
/// An effect that can be applied while fishing.
/// </summary>
public interface IFishingEffect
{
/// <summary>
/// Applies this effect.
/// </summary>
/// <param name="fishingInfo">Information about the <see cref="Farmer"/> that is fishing.</param>
public void Apply(FishingInfo fishingInfo);
/// <summary>
/// Unapplies this effect.
/// </summary>
/// <param name="fishingInfo">Information about the <see cref="Farmer"/> that is fishing.</param>
public void Unapply(FishingInfo fishingInfo);
/// <summary>
/// Unapplies this effect from all players.
/// </summary>
public void UnapplyAll();
}
}
|
using StardewValley;
namespace TehPers.FishingOverhaul.Api.Effects
{
/// <summary>
/// An effect that can be applied while fishing.
/// </summary>
public interface IFishingEffect
{
/// <summary>
/// Applies this effect.
/// </summary>
/// <param name="fishingInfo">Information about the <see cref="Farmer"/> that is fishing.</param>
void Apply(FishingInfo fishingInfo);
/// <summary>
/// Unapplies this effect.
/// </summary>
/// <param name="fishingInfo">Information about the <see cref="Farmer"/> that is fishing.</param>
void Unapply(FishingInfo fishingInfo);
/// <summary>
/// Unapplies this effect from all players.
/// </summary>
void UnapplyAll();
}
}
|
Remove extra `public`s from interface
|
Remove extra `public`s from interface
|
C#
|
mit
|
TehPers/StardewValleyMods
|
60d42fbb44a590640eb54b338dd66b141771079b
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Extras.DynamicProxy2")]
[assembly: AssemblyDescription("Autofac Castle.DynamicProxy2 Integration")]
[assembly: ComVisible(false)]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Extras.DynamicProxy2")]
[assembly: ComVisible(false)]
|
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
|
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
|
C#
|
mit
|
autofac/Autofac.Extras.DynamicProxy,jango2015/Autofac.Extras.DynamicProxy
|
aca0d881ecbf4ccc09d18135883808a76bed13af
|
src/SparkPost/IClient.cs
|
src/SparkPost/IClient.cs
|
namespace SparkPost
{
/// <summary>
/// Provides access to the SparkPost API.
/// </summary>
public interface IClient
{
/// <summary>
/// Gets or sets the key used for requests to the SparkPost API.
/// </summary>
string ApiKey { get; set; }
/// <summary>
/// Gets or sets the base URL of the SparkPost API.
/// </summary>
string ApiHost { get; set; }
/// <summary>
/// Gets access to the transmissions resource of the SparkPost API.
/// </summary>
ITransmissions Transmissions { get; }
/// <summary>
/// Gets access to the suppressions resource of the SparkPost API.
/// </summary>
ISuppressions Suppressions { get; }
/// <summary>
/// Gets access to the subaccounts resource of the SparkPost API.
/// </summary>
ISubaccounts Subaccounts { get; }
/// <summary>
/// Gets the API version supported by this client.
/// </summary>
string Version { get; }
/// <summary>
/// Get the custom settings for this client.
/// </summary>
Client.Settings CustomSettings { get; }
}
}
|
namespace SparkPost
{
/// <summary>
/// Provides access to the SparkPost API.
/// </summary>
public interface IClient
{
/// <summary>
/// Gets or sets the key used for requests to the SparkPost API.
/// </summary>
string ApiKey { get; set; }
/// <summary>
/// Gets or sets the base URL of the SparkPost API.
/// </summary>
string ApiHost { get; set; }
/// <summary>
/// Gets access to the transmissions resource of the SparkPost API.
/// </summary>
ITransmissions Transmissions { get; }
/// <summary>
/// Gets access to the suppressions resource of the SparkPost API.
/// </summary>
ISuppressions Suppressions { get; }
/// <summary>
/// Gets access to the subaccounts resource of the SparkPost API.
/// </summary>
ISubaccounts Subaccounts { get; }
/// <summary>
/// Gets access to the webhooks resource of the SparkPost API.
/// </summary>
IWebhooks Webhooks { get; }
/// <summary>
/// Gets the API version supported by this client.
/// </summary>
string Version { get; }
/// <summary>
/// Get the custom settings for this client.
/// </summary>
Client.Settings CustomSettings { get; }
}
}
|
Add webhooks to the client interface.
|
Add webhooks to the client interface.
|
C#
|
apache-2.0
|
kirilsi/csharp-sparkpost,darrencauthon/csharp-sparkpost,ZA1/csharp-sparkpost,SparkPost/csharp-sparkpost,kirilsi/csharp-sparkpost,darrencauthon/csharp-sparkpost
|
4046f07839495c751ceadf5db8446b01bb6b1b37
|
BatteryCommander.Web/Controllers/BattleRosterController.cs
|
BatteryCommander.Web/Controllers/BattleRosterController.cs
|
using BatteryCommander.Common;
using BatteryCommander.Common.Models;
using BatteryCommander.Web.Models;
using Microsoft.AspNet.Identity;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace BatteryCommander.Web.Controllers
{
public class BattleRosterController : BaseController
{
private readonly DataContext _db;
public BattleRosterController(UserManager<AppUser, int> userManager, DataContext db)
: base(userManager)
{
_db = db;
}
[Route("BattleRoster")]
public async Task<ActionResult> Show()
{
return View(new BattleRosterModel
{
Soldiers = await _db
.Soldiers
.Include(s => s.Qualifications)
.Where(s => s.Status == SoldierStatus.Active)
.OrderBy(s => s.Group)
.ThenBy(s => s.Rank)
.ToListAsync(),
Qualifications = await _db
.Qualifications
.Where(q => q.ParentTaskId == null)
.ToListAsync()
});
}
}
}
|
using BatteryCommander.Common;
using BatteryCommander.Common.Models;
using BatteryCommander.Web.Models;
using Microsoft.AspNet.Identity;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace BatteryCommander.Web.Controllers
{
public class BattleRosterController : BaseController
{
private readonly DataContext _db;
public BattleRosterController(UserManager<AppUser, int> userManager, DataContext db)
: base(userManager)
{
_db = db;
}
[Route("BattleRoster")]
public async Task<ActionResult> Show()
{
return View(new BattleRosterModel
{
Soldiers = await _db
.Soldiers
.Include(s => s.Qualifications)
.Where(s => s.Status == SoldierStatus.Active)
.OrderBy(s => s.Group)
.ThenByDescending(s => s.Position)
.ToListAsync(),
Qualifications = await _db
.Qualifications
.Where(q => q.ParentTaskId == null)
.ToListAsync()
});
}
}
}
|
Sort battle roster by group, then by position desc
|
Sort battle roster by group, then by position desc
|
C#
|
mit
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
90c0338ed6406a44015fbe9a547dbe6b932f0e5c
|
ChamberLib.OpenTK/BuiltinShaderImporter.cs
|
ChamberLib.OpenTK/BuiltinShaderImporter.cs
|
using System;
using ChamberLib.Content;
namespace ChamberLib.OpenTK
{
public class BuiltinShaderImporter
{
public BuiltinShaderImporter(ShaderImporter next, ShaderStageImporter next2)
{
if (next == null) throw new ArgumentNullException("next");
if (next2 == null) throw new ArgumentNullException("next2");
this.next = next;
this.next2 = next2;
}
readonly ShaderImporter next;
readonly ShaderStageImporter next2;
public ShaderContent ImportShader(string filename, IContentImporter importer)
{
if (filename == "$basic")
{
return BuiltinShaders.BasicShaderContent;
}
if (filename == "$skinned")
{
return BuiltinShaders.SkinnedShaderContent;
}
return next(filename, importer);
}
public ShaderContent ImportShaderStage(string filename, ShaderType type, IContentImporter importer)
{
if (filename == "$basic")
{
throw new NotImplementedException("ImportShaderStage $basic");
}
if (filename == "$skinned")
{
throw new NotImplementedException("ImportShaderStage $skinned");
}
return next2(filename, type, importer);
}
}
}
|
using System;
using ChamberLib.Content;
namespace ChamberLib.OpenTK
{
public class BuiltinShaderImporter
{
public BuiltinShaderImporter(ShaderImporter next, ShaderStageImporter next2)
{
if (next == null) throw new ArgumentNullException("next");
if (next2 == null) throw new ArgumentNullException("next2");
this.next = next;
this.next2 = next2;
}
readonly ShaderImporter next;
readonly ShaderStageImporter next2;
public ShaderContent ImportShader(string filename, IContentImporter importer)
{
if (filename == "$basic")
{
return BuiltinShaders.BasicShaderContent;
}
if (filename == "$skinned")
{
return BuiltinShaders.SkinnedShaderContent;
}
return next(filename, importer);
}
public ShaderContent ImportShaderStage(string filename, ShaderType type, IContentImporter importer)
{
if (filename == "$basic")
{
if (type != ShaderType.Vertex)
throw new ArgumentOutOfRangeException(
"type",
"Wrong shader type for built-in shader \"$basic\"");
return BuiltinShaders.BasicVertexShaderContent;
}
if (filename == "$skinned")
{
if (type != ShaderType.Vertex)
throw new ArgumentOutOfRangeException(
"type",
"Wrong shader type for built-in shader \"$skinned\"");
return BuiltinShaders.SkinnedVertexShaderContent;
}
if (filename == "$fragment")
{
if (type != ShaderType.Fragment)
throw new ArgumentOutOfRangeException(
"type",
"Wrong shader type for built-in shader \"$fragment\"");
return BuiltinShaders.BuiltinFragmentShaderContent;
}
return next2(filename, type, importer);
}
}
}
|
Return ShaderContent for built-in shader stages.
|
Return ShaderContent for built-in shader stages.
|
C#
|
lgpl-2.1
|
izrik/ChamberLib,izrik/ChamberLib,izrik/ChamberLib
|
0b1429cded35cf3b7b3337beeeb8c56bc2a1c080
|
Source/GenericGraphEditor/GenericGraphEditor.Build.cs
|
Source/GenericGraphEditor/GenericGraphEditor.Build.cs
|
using UnrealBuildTool;
public class GenericGraphEditor : ModuleRules
{
public GenericGraphEditor(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
bLegacyPublicIncludePaths = false;
ShadowVariableWarningLevel = WarningLevel.Error;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
"GenericGraphEditor/Private",
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"Engine",
"UnrealEd",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"GenericGraphRuntime",
"AssetTools",
"Slate",
"SlateCore",
"GraphEditor",
"PropertyEditor",
"EditorStyle",
"Kismet",
"KismetWidgets",
"ApplicationCore",
"ToolMenus",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
|
using UnrealBuildTool;
public class GenericGraphEditor : ModuleRules
{
public GenericGraphEditor(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
bLegacyPublicIncludePaths = false;
ShadowVariableWarningLevel = WarningLevel.Error;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
"GenericGraphEditor/Private",
"GenericGraphEditor/Public",
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"Engine",
"UnrealEd",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"GenericGraphRuntime",
"AssetTools",
"Slate",
"SlateCore",
"GraphEditor",
"PropertyEditor",
"EditorStyle",
"Kismet",
"KismetWidgets",
"ApplicationCore",
"ToolMenus",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
|
Add Public to build target
|
Add Public to build target
|
C#
|
mit
|
jinyuliao/GenericGraph,jinyuliao/GenericGraph,jinyuliao/GenericGraph
|
1f4a1872512a6d810d905ded980cf3594844bb40
|
src/Stripe.net/Services/Charges/ChargeListOptions.cs
|
src/Stripe.net/Services/Charges/ChargeListOptions.cs
|
namespace Stripe
{
using Newtonsoft.Json;
public class ChargeListOptions : ListOptionsWithCreated
{
[JsonProperty("customer")]
public string CustomerId { get; set; }
[JsonProperty("source")]
public ChargeSourceListOptions Source { get; set; }
}
}
|
namespace Stripe
{
using System;
using Newtonsoft.Json;
public class ChargeListOptions : ListOptionsWithCreated
{
/// <summary>
/// Only return charges for the customer specified by this customer ID.
/// </summary>
[JsonProperty("customer")]
public string CustomerId { get; set; }
/// <summary>
/// Only return charges that were created by the PaymentIntent specified by this
/// PaymentIntent ID.
/// </summary>
[JsonProperty("payment_intent")]
public string PaymentIntentId { get; set; }
[Obsolete("This parameter is deprecated. Filter the returned list of charges instead.")]
[JsonProperty("source")]
public ChargeSourceListOptions Source { get; set; }
/// <summary>
/// Only return charges for this transfer group.
/// </summary>
[JsonProperty("transfer_group")]
public string TransferGroup { get; set; }
}
}
|
Support listing charges by PaymentIntent id
|
Support listing charges by PaymentIntent id
|
C#
|
apache-2.0
|
richardlawley/stripe.net,stripe/stripe-dotnet
|
aecc135d9c7afb9914b74c4c83eee7a8afa99625
|
TMDbLibTests/ClientJobTests.cs
|
TMDbLibTests/ClientJobTests.cs
|
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TMDbLib.Objects.General;
namespace TMDbLibTests
{
[TestClass]
public class ClientJobTests
{
private TestConfig _config;
/// <summary>
/// Run once, on every test
/// </summary>
[TestInitialize]
public void Initiator()
{
_config = new TestConfig();
}
[TestMethod]
public void TestJobList()
{
List<Job> jobs = _config.Client.GetJobs();
Assert.IsNotNull(jobs);
Assert.IsTrue(jobs.Count > 0);
Assert.IsTrue(jobs.All(job => job.JobList != null));
Assert.IsTrue(jobs.All(job => job.JobList.Count > 0));
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TMDbLib.Objects.General;
namespace TMDbLibTests
{
[TestClass]
public class ClientJobTests
{
private TestConfig _config;
/// <summary>
/// Run once, on every test
/// </summary>
[TestInitialize]
public void Initiator()
{
_config = new TestConfig();
}
[TestMethod]
public void TestJobList()
{
List<Job> jobs = _config.Client.GetJobs();
Assert.IsNotNull(jobs);
Assert.IsTrue(jobs.Count > 0);
Assert.IsTrue(jobs.All(job => !string.IsNullOrEmpty(job.Department)));
Assert.IsTrue(jobs.All(job => job.JobList != null));
Assert.IsTrue(jobs.All(job => job.JobList.Count > 0));
}
}
}
|
Extend test for Jobs list
|
Extend test for Jobs list
Issue #99
|
C#
|
mit
|
LordMike/TMDbLib
|
0f05588ab183d4627a0d7213d7bea40a519a7f23
|
src/Noobot.Runner/NoobotHost.cs
|
src/Noobot.Runner/NoobotHost.cs
|
using System;
using Common.Logging;
using Noobot.Core;
using Noobot.Core.Configuration;
using Noobot.Core.DependencyResolution;
namespace Noobot.Runner
{
/// <summary>
/// NoobotHost is required due to TopShelf.
/// </summary>
public class NoobotHost
{
private readonly IConfigReader _configReader;
private readonly ILog _logger;
private INoobotCore _noobotCore;
/// <summary>
/// Default constructor will use the default ConfigReader from Core.Configuration
/// and look for the config.json file inside a sub directory called 'configuration' with the current directory.
/// </summary>
public NoobotHost() : this(new ConfigReader()) { }
public NoobotHost(IConfigReader configReader)
{
_configReader = configReader;
_logger = LogManager.GetLogger(GetType());
}
public void Start()
{
IContainerFactory containerFactory = new ContainerFactory(new ConfigurationBase(), _configReader, _logger);
INoobotContainer container = containerFactory.CreateContainer();
_noobotCore = container.GetNoobotCore();
Console.WriteLine("Connecting...");
_noobotCore
.Connect()
.ContinueWith(task =>
{
if (!task.IsCompleted || task.IsFaulted)
{
Console.WriteLine($"Error connecting to Slack: {task.Exception}");
}
});
}
public void Stop()
{
Console.WriteLine("Disconnecting...");
_noobotCore.Disconnect();
}
}
}
|
using System;
using Common.Logging;
using Noobot.Core;
using Noobot.Core.Configuration;
using Noobot.Core.DependencyResolution;
namespace Noobot.Runner
{
/// <summary>
/// NoobotHost is required due to TopShelf.
/// </summary>
public class NoobotHost
{
private readonly IConfigReader _configReader;
private readonly ILog _logger;
private INoobotCore _noobotCore;
/// <summary>
/// Default constructor will use the default ConfigReader from Core.Configuration
/// and look for the configuration file at .\configuration\config.json
/// </summary>
public NoobotHost() : this(new ConfigReader()) { }
public NoobotHost(IConfigReader configReader)
{
_configReader = configReader;
_logger = LogManager.GetLogger(GetType());
}
public void Start()
{
IContainerFactory containerFactory = new ContainerFactory(new ConfigurationBase(), _configReader, _logger);
INoobotContainer container = containerFactory.CreateContainer();
_noobotCore = container.GetNoobotCore();
Console.WriteLine("Connecting...");
_noobotCore
.Connect()
.ContinueWith(task =>
{
if (!task.IsCompleted || task.IsFaulted)
{
Console.WriteLine($"Error connecting to Slack: {task.Exception}");
}
});
}
public void Stop()
{
Console.WriteLine("Disconnecting...");
_noobotCore.Disconnect();
}
}
}
|
Revert "Update comment to reflect possible config.json path"
|
Revert "Update comment to reflect possible config.json path"
This reverts commit 8a45b9e90f9bfb43c17a74baa8fa9304396b5639.
|
C#
|
mit
|
Workshop2/noobot,noobot/noobot
|
5ae9b4c79152e0e9489cf5e5c3a8e4267a6a92c4
|
osu.Game.Rulesets.Catch/Tests/TestCaseCatchStacker.cs
|
osu.Game.Rulesets.Catch/Tests/TestCaseCatchStacker.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 NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
[Ignore("getting CI working")]
public class TestCaseCatchStacker : Game.Tests.Visual.TestCasePlayer
{
public TestCaseCatchStacker() : base(typeof(CatchRuleset))
{
}
protected override Beatmap CreateBeatmap()
{
var beatmap = new Beatmap();
for (int i = 0; i < 256; i++)
beatmap.HitObjects.Add(new Fruit { X = 0.5f, StartTime = i * 100, NewCombo = i % 8 == 0 });
return beatmap;
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
[Ignore("getting CI working")]
public class TestCaseCatchStacker : Game.Tests.Visual.TestCasePlayer
{
public TestCaseCatchStacker() : base(typeof(CatchRuleset))
{
}
protected override Beatmap CreateBeatmap()
{
var beatmap = new Beatmap();
for (int i = 0; i < 512; i++)
beatmap.HitObjects.Add(new Fruit { X = 0.5f + (i / 2048f * ((i % 10) - 5)), StartTime = i * 100, NewCombo = i % 8 == 0 });
return beatmap;
}
}
}
|
Make CatchStacker testcase more useful
|
Make CatchStacker testcase more useful
|
C#
|
mit
|
smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,Frontear/osuKyzer,johnneijzen/osu,peppy/osu,smoogipoo/osu,naoey/osu,naoey/osu,peppy/osu-new,smoogipoo/osu,2yangk23/osu,ppy/osu,ZLima12/osu,UselessToucan/osu,DrabWeb/osu,Nabile-Rahmani/osu,johnneijzen/osu,2yangk23/osu,DrabWeb/osu,EVAST9919/osu,naoey/osu,smoogipooo/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,ZLima12/osu,DrabWeb/osu,NeoAdonis/osu,ppy/osu
|
c50380ae715ab516e1de0c1a7304fd7a75fde638
|
Kudu.Core/Deployment/MsBuildSiteBuilder.cs
|
Kudu.Core/Deployment/MsBuildSiteBuilder.cs
|
using System;
using System.Linq;
using System.Threading.Tasks;
using Kudu.Contracts.Tracing;
using Kudu.Core.Infrastructure;
namespace Kudu.Core.Deployment
{
public abstract class MsBuildSiteBuilder : ISiteBuilder
{
private const string NuGetCachePathKey = "NuGetCachePath";
private readonly Executable _msbuildExe;
private readonly IBuildPropertyProvider _propertyProvider;
private readonly string _tempPath;
public MsBuildSiteBuilder(IBuildPropertyProvider propertyProvider, string workingDirectory, string tempPath, string nugetCachePath)
{
_propertyProvider = propertyProvider;
_msbuildExe = new Executable(PathUtility.ResolveMSBuildPath(), workingDirectory);
_msbuildExe.EnvironmentVariables[NuGetCachePathKey] = nugetCachePath;
_tempPath = tempPath;
}
protected string GetPropertyString()
{
return String.Join(";", _propertyProvider.GetProperties().Select(p => p.Key + "=" + p.Value));
}
public string ExecuteMSBuild(ITracer tracer, string arguments, params object[] args)
{
return _msbuildExe.Execute(tracer, arguments, args).Item1;
}
public abstract Task Build(DeploymentContext context);
}
}
|
using System;
using System.Linq;
using System.Threading.Tasks;
using Kudu.Contracts.Tracing;
using Kudu.Core.Infrastructure;
namespace Kudu.Core.Deployment
{
public abstract class MsBuildSiteBuilder : ISiteBuilder
{
private const string NuGetCachePathKey = "NuGetCachePath";
private readonly Executable _msbuildExe;
private readonly IBuildPropertyProvider _propertyProvider;
private readonly string _tempPath;
public MsBuildSiteBuilder(IBuildPropertyProvider propertyProvider, string workingDirectory, string tempPath, string nugetCachePath)
{
_propertyProvider = propertyProvider;
_msbuildExe = new Executable(PathUtility.ResolveMSBuildPath(), workingDirectory);
// Disable this for now
// _msbuildExe.EnvironmentVariables[NuGetCachePathKey] = nugetCachePath;
_tempPath = tempPath;
}
protected string GetPropertyString()
{
return String.Join(";", _propertyProvider.GetProperties().Select(p => p.Key + "=" + p.Value));
}
public string ExecuteMSBuild(ITracer tracer, string arguments, params object[] args)
{
return _msbuildExe.Execute(tracer, arguments, args).Item1;
}
public abstract Task Build(DeploymentContext context);
}
}
|
Remove the nuget environment variable.
|
Remove the nuget environment variable.
|
C#
|
apache-2.0
|
shibayan/kudu,sitereactor/kudu,duncansmart/kudu,juvchan/kudu,WeAreMammoth/kudu-obsolete,chrisrpatterson/kudu,WeAreMammoth/kudu-obsolete,puneet-gupta/kudu,shrimpy/kudu,kali786516/kudu,shibayan/kudu,juoni/kudu,badescuga/kudu,duncansmart/kudu,chrisrpatterson/kudu,badescuga/kudu,sitereactor/kudu,barnyp/kudu,bbauya/kudu,EricSten-MSFT/kudu,kali786516/kudu,kali786516/kudu,barnyp/kudu,chrisrpatterson/kudu,uQr/kudu,shrimpy/kudu,kenegozi/kudu,puneet-gupta/kudu,projectkudu/kudu,kenegozi/kudu,sitereactor/kudu,sitereactor/kudu,juvchan/kudu,dev-enthusiast/kudu,YOTOV-LIMITED/kudu,badescuga/kudu,puneet-gupta/kudu,shanselman/kudu,EricSten-MSFT/kudu,puneet-gupta/kudu,EricSten-MSFT/kudu,badescuga/kudu,oliver-feng/kudu,juvchan/kudu,projectkudu/kudu,juoni/kudu,shibayan/kudu,barnyp/kudu,juvchan/kudu,projectkudu/kudu,EricSten-MSFT/kudu,oliver-feng/kudu,shibayan/kudu,MavenRain/kudu,duncansmart/kudu,uQr/kudu,barnyp/kudu,EricSten-MSFT/kudu,badescuga/kudu,oliver-feng/kudu,YOTOV-LIMITED/kudu,shrimpy/kudu,oliver-feng/kudu,uQr/kudu,dev-enthusiast/kudu,uQr/kudu,MavenRain/kudu,kenegozi/kudu,shrimpy/kudu,shibayan/kudu,duncansmart/kudu,chrisrpatterson/kudu,sitereactor/kudu,bbauya/kudu,juoni/kudu,WeAreMammoth/kudu-obsolete,mauricionr/kudu,projectkudu/kudu,kenegozi/kudu,dev-enthusiast/kudu,mauricionr/kudu,YOTOV-LIMITED/kudu,shanselman/kudu,mauricionr/kudu,juoni/kudu,bbauya/kudu,YOTOV-LIMITED/kudu,mauricionr/kudu,puneet-gupta/kudu,juvchan/kudu,dev-enthusiast/kudu,bbauya/kudu,kali786516/kudu,MavenRain/kudu,projectkudu/kudu,shanselman/kudu,MavenRain/kudu
|
860df035bc7f39b4f043cddf8aa4eaf1cd607641
|
src/FlatFile.FixedLength.Attributes/Infrastructure/FixedLayoutDescriptorProvider.cs
|
src/FlatFile.FixedLength.Attributes/Infrastructure/FixedLayoutDescriptorProvider.cs
|
namespace FlatFile.FixedLength.Attributes.Infrastructure
{
using System;
using System.Linq;
using FlatFile.Core;
using FlatFile.Core.Attributes.Extensions;
using FlatFile.Core.Attributes.Infrastructure;
using FlatFile.Core.Base;
public class FixedLayoutDescriptorProvider : ILayoutDescriptorProvider<FixedFieldSettings, ILayoutDescriptor<FixedFieldSettings>>
{
public ILayoutDescriptor<FixedFieldSettings> GetDescriptor<T>()
{
var container = new FieldsContainer<FixedFieldSettings>();
var fileMappingType = typeof(T);
var fileAttribute = fileMappingType.GetAttribute<FixedLengthFileAttribute>();
if (fileAttribute == null)
{
throw new NotSupportedException(string.Format("Mapping type {0} should be marked with {1} attribute",
fileMappingType.Name,
typeof(FixedLengthFileAttribute).Name));
}
var properties = fileMappingType.GetTypeDescription<FixedLengthFieldAttribute>();
foreach (var p in properties)
{
var attribute = p.Attributes.FirstOrDefault() as FixedLengthFieldAttribute;
if (attribute != null)
{
var fieldSettings = attribute.GetFieldSettings(p.Property);
container.AddOrUpdate(fieldSettings, false);
}
}
var descriptor = new LayoutDescriptorBase<FixedFieldSettings>(container);
return descriptor;
}
}
}
|
namespace FlatFile.FixedLength.Attributes.Infrastructure
{
using System;
using System.Linq;
using FlatFile.Core;
using FlatFile.Core.Attributes.Extensions;
using FlatFile.Core.Attributes.Infrastructure;
using FlatFile.Core.Base;
public class FixedLayoutDescriptorProvider : ILayoutDescriptorProvider<FixedFieldSettings, ILayoutDescriptor<FixedFieldSettings>>
{
public ILayoutDescriptor<FixedFieldSettings> GetDescriptor<T>()
{
var container = new FieldsContainer<FixedFieldSettings>();
var fileMappingType = typeof(T);
var fileAttribute = fileMappingType.GetAttribute<FixedLengthFileAttribute>();
if (fileAttribute == null)
{
throw new NotSupportedException(string.Format("Mapping type {0} should be marked with {1} attribute",
fileMappingType.Name,
typeof(FixedLengthFileAttribute).Name));
}
var properties = fileMappingType.GetTypeDescription<FixedLengthFieldAttribute>();
foreach (var p in properties)
{
var attribute = p.Attributes.FirstOrDefault() as FixedLengthFieldAttribute;
if (attribute != null)
{
var fieldSettings = attribute.GetFieldSettings(p.Property);
container.AddOrUpdate(fieldSettings, false);
}
}
var descriptor = new LayoutDescriptorBase<FixedFieldSettings>(container)
{
HasHeader = false
};
return descriptor;
}
}
}
|
Fix header behavior for the fixed length types
|
Fix header behavior for the fixed length types
|
C#
|
mit
|
forcewake/FlatFile
|
e3d5f8d39b1d0da877d24bd1c41f675ede719e70
|
Stratis.Bitcoin/Builder/Feature/FeaturesExtensions.cs
|
Stratis.Bitcoin/Builder/Feature/FeaturesExtensions.cs
|
using System.Collections.Generic;
using System.Linq;
namespace Stratis.Bitcoin.Builder.Feature
{
/// <summary>
/// Extensions to features collection.
/// </summary>
public static class FeaturesExtensions
{
/// <summary>
/// Ensures a dependency feature type is present in the feature registration.
/// </summary>
/// <typeparam name="T">The dependency feature type.</typeparam>
/// <param name="features">List of feature registrations.</param>
/// <returns>List of feature registrations.</returns>
/// <exception cref="MissingDependencyException">Thrown if feature type is missing.</exception>
public static IEnumerable<IFullNodeFeature> EnsureFeature<T>(this IEnumerable<IFullNodeFeature> features)
{
if (!features.Any(i => i.GetType() == typeof(T)))
{
throw new MissingDependencyException($"Dependency feature {typeof(T)} cannot be found.");
}
return features;
}
}
}
|
using System.Collections.Generic;
using System.Linq;
namespace Stratis.Bitcoin.Builder.Feature
{
/// <summary>
/// Extensions to features collection.
/// </summary>
public static class FeaturesExtensions
{
/// <summary>
/// Ensures a dependency feature type is present in the feature list.
/// </summary>
/// <typeparam name="T">The dependency feature type.</typeparam>
/// <param name="features">List of features.</param>
/// <returns>List of features.</returns>
/// <exception cref="MissingDependencyException">Thrown if feature type is missing.</exception>
public static IEnumerable<IFullNodeFeature> EnsureFeature<T>(this IEnumerable<IFullNodeFeature> features)
{
if (!features.OfType<T>().Any())
{
throw new MissingDependencyException($"Dependency feature {typeof(T)} cannot be found.");
}
return features;
}
}
}
|
Clean up type checking code
|
Clean up type checking code
|
C#
|
mit
|
stratisproject/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode
|
4280ede14393bc708932c78681eb4a469fe9d74a
|
GameModel/entities/unitSystems/Weapons/BeamBatterySystem.cs
|
GameModel/entities/unitSystems/Weapons/BeamBatterySystem.cs
|
// <copyright file="BeamBatterySystem.cs" company="Patrick Maughan">
// Copyright (c) Patrick Maughan. All rights reserved.
// </copyright>
namespace FireAndManeuver.GameModel
{
using System.Xml.Serialization;
public class BeamBatterySystem : ArcWeaponSystem
{
[XmlIgnore]
private string arcs;
public BeamBatterySystem()
: base()
{
this.SystemName = "Class-1 Beam Battery System";
this.Rating = 1;
this.Arcs = "(All arcs)";
}
public BeamBatterySystem(int rating)
{
this.SystemName = $"Class-{rating} Beam Battery System";
this.Rating = rating;
// Default is "all arcs" for a B1,
this.Arcs = rating == 1 ? "(All arcs)" : "(F)";
}
public BeamBatterySystem(int rating, string arcs)
{
this.SystemName = $"Class-{rating} Beam Battery System";
this.Rating = rating;
this.Arcs = arcs;
}
[XmlAttribute("rating")]
public int Rating { get; set; } = 1;
[XmlAttribute("arcs")]
public override string Arcs
{
get
{
var arcString = this.Rating == 1 ? "(All arcs)" : string.IsNullOrWhiteSpace(this.arcs) ? "(F)" : this.arcs;
return arcString;
}
set
{
this.arcs = value;
}
}
}
}
|
// <copyright file="BeamBatterySystem.cs" company="Patrick Maughan">
// Copyright (c) Patrick Maughan. All rights reserved.
// </copyright>
namespace FireAndManeuver.GameModel
{
using System.Xml.Serialization;
public class BeamBatterySystem : ArcWeaponSystem
{
[XmlIgnore]
private const string BaseSystemName = "Beam Battery System";
[XmlIgnore]
private string arcs;
public BeamBatterySystem()
: base()
{
this.SystemName = "Beam Battery System";
this.Rating = 1;
this.Arcs = "(All arcs)";
}
public BeamBatterySystem(int rating)
{
this.SystemName = $"Beam Battery System";
this.Rating = rating;
// Default is "all arcs" for a B1
this.Arcs = rating == 1 ? "(All arcs)" : "(F)";
}
public BeamBatterySystem(int rating, string arcs)
{
this.SystemName = $"Beam Battery System";
this.Rating = rating;
this.Arcs = arcs;
}
[XmlAttribute("rating")]
public int Rating { get; set; } = 1;
[XmlAttribute("arcs")]
public override string Arcs
{
get
{
var arcString = this.Rating == 1 ? "(All arcs)" : string.IsNullOrWhiteSpace(this.arcs) ? "(F)" : this.arcs;
return arcString;
}
set
{
this.arcs = value;
}
}
public override string ToString()
{
this.SystemName = $"Class-{this.Rating} {BaseSystemName}";
return base.ToString();
}
}
}
|
Improve Beam-weapon toString to include rating value
|
Improve Beam-weapon toString to include rating value
|
C#
|
mit
|
skeolan/FireAndManeuver
|
bbb12d05d13d2276c0205f4257de5c2813f8fed9
|
src/SharedAssemblyInfo.cs
|
src/SharedAssemblyInfo.cs
|
#region License
/*
Copyright 2011 Andrew Davey
This file is part of Cassette.
Cassette is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
Cassette is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
Cassette. If not, see http://www.gnu.org/licenses/.
*/
#endregion
using System.Reflection;
[assembly: AssemblyCompany("Andrew Davey")]
[assembly: AssemblyProduct("Cassette")]
[assembly: AssemblyCopyright("Copyright © Andrew Davey 2011")]
[assembly: AssemblyVersion("0.8.3")]
[assembly: AssemblyFileVersion("0.8.3")]
|
#region License
/*
Copyright 2011 Andrew Davey
This file is part of Cassette.
Cassette is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
Cassette is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
Cassette. If not, see http://www.gnu.org/licenses/.
*/
#endregion
using System.Reflection;
[assembly: AssemblyCompany("Andrew Davey")]
[assembly: AssemblyProduct("Cassette")]
[assembly: AssemblyCopyright("Copyright © Andrew Davey 2011")]
[assembly: AssemblyVersion("0.9.0")]
[assembly: AssemblyFileVersion("0.9.0")]
|
Bump to v0.9 - this is going to be the beta for 1.0
|
Bump to v0.9 - this is going to be the beta for 1.0
|
C#
|
mit
|
andrewdavey/cassette,andrewdavey/cassette,honestegg/cassette,honestegg/cassette,damiensawyer/cassette,damiensawyer/cassette,BluewireTechnologies/cassette,BluewireTechnologies/cassette,andrewdavey/cassette,honestegg/cassette,damiensawyer/cassette
|
78dea0156a9bcb6458e98fbf4719d18f27cffa69
|
source/Handlebars.Benchmark/LargeArray.cs
|
source/Handlebars.Benchmark/LargeArray.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BenchmarkDotNet.Attributes;
using HandlebarsDotNet;
namespace HandlebarsNet.Benchmark
{
public class LargeArray
{
private object _data;
private HandlebarsTemplate<object, object> _default;
[Params(20000, 40000, 80000)]
public int N { get; set; }
[GlobalSetup]
public void Setup()
{
const string template = @"{{#each this}}{{this}}{{/each}}";
_default = Handlebars.Compile(template);
_data = Enumerable.Range(0, N).ToList();
}
[Benchmark]
public void Default() => _default(_data);
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BenchmarkDotNet.Attributes;
using HandlebarsDotNet;
namespace HandlebarsNet.Benchmark
{
public class LargeArray
{
private object _data;
private HandlebarsTemplate<TextWriter, object, object> _default;
[Params(20000, 40000, 80000)]
public int N { get; set; }
[GlobalSetup]
public void Setup()
{
const string template = @"{{#each this}}{{this}}{{/each}}";
var handlebars = Handlebars.Create();
using (var reader = new StringReader(template))
{
_default = handlebars.Compile(reader);
}
_data = Enumerable.Range(0, N).ToList();
}
[Benchmark]
public void Default() => _default(TextWriter.Null, _data);
}
}
|
Use TextWriter overload for template filling. Change was requested by pull request reviewer.
|
Use TextWriter overload for template filling.
Change was requested by pull request reviewer.
|
C#
|
mit
|
rexm/Handlebars.Net,rexm/Handlebars.Net
|
b47d04c049328aa07745db6449d9d29b9b165458
|
AppveyorShieldBadges/Program.cs
|
AppveyorShieldBadges/Program.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
namespace AppveyorShieldBadges
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();
host.Run();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
namespace AppveyorShieldBadges
{
public class Program
{
public static void Main(string[] args)
{
var host = ;new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();
host.Run();
}
}
}
|
Add error to see if CI is blocking Deployment
|
Add error to see if CI is blocking Deployment
|
C#
|
mit
|
monkey3310/appveyor-shields-badges
|
8ea8330e7f5f6b6181a879382455006738acea9c
|
CoffeeFilter.iOS/AppDelegate.cs
|
CoffeeFilter.iOS/AppDelegate.cs
|
using UIKit;
using Foundation;
namespace CoffeeFilter.iOS
{
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
const string GoogleMapsAPIKey = "AIzaSyAAOpU0qjK0LBTe2UCCxPQP1iTaSv_Xihw";
public override UIWindow Window { get; set; }
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
#if DEBUG
// Xamarin.Insights.Initialize("ef02f98fd6fb47ce8624862ab7625b933b6fb21d");
#else
Xamarin.Insights.Initialize ("8da86f8b3300aa58f3dc9bbef455d0427bb29086");
#endif
// Register Google maps key to use street view
Google.Maps.MapServices.ProvideAPIKey(GoogleMapsAPIKey);
// Code to start the Xamarin Test Cloud Agent
#if ENABLE_TEST_CLOUD
Xamarin.Calabash.Start();
#endif
return true;
}
}
}
|
using UIKit;
using Foundation;
namespace CoffeeFilter.iOS
{
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
const string GoogleMapsAPIKey = "AIzaSyAAOpU0qjK0LBTe2UCCxPQP1iTaSv_Xihw";
public override UIWindow Window { get; set; }
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
#if DEBUG
// Xamarin.Insights.Initialize("ef02f98fd6fb47ce8624862ab7625b933b6fb21d");
#else
Xamarin.Insights.Initialize ("8da86f8b3300aa58f3dc9bbef455d0427bb29086");
#endif
// Register Google maps key to use street view
Google.Maps.MapServices.ProvideAPIKey(GoogleMapsAPIKey);
// Code to start the Xamarin Test Cloud Agent
#if UITest
Xamarin.Calabash.Start();
#endif
return true;
}
}
}
|
Use UITest compiler directive instead of ENABLE_TEST_CLOUD
|
[CoffeeFilter.UITests] Use UITest compiler directive instead of ENABLE_TEST_CLOUD
|
C#
|
mit
|
jamesmontemagno/Coffee-Filter,hoanganhx86/Coffee-Filter
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.