commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13 values | lang stringclasses 23 values |
|---|---|---|---|---|---|---|---|---|
7062b0aa1db962eb02f7abc42e51e27f77547301 | Replace helper implementation with DateOffset members | PKRoma/libgit2sharp,libgit2/libgit2sharp | LibGit2Sharp/Core/Epoch.cs | LibGit2Sharp/Core/Epoch.cs | using System;
namespace LibGit2Sharp.Core
{
/// <summary>
/// Provides helper methods to help converting between Epoch (unix timestamp) and <see cref="DateTimeOffset"/>.
/// </summary>
internal static class Epoch
{
/// <summary>
/// Builds a <see cref="DateTimeOffset"/> from a Unix timestamp and a timezone offset.
/// </summary>
/// <param name="secondsSinceEpoch">The number of seconds since 00:00:00 UTC on 1 January 1970.</param>
/// <param name="timeZoneOffsetInMinutes">The number of minutes from UTC in a timezone.</param>
/// <returns>A <see cref="DateTimeOffset"/> representing this instant.</returns>
public static DateTimeOffset ToDateTimeOffset(long secondsSinceEpoch, int timeZoneOffsetInMinutes) =>
DateTimeOffset.FromUnixTimeSeconds(secondsSinceEpoch).ToOffset(TimeSpan.FromMinutes(timeZoneOffsetInMinutes));
/// <summary>
/// Converts the<see cref="DateTimeOffset.UtcDateTime"/> part of a <see cref="DateTimeOffset"/> into a Unix timestamp.
/// </summary>
/// <param name="date">The <see cref="DateTimeOffset"/> to convert.</param>
/// <returns>The number of seconds since 00:00:00 UTC on 1 January 1970.</returns>
public static Int32 ToSecondsSinceEpoch(this DateTimeOffset date) => (int)date.ToUnixTimeSeconds();
}
}
| using System;
namespace LibGit2Sharp.Core
{
/// <summary>
/// Provides helper methods to help converting between Epoch (unix timestamp) and <see cref="DateTimeOffset"/>.
/// </summary>
internal static class Epoch
{
private static readonly DateTimeOffset epochDateTimeOffset = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
/// <summary>
/// Builds a <see cref="DateTimeOffset"/> from a Unix timestamp and a timezone offset.
/// </summary>
/// <param name="secondsSinceEpoch">The number of seconds since 00:00:00 UTC on 1 January 1970.</param>
/// <param name="timeZoneOffsetInMinutes">The number of minutes from UTC in a timezone.</param>
/// <returns>A <see cref="DateTimeOffset"/> representing this instant.</returns>
public static DateTimeOffset ToDateTimeOffset(long secondsSinceEpoch, int timeZoneOffsetInMinutes)
{
DateTimeOffset utcDateTime = epochDateTimeOffset.AddSeconds(secondsSinceEpoch);
TimeSpan offset = TimeSpan.FromMinutes(timeZoneOffsetInMinutes);
return new DateTimeOffset(utcDateTime.DateTime.Add(offset), offset);
}
/// <summary>
/// Converts the<see cref="DateTimeOffset.UtcDateTime"/> part of a <see cref="DateTimeOffset"/> into a Unix timestamp.
/// </summary>
/// <param name="date">The <see cref="DateTimeOffset"/> to convert.</param>
/// <returns>The number of seconds since 00:00:00 UTC on 1 January 1970.</returns>
public static Int32 ToSecondsSinceEpoch(this DateTimeOffset date)
{
DateTimeOffset utcDate = date.ToUniversalTime();
return (Int32)utcDate.Subtract(epochDateTimeOffset).TotalSeconds;
}
}
}
| mit | C# |
c2b6dd3110a4f8bf2404d3a07d8245830a5dfee5 | Change MessageBox to Snackbar in Chips.xaml.cs | ButchersBoy/MaterialDesignInXamlToolkit,ButchersBoy/MaterialDesignInXamlToolkit,ButchersBoy/MaterialDesignInXamlToolkit | MainDemo.Wpf/Chips.xaml.cs | MainDemo.Wpf/Chips.xaml.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Xml;
using MaterialDesignDemo.Helper;
namespace MaterialDesignColors.WpfExample
{
/// <summary>
/// Interaction logic for Chips.xaml
/// </summary>
public partial class Chips : UserControl
{
public Chips()
{
InitializeComponent();
}
private void ButtonsDemoChip_OnClick(object sender, RoutedEventArgs e)
{
MainWindow.Snackbar.MessageQueue.Enqueue("Chip clicked!");
}
private void ButtonsDemoChip_OnDeleteClick(object sender, RoutedEventArgs e)
{
MainWindow.Snackbar.MessageQueue.Enqueue("Chip delete clicked!");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Xml;
using MaterialDesignDemo.Helper;
namespace MaterialDesignColors.WpfExample
{
/// <summary>
/// Interaction logic for Chips.xaml
/// </summary>
public partial class Chips : UserControl
{
public Chips()
{
InitializeComponent();
}
private void ButtonsDemoChip_OnClick(object sender, RoutedEventArgs e)
{
MessageBox.Show("Chip clicked.");
}
private void ButtonsDemoChip_OnDeleteClick(object sender, RoutedEventArgs e)
{
MessageBox.Show("Chip delete clicked.");
}
}
}
| mit | C# |
660cb641b7395b99db6c0a8e8c68beafe65d3c46 | Fix RadioButtons, need to use Active insted of Activate. | monsterlabs/HumanRightsTracker,monsterlabs/HumanRightsTracker,monsterlabs/HumanRightsTracker,monsterlabs/HumanRightsTracker,monsterlabs/HumanRightsTracker | Views/Widgets/BooleanRadioButton.cs | Views/Widgets/BooleanRadioButton.cs | using System;
namespace Views
{
[System.ComponentModel.ToolboxItem(true)]
public partial class BooleanRadioButton : Gtk.Bin, IEditable
{
String[] labels;
bool isEditable;
public BooleanRadioButton ()
{
this.Build ();
}
public String[] Labels {
get { return this.labels; }
set {
labels = value;
radiobutton_true.Label = labels[0];
radiobutton_false.Label = labels[1];
}
}
public bool Value () {
if (radiobutton_true.Active)
return true;
else
return false;
}
public bool IsEditable {
get {
return this.isEditable;
}
set {
isEditable = value;
radiobutton_true.Visible = value;
radiobutton_false.Visible = value;
text.Visible = !value;
text.Text = radiobutton_true.Active ? labels[0] : labels[1];
}
}
public new bool Activate {
get {
return Value ();
}
set {
bool state = value;
if (state) {
radiobutton_true.Active = true;
} else {
radiobutton_false.Active = true;
}
}
}
}
} | using System;
namespace Views
{
[System.ComponentModel.ToolboxItem(true)]
public partial class BooleanRadioButton : Gtk.Bin, IEditable
{
String[] labels;
bool isEditable;
public BooleanRadioButton ()
{
this.Build ();
}
public String[] Labels {
get { return this.labels; }
set {
labels = value;
radiobutton_true.Label = labels[0];
radiobutton_false.Label = labels[1];
}
}
public bool Value () {
if (radiobutton_true.Active)
return true;
else
return false;
}
public bool IsEditable {
get {
return this.isEditable;
}
set {
isEditable = value;
radiobutton_true.Visible = value;
radiobutton_false.Visible = value;
text.Visible = !value;
text.Text = radiobutton_true.Active ? labels[0] : labels[1];
}
}
public new bool Activate {
get {
return Value ();
}
set {
bool state = value;
if (state)
radiobutton_true.Activate ();
else
radiobutton_false.Activate ();
}
}
}
} | lgpl-2.1 | C# |
b78bddbf0db8a89d6b02ce29338b3844944acabb | Add missing ConfigureAwait | ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework | osu.Framework.Tests/Visual/Drawables/TestSceneSynchronizationContext.cs | osu.Framework.Tests/Visual/Drawables/TestSceneSynchronizationContext.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osuTK;
namespace osu.Framework.Tests.Visual.Drawables
{
public class TestSceneSynchronizationContext : FrameworkTestScene
{
private AsyncPerformingBox box;
[Test]
public void TestAsyncPerformingBox()
{
AddStep("add box", () => Child = box = new AsyncPerformingBox());
AddAssert("not spun", () => box.Rotation == 0);
AddStep("trigger", () => box.Trigger());
AddUntilStep("has spun", () => box.Rotation == 180);
}
public class AsyncPerformingBox : Box
{
private readonly SemaphoreSlim waiter = new SemaphoreSlim(0);
public AsyncPerformingBox()
{
Size = new Vector2(100);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
protected override async void LoadComplete()
{
base.LoadComplete();
await waiter.WaitAsync().ConfigureAwait(false);
this.RotateTo(180, 500);
}
public void Trigger()
{
waiter.Release();
}
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osuTK;
namespace osu.Framework.Tests.Visual.Drawables
{
public class TestSceneSynchronizationContext : FrameworkTestScene
{
private AsyncPerformingBox box;
[Test]
public void TestAsyncPerformingBox()
{
AddStep("add box", () => Child = box = new AsyncPerformingBox());
AddAssert("not spun", () => box.Rotation == 0);
AddStep("trigger", () => box.Trigger());
AddUntilStep("has spun", () => box.Rotation == 180);
}
public class AsyncPerformingBox : Box
{
private readonly SemaphoreSlim waiter = new SemaphoreSlim(0);
public AsyncPerformingBox()
{
Size = new Vector2(100);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
protected override async void LoadComplete()
{
base.LoadComplete();
await waiter.WaitAsync();
this.RotateTo(180, 500);
}
public void Trigger()
{
waiter.Release();
}
}
}
}
| mit | C# |
ca9a11b1a29cc441165a6fe25392c9477ab71742 | prepare release | anonymousthing/ListenMoeClient | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Listen.moe Client")]
[assembly: AssemblyProduct("Listen.moe Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright 2017 Listen.moe. All rights reserved.")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88b02799-425e-4622-a849-202adb19601b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.1.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Listen.moe Client")]
[assembly: AssemblyProduct("Listen.moe Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright 2017 Listen.moe. All rights reserved.")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88b02799-425e-4622-a849-202adb19601b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
| mit | C# |
7f5fc91b601f5c7deb2d02a312360103fd444675 | Bump version to 0.3.7 | FatturaElettronicaPA/FatturaElettronicaPA | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FatturaElettronica.NET")]
[assembly: AssemblyDescription("Fattura Elettronica per le aziende e la Pubblica Amministrazione Italiana")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronica.NET")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.7.0")]
[assembly: AssemblyFileVersion("0.3.7.0")]
| using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FatturaElettronica.NET")]
[assembly: AssemblyDescription("Fattura Elettronica per le aziende e la Pubblica Amministrazione Italiana")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronica.NET")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.6.0")]
[assembly: AssemblyFileVersion("0.3.6.0")]
| bsd-3-clause | C# |
546b3d9bae8e78e215e9c261b3ec52e9315c1025 | Change version to 0.2.1.1 | TechieGuy12/PlexServerAutoUpdater | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | #region Using directives
using System;
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle ("PlexServerAutoUpdater")]
[assembly: AssemblyDescription("Updates the Plex Server when it is run as a service.")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("PlexServerAutoUpdater")]
[assembly: AssemblyCopyright("Copyright 2021")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible (false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("0.2.1.1")]
[assembly: AssemblyFileVersion("0.2.1.1")]
| #region Using directives
using System;
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle ("PlexServerAutoUpdater")]
[assembly: AssemblyDescription("Updates the Plex Server when it is run as a service.")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("PlexServerAutoUpdater")]
[assembly: AssemblyCopyright("Copyright 2021")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible (false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("0.2.1.0")]
[assembly: AssemblyFileVersion("0.2.1.0")]
| mit | C# |
96004cb8f139d9e5d95c009b483dc52a84df4a1c | Validate stereotypes (#4459) | xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,petedavis/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,xkproject/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,OrchardCMS/Brochard,stevetayloruk/Orchard2,xkproject/Orchard2 | src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/ContentTypeSettingsDisplayDriver.cs | src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/ContentTypeSettingsDisplayDriver.cs | using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Localization;
using OrchardCore.ContentManagement.Metadata.Models;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.ContentTypes.ViewModels;
using OrchardCore.DisplayManagement.Views;
namespace OrchardCore.ContentTypes.Editors
{
public class ContentTypeSettingsDisplayDriver : ContentTypeDefinitionDisplayDriver
{
public ContentTypeSettingsDisplayDriver(IStringLocalizer<ContentTypeSettingsDisplayDriver> stringLocalizer)
{
S = stringLocalizer;
}
public IStringLocalizer S { get; }
public override IDisplayResult Edit(ContentTypeDefinition contentTypeDefinition)
{
return Initialize<ContentTypeSettingsViewModel>("ContentTypeSettings_Edit", model =>
{
var settings = contentTypeDefinition.GetSettings<ContentTypeSettings>();
model.Creatable = settings.Creatable;
model.Listable = settings.Listable;
model.Draftable = settings.Draftable;
model.Versionable = settings.Versionable;
model.Securable = settings.Securable;
model.Stereotype = settings.Stereotype;
}).Location("Content:5");
}
public override async Task<IDisplayResult> UpdateAsync(ContentTypeDefinition contentTypeDefinition, UpdateTypeEditorContext context)
{
var model = new ContentTypeSettingsViewModel();
if (await context.Updater.TryUpdateModelAsync(model, Prefix))
{
context.Builder.Creatable(model.Creatable);
context.Builder.Listable(model.Listable);
context.Builder.Draftable(model.Draftable);
context.Builder.Versionable(model.Versionable);
context.Builder.Securable(model.Securable);
var stereotype = model.Stereotype?.Trim();
context.Builder.Stereotype(stereotype);
if (!IsAlphaNumericOrEmpty(stereotype))
{
context.Updater.ModelState.AddModelError(nameof(ContentTypeSettingsViewModel.Stereotype), S["The stereotype should be alphanumeric."]);
}
}
return Edit(contentTypeDefinition, context.Updater);
}
private static bool IsAlphaNumericOrEmpty(string value)
{
if (String.IsNullOrEmpty(value))
{
return true;
}
var startWithLetter = char.IsLetter(value[0]);
return value.Length == 1
? startWithLetter
: startWithLetter && value.Skip(1).All(c => char.IsLetterOrDigit(c));
}
}
}
| using System.Threading.Tasks;
using OrchardCore.ContentManagement.Metadata.Models;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.ContentTypes.ViewModels;
using OrchardCore.DisplayManagement.Views;
namespace OrchardCore.ContentTypes.Editors
{
public class ContentTypeSettingsDisplayDriver : ContentTypeDefinitionDisplayDriver
{
public override IDisplayResult Edit(ContentTypeDefinition contentTypeDefinition)
{
return Initialize<ContentTypeSettingsViewModel>("ContentTypeSettings_Edit", model =>
{
var settings = contentTypeDefinition.GetSettings<ContentTypeSettings>();
model.Creatable = settings.Creatable;
model.Listable = settings.Listable;
model.Draftable = settings.Draftable;
model.Versionable = settings.Versionable;
model.Securable = settings.Securable;
model.Stereotype = settings.Stereotype;
}).Location("Content:5");
}
public override async Task<IDisplayResult> UpdateAsync(ContentTypeDefinition contentTypeDefinition, UpdateTypeEditorContext context)
{
var model = new ContentTypeSettingsViewModel();
if (await context.Updater.TryUpdateModelAsync(model, Prefix))
{
context.Builder.Creatable(model.Creatable);
context.Builder.Listable(model.Listable);
context.Builder.Draftable(model.Draftable);
context.Builder.Versionable(model.Versionable);
context.Builder.Securable(model.Securable);
context.Builder.Stereotype(model.Stereotype?.Trim());
}
return Edit(contentTypeDefinition, context.Updater);
}
}
} | bsd-3-clause | C# |
2e9b40dfd7fde0cd981f614f1aa8f265833fdb93 | Add IComparable interface to edges | MSayfullin/Basics | Basics.Structures/Graphs/Edge.cs | Basics.Structures/Graphs/Edge.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
namespace Basics.Structures.Graphs
{
[DebuggerDisplay("{Source}-({Weight})->{Target}")]
public class Edge<T> : IEquatable<Edge<T>>, IComparable<Edge<T>> where T : IEquatable<T>
{
public Edge(T source, T target, double weight = 1.0)
{
Source = source;
Target = target;
Weight = weight;
}
public T Source { get; private set; }
public T Target { get; private set; }
public double Weight { get; private set; }
public bool IsSelfLooped
{
get { return Source.Equals(Target); }
}
public static bool operator ==(Edge<T> a, Edge<T> b)
{
return a.Equals(b);
}
public static bool operator !=(Edge<T> a, Edge<T> b)
{
return !a.Equals(b);
}
public bool Equals(Edge<T> other)
{
return
!Object.ReferenceEquals(other, null)
&& this.Source.Equals(other.Source)
&& this.Target.Equals(other.Target);
}
public override bool Equals(object obj)
{
return Equals(obj as Edge<T>);
}
public override int GetHashCode()
{
var sourceHashCode = Source.GetHashCode();
return ((sourceHashCode << 5) + sourceHashCode) ^ Target.GetHashCode();
}
public override string ToString()
{
return Source + "-(" + Weight.ToString("N1", CultureInfo.CurrentCulture) + ")->" + Target;
}
public int CompareTo(Edge<T> other)
{
return other == null ? 1 : Weight.CompareTo(other.Weight);
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
namespace Basics.Structures.Graphs
{
[DebuggerDisplay("{Source}-({Weight})->{Target}")]
public class Edge<T> : IEquatable<Edge<T>> where T : IEquatable<T>
{
public Edge(T source, T target, double weight = 1.0)
{
Source = source;
Target = target;
Weight = weight;
}
public T Source { get; private set; }
public T Target { get; private set; }
public double Weight { get; private set; }
public bool IsSelfLooped
{
get { return Source.Equals(Target); }
}
public static bool operator ==(Edge<T> a, Edge<T> b)
{
return a.Equals(b);
}
public static bool operator !=(Edge<T> a, Edge<T> b)
{
return !a.Equals(b);
}
public bool Equals(Edge<T> other)
{
return
!Object.ReferenceEquals(other, null)
&& this.Source.Equals(other.Source)
&& this.Target.Equals(other.Target);
}
public override bool Equals(object obj)
{
return Equals(obj as Edge<T>);
}
public override int GetHashCode()
{
var sourceHashCode = Source.GetHashCode();
return ((sourceHashCode << 5) + sourceHashCode) ^ Target.GetHashCode();
}
public override string ToString()
{
return Source + "-(" + Weight.ToString("N1", CultureInfo.CurrentCulture) + ")->" + Target;
}
}
}
| mit | C# |
68e4f8e5056128f09e8d8512d32c075bf1749641 | Update version | agaboduarte/Cielo-API-3.0 | Cielo/Properties/AssemblyInfo.cs | Cielo/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Cielo API REST 3.0")]
[assembly: AssemblyDescription("Integração com a API REST 3.0 de pagamento da Cielo.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ágabo D. de Pinho (https://github.com/agaboduarte)")]
[assembly: AssemblyProduct("Cielo API REST 3.0")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("Github", "https://github.com/agaboduarte/Cielo-API-3.0")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("86182f72-e955-4d07-96cd-37c02cd2d941")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.4")]
[assembly: AssemblyFileVersion("1.0.0.4")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Cielo API REST 3.0")]
[assembly: AssemblyDescription("Integração com a API REST 3.0 de pagamento da Cielo.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ágabo D. de Pinho (https://github.com/agaboduarte)")]
[assembly: AssemblyProduct("Cielo API REST 3.0")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("Github", "https://github.com/agaboduarte/Cielo-API-3.0")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("86182f72-e955-4d07-96cd-37c02cd2d941")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.3")]
[assembly: AssemblyFileVersion("1.0.0.3")]
| mit | C# |
5e94ebb9aa1417ea6f0a63b59bc19d307d5c4a6e | Update test | dfensgmbh/biz.dfch.CS.Activiti.Client | src/biz.dfch.CS.Activiti.Client.Tests/ProcessEngineTest.cs | src/biz.dfch.CS.Activiti.Client.Tests/ProcessEngineTest.cs | /**
* Copyright 2015 d-fens GmbH
*
* 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;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace biz.dfch.CS.Activiti.Client.Tests
{
[TestClass]
public class ProcessEngineTest
{
#region test initialisation and cleanup
protected Uri serveruri = new Uri("http://192.168.112.129:9000/activiti-rest/service/");
protected string applicationName = "";
protected string username = "kermit";
protected string password = "kermit";
protected ProcessEngine _ProcessEngine = null;
[TestInitialize]
public void TestInitialize()
{
_ProcessEngine = new ProcessEngine(serveruri, applicationName);
}
[TestCleanup]
public void TestCleanup()
{
}
#endregion
#region test methods
[TestMethod]
[ExpectedException(typeof(UnauthorizedAccessException), "A wrong username was inappropriately allowed.")]
public void LoginWithWrongUsernameAndPassword()
{
this._ProcessEngine.Login("wrongusername", "1234");
}
[TestMethod]
public void Login()
{
this._ProcessEngine.Login(username, password);
Assert.IsTrue(this._ProcessEngine.IsLoggedIn);
}
[TestMethod]
public void GetWorkflowDefinitions()
{
// Arrange
// Act
this._ProcessEngine.Login(username, password);
Assert.IsTrue(this._ProcessEngine.IsLoggedIn);
var wdefObj1 = this._ProcessEngine.GetWorkflowDefinitions<ProcessDefinitionsResponse>();
var wdefObj2 = this._ProcessEngine.GetWorkflowDefinitions();
// Assert
Assert.IsNotNull(wdefObj1);
Assert.IsNotNull(wdefObj2);
}
#endregion
}
}
| /**
* Copyright 2015 d-fens GmbH
*
* 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;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace biz.dfch.CS.Activiti.Client.Tests
{
[TestClass]
public class ProcessEngineTest
{
#region test initialisation and cleanup
protected Uri serveruri = new Uri("http://192.168.112.129:9000/activiti-rest/service/");
protected string applicationName = "";
protected string username = "kermit";
protected string password = "kermit";
protected ProcessEngine _ProcessEngine = null;
[TestInitialize]
public void TestInitialize()
{
_ProcessEngine = new ProcessEngine(serveruri, applicationName);
}
[TestCleanup]
public void TestCleanup()
{
}
#endregion
#region test methods
[TestMethod]
public void LoginWithWrongUsernameAndPassword()
{
this._ProcessEngine.Login("wrongusername", "1234");
Assert.IsTrue(!this._ProcessEngine.IsLoggedIn);
}
[TestMethod]
public void Login()
{
this._ProcessEngine.Login(username, password);
Assert.IsTrue(this._ProcessEngine.IsLoggedIn);
}
[TestMethod]
public void GetWorkflowDefinitions()
{
// Arrange
// Act
this._ProcessEngine.Login(username, password);
Assert.IsTrue(this._ProcessEngine.IsLoggedIn);
var wdefObj1 = this._ProcessEngine.GetWorkflowDefinitions<ProcessDefinitionsResponse>();
var wdefObj2 = this._ProcessEngine.GetWorkflowDefinitions();
// Assert
Assert.IsNotNull(wdefObj1);
Assert.IsNotNull(wdefObj2);
}
#endregion
}
}
| apache-2.0 | C# |
73cfe394ed6e55d7526e60baf680e144bdf0b501 | refactor for serilog | Longfld/ASPNETcoreAngularJWT,Longfld/ASPNETcoreAngularJWT,Longfld/ASPNETcoreAngularJWT,Longfld/ASPNETcoreAngularJWT | Program.cs | 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;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;
namespace ASPNETCoreAngularJWT
{
public class Program
{
public static void Main(string[] args)
{
var webHost = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((hostingContext, config) =>
{
var env = hostingContext.HostingEnvironment;
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
Log.Logger = new LoggerConfiguration().MinimumLevel.Error().WriteTo.RollingFile(Path.Combine(env.ContentRootPath,"logs/{Date}.txt")).CreateLogger();
})
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
logging.AddSerilog(dispose: true);
logging.AddConsole();
logging.AddDebug();
})
.UseStartup<Startup>()
.Build();
webHost.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;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;
namespace ASPNETCoreAngularJWT
{
public class Program
{
public static void Main(string[] args)
{
var webHost = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((hostingContext, config) =>
{
var env = hostingContext.HostingEnvironment;
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
Log.Logger = new LoggerConfiguration().MinimumLevel.Error().WriteTo.RollingFile(Path.Combine(env.ContentRootPath,"logs/{Date}.txt")).CreateLogger();
})
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
logging.AddSerilog();
logging.AddConsole();
logging.AddDebug();
})
.UseStartup<Startup>()
.Build();
webHost.Run();
}
}
}
| mit | C# |
1116f6d5956e6e3b0e9dae0b046c26e726ceae58 | Update TestCompositionRootSetup.cs | tiksn/TIKSN-Framework | TIKSN.UnitTests.Shared/DependencyInjection/TestCompositionRootSetup.cs | TIKSN.UnitTests.Shared/DependencyInjection/TestCompositionRootSetup.cs | using System;
using System.Collections.Generic;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using TIKSN.Analytics.Logging;
using Xunit.Abstractions;
namespace TIKSN.DependencyInjection.Tests
{
public class TestCompositionRootSetup : CompositionRootSetupBase
{
private readonly ITestOutputHelper _testOutputHelper;
private readonly Action<IServiceCollection> _configureServices;
private readonly Action<IServiceCollection, IConfigurationRoot> _configureOptions;
public TestCompositionRootSetup(ITestOutputHelper testOutputHelper, Action<IServiceCollection> configureServices = null, Action<IServiceCollection, IConfigurationRoot> configureOptions = null) : base(new TestConfigurationRootSetup().GetConfigurationRoot())
{
this._testOutputHelper = testOutputHelper;
this._configureServices = configureServices;
this._configureOptions = configureOptions;
}
protected override void ConfigureOptions(IServiceCollection services, IConfigurationRoot configuration) => this._configureOptions?.Invoke(services, configuration);
protected override void ConfigureServices(IServiceCollection services) => this._configureServices?.Invoke(services);
protected override IEnumerable<ILoggingSetup> GetLoggingSetups()
{
yield return new TestSerilogLoggingSetup(this._testOutputHelper);
}
}
}
| using System;
using System.Collections.Generic;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using TIKSN.Analytics.Logging;
using Xunit.Abstractions;
namespace TIKSN.DependencyInjection.Tests
{
public class TestCompositionRootSetup : CompositionRootSetupBase
{
private readonly ITestOutputHelper _testOutputHelper;
private readonly Action<IServiceCollection> _configureServices;
private readonly Action<IServiceCollection, IConfigurationRoot> _configureOptions;
public TestCompositionRootSetup(ITestOutputHelper testOutputHelper, Action<IServiceCollection> configureServices = null, Action<IServiceCollection, IConfigurationRoot> configureOptions = null) : base(new TestConfigurationRootSetup().GetConfigurationRoot())
{
_testOutputHelper = testOutputHelper;
_configureServices = configureServices;
_configureOptions = configureOptions;
}
protected override void ConfigureOptions(IServiceCollection services, IConfigurationRoot configuration)
{
_configureOptions?.Invoke(services, configuration);
}
protected override void ConfigureServices(IServiceCollection services)
{
_configureServices?.Invoke(services);
}
protected override IEnumerable<ILoggingSetup> GetLoggingSetups()
{
yield return new TestSerilogLoggingSetup(_testOutputHelper);
}
}
}
| mit | C# |
7e0c0e2d505b77e3433c61ca473397ea61ca0d22 | Update Version : 1.7.171.0 URL Changes + Fix User Manager Delete | Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal | Master/Appleseed/Projects/Appleseed.Framework/Properties/AssemblyInfo.cs | Master/Appleseed/Projects/Appleseed.Framework/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Appleseed.AppCode")]
[assembly: AssemblyDescription("Appleseed Portal and Content Management System : Framework.Web ")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("Appleseed Portal Core Framework")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("03094a42-cc29-4a65-aead-e2f803e90931")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.7.171.0")]
[assembly: AssemblyFileVersion("1.7.171.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Appleseed.AppCode")]
[assembly: AssemblyDescription("Appleseed Portal and Content Management System : Framework.Web ")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("Appleseed Portal Core Framework")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("03094a42-cc29-4a65-aead-e2f803e90931")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.6.160.540")]
[assembly: AssemblyFileVersion("1.6.160.540")]
| apache-2.0 | C# |
7c90e6b379581049c235d9ac1da7e7a38b0d2e57 | Update server side API for single multiple answer question | Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist | Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs | Trappist/src/Promact.Trappist.Repository/Questions/QuestionRepository.cs | using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRespository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
{
singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
}
_dbContext.SaveChanges();
}
}
}
| using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;
namespace Promact.Trappist.Repository.Questions
{
public class QuestionRepository : IQuestionRespository
{
private readonly TrappistDbContext _dbContext;
public QuestionRepository(TrappistDbContext dbContext)
{
_dbContext = dbContext;
}
/// <summary>
/// Get all questions
/// </summary>
/// <returns>Question list</returns>
public List<SingleMultipleAnswerQuestion> GetAllQuestions()
{
var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
return question;
}
/// <summary>
/// Add single multiple answer question into model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <param name="singleMultipleAnswerQuestionOption"></param>
public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
{
_dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
{
singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
_dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
}
_dbContext.SaveChanges();
}
}
}
| mit | C# |
141e95229261292ed7f006b9f711d2c113efb25a | Fix #1: Grammar correction | ngEPL/Mocca | Mocca/Physical/PhysicalParser.cs | Mocca/Physical/PhysicalParser.cs |
using System;
using System.Collections.Generic;
using Mocca.Compiler;
using Mocca.DataType;
using Mocca.Blocks;
namespace Mocca.Physical {
public enum PhysicalDevice {
Microbit,
Arduino,
RaspberryPi,
Unknown
}
public class PhysicalParser {
public Block block;
public PhysicalDevice device;
public PhysicalParser(Block block) {
this.block = block;
this.device = checkDevices(block);
}
public string Parse() {
switch (device) {
case PhysicalDevice.Arduino:
return ParseArduino();
case PhysicalDevice.Microbit:
return ParseMicrobit();
case PhysicalDevice.RaspberryPi:
return ParseRaspberryPi();
default:
throw new FormatException();
}
}
#region Microbit
public string ParseMicrobit() {
var type = this.block.type;
var value = this.block.value;
switch (type.name) {
case "DisplayScroll":
return "display.scroll(" + value[0].ToString() + ")";
case "DisplayShow":
return "display.show(" + value[0].ToString() + ")";
case "Sleep":
return "sleep(" + value[0].ToString() + ")";
case "ButtonPressedA":
return "if button_a.is_pressed():";
case "ButtonPressedB":
return "if button_b.is_pressed():";
case "ButtonPressedAB":
return "if button_a.is_pressed() and button_b.is_pressed():";
default:
throw new FormatException();
}
}
#endregion Microbit
#region Arduino
public string ParseArduino() {
return null;
}
#endregion Arduino
#region RaspberryPi
public string ParseRaspberryPi() {
return null;
}
#endregion RaspberryPi
public PhysicalDevice checkDevices(Block cmd) {
if (cmd.type.category != BlockCategory.Hardware) {
return PhysicalDevice.Unknown;
}
PhysicalDevice ret;
switch (cmd.type.extModule) {
case "microbit":
ret = PhysicalDevice.Microbit;
break;
case "arduino":
ret = PhysicalDevice.Arduino;
break;
case "rbpi":
ret = PhysicalDevice.RaspberryPi;
break;
default:
ret = PhysicalDevice.Unknown;
break;
}
return ret;
}
}
}
|
using System;
using System.Collections.Generic;
using Mocca.Compiler;
using Mocca.DataType;
using Mocca.Blocks;
namespace Mocca.Physical {
public enum PhysicalDevice {
Microbit,
Arduino,
RaspberryPi,
Unknown
}
public class PhysicalParser {
public Block block;
public PhysicalDevice device;
public PhysicalParser(Block block) {
this.block = block;
this.device = checkDevices(block);
}
public string Parse() {
switch (device) {
case PhysicalDevice.Arduino:
return ParseArduino();
case PhysicalDevice.Microbit:
return ParseMicrobit();
case PhysicalDevice.RaspberryPi:
return ParseRaspberryPi();
default:
throw new FormatException();
}
}
#region Microbit
public string ParseMicrobit() {
var type = this.block.type;
var value = this.block.value;
switch (type.name) {
case "DisplayScroll":
return "display.scroll(" + value[0].ToString() + ")";
case "DisplayShow":
return "display.show(" + value[0].ToString() + ")";
case "Sleep":
return "sleep(" + value[0].ToString() + ")";
case "Button_A_pressed"
return "if microbit.button_a.is_pressed():"
case "Button_B_pressed"
return "if microbit.button_b.is_pressed():"
case "Button_AB_pressed"
return "if microbit.button_a.is_pressed() and microbit.button_b.is_pressed():"
default:
throw new FormatException();
}
}
#endregion Microbit
#region Arduino
public string ParseArduino() {
return null;
}
#endregion Arduino
#region RaspberryPi
public string ParseRaspberryPi() {
return null;
}
#endregion RaspberryPi
public PhysicalDevice checkDevices(Block cmd) {
if (cmd.type.category != BlockCategory.Hardware) {
return PhysicalDevice.Unknown;
}
PhysicalDevice ret;
switch (cmd.type.extModule) {
case "microbit":
ret = PhysicalDevice.Microbit;
break;
case "arduino":
ret = PhysicalDevice.Arduino;
break;
case "rbpi":
ret = PhysicalDevice.RaspberryPi;
break;
default:
ret = PhysicalDevice.Unknown;
break;
}
return ret;
}
}
}
| mit | C# |
d5093b656746231134b14b7d4a65f03e16dd5c6d | Fix "AddEnte" | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.Persistence.MongoDB/GestioneRubrica/Enti/AddEnte.cs | src/backend/SO115App.Persistence.MongoDB/GestioneRubrica/Enti/AddEnte.cs | using MongoDB.Driver;
using Persistence.MongoDB;
using SO115App.API.Models.Classi.Condivise;
using SO115App.Models.Servizi.Infrastruttura.GestioneRubrica.Enti;
namespace SO115App.Persistence.MongoDB.GestioneRubrica.Enti
{
public class AddEnte : IAddEnte
{
private readonly DbContext _dbContext;
public AddEnte(DbContext dbContext) => _dbContext = dbContext;
public void Add(EnteIntervenuto ente)
{
var rubricaDocumentsCount = _dbContext.RubricaCollection.Find(x => true).CountDocuments();
if (rubricaDocumentsCount > 0) {
var codice = _dbContext.RubricaCollection.Find(x => true).SortByDescending(c => c.Codice).First().Codice;
ente.Codice = codice + 1;
} else {
ente.Codice = 1;
}
_dbContext.RubricaCollection.InsertOne(ente);
}
}
}
| using MongoDB.Driver;
using Persistence.MongoDB;
using SO115App.API.Models.Classi.Condivise;
using SO115App.Models.Servizi.Infrastruttura.GestioneRubrica.Enti;
namespace SO115App.Persistence.MongoDB.GestioneRubrica.Enti
{
public class AddEnte : IAddEnte
{
private readonly DbContext _dbContext;
public AddEnte(DbContext dbContext) => _dbContext = dbContext;
public void Add(EnteIntervenuto ente)
{
var codice = _dbContext.RubricaCollection.Find(x => true).SortByDescending(c => c.Codice).First().Codice;
ente.Codice = codice + 1;
_dbContext.RubricaCollection.InsertOne(ente);
}
}
}
| agpl-3.0 | C# |
4634cac7ad3cbcc9d634ffc9330c5030f5d1396e | Update BlockDimensions.cs | LANDIS-II-Foundation/Landis-Spatial-Modeling-Library | src/RasterIO.Gdal/BlockDimensions.cs | src/RasterIO.Gdal/BlockDimensions.cs | // Contributors:
// James Domingo, Green Code LLC
namespace Landis.RasterIO.Gdal
{
/// <summary>
/// Dimensions of a data block for a raster band.
/// </summary>
public struct BlockDimensions
{
public int XSize;
public int YSize;
}
}
| // Copyright 2010 Green Code LLC
// All rights reserved.
//
// The copyright holders license this file under the New (3-clause) BSD
// License (the "License"). You may not use this file except in
// compliance with the License. A copy of the License is available at
//
// http://www.opensource.org/licenses/BSD-3-Clause
//
// and is included in the NOTICE.txt file distributed with this work.
//
// Contributors:
// James Domingo, Green Code LLC
namespace Landis.RasterIO.Gdal
{
/// <summary>
/// Dimensions of a data block for a raster band.
/// </summary>
public struct BlockDimensions
{
public int XSize;
public int YSize;
}
}
| apache-2.0 | C# |
4961416dd1b241a8192eed447c8b24ee4a59a639 | update HtmlExtensions. -add teg stripper. | SorenZ/Alamut | src/Alamut.Helpers/Html/HtmlExtensions.cs | src/Alamut.Helpers/Html/HtmlExtensions.cs | using System.Text.RegularExpressions;
namespace Alamut.Helpers.Html
{
/// <summary>
/// sets of tools and utility to work on Html text
/// </summary>
public static class HtmlExtensions
{
private static readonly Regex HtmlRegext = new Regex(@"<[^>]*(>|$)| |‌|»|«|"|­|‏",
RegexOptions.Compiled);
/// <summary>
/// remove html elements
/// </summary>
/// <param name="inputHtml">input html text</param>
/// <param name="length">length of result to return back (default = null)</param>
/// <param name="endWith">the restul end with "..." or nothing</param>
/// <returns></returns>
public static string StripHtmlElements(this string inputHtml, int? length = null, string endWith = " ...")
{
var result = HtmlRegext.Replace(inputHtml, string.Empty);
return length == null || result.Length < length.Value
? result
: result.Substring(0, length.Value) + endWith;
}
/// <summary>
/// Remove HTML tags from string using char array.
/// </summary>
public static string StripHtmlTags(this string source)
{
var array = new char[source.Length];
var arrayIndex = 0;
var inside = false;
foreach (var let in source)
{
if (let == '<')
{
inside = true;
continue;
}
if (let == '>')
{
inside = false;
continue;
}
if (inside) continue;
array[arrayIndex] = @let;
arrayIndex++;
}
return new string(array, 0, arrayIndex);
}
}
}
| using System.Text.RegularExpressions;
namespace Alamut.Helpers.Html
{
/// <summary>
/// sets of tools and utility to work on Html text
/// </summary>
public static class HtmlExtensions
{
private static readonly Regex HtmlRegext = new Regex(@"<[^>]*(>|$)| |‌|»|«|"|­|‏",
RegexOptions.Compiled);
/// <summary>
/// remove html elements
/// </summary>
/// <param name="inputHtml">input html text</param>
/// <param name="length">length of result to return back (default = null)</param>
/// <param name="endWith">the restul end with "..." or nothing</param>
/// <returns></returns>
public static string StripHtmlElements(this string inputHtml, int? length = null, string endWith = " ...")
{
var result = HtmlRegext.Replace(inputHtml, string.Empty);
return length == null || result.Length < length.Value
? result
: result.Substring(0, length.Value) + endWith;
}
}
}
| mit | C# |
4810d2ddd2ff54a408a76aa286a5c754d2237dc6 | Update Index.cshtml | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/Home/Index.cshtml | Anlab.Mvc/Views/Home/Index.cshtml | @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: July 10, 2020<br /><br />
We are open and receiving samples during normal business hours.<br /><br />
Please be safe!
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
| @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: June 10, 2020<br /><br />
We are open and receiving samples as usual.<br /><br />
Thank you for your patience over the last several months.
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
</address>
</div>
| mit | C# |
b743aa41c9bb8bbbe5cd6d74e122339823b7e7d5 | Update Index.cshtml | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/Home/Index.cshtml | Anlab.Mvc/Views/Home/Index.cshtml | @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<h3>The lab is experiencing much longer turnarounds than normal. Most tests are subject to at least 4 - 6 weeks.</h3>
<strong> We apologize for this inconvenience. We are expanding our staffing to address this issue and hope to return to more reasonable turnaround times soon.</strong><br /><br />
Thank you for your understanding and patience.<br />
~ Jan 3, 2022
</div>
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: Jan 3, 2022<br /><br />
<strong>Now offering</strong><br /><br />
Crude Fiber<br />
Crude Fat by Acid Hydrolysis<<br />
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
<p><a href="/media/pdf/UC-Davis-Analytical-Laboratory-Handout.pdf" target="_blank" title="Anlab Flyer"><div><img src="~/Images/AnlabFlyerThumb.png"/><br/>Lab Flyer</div> </a></p>
</div>
| @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<h3>The lab is experiencing much longer turnarounds than normal. Most tests are subject to at least 4 - 6 weeks.</h3>
<strong> We apologize for this inconvenience. We are expanding our staffing to address this issue and hope to return to more reasonable turnaround times soon.</strong><br /><br />
Thank you for your understanding and patience.<br />
~ Jan 3, 2021
</div>
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: Jan 3, 2022<br /><br />
<strong>Now offering</strong><br /><br />
Crude Fiber<br />
Crude Fat by Acid Hydrolysis<<br />
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
<p><a href="/media/pdf/UC-Davis-Analytical-Laboratory-Handout.pdf" target="_blank" title="Anlab Flyer"><div><img src="~/Images/AnlabFlyerThumb.png"/><br/>Lab Flyer</div> </a></p>
</div>
| mit | C# |
4ead64705dad39dd0806059d1bb609f194c51dfa | Update Index.cshtml | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/Home/Index.cshtml | Anlab.Mvc/Views/Home/Index.cshtml | @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: September 30, 2020<br /><br />
In response to the emergency need for the analysis of wine for smoke taint,
the UC Davis Department of Viticulture and Enology is partnering with the UC Davis Analytical Lab to offer testing<br /><br />
Please click <a href="/media/pdf/anlab_smoke-taint_instructions_v2.pdf" target="_blank"><strong>here</strong> for more information on
<strong> Wine Testing for Smoke Taint</strong></a>.<br /><br />
Please Note Receiving Hours: M - F, 8 - 5, except University Holidays.
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
| @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
Update posted: September 30, 2020<br /><br />
In response to the emergency need for the analysis of wine for smoke taint,
the UC Davis Department of Viticulture and Enology is partnering with the UC Davis Analytical Lab to offer testing<br /><br />
Please click <a href="/media/pdf/anlab_smoke-taint_instructions_v2.pdf" target="_blank"><strong>here</strong> for more information</a> on
<strong> Wine Testing for Smoke Taint</strong>.
</div>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p>
<p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and
waste water, and feed in support of agricultural and environmental research.</p>
<p>For new clients, please note the drop-down menu under “Lab Information” which contains
an “Order Completion Help” section to help guide you in creating a work order. Also helpful
under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides
brief descriptions of our current methods.</p>
<p>Please feel free to contact the lab with any questions.</p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br>
Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br>
Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br>
Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p>
<p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br>
Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p>
</address>
</div>
| mit | C# |
91d2976c443bf0ccd01a6494d64041f864e98339 | Add custom type serializer to destruction spawn (#7190) | space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14 | Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs | Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs | using Content.Server.Stack;
using Content.Shared.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public sealed class SpawnEntitiesBehavior : IThresholdBehavior
{
/// <summary>
/// Entities spawned on reaching this threshold, from a min to a max.
/// </summary>
[DataField("spawn", customTypeSerializer:typeof(PrototypeIdDictionarySerializer<MinMax, EntityPrototype>))]
public Dictionary<string, MinMax> Spawn { get; set; } = new();
[DataField("offset")]
public float Offset { get; set; } = 0.5f;
public void Execute(EntityUid owner, DestructibleSystem system)
{
var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset));
foreach (var (entityId, minMax) in Spawn)
{
var count = minMax.Min >= minMax.Max
? minMax.Min
: system.Random.Next(minMax.Min, minMax.Max + 1);
if (count == 0) continue;
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory))
{
var spawned = system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector()));
system.StackSystem.SetCount(spawned, count);
}
else
{
for (var i = 0; i < count; i++)
{
system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector()));
}
}
}
}
}
}
| using Content.Server.Stack;
using Content.Shared.Prototypes;
namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public sealed class SpawnEntitiesBehavior : IThresholdBehavior
{
/// <summary>
/// Entities spawned on reaching this threshold, from a min to a max.
/// </summary>
[DataField("spawn")]
public Dictionary<string, MinMax> Spawn { get; set; } = new();
[DataField("offset")]
public float Offset { get; set; } = 0.5f;
public void Execute(EntityUid owner, DestructibleSystem system)
{
var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset));
foreach (var (entityId, minMax) in Spawn)
{
var count = minMax.Min >= minMax.Max
? minMax.Min
: system.Random.Next(minMax.Min, minMax.Max + 1);
if (count == 0) continue;
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory))
{
var spawned = system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector()));
system.StackSystem.SetCount(spawned, count);
}
else
{
for (var i = 0; i < count; i++)
{
system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector()));
}
}
}
}
}
}
| mit | C# |
b80903def7e6444c580397777b663e2889426d43 | Bump version for release | ntent-ad/consuldotnet,highlyunavailable/consuldotnet,PlayFab/consuldotnet,yonglehou/consuldotnet | Consul/Properties/AssemblyInfo.cs | Consul/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Consul.NET")]
[assembly: AssemblyDescription(".NET API for Consul (http://www.consul.io/)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("PlayFab, Inc.")]
[assembly: AssemblyProduct("Consul.NET")]
[assembly: AssemblyCopyright("Copyright 2015 PlayFab, Inc.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1eb4b74d-0bac-4d14-872e-00cf455ccd53")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.2.5")]
[assembly: AssemblyFileVersion("0.5.2.5")]
[assembly: InternalsVisibleTo("Consul.Test")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Consul.NET")]
[assembly: AssemblyDescription(".NET API for Consul (http://www.consul.io/)")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("PlayFab, Inc.")]
[assembly: AssemblyProduct("Consul.NET")]
[assembly: AssemblyCopyright("Copyright 2015 PlayFab, Inc.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1eb4b74d-0bac-4d14-872e-00cf455ccd53")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.2.4")]
[assembly: AssemblyFileVersion("0.5.2.4")]
[assembly: InternalsVisibleTo("Consul.Test")]
| apache-2.0 | C# |
401c7b6a483996f5076617f1511f40cd3a7cfbc1 | Convert fields to properties | jlewin/MatterSlice | MatterSliceLib/GCodePathConfig.cs | MatterSliceLib/GCodePathConfig.cs | /*
This file is part of MatterSlice. A commandline utility for
generating 3D printing GCode.
Copyright (C) 2013 David Braam
Copyright (c) 2014, Lars Brubaker
MatterSlice is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace MatterHackers.MatterSlice
{
/// <summary>
/// Contains the configuration for moves/extrusion actions. This defines at which width the line is printed and at which speed.
/// </summary>
public class GCodePathConfig
{
public GCodePathConfig(string configName, string gcodeComment, bool closedLoop = true)
{
this.Name = configName;
this.gcodeComment = gcodeComment;
}
public bool DoSeamHiding { get; set; }
public string Name { get; set; }
public double Speed { get; private set; }
public bool closedLoop { get; set; } = true;
public string gcodeComment { get; set; }
public long lineWidth_um { get; set; }
public bool spiralize { get; set; }
/// <summary>
/// Set the data for a path config. This is used to define how different parts (infill, perimeters) are written to gcode.
/// </summary>
/// <param name="speed"></param>
/// <param name="lineWidth_um"></param>
public void SetData(double speed, long lineWidth_um)
{
this.Speed = speed;
this.lineWidth_um = lineWidth_um;
}
}
} | /*
This file is part of MatterSlice. A commandline utility for
generating 3D printing GCode.
Copyright (C) 2013 David Braam
Copyright (c) 2014, Lars Brubaker
MatterSlice is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace MatterHackers.MatterSlice
{
/// <summary>
/// Contains the configuration for moves/extrusion actions. This defines at which width the line is printed and at which speed.
/// </summary>
public class GCodePathConfig
{
public bool closedLoop = true;
public bool DoSeamHiding { get; set; }
public string gcodeComment;
public long lineWidth_um;
public double Speed { get; private set; }
public bool spiralize;
public GCodePathConfig(string configName, string gcodeComment, bool closedLoop = true)
{
this.Name = configName;
this.gcodeComment = gcodeComment;
}
public string Name { get; set; }
/// <summary>
/// Set the data for a path config. This is used to define how different parts (infill, perimeters) are written to gcode.
/// </summary>
/// <param name="speed"></param>
/// <param name="lineWidth_um"></param>
/// <param name="gcodeComment"></param>
public void SetData(double speed, long lineWidth_um)
{
this.Speed = speed;
this.lineWidth_um = lineWidth_um;
}
}
} | agpl-3.0 | C# |
20413b9a921b8629be53a36c50d55a78febcbda2 | Use localized content for cookies disabled message | markeldigital/design-system,markeldigital/design-system,markeldigital/design-system,markeldigital/design-system,markeldigital/design-system | Markel.REMUS.DesignSystem.Web/Components/cookies-disabled/template/cookiesDisabledMessage.cshtml | Markel.REMUS.DesignSystem.Web/Components/cookies-disabled/template/cookiesDisabledMessage.cshtml | <article id="cookies-disabled-panel" class="panel-inverse">
<h1>@Text.Content.CookiesDisabledHeading</h1>
<section>
@Text.Content.CookiesDisabledDetails
</section>
</br>
</br>
</article>
| <article id="cookies-disabled-panel" class="panel-inverse">
<h1>Cookies are disabled</h1>
<section>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</section>
</br>
</br>
</article>
| mit | C# |
db80294a45a708c179c0a44f49ecf5ac6bbe5db3 | Make Handbook page not blank (#153) | reactiveui/website,reactiveui/website,reactiveui/website,reactiveui/website | input/docs/handbook/index.cshtml | input/docs/handbook/index.cshtml | Order: 15
---
@Html.Partial("_ChildPages")
| Order: 15
---
This page is deliberately blank.
| mit | C# |
8ad1fa403822c8ac3f3c7e66cd3b504540983e6d | Fix IsInternetAvailable Method | janabimustafa/waslibs,janabimustafa/waslibs,janabimustafa/waslibs,wasteam/waslibs,pellea/waslibs,wasteam/waslibs,pellea/waslibs,wasteam/waslibs,pellea/waslibs | src/AppStudio.Uwp/Services/InternetConnection.cs | src/AppStudio.Uwp/Services/InternetConnection.cs | using System;
using Windows.Networking.Connectivity;
namespace AppStudio.Uwp.Services
{
public static class InternetConnection
{
public static bool IsInternetAvailable()
{
try
{
ConnectionProfile connections = NetworkInformation.GetInternetConnectionProfile();
return connections != null && connections.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
return false;
}
}
}
}
| using System.Linq;
using System.Net.NetworkInformation;
using Windows.Networking.Connectivity;
namespace AppStudio.Uwp.Services
{
public static class InternetConnection
{
public static bool IsInternetAvailable()
{
if (!NetworkInterface.GetIsNetworkAvailable())
{
return false;
}
return NetworkInformation.GetConnectionProfiles().Any(p => IsInternetProfile(p));
}
private static bool IsInternetProfile(ConnectionProfile connectionProfile)
{
if (connectionProfile == null)
{
return false;
}
var connectivityLevel = connectionProfile.GetNetworkConnectivityLevel();
return connectivityLevel != NetworkConnectivityLevel.None;
}
}
}
| mit | C# |
79b4944c0e20aed974220d65e6d26f7c012c1727 | Fix typo in DownloadPersonalData | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/UI/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs | src/UI/Areas/Identity/Pages/Account/Manage/DownloadPersonalData.cshtml.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace Microsoft.AspNetCore.Identity.UI.Pages.Account.Manage
{
public class DownloadPersonalDataModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly ILogger<DownloadPersonalDataModel> _logger;
public DownloadPersonalDataModel(
UserManager<IdentityUser> userManager,
ILogger<DownloadPersonalDataModel> logger)
{
_userManager = userManager;
_logger = logger;
}
public async Task<IActionResult> OnPostAsync()
{
var user = await _userManager.GetUserAsync(User);
if (user == null)
{
return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
}
_logger.LogInformation("User with ID '{UserId}' asked for their personal data.", _userManager.GetUserId(User));
// Only include personal data for download
var personalData = new Dictionary<string, string>();
personalData.Add("UserId", await _userManager.GetUserIdAsync(user));
personalData.Add("UserName", await _userManager.GetUserNameAsync(user));
personalData.Add("Email", await _userManager.GetEmailAsync(user));
personalData.Add("EmailConfirmed", (await _userManager.IsEmailConfirmedAsync(user)).ToString());
personalData.Add("PhoneNumber", await _userManager.GetPhoneNumberAsync(user));
personalData.Add("PhoneNumberConfirmed", (await _userManager.IsPhoneNumberConfirmedAsync(user)).ToString());
Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json");
return new FileContentResult(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(personalData)), "text/json");
}
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace Microsoft.AspNetCore.Identity.UI.Pages.Account.Manage
{
public class DownloadPersonalDataModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly ILogger<DownloadPersonalDataModel> _logger;
public DownloadPersonalDataModel(
UserManager<IdentityUser> userManager,
ILogger<DownloadPersonalDataModel> logger)
{
_userManager = userManager;
_logger = logger;
}
public async Task<IActionResult> OnPostAsync()
{
var user = await _userManager.GetUserAsync(User);
if (user == null)
{
return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
}
_logger.LogInformation("User with ID '{UserId}' asked for their personal data.", _userManager.GetUserId(User));
// Only include personal data for download
var personalData = new Dictionary<string, string>();
personalData.Add("UserId", await _userManager.GetUserIdAsync(user));
personalData.Add("UserName", await _userManager.GetUserNameAsync(user));
personalData.Add("Email", await _userManager.GetEmailAsync(user));
personalData.Add("EmailConfirmed", (await _userManager.IsEmailConfirmedAsync(user)).ToString());
personalData.Add("PhoneNumber", await _userManager.GetPhoneNumberAsync(user));
personalData.Add("PhoneNumberConfirmed", (await _userManager.IsEmailConfirmedAsync(user)).ToString());
Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json");
return new FileContentResult(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(personalData)), "text/json");
}
}
}
| apache-2.0 | C# |
6016310b0933f3a81a91ba9167be8b138df74e04 | Use a better default for difficulty values | EVAST9919/osu,UselessToucan/osu,naoey/osu,smoogipoo/osu,2yangk23/osu,smoogipoo/osu,ppy/osu,DrabWeb/osu,ppy/osu,peppy/osu-new,EVAST9919/osu,smoogipoo/osu,Damnae/osu,naoey/osu,Drezi126/osu,johnneijzen/osu,DrabWeb/osu,UselessToucan/osu,johnneijzen/osu,naoey/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,2yangk23/osu,ZLima12/osu,UselessToucan/osu,Nabile-Rahmani/osu,peppy/osu,ZLima12/osu,DrabWeb/osu,ppy/osu,NeoAdonis/osu,peppy/osu,Frontear/osuKyzer | osu.Game/Database/BeatmapDifficulty.cs | osu.Game/Database/BeatmapDifficulty.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 SQLite.Net.Attributes;
namespace osu.Game.Database
{
public class BeatmapDifficulty
{
/// <summary>
/// The default value used for all difficulty settings except <see cref="SliderMultiplier"/> and <see cref="SliderTickRate"/>.
/// </summary>
public const float DEFAULT_DIFFICULTY = 0;
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public float DrainRate { get; set; } = DEFAULT_DIFFICULTY;
public float CircleSize { get; set; } = DEFAULT_DIFFICULTY;
public float OverallDifficulty { get; set; } = DEFAULT_DIFFICULTY;
public float ApproachRate { get; set; } = DEFAULT_DIFFICULTY;
public float SliderMultiplier { get; set; } = 1;
public float SliderTickRate { get; set; } = 1;
/// <summary>
/// Maps a difficulty value [0, 10] to a two-piece linear range of values.
/// </summary>
/// <param name="difficulty">The difficulty value to be mapped.</param>
/// <param name="min">Minimum of the resulting range which will be achieved by a difficulty value of 0.</param>
/// <param name="mid">Midpoint of the resulting range which will be achieved by a difficulty value of 5.</param>
/// <param name="max">Maximum of the resulting range which will be achieved by a difficulty value of 10.</param>
/// <returns>Value to which the difficulty value maps in the specified range.</returns>
public static double DifficultyRange(double difficulty, double min, double mid, double max)
{
if (difficulty > 5)
return mid + (max - mid) * (difficulty - 5) / 5;
if (difficulty < 5)
return mid - (mid - min) * (5 - difficulty) / 5;
return mid;
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using SQLite.Net.Attributes;
namespace osu.Game.Database
{
public class BeatmapDifficulty
{
/// <summary>
/// The default value used for all difficulty settings except <see cref="SliderMultiplier"/> and <see cref="SliderTickRate"/>.
/// </summary>
public const float DEFAULT_DIFFICULTY = 5;
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public float DrainRate { get; set; } = DEFAULT_DIFFICULTY;
public float CircleSize { get; set; } = DEFAULT_DIFFICULTY;
public float OverallDifficulty { get; set; } = DEFAULT_DIFFICULTY;
public float ApproachRate { get; set; } = DEFAULT_DIFFICULTY;
public float SliderMultiplier { get; set; } = 1;
public float SliderTickRate { get; set; } = 1;
/// <summary>
/// Maps a difficulty value [0, 10] to a two-piece linear range of values.
/// </summary>
/// <param name="difficulty">The difficulty value to be mapped.</param>
/// <param name="min">Minimum of the resulting range which will be achieved by a difficulty value of 0.</param>
/// <param name="mid">Midpoint of the resulting range which will be achieved by a difficulty value of 5.</param>
/// <param name="max">Maximum of the resulting range which will be achieved by a difficulty value of 10.</param>
/// <returns>Value to which the difficulty value maps in the specified range.</returns>
public static double DifficultyRange(double difficulty, double min, double mid, double max)
{
if (difficulty > 5)
return mid + (max - mid) * (difficulty - 5) / 5;
if (difficulty < 5)
return mid - (mid - min) * (5 - difficulty) / 5;
return mid;
}
}
}
| mit | C# |
29d860d70af513d2c126813b6048cbdafcb40057 | Add PremiumRS value to DatabaseEdition enum | seanbamsft/azure-powershell,atpham256/azure-powershell,AzureRT/azure-powershell,atpham256/azure-powershell,seanbamsft/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,yoavrubin/azure-powershell,hungmai-msft/azure-powershell,alfantp/azure-powershell,naveedaz/azure-powershell,alfantp/azure-powershell,rohmano/azure-powershell,hungmai-msft/azure-powershell,naveedaz/azure-powershell,devigned/azure-powershell,rohmano/azure-powershell,AzureAutomationTeam/azure-powershell,alfantp/azure-powershell,pankajsn/azure-powershell,zhencui/azure-powershell,atpham256/azure-powershell,AzureAutomationTeam/azure-powershell,AzureRT/azure-powershell,atpham256/azure-powershell,ClogenyTechnologies/azure-powershell,yoavrubin/azure-powershell,naveedaz/azure-powershell,rohmano/azure-powershell,hungmai-msft/azure-powershell,jtlibing/azure-powershell,yantang-msft/azure-powershell,yantang-msft/azure-powershell,devigned/azure-powershell,AzureRT/azure-powershell,krkhan/azure-powershell,AzureAutomationTeam/azure-powershell,hungmai-msft/azure-powershell,rohmano/azure-powershell,zhencui/azure-powershell,krkhan/azure-powershell,krkhan/azure-powershell,devigned/azure-powershell,krkhan/azure-powershell,pankajsn/azure-powershell,AzureRT/azure-powershell,ClogenyTechnologies/azure-powershell,jtlibing/azure-powershell,jtlibing/azure-powershell,jtlibing/azure-powershell,devigned/azure-powershell,zhencui/azure-powershell,yantang-msft/azure-powershell,yantang-msft/azure-powershell,zhencui/azure-powershell,yoavrubin/azure-powershell,pankajsn/azure-powershell,zhencui/azure-powershell,yoavrubin/azure-powershell,devigned/azure-powershell,AzureAutomationTeam/azure-powershell,krkhan/azure-powershell,seanbamsft/azure-powershell,naveedaz/azure-powershell,rohmano/azure-powershell,krkhan/azure-powershell,rohmano/azure-powershell,hungmai-msft/azure-powershell,alfantp/azure-powershell,yoavrubin/azure-powershell,seanbamsft/azure-powershell,devigned/azure-powershell,yantang-msft/azure-powershell,pankajsn/azure-powershell,ClogenyTechnologies/azure-powershell,naveedaz/azure-powershell,atpham256/azure-powershell,naveedaz/azure-powershell,ClogenyTechnologies/azure-powershell,seanbamsft/azure-powershell,AzureRT/azure-powershell,pankajsn/azure-powershell,hungmai-msft/azure-powershell,AzureAutomationTeam/azure-powershell,atpham256/azure-powershell,seanbamsft/azure-powershell,pankajsn/azure-powershell,jtlibing/azure-powershell,zhencui/azure-powershell,AzureRT/azure-powershell,yantang-msft/azure-powershell,alfantp/azure-powershell | src/ResourceManager/Sql/Commands.Sql/Database/Model/DatabaseEdition.cs | src/ResourceManager/Sql/Commands.Sql/Database/Model/DatabaseEdition.cs | // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 Microsoft.Azure.Commands.Sql.Database.Model
{
/// <summary>
/// The database edition
/// </summary>
public enum DatabaseEdition
{
/// <summary>
/// No database edition specified
/// </summary>
None = 0,
/// <summary>
/// A database premium edition
/// </summary>
Premium = 3,
/// <summary>
/// A database basic edition
/// </summary>
Basic = 4,
/// <summary>
/// A database standard edition
/// </summary>
Standard = 5,
/// <summary>
/// Azure SQL Data Warehouse database edition
/// </summary>
DataWarehouse = 6,
/// <summary>
/// Azure SQL Stretch database edition
/// </summary>
Stretch = 7,
/// <summary>
/// Free database edition. Reserved for special use cases/scenarios.
/// </summary>
Free = 8,
/// <summary>
/// A database PremiumRS edition
/// </summary>
PremiumRS = 9,
}
}
| // ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 Microsoft.Azure.Commands.Sql.Database.Model
{
/// <summary>
/// The database edition
/// </summary>
public enum DatabaseEdition
{
/// <summary>
/// No database edition specified
/// </summary>
None = 0,
/// <summary>
/// A database premium edition
/// </summary>
Premium = 3,
/// <summary>
/// A database basic edition
/// </summary>
Basic = 4,
/// <summary>
/// A database standard edition
/// </summary>
Standard = 5,
/// <summary>
/// Azure SQL Data Warehouse database edition
/// </summary>
DataWarehouse = 6,
/// <summary>
/// Azure SQL Stretch database edition
/// </summary>
Stretch = 7,
/// <summary>
/// Free database edition. Reserved for special use cases/scenarios.
/// </summary>
Free = 8,
}
}
| apache-2.0 | C# |
f968a31ebf964215e8493997589d21252f9d413a | Optimize windows platform detection code | github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity,mpOzelot/Unity,mpOzelot/Unity | src/UnityExtension/Assets/Editor/GitHub.Unity/IO/DefaultEnvironment.cs | src/UnityExtension/Assets/Editor/GitHub.Unity/IO/DefaultEnvironment.cs | using System;
using System.IO;
namespace GitHub.Unity
{
class DefaultEnvironment : IEnvironment
{
public string GetSpecialFolder(Environment.SpecialFolder folder)
{
return Environment.GetFolderPath(folder);
}
public string ExpandEnvironmentVariables(string name)
{
return Environment.ExpandEnvironmentVariables(name);
}
public string GetEnvironmentVariable(string variable)
{
return Environment.GetEnvironmentVariable(variable);
}
public string UserProfilePath { get { return Environment.GetEnvironmentVariable("USERPROFILE"); } }
public string Path { get { return Environment.GetEnvironmentVariable("PATH"); } }
public string NewLine { get { return Environment.NewLine; } }
public string GitInstallPath { get; set; }
public bool IsWindows
{
get { return Environment.OSVersion.Platform != PlatformID.Unix && Environment.OSVersion.Platform != PlatformID.MacOSX; }
}
public bool IsLinux
{
get { return Environment.OSVersion.Platform == PlatformID.Unix && Directory.Exists("/proc"); }
}
public bool IsMac
{
get
{
// most likely it'll return the proper id but just to be on the safe side, have a fallback
return Environment.OSVersion.Platform == PlatformID.MacOSX ||
(Environment.OSVersion.Platform == PlatformID.Unix && !Directory.Exists("/proc"));
}
}
}
} | using System;
using System.IO;
namespace GitHub.Unity
{
class DefaultEnvironment : IEnvironment
{
public string GetSpecialFolder(Environment.SpecialFolder folder)
{
return Environment.GetFolderPath(folder);
}
public string ExpandEnvironmentVariables(string name)
{
return Environment.ExpandEnvironmentVariables(name);
}
public string GetEnvironmentVariable(string variable)
{
return Environment.GetEnvironmentVariable(variable);
}
public string UserProfilePath { get { return Environment.GetEnvironmentVariable("USERPROFILE"); } }
public string Path { get { return Environment.GetEnvironmentVariable("PATH"); } }
public string NewLine { get { return Environment.NewLine; } }
public string GitInstallPath { get; set; }
public bool IsWindows { get { return !IsLinux && !IsMac; } }
public bool IsLinux
{
get { return Environment.OSVersion.Platform == PlatformID.Unix && Directory.Exists("/proc"); }
}
public bool IsMac
{
get
{
// most likely it'll return the proper id but just to be on the safe side, have a fallback
return Environment.OSVersion.Platform == PlatformID.MacOSX ||
(Environment.OSVersion.Platform == PlatformID.Unix && !Directory.Exists("/proc"));
}
}
}
} | mit | C# |
4e056f16b767cb8d716fd29b6721639b31b02db1 | Remove unused using | Nabile-Rahmani/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework,default0/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework,ppy/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,default0/osu-framework,Tom94/osu-framework | osu.Framework/Allocation/RecursiveLoadException.cs | osu.Framework/Allocation/RecursiveLoadException.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Linq;
using System.Reflection;
using System.Text;
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Allocation
{
/// <summary>
/// The exception that is re-thrown by <see cref="DependencyContainer"/> when a loader invocation fails.
/// This exception type builds a readablestacktrace message since loader invocations tend to be long recursive reflection calls.
/// </summary>
public class RecursiveLoadException : Exception
{
/// <summary>
/// Types that are ignored for the custom stack traces. The initializers for these typically invoke
/// initializers in user code where the problem actually lies.
/// </summary>
private static readonly Type[] blacklist =
{
typeof(Container),
typeof(Container<>),
typeof(CompositeDrawable)
};
private readonly StringBuilder traceBuilder;
public RecursiveLoadException(Exception inner, MethodInfo loaderMethod)
: base(string.Empty, (inner as RecursiveLoadException)?.InnerException ?? inner)
{
traceBuilder = inner is RecursiveLoadException recursiveException ? recursiveException.traceBuilder : new StringBuilder();
if (!blacklist.Contains(loaderMethod.DeclaringType))
traceBuilder.AppendLine($" at {loaderMethod.DeclaringType}.{loaderMethod.Name} ()");
}
public override string ToString()
{
var builder = new StringBuilder();
builder.Append(InnerException?.ToString() ?? string.Empty);
builder.AppendLine(traceBuilder.ToString());
return builder.ToString();
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Linq;
using System.Reflection;
using System.Text;
using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Allocation
{
/// <summary>
/// The exception that is re-thrown by <see cref="DependencyContainer"/> when a loader invocation fails.
/// This exception type builds a readablestacktrace message since loader invocations tend to be long recursive reflection calls.
/// </summary>
public class RecursiveLoadException : Exception
{
/// <summary>
/// Types that are ignored for the custom stack traces. The initializers for these typically invoke
/// initializers in user code where the problem actually lies.
/// </summary>
private static readonly Type[] blacklist =
{
typeof(Container),
typeof(Container<>),
typeof(CompositeDrawable)
};
private readonly StringBuilder traceBuilder;
public RecursiveLoadException(Exception inner, MethodInfo loaderMethod)
: base(string.Empty, (inner as RecursiveLoadException)?.InnerException ?? inner)
{
traceBuilder = inner is RecursiveLoadException recursiveException ? recursiveException.traceBuilder : new StringBuilder();
if (!blacklist.Contains(loaderMethod.DeclaringType))
traceBuilder.AppendLine($" at {loaderMethod.DeclaringType}.{loaderMethod.Name} ()");
}
public override string ToString()
{
var builder = new StringBuilder();
builder.Append(InnerException?.ToString() ?? string.Empty);
builder.AppendLine(traceBuilder.ToString());
return builder.ToString();
}
}
}
| mit | C# |
4afc808ffcf32c1930f7a1bd256b62926b6c65e3 | Remove horizontal transitions for now | ppy/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,ppy/osu,smoogipooo/osu,peppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu | osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs | osu.Game/Screens/OnlinePlay/OnlinePlaySubScreen.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Screens;
namespace osu.Game.Screens.OnlinePlay
{
public abstract class OnlinePlaySubScreen : OsuScreen, IOnlinePlaySubScreen
{
public override bool DisallowExternalBeatmapRulesetChanges => false;
public virtual string ShortTitle => Title;
[Resolved(CanBeNull = true)]
protected IRoomManager RoomManager { get; private set; }
protected OnlinePlaySubScreen()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
}
public const double APPEAR_DURATION = 800;
public const double DISAPPEAR_DURATION = 500;
public override void OnEntering(IScreen last)
{
this.FadeInFromZero(APPEAR_DURATION, Easing.OutQuint);
}
public override bool OnExiting(IScreen next)
{
this.FadeOut(DISAPPEAR_DURATION, Easing.OutQuint);
return false;
}
public override void OnResuming(IScreen last)
{
this.FadeIn(APPEAR_DURATION, Easing.OutQuint);
}
public override void OnSuspending(IScreen next)
{
this.FadeOut(DISAPPEAR_DURATION, Easing.OutQuint);
}
public override string ToString() => Title;
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Screens;
namespace osu.Game.Screens.OnlinePlay
{
public abstract class OnlinePlaySubScreen : OsuScreen, IOnlinePlaySubScreen
{
public override bool DisallowExternalBeatmapRulesetChanges => false;
public virtual string ShortTitle => Title;
[Resolved(CanBeNull = true)]
protected IRoomManager RoomManager { get; private set; }
protected OnlinePlaySubScreen()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
}
public const float X_SHIFT = 200;
public const double X_MOVE_DURATION = 800;
public const double RESUME_TRANSITION_DELAY = DISAPPEAR_DURATION / 2;
public const double APPEAR_DURATION = 800;
public const double DISAPPEAR_DURATION = 500;
public override void OnEntering(IScreen last)
{
this.FadeInFromZero(APPEAR_DURATION, Easing.OutQuint);
this.FadeInFromZero(APPEAR_DURATION, Easing.OutQuint);
this.MoveToX(X_SHIFT).MoveToX(0, X_MOVE_DURATION, Easing.OutQuint);
}
public override bool OnExiting(IScreen next)
{
this.FadeOut(DISAPPEAR_DURATION, Easing.OutQuint);
this.MoveToX(X_SHIFT, X_MOVE_DURATION, Easing.OutQuint);
return false;
}
public override void OnResuming(IScreen last)
{
this.Delay(RESUME_TRANSITION_DELAY).FadeIn(APPEAR_DURATION, Easing.OutQuint);
this.MoveToX(0, X_MOVE_DURATION, Easing.OutQuint);
}
public override void OnSuspending(IScreen next)
{
this.FadeOut(DISAPPEAR_DURATION, Easing.OutQuint);
this.MoveToX(-X_SHIFT, X_MOVE_DURATION, Easing.OutQuint);
}
public override string ToString() => Title;
}
}
| mit | C# |
2a98347ca28d2d5db14a017b9c0738faa2c38c3d | Set version before restore | Bee-Htcpcp/protoactor-dotnet,masteryee/protoactor-dotnet,cpx86/protoactor-dotnet,AsynkronIT/protoactor-dotnet,raskolnikoov/protoactor-dotnet,tomliversidge/protoactor-dotnet,masteryee/protoactor-dotnet,raskolnikoov/protoactor-dotnet,tomliversidge/protoactor-dotnet,Bee-Htcpcp/protoactor-dotnet,cpx86/protoactor-dotnet | build.cake | build.cake | #addin Cake.Git
var packageVersion = "0.1.0";
var target = Argument("target", "Default");
var mygetApiKey = Argument<string>("mygetApiKey", null);
var currentBranch = Argument<string>("currentBranch", GitBranchCurrent("./").FriendlyName);
var buildNumber = Argument<string>("buildNumber", null);
var versionSuffix = "";
if (currentBranch != "master") {
versionSuffix += "-" + currentBranch;
if (buildNumber != null) {
versionSuffix += "-build" + buildNumber.PadLeft(5, '0');
}
packageVersion += versionSuffix;
}
Information("Version: " + packageVersion);
Task("PatchVersion")
.Does(() => {
foreach(var proj in GetFiles("src/**/*.csproj")) {
Information("Patching " + proj);
XmlPoke(proj, "/Project/PropertyGroup/Version", packageVersion);
}
});
Task("Restore")
.IsDependentOn("PatchVersion")
.Does(() => {
DotNetCoreRestore();
});
Task("Build")
.IsDependentOn("Restore")
.Does(() => {
DotNetCoreBuild("ProtoActor.sln", new DotNetCoreBuildSettings {
Configuration = "Release",
});
});
Task("UnitTest")
.Does(() => {
foreach(var proj in GetFiles("tests/**/*.Tests.csproj")) {
DotNetCoreTest(proj.ToString());
}
});
Task("Pack")
.Does(() => {
foreach(var proj in GetFiles("src/**/*.csproj")) {
DotNetCorePack(proj.ToString(), new DotNetCorePackSettings {
OutputDirectory = "out",
Configuration = "Release",
});
}
});
Task("Push")
.Does(() => {
var pkgs = GetFiles("out/*.nupkg");
foreach(var pkg in pkgs) {
NuGetPush(pkg, new NuGetPushSettings {
Source = "https://www.myget.org/F/protoactor/api/v2/package",
ApiKey = mygetApiKey
});
}
});
Task("Default")
.IsDependentOn("Restore")
.IsDependentOn("PatchVersion")
.IsDependentOn("Build")
.IsDependentOn("UnitTest")
.IsDependentOn("Pack")
;
RunTarget(target); | #addin Cake.Git
var packageVersion = "0.1.0";
var target = Argument("target", "Default");
var mygetApiKey = Argument<string>("mygetApiKey", null);
var currentBranch = Argument<string>("currentBranch", GitBranchCurrent("./").FriendlyName);
var buildNumber = Argument<string>("buildNumber", null);
var versionSuffix = "";
if (currentBranch != "master") {
versionSuffix += "-" + currentBranch;
if (buildNumber != null) {
versionSuffix += "-build" + buildNumber.PadLeft(5, '0');
}
packageVersion += versionSuffix;
}
Information("Version: " + packageVersion);
Task("Restore")
.Does(() => {
DotNetCoreRestore();
});
Task("PatchVersion")
.Does(() => {
foreach(var proj in GetFiles("src/**/*.csproj")) {
Information("Patching " + proj);
XmlPoke(proj, "/Project/PropertyGroup/Version", packageVersion);
}
});
Task("Build")
.IsDependentOn("Restore")
.IsDependentOn("PatchVersion")
.Does(() => {
DotNetCoreBuild("ProtoActor.sln", new DotNetCoreBuildSettings {
Configuration = "Release",
});
});
Task("UnitTest")
.Does(() => {
foreach(var proj in GetFiles("tests/**/*.Tests.csproj")) {
DotNetCoreTest(proj.ToString());
}
});
Task("Pack")
.Does(() => {
foreach(var proj in GetFiles("src/**/*.csproj")) {
DotNetCorePack(proj.ToString(), new DotNetCorePackSettings {
OutputDirectory = "out",
Configuration = "Release",
});
}
});
Task("Push")
.Does(() => {
var pkgs = GetFiles("out/*.nupkg");
foreach(var pkg in pkgs) {
NuGetPush(pkg, new NuGetPushSettings {
Source = "https://www.myget.org/F/protoactor/api/v2/package",
ApiKey = mygetApiKey
});
}
});
Task("Default")
.IsDependentOn("Restore")
.IsDependentOn("PatchVersion")
.IsDependentOn("Build")
.IsDependentOn("UnitTest")
.IsDependentOn("Pack")
;
RunTarget(target); | apache-2.0 | C# |
9d1422e6fdf24452319008544a0d6ae565ae8d09 | fix for CI | fluentassertions/fluentassertions.analyzers | build.cake | build.cake | //////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var buildDir = Directory("./artifacts") + Directory(configuration);
var solutionFile = File("./src/FluentAssertions.BestPractices.sln");
var testCsproj = File("./src/FluentAssertions.BestPractices.Tests/FluentAssertions.BestPractices.Tests.csproj");
var nuspecFile = File("./src/FluentAssertions.BestPractices/FluentAssertions.BestPractices.nuspec");
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetCoreRestore(solutionFile);
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
DotNetCoreBuild(solutionFile, new DotNetCoreBuildSettings
{
Configuration = configuration,
OutputDirectory = buildDir
});
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
DotNetCoreTest(testCsproj, new DotNetCoreTestSettings
{
Filter = "TestCategory=Completed",
Configuration = configuration
});
});
Task("Pack")
.Does(() =>
{
var nuGetPackSettings = new NuGetPackSettings {
OutputDirectory = buildDir
};
NuGetPack(nuspecFile, nuGetPackSettings);
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("Run-Unit-Tests")
.IsDependentOn("Pack");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target); | //////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var buildDir = Directory("./artifacts") + Directory(configuration);
var solutionFile = File("./src/FluentAssertions.BestPractices.sln");
var testCsproj = File("./src/FluentAssertions.BestPractices.Tests/FluentAssertions.BestPractices.Tests.csproj");
var nuspecFile = File("./src/FluentAssertions.BestPractices/FluentAssertions.BestPractices.nuspec");
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetCoreRestore(solutionFile);
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
DotNetCoreBuild(solutionFile, new DotNetCoreBuildSettings
{
Configuration = configuration,
OutputDirectory = buildDir
});
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
DotNetCoreTest(testCsproj, new DotNetCoreTestSettings
{
Filter = "TestCategory=Completed",
Configuration = configuration,
NoBuild = true
});
});
Task("Pack")
.Does(() =>
{
var nuGetPackSettings = new NuGetPackSettings {
OutputDirectory = buildDir
};
NuGetPack(nuspecFile, nuGetPackSettings);
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("Run-Unit-Tests")
.IsDependentOn("Pack");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target); | mit | C# |
2ef8e7d09332fd91b0b23b956a70b8ba8da05fca | Update Contact.cs | programulya/Contacts,programulya/Contacts | Contacts/Domain/Contact.cs | Contacts/Domain/Contact.cs | using System;
namespace Contacts.Domain
{
public sealed class Contact
{
public Int32 Id { get; set; }
public String Email { get; set; }
public String FirstName { get; set; }
public String MiddleName { get; set; }
public String LastName { get; set; }
public String Phone { get; set; }
public Int32 ContactGroupId { get; set; }
public string FullName
{
get
{
return string.Format("{0} {1}{2}",
FirstName,
!string.IsNullOrEmpty(MiddleName) ? MiddleName + " " : string.Empty,
LastName);
}
}
public override string ToString()
{
return FullName;
}
}
}
| using System;
namespace Contacts.Domain
{
public sealed class Contact
{
public Int32 Id { get; set; }
public String Email { get; set; }
public String FirstName { get; set; }
public String MiddleName { get; set; }
public String LastName { get; set; }
public String Phone { get; set; }
public Int32 ContactGroupId { get; set; }
public string FullName
{
get
{
return string.Format("{0} {1}{2}",
FirstName,
!string.IsNullOrEmpty(MiddleName) ? MiddleName + " " : string.Empty,
LastName);
}
}
public override string ToString()
{
return FullName;
}
}
} | mit | C# |
7a963d44c9158e1880b37ab8657c359cbd513380 | Update KymPhillpotts.cs | beraybentesen/planetxamarin,MabroukENG/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin | src/Firehose.Web/Authors/KymPhillpotts.cs | src/Firehose.Web/Authors/KymPhillpotts.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
public class KymPhillpotts : IWorkAtXamarinOrMicrosoft
{
public string FirstName => "Kym";
public string LastName => "Phillpotts";
public string Title => "instructor at Xamarin University";
public string StateOrRegion => "Melbourne, Australia";
public string EmailAddress => "kphillpotts@gmail.com";
public string TwitterHandle => "kphillpotts";
public string GravatarHash => "";
public DateTime Started => new DateTime(2004, 01, 06);
public Uri WebSite => new Uri("http://kymphillpotts.com/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("http://kymphillpotts.com/rss/"); } }
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
public class KymPhillpotts : IWorkAtXamarinOrMicrosoft
{
public string FirstName => "Kym";
public string LastName => "Phillpotts";
public string Title => "Instructor @ Xamarin University";
public string StateOrRegion => "Melbourne, Australia";
public string EmailAddress => "kphillpotts@gmail.com";
public string TwitterHandle => "kphillpotts";
public string GravatarHash => "";
public DateTime Started => new DateTime(2004, 01, 06);
public Uri WebSite => new Uri("http://kymphillpotts.com/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("http://kymphillpotts.com/rss/"); } }
}
| mit | C# |
6277b65404d8ebcaaf928d54e88556eceff595f3 | Change Version Number to 9.6.0.11 | krs43/ib-csharp,sebfia/ib-csharp,qusma/ib-csharp | Krs.Ats.IBNet/Properties/AssemblyInfo.cs | Krs.Ats.IBNet/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("Krs.Ats.IBNet")]
[assembly : AssemblyDescription("Interactive Brokers C# Client")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("Dinosaurtech")]
[assembly : AssemblyProduct("Krs.Ats.IBNet")]
[assembly : AssemblyCopyright("Copyright © 2008")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("099cdbe6-c63a-4c1d-9d1e-de9942e56388")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly : AssemblyVersion("9.6.0.11")]
[assembly : AssemblyFileVersion("9.6.0.11")]
//CLS Compliant
[assembly : CLSCompliant(true)] | using System;
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("Krs.Ats.IBNet")]
[assembly : AssemblyDescription("Interactive Brokers C# Client")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("Dinosaurtech")]
[assembly : AssemblyProduct("Krs.Ats.IBNet")]
[assembly : AssemblyCopyright("Copyright © 2008")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("099cdbe6-c63a-4c1d-9d1e-de9942e56388")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly : AssemblyVersion("9.5.0.10")]
[assembly : AssemblyFileVersion("9.5.0.10")]
//CLS Compliant
[assembly : CLSCompliant(true)] | mit | C# |
80689ba735032076831e4f9a1a952e12a37f8171 | Fix issue with graphql-dotnet where multiple interfaces would correctly register from a .graphqls. (#704) | graphql-dotnet/graphql-dotnet,graphql-dotnet/graphql-dotnet,graphql-dotnet/graphql-dotnet,joemcbride/graphql-dotnet,joemcbride/graphql-dotnet | src/GraphQL/Types/GraphQLTypeReference.cs | src/GraphQL/Types/GraphQLTypeReference.cs | namespace GraphQL.Types
{
public class GraphQLTypeReference : InterfaceGraphType
{
public GraphQLTypeReference(string typeName)
{
Name = "__GraphQLTypeReference";
TypeName = typeName;
}
public string TypeName { get; private set; }
public override bool Equals(object obj)
{
if (obj is GraphQLTypeReference other)
{
return TypeName == other.TypeName;
}
return base.Equals(obj);
}
}
}
| namespace GraphQL.Types
{
public class GraphQLTypeReference : InterfaceGraphType
{
public GraphQLTypeReference(string typeName)
{
Name = "__GraphQLTypeReference";
TypeName = typeName;
}
public string TypeName { get; private set; }
}
} | mit | C# |
ba98eef34522e2d100b4df6388e903d92a235a6a | Update assembly version to match package version | mikeobrien/HidLibrary,mikeobrien/HidLibrary | src/HidLibrary/Properties/AssemblyInfo.cs | src/HidLibrary/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Hid Library")]
[assembly: AssemblyDescription("Hid Device Communication Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ultraviolet Catastrophe")]
[assembly: AssemblyProduct("HidLibrary")]
[assembly: AssemblyCopyright("Copyright © 2011 Ultraviolet Catastrophe")]
[assembly: AssemblyTrademark("HidLibrary")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d51e590e-e0ce-485f-8e64-d12abfbff2d6")]
// 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("3.2.49")]
[assembly: AssemblyFileVersion("3.2.49")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Hid Library")]
[assembly: AssemblyDescription("Hid Device Communication Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ultraviolet Catastrophe")]
[assembly: AssemblyProduct("HidLibrary")]
[assembly: AssemblyCopyright("Copyright © 2011 Ultraviolet Catastrophe")]
[assembly: AssemblyTrademark("HidLibrary")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d51e590e-e0ce-485f-8e64-d12abfbff2d6")]
// 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("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
| mit | C# |
3e45247748224184e05c8b80d60791ef5c677d0e | add s | IlyasGaripov/Math-Shapes | MathShapesProject/Assets/Scripts/Game.cs | MathShapesProject/Assets/Scripts/Game.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Game : MonoBehaviour {
private int stars;
// Use this for initialization
void Start () {
int s;
}
// Update is called once per frame
void Update () {
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Game : MonoBehaviour {
private int stars;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
| mit | C# |
2cf50613425086609786c0f827c820fead72c0ec | add method for local time | huoxudong125/Metrics.NET,alhardy/Metrics.NET,mnadel/Metrics.NET,ntent-ad/Metrics.NET,MetaG8/Metrics.NET,Liwoj/Metrics.NET,Recognos/Metrics.NET,alhardy/Metrics.NET,MetaG8/Metrics.NET,DeonHeyns/Metrics.NET,cvent/Metrics.NET,DeonHeyns/Metrics.NET,cvent/Metrics.NET,Recognos/Metrics.NET,etishor/Metrics.NET,ntent-ad/Metrics.NET,mnadel/Metrics.NET,huoxudong125/Metrics.NET,MetaG8/Metrics.NET,etishor/Metrics.NET,Liwoj/Metrics.NET | Src/Metrics.Tests/TestUtils/TestClock.cs | Src/Metrics.Tests/TestUtils/TestClock.cs | using System;
using Metrics.Utils;
namespace Metrics.Tests.TestUtils
{
public sealed class TestClock : Clock
{
private long nanoseconds = 0;
public override long Nanoseconds { get { return this.nanoseconds; } }
public override DateTime LocalDateTime { get { return new DateTime(this.nanoseconds / 100L, DateTimeKind.Local); } }
public void Advance(TimeUnit unit, long value)
{
this.nanoseconds += unit.ToNanoseconds(value);
if (Advanced != null)
{
Advanced(this, EventArgs.Empty);
}
}
public event EventHandler Advanced;
}
}
| using System;
using Metrics.Utils;
namespace Metrics.Tests.TestUtils
{
public sealed class TestClock : Clock
{
private long nanoseconds = 0;
public override long Nanoseconds { get { return this.nanoseconds; } }
public void Advance(TimeUnit unit, long value)
{
this.nanoseconds += unit.ToNanoseconds(value);
if (Advanced != null)
{
Advanced(this, EventArgs.Empty);
}
}
public event EventHandler Advanced;
}
}
| apache-2.0 | C# |
04868c79fc563d137682fe4ba0d2705a4f2769f0 | test setup fix | yetanotherchris/Remy | src/Remy.Tests/Unit/Core/Tasks/TypeManagerTests.cs | src/Remy.Tests/Unit/Core/Tasks/TypeManagerTests.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
using Remy.Core.Tasks;
using Remy.Tests.StubsAndMocks;
using Serilog;
namespace Remy.Tests.Unit.Core.Tasks
{
[TestFixture]
public class TypeManagerTests
{
private ILogger _logger;
private string _currentDir;
private string _pluginsDirectory;
[SetUp]
public void Setup()
{
_logger = new LoggerConfiguration()
.WriteTo
.LiterateConsole()
.CreateLogger();
_currentDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
_pluginsDirectory = Path.Combine(_currentDir, "plugins");
try
{
if (Directory.Exists(_pluginsDirectory))
Directory.Delete(_pluginsDirectory, true);
Directory.CreateDirectory(_pluginsDirectory);
}
catch
{
}
}
[TearDown]
public void TearDown()
{
try
{
Directory.Delete(_pluginsDirectory, true);
}
catch
{
}
}
[Test]
public void should_return_all_itasks_and_register_yamlname_for_keys()
{
// given + when
Dictionary<string, ITask> tasks = TypeManager.GetRegisteredTaskInstances(_logger);
// then
Assert.That(tasks.Count, Is.EqualTo(4));
KeyValuePair<string, ITask> task = tasks.First();
Assert.That(task.Value, Is.Not.Null);
Assert.That(task.Key, Is.EqualTo(task.Value.YamlName));
}
[Test]
public void should_add_tasks_from_plugins_directory()
{
// given - copy MockTask (Remy.tests.dll) into plugins/
string nugetFolder = Path.Combine(_pluginsDirectory, "Remy.tests", "lib", "net461");
Directory.CreateDirectory(nugetFolder);
File.Copy(Path.Combine(_currentDir, "Remy.tests.dll"), Path.Combine(nugetFolder, "Remy.tests.dll"));
// when
Dictionary<string, ITask> tasks = TypeManager.GetRegisteredTaskInstances(_logger);
// then
Assert.That(tasks.Count, Is.EqualTo(5));
KeyValuePair<string, ITask> task = tasks.FirstOrDefault(x => x.Key == "mock-task");
Assert.That(task, Is.Not.Null);
Assert.That(task.Key, Is.EqualTo(task.Value.YamlName));
Assert.That(task.Value, Is.Not.Null);
Assert.That(task.Value.GetType().Name, Is.EqualTo(typeof(MockTask).Name));
}
}
} | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
using Remy.Core.Tasks;
using Remy.Tests.StubsAndMocks;
using Serilog;
namespace Remy.Tests.Unit.Core.Tasks
{
[TestFixture]
public class TypeManagerTests
{
private ILogger _logger;
private string _currentDir;
private string _pluginsDirectory;
[SetUp]
public void Setup()
{
_logger = new LoggerConfiguration()
.WriteTo
.LiterateConsole()
.CreateLogger();
_currentDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
_pluginsDirectory = Path.Combine(_currentDir, "plugins");
if (Directory.Exists(_pluginsDirectory))
Directory.Delete(_pluginsDirectory, true);
else
Directory.CreateDirectory(_pluginsDirectory);
}
[TearDown]
public void TearDown()
{
try
{
Directory.Delete(_pluginsDirectory, true);
}
catch
{
}
}
[Test]
public void should_return_all_itasks_and_register_yamlname_for_keys()
{
// given + when
Dictionary<string, ITask> tasks = TypeManager.GetRegisteredTaskInstances(_logger);
// then
Assert.That(tasks.Count, Is.EqualTo(4));
KeyValuePair<string, ITask> task = tasks.First();
Assert.That(task.Value, Is.Not.Null);
Assert.That(task.Key, Is.EqualTo(task.Value.YamlName));
}
[Test]
public void should_add_tasks_from_plugins_directory()
{
// given - copy MockTask (Remy.tests.dll) into plugins/
string nugetFolder = Path.Combine(_pluginsDirectory, "Remy.tests", "lib", "net461");
Directory.CreateDirectory(nugetFolder);
File.Copy(Path.Combine(_currentDir, "Remy.tests.dll"), Path.Combine(nugetFolder, "Remy.tests.dll"));
// when
Dictionary<string, ITask> tasks = TypeManager.GetRegisteredTaskInstances(_logger);
// then
Assert.That(tasks.Count, Is.EqualTo(5));
KeyValuePair<string, ITask> task = tasks.FirstOrDefault(x => x.Key == "mock-task");
Assert.That(task, Is.Not.Null);
Assert.That(task.Key, Is.EqualTo(task.Value.YamlName));
Assert.That(task.Value, Is.Not.Null);
Assert.That(task.Value.GetType().Name, Is.EqualTo(typeof(MockTask).Name));
}
}
} | mit | C# |
88ed56836d926d141d945210b21b7111b5da3d82 | Make project comvisible explicitly set to false to meet compliance requirements. | Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnet5 | src/Microsoft.ApplicationInsights.AspNetCore/Properties/AssemblyInfo.cs | src/Microsoft.ApplicationInsights.AspNetCore/Properties/AssemblyInfo.cs | using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.AspNetCore.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: ComVisible(false)] | using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.AspNetCore.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] | mit | C# |
473407d2a12c8f36b2ba7ea1d5cc2bc7e39d4dda | Support nullable properties on authorization_controls | richardlawley/stripe.net,stripe/stripe-dotnet | src/Stripe.net/Entities/Issuing/Authorizations/AuthorizationControls.cs | src/Stripe.net/Entities/Issuing/Authorizations/AuthorizationControls.cs | namespace Stripe.Issuing
{
using System.Collections.Generic;
using Newtonsoft.Json;
public class AuthorizationControls : StripeEntity
{
[JsonProperty("allowed_categories")]
public List<string> AllowedCategories { get; set; }
[JsonProperty("blocked_categories")]
public List<string> BlockedCategories { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
[JsonProperty("max_amount")]
public long? MaxAmount { get; set; }
[JsonProperty("max_approvals")]
public long? MaxApprovals { get; set; }
}
}
| namespace Stripe.Issuing
{
using System.Collections.Generic;
using Newtonsoft.Json;
public class AuthorizationControls : StripeEntity
{
[JsonProperty("allowed_categories")]
public List<string> AllowedCategories { get; set; }
[JsonProperty("blocked_categories")]
public List<string> BlockedCategories { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
[JsonProperty("max_amount")]
public long MaxAmount { get; set; }
[JsonProperty("max_approvals")]
public long MaxApprovals { get; set; }
}
}
| apache-2.0 | C# |
881471c9e5a31741f0fecf09f614b985b61abdcb | Fix failing test | kevbite/CompaniesHouse.NET,LiberisLabs/CompaniesHouse.NET | src/CompaniesHouse.IntegrationTests/Tests/CompanyFilingHistoryTests/CompanyFilingHistoryTestsValid.cs | src/CompaniesHouse.IntegrationTests/Tests/CompanyFilingHistoryTests/CompanyFilingHistoryTestsValid.cs | using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CompaniesHouse.Response.CompanyFiling;
using NUnit.Framework;
namespace CompaniesHouse.IntegrationTests.Tests.CompanyFilingHistoryTests
{
[TestFixtureSource(nameof(TestCases))]
public class CompanyFilingHistoryTestsValid : CompanyFilingHistoryTestBase
{
private readonly string _companyNumber;
private List<FilingHistoryItem> _results;
public CompanyFilingHistoryTestsValid(string companyNumber)
{
_companyNumber = companyNumber;
}
public static string[] TestCases()
{
return new[]
{
"03977902", // Google
"00445790", // Tesco
"00002065", // Lloyds Bank PLC
"09965459", // Amazebytes
"06768813", // TEST & COOL LTD,
"00059337",
"SC171417",
"09018331"
};
}
protected override async Task When()
{
var page = 0;
var size = 100;
_results = new List<FilingHistoryItem>();
CompaniesHouseClientResponse<CompanyFilingHistory> result;
do
{
result = await _client.GetCompanyFilingHistoryAsync(_companyNumber, page++ * size, size);
_results.AddRange(result.Data.Items);
} while (result.Data.Items.Any());
}
[Test]
public void ThenTheDataItemsAreNotEmpty()
{
Assert.That(_results, Is.Not.Empty);
}
}
}
| using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CompaniesHouse.Response.CompanyFiling;
using NUnit.Framework;
namespace CompaniesHouse.IntegrationTests.Tests.CompanyFilingHistoryTests
{
[TestFixtureSource(nameof(TestCases))]
public class CompanyFilingHistoryTestsValid : CompanyFilingHistoryTestBase
{
private readonly string _companyNumber;
private List<FilingHistoryItem> _results;
public CompanyFilingHistoryTestsValid(string companyNumber)
{
_companyNumber = companyNumber;
}
public static string[] TestCases()
{
return new[]
{
"03977902", // Google
"00445790", // Tesco
"00002065", // Lloyds Bank PLC
"09965459", // Amazebytes
"06768813", // TEST & COOL LTD,
"00059337",
"06484911",
"09018331"
};
}
protected override async Task When()
{
var page = 0;
var size = 100;
_results = new List<FilingHistoryItem>();
CompaniesHouseClientResponse<CompanyFilingHistory> result;
do
{
result = await _client.GetCompanyFilingHistoryAsync(_companyNumber, page++ * size, size);
_results.AddRange(result.Data.Items);
} while (result.Data.Items.Any());
}
[Test]
public void ThenTheDataItemsAreNotEmpty()
{
Assert.That(_results, Is.Not.Empty);
}
}
}
| mit | C# |
5284e17ecb7436cbfc2c1c3eb9cf50ff40474691 | Change the HTML according to the new Habitat theming | zyq524/Habitat,bhaveshmaniya/Habitat,nurunquebec/Habitat,GoranHalvarsson/Habitat,bhaveshmaniya/Habitat,ClearPeopleLtd/Habitat,GoranHalvarsson/Habitat,nurunquebec/Habitat,zyq524/Habitat,ClearPeopleLtd/Habitat | src/Feature/faq/code/Views/FAQ/FaqAccordion.cshtml | src/Feature/faq/code/Views/FAQ/FaqAccordion.cshtml | @using System.Web.Mvc.Html
@using Sitecore.Feature.FAQ.Repositories
@using Sitecore.Feature.FAQ
@using Sitecore.Data.Items
@model Sitecore.Mvc.Presentation.RenderingModel
@{
var elements = GroupMemberRepository.Get(Model.Item).ToArray();
}
@foreach (Item item in elements)
{
var ID = Guid.NewGuid().ToString();
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingcollapse0">
<h4 class="panel-title">
<a role="button" class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#@ID">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
@Html.Sitecore().Field(Templates.Faq.Fields.Question_FieldName, item)
</a>
</h4>
</div>
<div id=@ID class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingcollapse0">
<div class="panel-body">
@Html.Sitecore().Field(Templates.Faq.Fields.Answer_FieldName,item)
</div>
</div>
</div>
<!-- /.panel -->
</div>
}
@if (Sitecore.Context.PageMode.IsPageEditor)
{
<script>
$('.panel-collapse').toggle();
</script>
} | @using System.Web.Mvc.Html
@using Sitecore.Feature.FAQ.Repositories
@using Sitecore.Feature.FAQ
@using Sitecore.Data.Items
@model Sitecore.Mvc.Presentation.RenderingModel
@{
var elements = GroupMemberRepository.Get(Model.Item).ToArray();
int i = 1;
}
@foreach (Item item in elements)
{
var ID = Guid.NewGuid().ToString();
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#@ID">
@Html.Sitecore().Field(Templates.Faq.Fields.Question_FieldName, item)
</a>
</h4>
</div>
<div id=@ID class="panel-collapse collapse">
<div class="panel-body">
@Html.Sitecore().Field(Templates.Faq.Fields.Answer_FieldName,item)
</div>
</div>
</div>
<!-- /.panel -->
</div>
}
@if (Sitecore.Context.PageMode.IsPageEditor)
{
<script>
$('.panel-collapse').toggle();
</script>
} | apache-2.0 | C# |
d7010fb19ec0a93e3d71a83375362a1cba6ff86b | Add comment | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | AspNetCoreSdkTests/TestData.cs | AspNetCoreSdkTests/TestData.cs | using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
namespace AspNetCoreSdkTests
{
public static class TestData
{
public static IEnumerable<TestCaseData> AllTemplates { get; } =
from t in Enum.GetValues(typeof(Template)).Cast<Template>()
from c in Enum.GetValues(typeof(NuGetConfig)).Cast<NuGetConfig>()
let data = new TestCaseData(t, c)
select (
c == NuGetConfig.NuGetOrg ?
data.Ignore("RC1 not yet published to nuget.org") :
data);
// TODO: Add TemplateTypeAttribute to distinguish app templates from classlib templates
public static IEnumerable<TestCaseData> ApplicationTemplates { get; } =
from d in AllTemplates
where ((Template)d.Arguments[0] != Template.RazorClassLib)
select d;
}
}
| using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
namespace AspNetCoreSdkTests
{
public static class TestData
{
public static IEnumerable<TestCaseData> AllTemplates { get; } =
from t in Enum.GetValues(typeof(Template)).Cast<Template>()
from c in Enum.GetValues(typeof(NuGetConfig)).Cast<NuGetConfig>()
let data = new TestCaseData(t, c)
select (
c == NuGetConfig.NuGetOrg ?
data.Ignore("RC1 not yet published to nuget.org") :
data);
public static IEnumerable<TestCaseData> ApplicationTemplates { get; } =
from d in AllTemplates
where ((Template)d.Arguments[0] != Template.RazorClassLib)
select d;
}
}
| apache-2.0 | C# |
b9b5da07dd1f598fa374d7d4901f684920c04f03 | update the TrackingDetail class to make the 'tracking_location' property a single TrackingLocation rather than a collection of them, as per this documentation: https://www.easypost.com/docs/api#tracking | jmalatia/easypost-csharp,EasyPost/easypost-csharp,kendallb/easypost-async-csharp,EasyPost/easypost-csharp | EasyPost/TrackingDetail.cs | EasyPost/TrackingDetail.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EasyPost {
public class TrackingDetail : IResource {
public DateTime datetime { get; set; }
public string message { get; set; }
public string status { get; set; }
public TrackingLocation tracking_location { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EasyPost {
public class TrackingDetail : IResource {
public DateTime datetime { get; set; }
public string message { get; set; }
public string status { get; set; }
public List<TrackingLocation> tracking_location { get; set; }
}
}
| mit | C# |
4045ee4e9556530915cf65e66e26cd8c2c3f5d40 | Update WaterVapourReaction.cs | fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation | UnityProject/Assets/Scripts/Tilemaps/Behaviours/Meta/Atmospherics/Data/Reactions/WaterVapourReaction.cs | UnityProject/Assets/Scripts/Tilemaps/Behaviours/Meta/Atmospherics/Data/Reactions/WaterVapourReaction.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Systems.Atmospherics
{
public class WaterVapourReaction : Reaction
{
public bool Satisfies(GasMix gasMix)
{
throw new System.NotImplementedException();
}
public void React(GasMix gasMix, Vector3 tilePos, Matrix matrix)
{
if (gasMix.Temperature <= AtmosDefines.WATER_VAPOR_FREEZE)
{
if (gasMix.GetMoles(Gas.WaterVapor) < 2f)
{
//Not enough moles to freeze
return;
}
var numberOfIceToSpawn = (int)Mathf.Floor(gasMix.GetMoles(Gas.WaterVapor) / 2f);
//Stack size of ice is 50
if (numberOfIceToSpawn > 50)
{
numberOfIceToSpawn = 50;
}
if (numberOfIceToSpawn > 0)
{
SpawnSafeThread.SpawnPrefab(tilePos, AtmosManager.Instance.iceShard, amountIfStackable: numberOfIceToSpawn);
gasMix.RemoveGas(Gas.WaterVapor, numberOfIceToSpawn * 2f);
}
}
}
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Systems.Atmospherics
{
public class WaterVapourReaction : Reaction
{
public bool Satisfies(GasMix gasMix)
{
throw new System.NotImplementedException();
}
public void React(GasMix gasMix, Vector3 tilePos, Matrix matrix)
{
if (gasMix.Temperature <= AtmosDefines.WATER_VAPOR_FREEZE)
{
if (gasMix.GetMoles(Gas.WaterVapor) < 2f)
{
//Not enough moles to freeze
return;
}
var numberOfIceToSpawn = (int)Mathf.Floor(gasMix.GetMoles(Gas.WaterVapor) / 2f);
//Stack size of ice is 50
if (numberOfIceToSpawn > 50)
{
numberOfIceToSpawn = 50;
}
SpawnSafeThread.SpawnPrefab(tilePos, AtmosManager.Instance.iceShard, amountIfStackable: numberOfIceToSpawn);
gasMix.RemoveGas(Gas.WaterVapor, numberOfIceToSpawn * 2f);
}
}
}
}
| agpl-3.0 | C# |
299a7605ca9b5a1c75eaca11ab1b7c0330deb7d1 | Call base.Dispose in HttpConnectionResponseContent | ahmetalpbalkan/Docker.DotNet,jterry75/Docker.DotNet,jterry75/Docker.DotNet | Docker.DotNet/Microsoft.Net.Http.Client/HttpConnectionResponseContent.cs | Docker.DotNet/Microsoft.Net.Http.Client/HttpConnectionResponseContent.cs | using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
namespace Microsoft.Net.Http.Client
{
public class HttpConnectionResponseContent : HttpContent
{
private readonly HttpConnection _connection;
private Stream _responseStream;
internal HttpConnectionResponseContent(HttpConnection connection)
{
_connection = connection;
}
internal void ResolveResponseStream(bool chunked)
{
if (_responseStream != null)
{
throw new InvalidOperationException("Called multiple times");
}
if (chunked)
{
_responseStream = new ChunkedReadStream(_connection.Transport);
}
else if (Headers.ContentLength.HasValue)
{
_responseStream = new ContentLengthReadStream(_connection.Transport, Headers.ContentLength.Value);
}
else
{
// Raw, read until end and close
_responseStream = _connection.Transport;
}
}
public WriteClosableStream HijackStream()
{
if (_responseStream != _connection.Transport)
{
throw new InvalidOperationException("cannot hijack chunked or content length stream");
}
return _connection.Transport;
}
protected override Task SerializeToStreamAsync(Stream stream, System.Net.TransportContext context)
{
return _responseStream.CopyToAsync(stream);
}
protected override Task<Stream> CreateContentReadStreamAsync()
{
return Task.FromResult(_responseStream);
}
protected override bool TryComputeLength(out long length)
{
length = 0;
return false;
}
protected override void Dispose(bool disposing)
{
try
{
if (disposing)
{
_responseStream.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
}
}
| using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
namespace Microsoft.Net.Http.Client
{
public class HttpConnectionResponseContent : HttpContent
{
private readonly HttpConnection _connection;
private Stream _responseStream;
internal HttpConnectionResponseContent(HttpConnection connection)
{
_connection = connection;
}
internal void ResolveResponseStream(bool chunked)
{
if (_responseStream != null)
{
throw new InvalidOperationException("Called multiple times");
}
if (chunked)
{
_responseStream = new ChunkedReadStream(_connection.Transport);
}
else if (Headers.ContentLength.HasValue)
{
_responseStream = new ContentLengthReadStream(_connection.Transport, Headers.ContentLength.Value);
}
else
{
// Raw, read until end and close
_responseStream = _connection.Transport;
}
}
public WriteClosableStream HijackStream()
{
if (_responseStream != _connection.Transport)
{
throw new InvalidOperationException("cannot hijack chunked or content length stream");
}
return _connection.Transport;
}
protected override Task SerializeToStreamAsync(Stream stream, System.Net.TransportContext context)
{
return _responseStream.CopyToAsync(stream);
}
protected override Task<Stream> CreateContentReadStreamAsync()
{
return Task.FromResult(_responseStream);
}
protected override bool TryComputeLength(out long length)
{
length = 0;
return false;
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
_responseStream.Dispose();
}
}
}
}
| apache-2.0 | C# |
2a13f6ed19b202bdf510738bbd142f5522eefd3f | Update ShapeTool.cs | Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Core2D/UI/Avalonia/Dock/Tools/ShapeTool.cs | src/Core2D/UI/Avalonia/Dock/Tools/ShapeTool.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 DMC = Dock.Model.Controls;
namespace Core2D.UI.Avalonia.Dock.Tools
{
/// <summary>
/// Shape view.
/// </summary>
public class ShapeTool : DMC.Tool
{
}
}
| // 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 DMC=Dock.Model.Controls;
namespace Core2D.UI.Avalonia.Dock.Tools
{
/// <summary>
/// Shape view.
/// </summary>
public class ShapeTool : DMC.Tool
{
}
}
| mit | C# |
30bbb8a2b736464f3daccdc7bea60c88c8a59622 | Fix error | 12joan/hangman | row.cs | row.cs | using System;
using System.Collections.Generic;
namespace Hangman {
public class Row {
public Cell[] Cells;
public Row(Cell[] cells) {
Cells = cells;
}
public string Draw(int width) {
// return new String(' ', width - Text.Length) + Text;
return String.Join("\n", Lines());
}
private string[] Lines() {
var lines = new List<string>();
for (var i = 0; i < MaxCellDepth(); i++) {
var line = LineAtIndex(i);
lines.Add(String.Join("", line));
}
return lines.ToArray();
}
private string LineAtIndex(int index) {
var line = new List<string>();
int usedSpace = 0;
foreach (var cell in Cells) {
var part = cell.LineAtIndex(index);
line.Add(part);
usedSpace += part.Length;
}
return String.Join("", line);
}
private int MaxCellDepth() {
int max = 0;
foreach (var cell in Cells) {
max = Math.Max(max, cell.Depth());
}
return max;
}
}
}
| using System;
using System.Collections.Generic;
namespace Hangman {
public class Row {
public Cell[] Cells;
public Row(Cell[] cells) {
Cells = cells;
}
public string Draw(int width) {
// return new String(' ', width - Text.Length) + Text;
return String.Join("\n", Lines());
}
private string[] Lines() {
var lines = new List<string>();
for (var i = 0; i < MaxCellDepth(); i++) {
var line = LineAtIndex(i);
lines.Add(String.Join("", line));
}
return lines.ToArray();
}
private string LineAtIndex(int index) {
var line = new List<string>();
int usedSpace = 0;
foreach (var cell in Cells) {
var part = cell.LineAtIndex(index);
line.Add(part);
usedSpace += part.Length;
}
return line;
}
private int MaxCellDepth() {
int max = 0;
foreach (var cell in Cells) {
max = Math.Max(max, cell.Depth());
}
return max;
}
}
}
| unlicense | C# |
e0fab12e4509eedef9916fc6b0c8952f2ef32443 | Undo previous commit | fluentmigrator/fluentmigrator,stsrki/fluentmigrator,stsrki/fluentmigrator,fluentmigrator/fluentmigrator | src/FluentMigrator.DotNet.Cli/Commands/Root.cs | src/FluentMigrator.DotNet.Cli/Commands/Root.cs | #region License
// Copyright (c) 2007-2018, Sean Chambers and the FluentMigrator Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using McMaster.Extensions.CommandLineUtils;
namespace FluentMigrator.DotNet.Cli.Commands
{
[HelpOption(Description = "Execute FluentMigrator actions")]
[Command("dotnet-fm", Description = "The external FluentMigrator runner that integrates into the .NET Core CLI tooling")]
[Subcommand(typeof(Migrate), typeof(Rollback), typeof(Validate), typeof(ListCommand))]
public class Root
{
protected int OnExecute(CommandLineApplication app, IConsole console)
{
console.Error.WriteLine("You must specify a subcommand.");
app.ShowHelp();
return 1;
}
}
}
| #region License
// Copyright (c) 2007-2018, Sean Chambers and the FluentMigrator Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using McMaster.Extensions.CommandLineUtils;
namespace FluentMigrator.DotNet.Cli.Commands
{
[HelpOption(Description = "Execute FluentMigrator actions")]
[Command("dotnet-fm", Description = "The external FluentMigrator runner that integrates into the .NET Core CLI tooling")]
[Subcommand("migrate", typeof(Migrate))]
[Subcommand("rollback", typeof(Rollback))]
[Subcommand("validate", typeof(Validate))]
[Subcommand("list", typeof(ListCommand))]
public class Root
{
protected int OnExecute(CommandLineApplication app, IConsole console)
{
console.Error.WriteLine("You must specify a subcommand.");
app.ShowHelp();
return 1;
}
}
}
| apache-2.0 | C# |
90307bc71e8f7a62fd07a93648aacd8091bff80e | fix dotnet-repl-csi | marono/cli,marono/cli,jaredpar/cli,MichaelSimons/cli,jaredpar/cli,FubarDevelopment/cli,naamunds/cli,jaredpar/cli,AbhitejJohn/cli,mylibero/cli,mylibero/cli,mylibero/cli,Faizan2304/cli,krwq/cli,livarcocc/cli-1,johnbeisner/cli,livarcocc/cli-1,krwq/cli,jonsequitur/cli,stuartleeks/dotnet-cli,AbhitejJohn/cli,gkhanna79/cli,mlorbetske/cli,dasMulli/cli,borgdylan/dotnet-cli,JohnChen0/cli,mlorbetske/cli,nguerrera/cli,svick/cli,nguerrera/cli,weshaggard/cli,mlorbetske/cli,anurse/Cli,svick/cli,blackdwarf/cli,mlorbetske/cli,schellap/cli,jaredpar/cli,ravimeda/cli,gkhanna79/cli,dasMulli/cli,stuartleeks/dotnet-cli,nguerrera/cli,schellap/cli,borgdylan/dotnet-cli,marono/cli,mylibero/cli,krwq/cli,schellap/cli,gkhanna79/cli,harshjain2/cli,johnbeisner/cli,naamunds/cli,naamunds/cli,weshaggard/cli,svick/cli,harshjain2/cli,danquirk/cli,schellap/cli,EdwardBlair/cli,krwq/cli,dasMulli/cli,weshaggard/cli,gkhanna79/cli,jkotas/cli,stuartleeks/dotnet-cli,mylibero/cli,danquirk/cli,MichaelSimons/cli,jkotas/cli,ravimeda/cli,JohnChen0/cli,JohnChen0/cli,jonsequitur/cli,ravimeda/cli,blackdwarf/cli,FubarDevelopment/cli,jaredpar/cli,AbhitejJohn/cli,johnbeisner/cli,borgdylan/dotnet-cli,nguerrera/cli,krwq/cli,jkotas/cli,jkotas/cli,gkhanna79/cli,blackdwarf/cli,marono/cli,naamunds/cli,harshjain2/cli,stuartleeks/dotnet-cli,danquirk/cli,jkotas/cli,marono/cli,schellap/cli,MichaelSimons/cli,jonsequitur/cli,borgdylan/dotnet-cli,FubarDevelopment/cli,stuartleeks/dotnet-cli,livarcocc/cli-1,AbhitejJohn/cli,schellap/cli,JohnChen0/cli,EdwardBlair/cli,jaredpar/cli,weshaggard/cli,weshaggard/cli,FubarDevelopment/cli,MichaelSimons/cli,blackdwarf/cli,Faizan2304/cli,naamunds/cli,jonsequitur/cli,MichaelSimons/cli,borgdylan/dotnet-cli,EdwardBlair/cli,danquirk/cli,Faizan2304/cli,danquirk/cli | src/Microsoft.DotNet.Tools.Repl.Csi/Program.cs | src/Microsoft.DotNet.Tools.Repl.Csi/Program.cs | // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Tools.Repl.Csi
{
public sealed class Program
{
public static int Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
var app = new CommandLineApplication();
app.Name = "dotnet repl csi";
app.FullName = "C# REPL";
app.Description = "C# REPL for the .NET platform";
app.HelpOption("-h|--help");
var script = app.Argument("<SCRIPT>", "The .csx file to run. Defaults to interactive mode.");
app.OnExecute(() => Run(script.Value));
return app.Execute(args);
}
private static int Run(string scriptOpt)
{
var corerun = Path.Combine(AppContext.BaseDirectory, Constants.HostExecutableName);
var csiExe = Path.Combine(AppContext.BaseDirectory, "csi.exe");
var csiArgs = string.IsNullOrEmpty(scriptOpt) ? "-i" : scriptOpt;
var result = Command.Create(csiExe, csiArgs)
.ForwardStdOut()
.ForwardStdErr()
.Execute();
return result.ExitCode;
}
}
}
| // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using Microsoft.Dnx.Runtime.Common.CommandLine;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Tools.Repl.Csi
{
public sealed class Program
{
public static int Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
var app = new CommandLineApplication();
app.Name = "dotnet repl csi";
app.FullName = "C# REPL";
app.Description = "C# REPL for the .NET platform";
app.HelpOption("-h|--help");
var script = app.Argument("<SCRIPT>", "The .csx file to run. Defaults to interactive mode.");
app.OnExecute(() => Run(script.Value));
return app.Execute(args);
}
private static int Run(string scriptOpt)
{
var corerun = Path.Combine(AppContext.BaseDirectory, Constants.HostExecutableName);
var csiExe = Path.Combine(AppContext.BaseDirectory, "csi.exe");
var csiArgs = string.IsNullOrEmpty(scriptOpt) ? "-i" : scriptOpt;
var command = File.Exists(corerun) && File.Exists(csiExe) ?
Command.Create(corerun, $@"""{csiExe}"" {csiArgs}") :
Command.Create(csiExe, csiArgs);
command = command.ForwardStdOut().ForwardStdErr();
var result = command.Execute();
return result.ExitCode;
}
}
}
| mit | C# |
bd872b45afe894359b25af8528907abbfb844107 | Fix for SiteWebhookSerializer for schema V201705 | OfficeDev/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,OfficeDev/PnP-Sites-Core | Core/OfficeDevPnP.Core/Framework/Provisioning/Providers/Xml/Serializers/V201705/SiteWebhooksSerializer.cs | Core/OfficeDevPnP.Core/Framework/Provisioning/Providers/Xml/Serializers/V201705/SiteWebhooksSerializer.cs | using OfficeDevPnP.Core.Framework.Provisioning.Model;
using OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.Resolvers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.Serializers
{
/// <summary>
/// Class to serialize/deserialize the Site Webhooks
/// </summary>
[TemplateSchemaSerializer(
MinimalSupportedSchemaVersion = XMLPnPSchemaVersion.V201705,
SerializationSequence = 2200, DeserializationSequence = 2200,
Default = true)]
internal class SiteWebhooksSerializer : PnPBaseSchemaSerializer<SiteWebhook>
{
public override void Deserialize(object persistence, ProvisioningTemplate template)
{
var siteWebhooks = persistence.GetPublicInstancePropertyValue("SiteWebhooks");
template.SiteWebhooks.AddRange(
PnPObjectsMapper.MapObjects(siteWebhooks,
new CollectionFromSchemaToModelTypeResolver(typeof(SiteWebhook)))
as IEnumerable<SiteWebhook>);
}
public override void Serialize(ProvisioningTemplate template, object persistence)
{
var siteWebhooksTypeName = $"{PnPSerializationScope.Current?.BaseSchemaNamespace}.SiteWebhook, {PnPSerializationScope.Current?.BaseSchemaAssemblyName}";
var siteWebhooksType = Type.GetType(siteWebhooksTypeName, true);
var expressions = new Dictionary<string, IResolver>();
// Manage SiteWebhookTypeSpecified property
expressions.Add($"{siteWebhooksType}.SiteWebhookTypeSpecified", new ExpressionValueResolver((s, p) => true));
persistence.GetPublicInstanceProperty("SiteWebhooks")
.SetValue(
persistence,
PnPObjectsMapper.MapObjects(template.SiteWebhooks,
new CollectionFromModelToSchemaTypeResolver(siteWebhooksType),
expressions, false));
}
}
}
| using OfficeDevPnP.Core.Framework.Provisioning.Model;
using OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.Resolvers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.Serializers
{
/// <summary>
/// Class to serialize/deserialize the Site Webhooks
/// </summary>
[TemplateSchemaSerializer(
MinimalSupportedSchemaVersion = XMLPnPSchemaVersion.V201705,
SerializationSequence = 2200, DeserializationSequence = 2200,
Default = true)]
internal class SiteWebhooksSerializer : PnPBaseSchemaSerializer<SupportedUILanguage>
{
public override void Deserialize(object persistence, ProvisioningTemplate template)
{
var siteWebhooks = persistence.GetPublicInstancePropertyValue("SiteWebhooks");
template.SiteWebhooks.AddRange(
PnPObjectsMapper.MapObjects(siteWebhooks,
new CollectionFromSchemaToModelTypeResolver(typeof(SiteWebhook)))
as IEnumerable<SiteWebhook>);
}
public override void Serialize(ProvisioningTemplate template, object persistence)
{
var siteWebhooksTypeName = $"{PnPSerializationScope.Current?.BaseSchemaNamespace}.SiteWebhook, {PnPSerializationScope.Current?.BaseSchemaAssemblyName}";
var siteWebhooksType = Type.GetType(siteWebhooksTypeName, true);
var expressions = new Dictionary<string, IResolver>();
// Manage SiteWebhookTypeSpecified property
expressions.Add($"{siteWebhooksType}.SiteWebhookTypeSpecified", new ExpressionValueResolver((s, p) => true));
persistence.GetPublicInstanceProperty("SiteWebhooks")
.SetValue(
persistence,
PnPObjectsMapper.MapObjects(template.SiteWebhooks,
new CollectionFromModelToSchemaTypeResolver(siteWebhooksType),
expressions, false));
}
}
}
| mit | C# |
68e269904377205b62661aac719c886be9ba320d | Fix oversight in playlist matching logic | smoogipooo/osu,smoogipoo/osu,ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu | osu.Game/Overlays/Music/Playlist.cs | osu.Game/Overlays/Music/Playlist.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.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
using osuTK;
namespace osu.Game.Overlays.Music
{
public class Playlist : OsuRearrangeableListContainer<BeatmapSetInfo>
{
public Action<BeatmapSetInfo> RequestSelection;
public readonly Bindable<BeatmapSetInfo> SelectedSet = new Bindable<BeatmapSetInfo>();
public new MarginPadding Padding
{
get => base.Padding;
set => base.Padding = value;
}
public void Filter(FilterCriteria criteria)
{
var items = (SearchContainer<RearrangeableListItem<BeatmapSetInfo>>)ListContainer;
foreach (var item in items.OfType<PlaylistItem>())
item.InSelectedCollection = criteria.Collection?.Beatmaps.Any(b => item.Model.Equals(b.BeatmapSet)) ?? true;
items.SearchTerm = criteria.SearchText;
}
public BeatmapSetInfo FirstVisibleSet => Items.FirstOrDefault(i => ((PlaylistItem)ItemMap[i]).MatchingFilter);
protected override OsuRearrangeableListItem<BeatmapSetInfo> CreateOsuDrawable(BeatmapSetInfo item) => new PlaylistItem(item)
{
SelectedSet = { BindTarget = SelectedSet },
RequestSelection = set => RequestSelection?.Invoke(set)
};
protected override FillFlowContainer<RearrangeableListItem<BeatmapSetInfo>> CreateListFillFlowContainer() => new SearchContainer<RearrangeableListItem<BeatmapSetInfo>>
{
Spacing = new Vector2(0, 3),
LayoutDuration = 200,
LayoutEasing = Easing.OutQuint,
};
}
}
| // 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.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Extensions;
using osu.Game.Graphics.Containers;
using osuTK;
namespace osu.Game.Overlays.Music
{
public class Playlist : OsuRearrangeableListContainer<BeatmapSetInfo>
{
public Action<BeatmapSetInfo> RequestSelection;
public readonly Bindable<BeatmapSetInfo> SelectedSet = new Bindable<BeatmapSetInfo>();
public new MarginPadding Padding
{
get => base.Padding;
set => base.Padding = value;
}
public void Filter(FilterCriteria criteria)
{
var items = (SearchContainer<RearrangeableListItem<BeatmapSetInfo>>)ListContainer;
foreach (var item in items.OfType<PlaylistItem>())
item.InSelectedCollection = criteria.Collection?.Beatmaps.Any(b => b.MatchesOnlineID(item.Model)) ?? true;
items.SearchTerm = criteria.SearchText;
}
public BeatmapSetInfo FirstVisibleSet => Items.FirstOrDefault(i => ((PlaylistItem)ItemMap[i]).MatchingFilter);
protected override OsuRearrangeableListItem<BeatmapSetInfo> CreateOsuDrawable(BeatmapSetInfo item) => new PlaylistItem(item)
{
SelectedSet = { BindTarget = SelectedSet },
RequestSelection = set => RequestSelection?.Invoke(set)
};
protected override FillFlowContainer<RearrangeableListItem<BeatmapSetInfo>> CreateListFillFlowContainer() => new SearchContainer<RearrangeableListItem<BeatmapSetInfo>>
{
Spacing = new Vector2(0, 3),
LayoutDuration = 200,
LayoutEasing = Easing.OutQuint,
};
}
}
| mit | C# |
4f12aca473a586a72a27b4de7767442664ba41e8 | Fix tests | austinmao/reduxity,austinmao/reduxity | Assets/Tests/Editor/CharacterMoverTests.cs | Assets/Tests/Editor/CharacterMoverTests.cs | using UnityEngine;
using NUnit.Framework;
namespace Reduxity.Tests.Example {
[TestFixture]
public class CharacterMoverTests {
private App app_;
private GameObject mockGameObject_;
[SetUpAttribute]
public void Init() {
// initialize app
app_ = new App();
app_.Initialize();
// set initial state object dump
new State {}.Initialize();
// create empty game object
mockGameObject_ = new GameObject();
}
[TearDownAttribute]
public void Dispose() {
app_ = null;
mockGameObject_ = null;
}
[Test]
public void Should_return_accurate_move_distance_from_move_reducer() {
CharacterMover.Action.Move mockMoveAction = new CharacterMover.Action.Move {
inputVelocity = Vector2.up.normalized,
playerTransform = mockGameObject_.transform,
fixedDeltaTime = 1.0f
};
App.Store.Dispatch(mockMoveAction);
State currentState = GetCurrentState();
Assert.IsTrue(currentState.Movement.isMoving);
Assert.AreEqual(currentState.Movement.distance, Vector3.forward);
}
[Test]
public void Should_stop_on_stop_action() {
CharacterMover.Action.Stop mockStopAction = new CharacterMover.Action.Stop {};
App.Store.Dispatch(mockStopAction);
State currentState = GetCurrentState();
Assert.IsFalse(currentState.Movement.isMoving);
}
private State GetCurrentState() {
return App.Store.GetState();
}
}
} | using UnityEngine;
using NUnit.Framework;
namespace Reduxity.Tests.Example {
[TestFixture]
public class CharacterMoverTests {
private App app_;
private GameObject mockGameObject_;
private State initialStateDump_;
private State currentStateDump_;
[SetUpAttribute]
public void Init() {
// initialize app
app_ = new App();
app_.Initialize();
// set initial state object dump
initialStateDump_ = new State {}.Initialize();
// create empty game object
mockGameObject_ = new GameObject();
}
[TearDownAttribute]
public void Dispose() {
app_ = null;
initialStateDump_ = null;
currentStateDump_ = null;
mockGameObject_ = null;
}
[Test]
public void Should_return_accurate_move_distance_from_move_reducer() {
CharacterMover.Action.Move mockMoveAction = new CharacterMover.Action.Move {
inputVelocity = Vector2.up.normalized,
playerTransform = mockGameObject_.transform,
fixedDeltaTime = 1.0f
};
App.Store.Dispatch(mockMoveAction);
State currentState = GetCurrentState();
Debug.Log(currentState.Movement.distance);
Assert.IsTrue(currentState.Movement.isMoving);
Assert.AreEqual(currentState.Movement.distance, Vector3.forward);
}
[Test]
public void Should_stop_on_stop_action() {
CharacterMover.Action.Stop mockStopAction = new CharacterMover.Action.Stop {};
App.Store.Dispatch(mockStopAction);
State currentState = GetCurrentState();
Assert.IsFalse(currentState.Movement.isMoving);
}
private State GetCurrentState() {
return App.Store.GetState();
}
}
} | mit | C# |
3bf9979b17aaec77a0c56f94e8dc9860b9b06c68 | Bump version to 0.6.1 | FatturaElettronicaPA/FatturaElettronicaPA.Forms | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FatturaElettronica.Forms")]
[assembly: AssemblyDescription("Windows.Forms per FatturaElettronica.NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronica.Forms")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a82cf38b-b7fe-42ae-b114-dc8fed8bd718")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.1.0")]
[assembly: AssemblyFileVersion("0.6.1.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FatturaElettronica.Forms")]
[assembly: AssemblyDescription("Windows.Forms per FatturaElettronica.NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronica.Forms")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a82cf38b-b7fe-42ae-b114-dc8fed8bd718")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.0.0")]
[assembly: AssemblyFileVersion("0.6.0.0")]
| bsd-3-clause | C# |
645d6f5c2b06fdaadaf4add1e0ac385566d133c6 | Bump version | nixxquality/WebMConverter,o11c/WebMConverter,Yuisbean/WebMConverter | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.17.1")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.17.0")]
| mit | C# |
e1b99799eb9f206b624745fc12914f8c2d0f38c4 | 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. | caioproiete/Autofac.Wcf,autofac/Autofac.Wcf | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("Autofac.Tests.Integration.Wcf")]
| using System.Reflection;
[assembly: AssemblyTitle("Autofac.Tests.Integration.Wcf")]
[assembly: AssemblyDescription("")]
| mit | C# |
b5e4a6fb07542e1ffc4a9b7de71a010fe46b9a10 | Refactor detector deeplink logic | projectkudu/kudu,EricSten-MSFT/kudu,EricSten-MSFT/kudu,projectkudu/kudu,projectkudu/kudu,EricSten-MSFT/kudu,projectkudu/kudu,EricSten-MSFT/kudu,EricSten-MSFT/kudu,projectkudu/kudu | Kudu.Services.Web/Detectors/Default.cshtml | Kudu.Services.Web/Detectors/Default.cshtml | @{
var ownerName = Environment.GetEnvironmentVariable("WEBSITE_OWNER_NAME") ?? "";
var subscriptionId = ownerName;
var resourceGroup = Environment.GetEnvironmentVariable("WEBSITE_RESOURCE_GROUP") ?? "";
var siteName = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME") ?? "";
var hostName = Environment.GetEnvironmentVariable("HTTP_HOST") ?? "";
var slotName = "";
var index = ownerName.IndexOf('+');
if (index >= 0)
{
subscriptionId = ownerName.Substring(0, index);
}
string detectorPath;
if (Kudu.Core.Helpers.OSDetector.IsOnWindows())
{
detectorPath = "diagnostics%2Favailability%2Fanalysis";
}
else
{
detectorPath = "detectors%2FLinuxAppDown";
}
var hostNameIndex = hostName.IndexOf('.');
if (hostNameIndex >= 0)
{
hostName = hostName.Substring(0, hostNameIndex);
}
var runtimeSuffxIndex = siteName.IndexOf("__");
if (runtimeSuffxIndex >= 0)
{
siteName = siteName.Substring(0, runtimeSuffxIndex);
}
// Get the slot name
if (!hostName.Equals(siteName, StringComparison.CurrentCultureIgnoreCase))
{
var slotNameIndex = siteName.Length;
if (hostName.Length > slotNameIndex && hostName[slotNameIndex] == '-')
{
// Fix up hostName by removing "-SLOTNAME"
slotName = hostName.Substring(slotNameIndex + 1);
hostName = hostName.Substring(0, slotNameIndex);
}
}
var isSlot = !String.IsNullOrWhiteSpace(slotName) && !slotName.Equals("production", StringComparison.CurrentCultureIgnoreCase);
var detectorDeepLink = "https://portal.azure.com/?websitesextension_ext=asd.featurePath%3D"
+ detectorPath
+ "#resource/subscriptions/" + subscriptionId
+ "/resourceGroups/" + resourceGroup
+ "/providers/Microsoft.Web/sites/"
+ hostName
+ (isSlot ? "/slots/" + slotName : "")
+ "/troubleshoot";
Response.Redirect(detectorDeepLink);
}
| @{
var ownerName = Environment.GetEnvironmentVariable("WEBSITE_OWNER_NAME") ?? "";
var subscriptionId = ownerName;
var resourceGroup = Environment.GetEnvironmentVariable("WEBSITE_RESOURCE_GROUP") ?? "";
var siteName = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME") ?? "";
var hostName = Environment.GetEnvironmentVariable("HTTP_HOST") ?? "";
var index = ownerName.IndexOf('+');
if (index >= 0)
{
subscriptionId = ownerName.Substring(0, index);
}
string detectorPath;
if (Kudu.Core.Helpers.OSDetector.IsOnWindows())
{
detectorPath = "diagnostics%2Favailability%2Fanalysis";
}
else
{
detectorPath = "detectors%2FLinuxAppDown";
}
var hostNameIndex = hostName.IndexOf('.');
if (hostNameIndex >= 0)
{
hostName = hostName.Substring(0, hostNameIndex);
}
var runtimeSuffxIndex = siteName.IndexOf("__");
if (runtimeSuffxIndex >= 0)
{
siteName = siteName.Substring(0, runtimeSuffxIndex);
}
// Get the slot name
if (!hostName.Equals(siteName, StringComparison.CurrentCultureIgnoreCase))
{
var slotNameIndex = siteName.Length;
if (hostName.Length > slotNameIndex && hostName[slotNameIndex] == '-')
{
// Fix up hostName by replacing "-SLOTNAME" with "/slots/SLOTNAME"
var slotName = hostName.Substring(slotNameIndex + 1);
hostName = hostName.Substring(0, slotNameIndex) + "/slots/" + slotName;
}
}
var detectorDeepLink = "https://portal.azure.com/?websitesextension_ext=asd.featurePath%3D"
+ detectorPath
+ "#resource/subscriptions/" + subscriptionId
+ "/resourceGroups/" + resourceGroup
+ "/providers/Microsoft.Web/sites/"
+ hostName
+ "/troubleshoot";
Response.Redirect(detectorDeepLink);
}
| apache-2.0 | C# |
a2c8e4b3a7378d4e869493eb2e92a154e77cb2d9 | rename bug_39 test | Construktion/Construktion,Construktion/Construktion | Construktion.Tests/Bugs/Bug_39_interface_properties_are_matching_the_ignore_virtual_properties_blueprint.cs | Construktion.Tests/Bugs/Bug_39_interface_properties_are_matching_the_ignore_virtual_properties_blueprint.cs | namespace Construktion.Tests.Bugs
{
using System;
using Blueprints.Simple;
using Shouldly;
using Xunit;
public class Bug_39_interface_properties_are_matching_the_ignore_virtual_properties_blueprint
{
[Fact]
public void interface_properties_should_not_match_virtual_blueprint()
{
var blueprint = new IgnoreVirtualPropertiesBlueprint();
var dateProp = typeof(Foo).GetProperty(nameof(Foo.DateTime));
var stringProp = typeof(Foo).GetProperty(nameof(Foo.String));
var matchesDate = blueprint.Matches(new ConstruktionContext(dateProp));
var matchesString = blueprint.Matches(new ConstruktionContext(stringProp));
matchesDate.ShouldBe(false);
matchesString.ShouldBe(false);
}
public class Foo : IFoo
{
public DateTime DateTime { get; set; }
public string String { get; set; }
}
public interface IFoo
{
DateTime DateTime { get; set; }
string String { get; set; }
}
}
} | namespace Construktion.Tests.Bugs
{
using System;
using Blueprints.Simple;
using Shouldly;
using Xunit;
public class Bug_39_interface_properties_are_matching_the_ignore_virtual_properties_blueprint
{
[Fact]
public void interface_members_should_not_match_virtual_blueprint()
{
var blueprint = new IgnoreVirtualPropertiesBlueprint();
var dateProp = typeof(Foo).GetProperty(nameof(Foo.DateTime));
var stringProp = typeof(Foo).GetProperty(nameof(Foo.String));
var matchesDate = blueprint.Matches(new ConstruktionContext(dateProp));
var matchesString = blueprint.Matches(new ConstruktionContext(stringProp));
matchesDate.ShouldBe(false);
matchesString.ShouldBe(false);
}
public class Foo : IFoo
{
public DateTime DateTime { get; set; }
public string String { get; set; }
}
public interface IFoo
{
DateTime DateTime { get; set; }
string String { get; set; }
}
}
} | mit | C# |
5cc3dc9d8d8867b7c75d21c8b7504d529eb6b618 | modify InControls keyboard profile | kasoki/UniCube,kasoki/UniCube | InControl/Unity/DeviceProfiles/KeyboardProfile.cs | InControl/Unity/DeviceProfiles/KeyboardProfile.cs | using System;
using System.Collections;
using System.Collections.Generic;
namespace InControl
{
[AutoDiscover]
public class KeyboardProfile : UnityInputDeviceProfile
{
public KeyboardProfile()
{
Name = "Keyboard";
Meta = "";
SupportedPlatforms = new[]
{
"Windows",
"Mac",
"Linux"
};
Sensitivity = 1.0f;
DeadZone = 0.0f;
ButtonMappings = new[]
{
new InputControlButtonMapping()
{
Handle = "W Key",
Target = InputControlType.Action4,
Source = "w"
},
new InputControlButtonMapping()
{
Handle = "A Key",
Target = InputControlType.Action3,
Source = "a"
},
new InputControlButtonMapping()
{
Handle = "S Key",
Target = InputControlType.Action1,
Source = "s"
},
new InputControlButtonMapping()
{
Handle = "D Key",
Target = InputControlType.Action2,
Source = "d"
},
new InputControlButtonMapping() {
Handle = "Q Key",
Target = InputControlType.LeftBumper,
Source = "q"
},
new InputControlButtonMapping() {
Handle = "E Key",
Target = InputControlType.RightBumper,
Source = "e"
}
};
AnalogMappings = new InputControlAnalogMapping[]
{
new InputControlAnalogMapping()
{
Handle = "Arrow Keys X",
Target = InputControlType.LeftStickX,
Source = "left right"
},
new InputControlAnalogMapping()
{
Handle = "Arrow Keys Y",
Target = InputControlType.LeftStickY,
Source = "down up"
}
};
}
}
}
| using System;
using System.Collections;
using System.Collections.Generic;
namespace InControl
{
[AutoDiscover]
public class KeyboardProfile : UnityInputDeviceProfile
{
public KeyboardProfile()
{
Name = "Keyboard";
Meta = "";
SupportedPlatforms = new[]
{
"Windows",
"Mac",
"Linux"
};
Sensitivity = 1.0f;
DeadZone = 0.0f;
ButtonMappings = new[]
{
new InputControlButtonMapping()
{
Handle = "Spacebar",
Target = InputControlType.Action1,
Source = "space"
},
new InputControlButtonMapping()
{
Handle = "A Key",
Target = InputControlType.Action2,
Source = "a"
},
new InputControlButtonMapping()
{
Handle = "S Key",
Target = InputControlType.Action3,
Source = "s"
},
new InputControlButtonMapping()
{
Handle = "D Key",
Target = InputControlType.Action4,
Source = "d"
}
};
AnalogMappings = new InputControlAnalogMapping[]
{
new InputControlAnalogMapping()
{
Handle = "Arrow Keys X",
Target = InputControlType.LeftStickX,
Source = "left right"
},
new InputControlAnalogMapping()
{
Handle = "Arrow Keys Y",
Target = InputControlType.LeftStickY,
Source = "down up"
}
};
}
}
}
| mit | C# |
65df8afef05e8e6d704b0a395ca80481cb82b961 | Add missing copyright notice | Shaddix/realm-dotnet,Shaddix/realm-dotnet,realm/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet,realm/realm-dotnet,realm/realm-dotnet | Realm.Shared/weaving/IRealmObjectHelper.cs | Realm.Shared/weaving/IRealmObjectHelper.cs | /* Copyright 2016 Realm Inc - All Rights Reserved
* Proprietary and Confidential
*/
using System;
namespace Realms.Weaving
{
public interface IRealmObjectHelper
{
RealmObject CreateInstance();
}
}
| using System;
namespace Realms.Weaving
{
public interface IRealmObjectHelper
{
RealmObject CreateInstance();
}
}
| apache-2.0 | C# |
8ec78c12f3565cc81e8708a53a52c8663956b797 | Update TwoAnimation.cs | thakyZ/VoidEngine,vvoid-inc/VoidEngine | VoidEngine/TwoAnimation.cs | VoidEngine/TwoAnimation.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace VoidEngine
{
/// <summary>
/// The TwoAnimation sub-class of Sprite
/// </summary>
public class TwoAnimation : Sprite
{
/// <summary>
/// The creator of TwoAnimation class.
/// </summary>
/// <param name="tex">The texture</param>
/// <param name="pos">The position</param>
/// <param name="frameWidth">The frame's width</param>
/// <param name="frameHeight">The frame's Height</param>
/// <param name="sheetWidth">The amount of frames on the x axis</param>
/// <param name="sheetHeight">The amount of frames on the y axis</param>
/// <param name="fps">The frames per second in miliseconds</param>
public TwoAnimation(Vector2 position) : base(position)
{
}
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
base.Draw(gameTime, spriteBatch);
}
public override void AddAnimations(Texture2D tex)
{
Addanimation("IDLE", tex, new Point(60, 50), new Point(1, 1), new Point(0, 0), 16);
Addanimation("WALK", tex, new Point(60, 50), new Point(3, 4), new Point(0, 60), 16);
Addanimation("BLOCK", tex, new Point(60, 50), new Point(2, 2), new Point(150, 200), 16);
Addanimation("SHOOT", tex, new Point(60, 50), new Point(1, 3), new Point(240, 0), 16);
Addanimation("JUMP", tex, new Point(60, 50), new Point(5, 1), new Point(0, 150), 16);
Addanimation("SWING", tex, new Point(60, 50), new Point(3, 2), new Point(0, 200), 16);
SetAnimation("IDLE");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace VoidEngine
{
/// <summary>
/// The TwoAnimation sub-class of Sprite
/// </summary>
public class TwoAnimation : Sprite
{
protected bool move;
protected int speed;
protected Keys up;
protected Keys down;
protected Keys left;
protected Keys right;
/// <summary>
/// The creator of TwoAnimation class.
/// </summary>
/// <param name="tex">The texture</param>
/// <param name="pos">The position</param>
/// <param name="frameWidth">The frame's width</param>
/// <param name="frameHeight">The frame's Height</param>
/// <param name="sheetWidth">The amount of frames on the x axis</param>
/// <param name="sheetHeight">The amount of frames on the y axis</param>
/// <param name="fps">The frames per second in miliseconds</param>
public TwoAnimation(Vector2 position) : base(position)
{
}
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
base.Draw(gameTime, spriteBatch);
}
public override void AddAnimations(Texture2D tex)
{
Addanimation("IDLE", tex, new Point(60, 50), new Point(1, 1), new Point(0, 0), 16);
Addanimation("WALK", tex, new Point(60, 50), new Point(3, 4), new Point(0, 60), 16);
Addanimation("BLOCK", tex, new Point(60, 50), new Point(2, 2), new Point(150, 200), 16);
Addanimation("SHOOT", tex, new Point(60, 50), new Point(1, 3), new Point(240, 0), 16);
Addanimation("JUMP", tex, new Point(60, 50), new Point(5, 1), new Point(0, 150), 16);
Addanimation("SWING", tex, new Point(60, 50), new Point(3, 2), new Point(0, 200), 16);
SetAnimation("IDLE");
}
}
}
| mit | C# |
6c7b70e70db54d5bd8c8a68d23399fbf86ebf10c | Bump Version | c0nnex/SPAD.neXt,c0nnex/SPAD.neXt | SPAD.Interfaces/Properties/AssemblyInfo.cs | SPAD.Interfaces/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows.Markup;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SPAD.neXt.Interfaces")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SPAD.neXt.Interfaces")]
[assembly: AssemblyCopyright("Copyright © 2014-2016 Ulrich Strauss")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2b25a2bf-891e-4970-b709-e53f1ebecb41")]
[assembly: XmlnsPrefix("http://www.fsgs.com/SPAD.neXt.Interfaces", "Interfaces")]
[assembly: XmlnsDefinition("http://www.fsgs.com/SPAD.neXt.Interfaces", "SPAD.neXt.Interfaces")]
[assembly: XmlnsDefinition("http://www.fsgs.com/SPAD.neXt.Interfaces", "SPAD.neXt.Interfaces.Events")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.5.16")]
[assembly: AssemblyFileVersion("0.9.5.16")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows.Markup;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SPAD.neXt.Interfaces")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SPAD.neXt.Interfaces")]
[assembly: AssemblyCopyright("Copyright © 2014-2016 Ulrich Strauss")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2b25a2bf-891e-4970-b709-e53f1ebecb41")]
[assembly: XmlnsPrefix("http://www.fsgs.com/SPAD.neXt.Interfaces", "Interfaces")]
[assembly: XmlnsDefinition("http://www.fsgs.com/SPAD.neXt.Interfaces", "SPAD.neXt.Interfaces")]
[assembly: XmlnsDefinition("http://www.fsgs.com/SPAD.neXt.Interfaces", "SPAD.neXt.Interfaces.Events")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.5.15")]
[assembly: AssemblyFileVersion("0.9.5.15")] | mit | C# |
4e6b0d673f5943c21d7454d45b61959a80aa10b9 | Change 'StartGame' method to 'OpenScene' method for wider use | Curdflappers/UltimateTicTacToe | Assets/Resources/Scripts/settings/PlayController.cs | Assets/Resources/Scripts/settings/PlayController.cs | using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class PlayController : MonoBehaviour
{
public InputField p1Name, p2Name;
public ToggleGroup p1Toggle, p2Toggle;
public Slider p1Difficulty, p2Difficulty;
public void PlayGame()
{
CreatePlayers();
OpenScene("Game");
}
void CreatePlayers()
{
Settings.p1 = CreatePlayer(p1Name, p1Toggle, p1Difficulty, true);
Settings.p2 = CreatePlayer(p2Name, p2Toggle, p2Difficulty, false);
}
Player CreatePlayer(
InputField nameField,
ToggleGroup toggle,
Slider diff,
bool first)
{
int turn = first ? 1 : 2;
Color color = first ? Color.red : Color.blue;
Sprite sprite = Resources.Load<Sprite>("Sprites/" + (first ? "x" : "o"));
string name = nameField.text;
float time = diff.value;
bool isAI = ActiveToggleTag(toggle).Equals("AI");
if (isAI)
{
if (time > 0)
{
return new MonteCarloAI(null, turn, color, sprite, name, time);
}
else
{
return new RandomAI(null, turn, color, sprite, name);
}
}
else
{
return new Player(turn, color, sprite, name);
}
}
string ActiveToggleTag(ToggleGroup group)
{
IEnumerator<Toggle> enumerator = group.ActiveToggles().GetEnumerator();
enumerator.MoveNext();
return enumerator.Current.tag;
}
public void OpenScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
}
| using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class PlayController : MonoBehaviour
{
public InputField p1Name, p2Name;
public ToggleGroup p1Toggle, p2Toggle;
public Slider p1Difficulty, p2Difficulty;
public void PlayGame()
{
CreatePlayers();
StartGame();
}
void CreatePlayers()
{
Settings.p1 = CreatePlayer(p1Name, p1Toggle, p1Difficulty, true);
Settings.p2 = CreatePlayer(p2Name, p2Toggle, p2Difficulty, false);
}
Player CreatePlayer(
InputField nameField,
ToggleGroup toggle,
Slider diff,
bool first)
{
int turn = first ? 1 : 2;
Color color = first ? Color.red : Color.blue;
Sprite sprite = Resources.Load<Sprite>("Sprites/" + (first ? "x" : "o"));
string name = nameField.text;
float time = diff.value;
bool isAI = ActiveToggleTag(toggle).Equals("AI");
if (isAI)
{
if (time > 0)
{
return new MonteCarloAI(null, turn, color, sprite, name, time);
}
else
{
return new RandomAI(null, turn, color, sprite, name);
}
}
else
{
return new Player(turn, color, sprite, name);
}
}
string ActiveToggleTag(ToggleGroup group)
{
IEnumerator<Toggle> enumerator = group.ActiveToggles().GetEnumerator();
enumerator.MoveNext();
return enumerator.Current.tag;
}
void StartGame()
{
SceneManager.LoadScene("Game");
}
}
| mit | C# |
77c96cd28611c17c225fe77a42b304b96524146d | Add player's current resolution to dropdown list | NitorInc/NitoriWare,Barleytree/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare | Assets/Scripts/Menu/Dropdowns/ResolutionDropdown.cs | Assets/Scripts/Menu/Dropdowns/ResolutionDropdown.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Linq;
public class ResolutionDropdown : MonoBehaviour
{
private const char ResolutionDelimiter = 'x';
#pragma warning disable 0649 //Serialized Fields
[SerializeField]
private Dropdown dropdown;
#pragma warning restore 0649
void Start()
{
List<Resolution> resolutions = new List<Resolution>(Screen.resolutions);
addCurrentResolutionIfNeeded(resolutions);
IEnumerable<string> resolutionStrings = (from resolution
in resolutions.OrderBy(a => a.width).ThenBy(a => a.height)
select resolution.width.ToString() + ResolutionDelimiter + resolution.height.ToString())
.Distinct();
List<Dropdown.OptionData> dropList = (from resolution
in resolutionStrings
select new Dropdown.OptionData(resolution))
.ToList();
dropdown.ClearOptions();
dropdown.AddOptions(dropList);
dropdown.value = findCurrentSelection();
}
void addCurrentResolutionIfNeeded(List<Resolution> resolutions)
{
Resolution currentResolution = Screen.currentResolution;
int resolutionCheckThreshold = 3;
foreach (Resolution resolution in resolutions)
{
if (MathHelper.Approximately(resolution.width, currentResolution.width, resolutionCheckThreshold)
&& MathHelper.Approximately(resolution.height, currentResolution.height, resolutionCheckThreshold))
return;
}
resolutions.Add(currentResolution);
}
public void select(int item)
{
string[] dimensions = dropdown.options[item].text.Split(ResolutionDelimiter);
Screen.SetResolution(int.Parse(dimensions[0]), int.Parse(dimensions[1]), Screen.fullScreen);
}
int findCurrentSelection()
{
string resolution = Screen.currentResolution.width.ToString() + ResolutionDelimiter + Screen.currentResolution.height.ToString();
var options = dropdown.options;
for (int i = 0; i < options.Count; i++)
{
if (options[i].text == resolution)
return i;
}
return 0;
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Linq;
public class ResolutionDropdown : MonoBehaviour
{
private const char ResolutionDelimiter = 'x';
#pragma warning disable 0649 //Serialized Fields
[SerializeField]
private Dropdown dropdown;
#pragma warning restore 0649
void Start()
{
List<Resolution> resolutions = new List<Resolution>(Screen.resolutions);
IEnumerable<string> resolutionStrings = (from resolution
in resolutions.OrderBy(a => a.width).ThenBy(a => a.height)
select resolution.width.ToString() + ResolutionDelimiter + resolution.height.ToString())
.Distinct();
List<Dropdown.OptionData> dropList = (from resolution
in resolutionStrings
select new Dropdown.OptionData(resolution))
.ToList();
dropdown.ClearOptions();
dropdown.AddOptions(dropList);
dropdown.value = findCurrentSelection();
}
public void select(int item)
{
string[] dimensions = dropdown.options[item].text.Split(ResolutionDelimiter);
Screen.SetResolution(int.Parse(dimensions[0]), int.Parse(dimensions[1]), Screen.fullScreen);
}
int findCurrentSelection()
{
string resolution = Screen.currentResolution.width.ToString() + ResolutionDelimiter + Screen.currentResolution.height.ToString();
var options = dropdown.options;
for (int i = 0; i < options.Count; i++)
{
if (options[i].text == resolution)
return i;
}
return 0;
}
}
| mit | C# |
d09d46ddd891ab985ca2fcf117642aa0b1b63085 | Fix assembly version attributes for Ignition.Foundation.Core | sitecoreignition/Ignition.Foundation | Ignition.Foundation.Core/Properties/AssemblyInfo.cs | Ignition.Foundation.Core/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using Ignition.Foundation.Core.Automap;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Ignition.Foundation.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Perficient")]
[assembly: AssemblyProduct("Ignition for Sitecore")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f2b7b1af-dd39-4815-9719-66abfcfff57e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: IgnitionAutomap] | using System.Reflection;
using System.Runtime.InteropServices;
using Ignition.Foundation.Core.Automap;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Ignition.Foundation.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Perficient")]
[assembly: AssemblyProduct("Ignition for Sitecore")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f2b7b1af-dd39-4815-9719-66abfcfff57e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: IgnitionAutomap] | mit | C# |
5b09e3043113f3c3ae5b9a82973a8c8f750c5e00 | change the commands used by the application | TwilioDevEd/marketing-notifications-csharp,TwilioDevEd/marketing-notifications-csharp | MarketingNotifications.Web/Domain/MessageCreator.cs | MarketingNotifications.Web/Domain/MessageCreator.cs | using System;
using System.Threading.Tasks;
using MarketingNotifications.Web.Models;
using MarketingNotifications.Web.Models.Repository;
namespace MarketingNotifications.Web.Domain
{
public class MessageCreator
{
private readonly ISubscribersRepository _repository;
private const string Subscribe = "add";
private const string Unsubscribe = "remove";
public MessageCreator(ISubscribersRepository repository)
{
_repository = repository;
}
public async Task<String> Create(string phoneNumber, string message)
{
var subscriber = await _repository.FindByPhoneNumberAsync(phoneNumber);
if (subscriber != null)
{
return await CreateOutputMessage(subscriber, message.ToLower());
}
subscriber = new Subscriber
{
PhoneNumber = phoneNumber,
CreatedAt = DateTime.Now,
UpdatedAt = DateTime.Now
};
await _repository.CreateAsync(subscriber);
return "Thanks for contacting TWBC! Text 'add' if you would to receive updates via text message.";
}
private async Task<string> CreateOutputMessage(Subscriber subscriber, string message)
{
if (!IsValidCommand(message))
{
return "Sorry, we don't recognize that command. Available commands are: 'add' or 'remove'.";
}
var isSubscribed = message.StartsWith(Subscribe);
subscriber.Subscribed = isSubscribed;
subscriber.UpdatedAt = DateTime.Now;
await _repository.UpdateAsync(subscriber);
return isSubscribed
? "You are now subscribed for updates."
: "You have unsubscribed from notifications. Test 'add' to start receiving updates again";
}
private static bool IsValidCommand(string command)
{
return command.StartsWith(Subscribe) || command.StartsWith(Unsubscribe);
}
}
}
| using System;
using System.Threading.Tasks;
using MarketingNotifications.Web.Models;
using MarketingNotifications.Web.Models.Repository;
namespace MarketingNotifications.Web.Domain
{
public class MessageCreator
{
private readonly ISubscribersRepository _repository;
private const string Subscribe = "subscribe";
private const string Unsubscribe = "unsubscribe";
public MessageCreator(ISubscribersRepository repository)
{
_repository = repository;
}
public async Task<String> Create(string phoneNumber, string message)
{
var subscriber = await _repository.FindByPhoneNumberAsync(phoneNumber);
if (subscriber != null)
{
return await CreateOutputMessage(subscriber, message.ToLower());
}
subscriber = new Subscriber
{
PhoneNumber = phoneNumber,
CreatedAt = DateTime.Now,
UpdatedAt = DateTime.Now
};
await _repository.CreateAsync(subscriber);
return "Thanks for contacting TWBC! Text 'subscribe' if you would to receive updates via text message.";
}
private async Task<string> CreateOutputMessage(Subscriber subscriber, string message)
{
if (!IsValidCommand(message))
{
return "Sorry, we don't recognize that command. Available commands are: 'subscribe' or 'unsubscribe'.";
}
var isSubscribed = message.StartsWith(Subscribe);
subscriber.Subscribed = isSubscribed;
subscriber.UpdatedAt = DateTime.Now;
await _repository.UpdateAsync(subscriber);
return isSubscribed
? "You are now subscribed for updates."
: "You have unsubscribed from notifications. Test 'subscribe' to start receieving updates again";
}
private static bool IsValidCommand(string command)
{
return command.StartsWith(Subscribe) || command.StartsWith(Unsubscribe);
}
}
}
| mit | C# |
f7f735eab4bb2443702776762711a59213e12c5c | Update DefaultRegistry.cs | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EmployerFinance.Jobs/DependencyResolution/DefaultRegistry.cs | src/SFA.DAS.EmployerFinance.Jobs/DependencyResolution/DefaultRegistry.cs | using System;
using System.Configuration;
using System.Data.SqlClient;
using Microsoft.Azure.Services.AppAuthentication;
using SFA.DAS.EmployerFinance.Configuration;
using SFA.DAS.EmployerFinance.Data;
using StructureMap;
namespace SFA.DAS.EmployerFinance.Jobs.DependencyResolution
{
public class DefaultRegistry : Registry
{
private const string AzureResource = "https://database.windows.net/";
public DefaultRegistry()
{
Scan(s =>
{
s.AssembliesFromApplicationBaseDirectory(a => a.GetName().Name.StartsWith("SFA.DAS"));
s.RegisterConcreteTypesAgainstTheFirstInterface();
});
For<EmployerFinanceDbContext>().Use(c => GetDbContext(c));
}
private EmployerFinanceDbContext GetDbContext(IContext context)
{
var environmentName = ConfigurationManager.AppSettings["EnvironmentName"];
var azureServiceTokenProvider = new AzureServiceTokenProvider();
var connection = environmentName.Equals("LOCAL", StringComparison.CurrentCultureIgnoreCase)
? new SqlConnection(GetConnectionString(context))
: new SqlConnection
{
ConnectionString = GetConnectionString(context),
AccessToken = azureServiceTokenProvider.GetAccessTokenAsync(AzureResource).Result
};
return new EmployerFinanceDbContext(connection);
}
private string GetConnectionString(IContext context)
{
return context.GetInstance<EmployerFinanceConfiguration>().DatabaseConnectionString;
}
}
} | using SFA.DAS.EmployerFinance.Configuration;
using SFA.DAS.EmployerFinance.Data;
using StructureMap;
namespace SFA.DAS.EmployerFinance.Jobs.DependencyResolution
{
public class DefaultRegistry : Registry
{
public DefaultRegistry()
{
Scan(s =>
{
s.AssembliesFromApplicationBaseDirectory(a => a.GetName().Name.StartsWith("SFA.DAS"));
s.RegisterConcreteTypesAgainstTheFirstInterface();
});
For<EmployerFinanceDbContext>().Use(c => new EmployerFinanceDbContext(c.GetInstance<EmployerFinanceConfiguration>().DatabaseConnectionString));
}
}
} | mit | C# |
48ab59dd01c7ee3fa240d09303e3747f94f61931 | fix - box personale 204 no content | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.Models/Classi/ServiziEsterni/OPService/WorkShift.cs | src/backend/SO115App.Models/Classi/ServiziEsterni/OPService/WorkShift.cs | using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
namespace SO115App.Models.Classi.ServiziEsterni.OPService
{
public class WorkShift
{
public WorkShift()
{
Precedente = new SquadraWorkShift();
Successivo = new SquadraWorkShift();
Attuale = new SquadraWorkShift();
}
[JsonPropertyName("previous")]
public SquadraWorkShift Precedente { get; set; }
[JsonPropertyName("next")]
public SquadraWorkShift Successivo { get; set; }
[JsonPropertyName("current")]
public SquadraWorkShift Attuale { get; set; }
[JsonIgnore()]
public Squadra[] Squadre => new List<Squadra[]> { Attuale?.Squadre ?? new Squadra[] { }, Precedente?.Squadre ?? new Squadra[] { }, Successivo?.Squadre ?? new Squadra[] { } }
.SelectMany(l => l)
.GroupBy(s => s?.Codice)
.Select(s => s?.FirstOrDefault())
.ToArray();
[JsonIgnore()]
public Officer[] Funzionari => new List<Officer[]> { Attuale?.Funzionari ?? new Officer[] { }, Precedente?.Funzionari ?? new Officer[] { }, Successivo?.Funzionari ?? new Officer[] { } }
.SelectMany(l => l)
.GroupBy(s => s.CodiceFiscale)
.Select(s => s.First())
.ToArray();
}
public class SquadraWorkShift
{
public SquadraWorkShift()
{
Squadre = new Squadra[] { };
Funzionari = new Officer[] { };
}
[JsonPropertyName("workshiftID")]
public string Id { get; set; }
[JsonPropertyName("spots")]
public Squadra[] Squadre { get; set; }
[JsonPropertyName("officers")]
public Officer[] Funzionari { get; set; }
}
public class Officer
{
[JsonPropertyName("userId")]
public string CodiceFiscale { get; set; }
[JsonPropertyName("type")]
public string Ruolo { get; set; }
[JsonPropertyName("jobTitleCode")]
public string JobTitleCode { get; set; }
[JsonPropertyName("firstName")]
public string Nome { get; set; }
[JsonPropertyName("lastName")]
public string Cognome { get; set; }
}
}
| using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
namespace SO115App.Models.Classi.ServiziEsterni.OPService
{
public class WorkShift
{
[JsonPropertyName("previous")]
public SquadraWorkShift Precedente { get; set; }
[JsonPropertyName("next")]
public SquadraWorkShift Successivo { get; set; }
[JsonPropertyName("current")]
public SquadraWorkShift Attuale { get; set; }
[JsonIgnore()]
public Squadra[] Squadre => new List<Squadra[]> { Attuale?.Squadre ?? new Squadra[] { }, Precedente?.Squadre ?? new Squadra[] { }, Successivo?.Squadre ?? new Squadra[] { } }
.SelectMany(l => l)
.GroupBy(s => s?.Codice)
.Select(s => s?.FirstOrDefault())
.ToArray();
[JsonIgnore()]
public Officer[] Funzionari => new List<Officer[]> { Attuale?.Funzionari ?? new Officer[] { }, Precedente?.Funzionari ?? new Officer[] { }, Successivo?.Funzionari ?? new Officer[] { } }
.SelectMany(l => l)
.GroupBy(s => s.CodiceFiscale)
.Select(s => s.First())
.ToArray();
}
public class SquadraWorkShift
{
[JsonPropertyName("workshiftID")]
public string Id { get; set; }
[JsonPropertyName("spots")]
public Squadra[] Squadre { get; set; }
[JsonPropertyName("officers")]
public Officer[] Funzionari { get; set; }
}
public class Officer
{
[JsonPropertyName("userId")]
public string CodiceFiscale { get; set; }
[JsonPropertyName("type")]
public string Ruolo { get; set; }
[JsonPropertyName("jobTitleCode")]
public string JobTitleCode { get; set; }
[JsonPropertyName("firstName")]
public string Nome { get; set; }
[JsonPropertyName("lastName")]
public string Cognome { get; set; }
}
}
| agpl-3.0 | C# |
83e92f6ecff44d7be9a3c73a4a81f6a25b31acb8 | Change exception type for null argument to ArgumentNullException. | devtyr/gullap | DevTyr.Gullap.Tests/With_Converter/For_SetParser/When_argument_is_null.cs | DevTyr.Gullap.Tests/With_Converter/For_SetParser/When_argument_is_null.cs | using System;
using NUnit.Framework;
using DevTyr.Gullap;
namespace DevTyr.Gullap.Tests.With_Converter.For_SetParser
{
[TestFixture]
public class When_argument_is_null
{
[Test]
public void Should_throw_argument_null_exception ()
{
var converter = new Converter (new ConverterOptions {
SitePath = "any"
});
Assert.Throws<ArgumentNullException> (() => converter.SetParser (null));
}
[Test]
public void Should_throw_exception_with_proper_message ()
{
var converter = new Converter (new ConverterOptions {
SitePath = "any"
});
Assert.Throws<ArgumentNullException> (() => converter.SetParser (null), "No valid parser given");
}
}
}
| using System;
using NUnit.Framework;
using DevTyr.Gullap;
namespace DevTyr.Gullap.Tests.With_Converter.For_SetParser
{
[TestFixture]
public class When_argument_is_null
{
[Test]
public void Should_throw_argument_exception ()
{
var converter = new Converter (new ConverterOptions {
SitePath = "any"
});
Assert.Throws<ArgumentException> (() => converter.SetParser (null));
}
[Test]
public void Should_throw_exception_with_proper_message ()
{
var converter = new Converter (new ConverterOptions {
SitePath = "any"
});
Assert.Throws<ArgumentException> (() => converter.SetParser (null), "No valid parser given");
}
}
}
| mit | C# |
a7a1b71a824716efbb04b818283b848327163e18 | Use auto properties | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/ViewModels/RoutableViewModel.cs | WalletWasabi.Fluent/ViewModels/RoutableViewModel.cs | using System;
using System.Windows.Input;
using ReactiveUI;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Fluent.ViewModels
{
public abstract class RoutableViewModel : ViewModelBase, IRoutableViewModel
{
protected RoutableViewModel(NavigationStateViewModel navigationState, NavigationTarget navigationTarget)
{
NavigationState = navigationState;
NigationTarget = navigationTarget;
BackCommand = ReactiveCommand.Create(() => GoBack());
CancelCommand = ReactiveCommand.Create(() => ClearNavigation());
}
public string UrlPathSegment { get; } = Guid.NewGuid().ToString().Substring(0, 5);
public IScreen HostScreen => NigationTarget switch
{
NavigationTarget.DialogScreen => NavigationState.DialogScreen.Invoke(),
_ => NavigationState.HomeScreen.Invoke(),
};
public NavigationStateViewModel NavigationState { get; }
public NavigationTarget NigationTarget { get; }
public void Navigate()
{
switch (NigationTarget)
{
case NavigationTarget.Default:
case NavigationTarget.HomeScreen:
NavigationState.HomeScreen.Invoke().Router.Navigate.Execute(this);
break;
case NavigationTarget.DialogScreen:
NavigationState.DialogScreen.Invoke().Router.Navigate.Execute(this);
break;
}
}
public void NavigateAndReset()
{
switch (NigationTarget)
{
case NavigationTarget.Default:
case NavigationTarget.HomeScreen:
NavigationState.HomeScreen.Invoke().Router.NavigateAndReset.Execute(this);
break;
case NavigationTarget.DialogScreen:
NavigationState.DialogScreen.Invoke().Router.NavigateAndReset.Execute(this);
break;
}
}
public ICommand BackCommand { get; protected set; }
public ICommand CancelCommand { get; protected set; }
public void GoBack()
{
switch (NigationTarget)
{
case NavigationTarget.Default:
case NavigationTarget.HomeScreen:
NavigationState.HomeScreen.Invoke().Router.NavigateBack.Execute();
break;
case NavigationTarget.DialogScreen:
NavigationState.DialogScreen.Invoke().Router.NavigateBack.Execute();
break;
}
}
public void ClearNavigation()
{
switch (NigationTarget)
{
case NavigationTarget.Default:
case NavigationTarget.HomeScreen:
NavigationState.HomeScreen.Invoke().Router.NavigationStack.Clear();
break;
case NavigationTarget.DialogScreen:
NavigationState.DialogScreen.Invoke().Router.NavigationStack.Clear();
break;
}
}
}
} | using System;
using System.Windows.Input;
using ReactiveUI;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Fluent.ViewModels
{
public abstract class RoutableViewModel : ViewModelBase, IRoutableViewModel
{
private NavigationStateViewModel _navigationState;
private NavigationTarget _navigationTarget;
protected RoutableViewModel(NavigationStateViewModel navigationState, NavigationTarget navigationTarget)
{
_navigationState = navigationState;
_navigationTarget = navigationTarget;
BackCommand = ReactiveCommand.Create(() => GoBack());
CancelCommand = ReactiveCommand.Create(() => ClearNavigation());
}
public string UrlPathSegment { get; } = Guid.NewGuid().ToString().Substring(0, 5);
public IScreen HostScreen => _navigationTarget switch
{
NavigationTarget.DialogScreen => _navigationState.DialogScreen.Invoke(),
_ => _navigationState.HomeScreen.Invoke(),
};
public void Navigate()
{
switch (_navigationTarget)
{
case NavigationTarget.Default:
case NavigationTarget.HomeScreen:
_navigationState.HomeScreen.Invoke().Router.Navigate.Execute(this);
break;
case NavigationTarget.DialogScreen:
_navigationState.DialogScreen.Invoke().Router.Navigate.Execute(this);
break;
}
}
public void NavigateAndReset()
{
switch (_navigationTarget)
{
case NavigationTarget.Default:
case NavigationTarget.HomeScreen:
_navigationState.HomeScreen.Invoke().Router.NavigateAndReset.Execute(this);
break;
case NavigationTarget.DialogScreen:
_navigationState.DialogScreen.Invoke().Router.NavigateAndReset.Execute(this);
break;
}
}
public ICommand BackCommand { get; protected set; }
public ICommand CancelCommand { get; protected set; }
public void GoBack()
{
switch (_navigationTarget)
{
case NavigationTarget.Default:
case NavigationTarget.HomeScreen:
_navigationState.HomeScreen.Invoke().Router.NavigateBack.Execute();
break;
case NavigationTarget.DialogScreen:
_navigationState.DialogScreen.Invoke().Router.NavigateBack.Execute();
break;
}
}
public void ClearNavigation()
{
switch (_navigationTarget)
{
case NavigationTarget.Default:
case NavigationTarget.HomeScreen:
_navigationState.HomeScreen.Invoke().Router.NavigationStack.Clear();
break;
case NavigationTarget.DialogScreen:
_navigationState.DialogScreen.Invoke().Router.NavigationStack.Clear();
break;
}
}
}
} | mit | C# |
27e8c971d05ee4bd8600d46a250aac6de90610b6 | Change statusbar errors to yellow | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Converters/StatusColorConvertor.cs | WalletWasabi.Gui/Converters/StatusColorConvertor.cs | using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Avalonia.Data.Converters;
using Avalonia.Media;
using AvalonStudio.Extensibility.Theme;
using WalletWasabi.Models;
namespace WalletWasabi.Gui.Converters
{
public class StatusColorConvertor : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool isTor = Enum.TryParse(value.ToString(), out TorStatus tor);
if (isTor && tor == TorStatus.NotRunning)
{
return Brushes.Yellow;
}
bool isBackend = Enum.TryParse(value.ToString(), out BackendStatus backend);
if (isBackend && backend == BackendStatus.NotConnected)
{
return Brushes.Yellow;
}
return ColorTheme.CurrentTheme.Foreground;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
| using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Avalonia.Data.Converters;
using Avalonia.Media;
using AvalonStudio.Extensibility.Theme;
using WalletWasabi.Models;
namespace WalletWasabi.Gui.Converters
{
public class StatusColorConvertor : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool isTor = Enum.TryParse(value.ToString(), out TorStatus tor);
if (isTor && tor == TorStatus.NotRunning)
{
return Brushes.Red;
}
bool isBackend = Enum.TryParse(value.ToString(), out BackendStatus backend);
if (isBackend && backend == BackendStatus.NotConnected)
{
return Brushes.Red;
}
return ColorTheme.CurrentTheme.Foreground;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
| mit | C# |
40c1d1867c0fb05e97e9c32b7295cadc5dde8fdf | fix migrations configuratuion | NickSerg/water-meter,NickSerg/water-meter,NickSerg/water-meter | WaterMeter/WM.AspNetMvc/Migrations/Configuration.cs | WaterMeter/WM.AspNetMvc/Migrations/Configuration.cs | using System;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using WM.AspNetMvc.Models;
using Constants = WM.AspNetMvc.Models.Constants;
namespace WM.AspNetMvc.Migrations
{
internal class Configuration : DbMigrationsConfiguration<ApplicationDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
}
protected override void Seed(ApplicationDbContext context)
{
var userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>();
var roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>();
const string name = "Admin@watermeter.com";
const string password = "Default@123";
var role = roleManager.Roles.FirstOrDefault(x => x.Name == Constants.AdminRoleName);
if (role == null)
{
role = new ApplicationRole(Constants.AdminRoleName);
var roleresult = roleManager.Create(role);
var user = userManager.FindByName(name);
if (user == null)
{
user = new ApplicationUser {UserName = name, Email = name};
var result = userManager.Create(user, password);
if (!result.Succeeded)
throw new Exception(result.Errors.FirstOrDefault() ?? string.Empty);
result = userManager.SetLockoutEnabled(user.Id, false);
}
// Add user admin to Role Admin if not already added
var rolesForUser = userManager.GetRoles(user.Id);
if (!rolesForUser.Contains(role.Name))
{
var result = userManager.AddToRole(user.Id, role.Name);
}
}
base.Seed(context);
}
}
}
| using System;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using WM.AspNetMvc.Models;
using Constants = WM.AspNetMvc.Models.Constants;
namespace WM.AspNetMvc.Migrations
{
internal class Configuration : DbMigrationsConfiguration<ApplicationDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
}
protected override void Seed(ApplicationDbContext context)
{
var userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>();
var roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>();
const string name = "Admin@watermeter.com";
const string password = "Default@123";
var role = roleManager.Roles.FirstOrDefault(x => x.Name == Constants.AdminRoleName);
if (role == null)
{
role = new ApplicationRole(Constants.AdminRoleName);
var roleresult = roleManager.Create(role);
}
var user = userManager.FindByName(name);
if (user == null)
{
user = new ApplicationUser { UserName = name, Email = name };
var result = userManager.Create(user, password);
if (!result.Succeeded)
throw new Exception(result.Errors.FirstOrDefault() ?? string.Empty);
result = userManager.SetLockoutEnabled(user.Id, false);
}
// Add user admin to Role Admin if not already added
var rolesForUser = userManager.GetRoles(user.Id);
if (!rolesForUser.Contains(role.Name))
{
var result = userManager.AddToRole(user.Id, role.Name);
}
base.Seed(context);
}
}
}
| apache-2.0 | C# |
3fba9ac775397a18cacb0524039283e0e6e9062a | Increase the estinated cost for the text file property store to 10 to avoid fetching all dead properties | FubarDevelopment/WebDavServer,FubarDevelopment/WebDavServer,FubarDevelopment/WebDavServer | FubarDev.WebDavServer.Props.Store.TextFile/TextFilePropertyStoreOptions.cs | FubarDev.WebDavServer.Props.Store.TextFile/TextFilePropertyStoreOptions.cs | // <copyright file="TextFilePropertyStoreOptions.cs" company="Fubar Development Junker">
// Copyright (c) Fubar Development Junker. All rights reserved.
// </copyright>
namespace FubarDev.WebDavServer.Props.Store.TextFile
{
public class TextFilePropertyStoreOptions
{
public int EstimatedCost { get; set; } = 10;
public string RootFolder { get; set; }
public bool StoreInTargetFileSystem { get; set; }
}
}
| // <copyright file="TextFilePropertyStoreOptions.cs" company="Fubar Development Junker">
// Copyright (c) Fubar Development Junker. All rights reserved.
// </copyright>
namespace FubarDev.WebDavServer.Props.Store.TextFile
{
public class TextFilePropertyStoreOptions
{
public int EstimatedCost { get; set; }
public string RootFolder { get; set; }
public bool StoreInTargetFileSystem { get; set; }
}
}
| mit | C# |
dee5e122d738aa5eadd1ded95ed3862f1b6ceada | bump version to 2.7.0 | piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker | Piwik.Tracker/Properties/AssemblyInfo.cs | Piwik.Tracker/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.7.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.6.1")]
| bsd-3-clause | C# |
063f6a2f8b0e5749eb8ad967bd6002c14366a1ca | Increment version number | Marc3842h/Titan,Marc3842h/Titan,Marc3842h/Titan | Titan/Properties/AssemblyInfo.cs | Titan/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Titan")]
[assembly: AssemblyDescription("A advanced CS:GO report and commendation bot built with performance and ease-of-use in mind")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Titan")]
[assembly: AssemblyCopyright("Copyright © Marc3842h 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(true)]
[assembly: Guid("9657B506-5F2D-4699-8030-31442C3D8A16")]
// Titan uses SemVar, against all code guidelines of Microsoft, but I prefer SemVer.
[assembly: AssemblyVersion("1.5.0")]
[assembly: AssemblyFileVersion("1.5.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Titan")]
[assembly: AssemblyDescription("A advanced CS:GO report and commendation bot built with performance and ease-of-use in mind")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Titan")]
[assembly: AssemblyCopyright("Copyright © Marc3842h 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(true)]
[assembly: Guid("9657B506-5F2D-4699-8030-31442C3D8A16")]
// Titan uses SemVar, against all code guidelines of Microsoft, but I prefer SemVer.
[assembly: AssemblyVersion("1.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]
| mit | C# |
123f064916e7d4bbf4c620da8cfa105787b17ec8 | Remove unused directives | mavasani/roslyn-analyzers,dotnet/roslyn-analyzers,mavasani/roslyn-analyzers,dotnet/roslyn-analyzers | src/NetAnalyzers/CSharp/Microsoft.CodeQuality.Analyzers/Maintainability/CSharpReviewUnusedParametersAnalyzer.cs | src/NetAnalyzers/CSharp/Microsoft.CodeQuality.Analyzers/Maintainability/CSharpReviewUnusedParametersAnalyzer.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeQuality.Analyzers.Maintainability;
namespace Microsoft.CodeQuality.CSharp.Analyzers.Maintainability
{
/// <summary>
/// CA1801: Review unused parameters
/// </summary>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public sealed class CSharpReviewUnusedParametersAnalyzer : ReviewUnusedParametersAnalyzer
{
private const SyntaxKind RecordDeclaration = (SyntaxKind)9063;
protected override bool IsPositionalRecordPrimaryConstructor(IMethodSymbol methodSymbol)
{
if (methodSymbol.MethodKind != MethodKind.Constructor)
{
return false;
}
if (methodSymbol.DeclaringSyntaxReferences.Length == 0)
{
return false;
}
return methodSymbol.DeclaringSyntaxReferences[0]
.GetSyntax()
.IsKind(RecordDeclaration);
}
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Analyzer.Utilities.Lightup;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeQuality.Analyzers.Maintainability;
namespace Microsoft.CodeQuality.CSharp.Analyzers.Maintainability
{
/// <summary>
/// CA1801: Review unused parameters
/// </summary>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public sealed class CSharpReviewUnusedParametersAnalyzer : ReviewUnusedParametersAnalyzer
{
private const SyntaxKind RecordDeclaration = (SyntaxKind)9063;
protected override bool IsPositionalRecordPrimaryConstructor(IMethodSymbol methodSymbol)
{
if (methodSymbol.MethodKind != MethodKind.Constructor)
{
return false;
}
if (methodSymbol.DeclaringSyntaxReferences.Length == 0)
{
return false;
}
return methodSymbol.DeclaringSyntaxReferences[0]
.GetSyntax()
.IsKind(RecordDeclaration);
}
}
}
| mit | C# |
358b612f4ba225704b88d6eedfa4e13dc34a1008 | Update IMongoClientSessionStore.cs | tiksn/TIKSN-Framework | TIKSN.Core/Data/Mongo/IMongoClientSessionStore.cs | TIKSN.Core/Data/Mongo/IMongoClientSessionStore.cs | using MongoDB.Driver;
namespace TIKSN.Data.Mongo
{
public interface IMongoClientSessionStore
{
void SetClientSessionHandle(IClientSessionHandle clientSessionHandle);
void ClearClientSessionHandle();
}
}
| using MongoDB.Driver;
namespace TIKSN.Data.Mongo
{
public interface IMongoClientSessionStore
{
void SetClientSessionHandle(IClientSessionHandle clientSessionHandle);
void ClearClientSessionHandle();
}
} | mit | C# |
85b06d7454349a308469f4811d0c9866cd395b8f | Fix #22 | lucasdavid/Gamedalf,lucasdavid/Gamedalf | Gamedalf.Core/Models/Player.cs | Gamedalf.Core/Models/Player.cs | using Gamedalf.Core.Infrastructure;
using System;
using System.ComponentModel.DataAnnotations;
namespace Gamedalf.Core.Models
{
public class Player : ApplicationUser, IDateTrackable
{
[Display(Name = "Birth date")]
public DateTime? DateBirth { get; set; }
[ScaffoldColumn(false)]
public DateTime DateCreated { get; set; }
[ScaffoldColumn(false)]
public DateTime? DateUpdated { get; set; }
//public virtual ICollection<Playing> Playing { get; set; }
}
}
| using Gamedalf.Core.Infrastructure;
using System;
using System.ComponentModel.DataAnnotations;
namespace Gamedalf.Core.Models
{
public class Player : ApplicationUser, IDateTrackable
{
[Display(Name = "Birth date")]
public DateTime? DateBirth { get; set; }
[ScaffoldColumn(false)]
public DateTime DateCreated { get; set; }
[ScaffoldColumn(false)]
public DateTime? DateUpdated { get; set; }
}
}
| mit | C# |
a45a43371aaf5ccea0ec8adba26ef7e9e5e64565 | Test 2 lokid | haftor2410/TransApp,haftor2410/TransApp,hftor/TransApp,hftor/TransApp | TransApp.Tests/Controllers/VideoControllerTest.cs | TransApp.Tests/Controllers/VideoControllerTest.cs | using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TransApp.Models;
using System.Collections.Generic;
using TransApp.Controllers;
using System.Web.Mvc;
using System.Linq;
namespace TransApp.Tests.Controllers
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestAddingNewVideoInEmptyTable()
{
// Arrange:
List<Video> video = new List<Video>();
video.Add(new Video
{
vID = 1,
catID = 1,
videoName = "Kalli"
});
var mockRepo = new Mocks.MockVideoRepository(video);
var controller = new VideoController(mockRepo);
// Act:
var result = controller.AddTranslation();
// Assert:
var viewResult = (ViewResult)result;
List<Video> model = (viewResult.Model as IEnumerable<Video>).ToList();
Assert.IsTrue(model.Count == 1);
}
[TestMethod]
public void TestAddingManyVideosInTheTable()
{
// Arrange:
List<Video> videos = new List<Video>();
for(int i = 0; i < 10; i++)
{
videos.Add(new Video
{
vID = i,
catID = i,
videoName = "GrumpyCat"
});
}
var mockRepo = new Mocks.MockVideoRepository(videos);
var controller = new VideoController(mockRepo);
// Act:
var result = controller.AddTranslation();
// Assert:
var viewResult = (ViewResult)result;
List<Video> model = (viewResult.Model as IEnumerable<Video>).ToList();
Assert.IsTrue(model.Count == 10);
}
}
}
| using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TransApp.Models;
using System.Collections.Generic;
using TransApp.Controllers;
using System.Web.Mvc;
using System.Linq;
namespace TransApp.Tests.Controllers
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestAddingNewVideoInEmptyTable()
{
// Arrange:
List<Video> video = new List<Video>();
video.Add(new Video
{
vID = 1,
catID = 1,
videoName = "Kalli"
});
var mockRepo = new Mocks.MockVideoRepository(video);
var controller = new VideoController(mockRepo);
// Act:
var result = controller.AddTranslation();
// Assert:
var viewResult = (ViewResult)result;
List<Video> model = (viewResult.Model as IEnumerable<Video>).ToList();
Assert.IsTrue(model.Count == 1);
}
[TestMethod]
public void TestAddingManyVideosInTheTable()
{
// Arrange:
List<Video> videos = new List<Video>();
// Act:
// Assert:
}
}
}
| mit | C# |
62daea195c5ab9b90d170c878c5fbaba5161e360 | Fix possible null | UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,johnneijzen/osu,ppy/osu,UselessToucan/osu,ppy/osu,2yangk23/osu,EVAST9919/osu,smoogipoo/osu,peppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,smoogipooo/osu,EVAST9919/osu,NeoAdonis/osu,peppy/osu,2yangk23/osu,johnneijzen/osu,peppy/osu-new,NeoAdonis/osu | osu.Game/Users/Country.cs | osu.Game/Users/Country.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 Newtonsoft.Json;
namespace osu.Game.Users
{
public class Country : IEquatable<Country>
{
/// <summary>
/// The name of this country.
/// </summary>
[JsonProperty(@"name")]
public string FullName;
/// <summary>
/// Two-letter flag acronym (ISO 3166 standard)
/// </summary>
[JsonProperty(@"code")]
public string FlagName;
public bool Equals(Country other) => FlagName == other?.FlagName;
}
}
| // 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 Newtonsoft.Json;
namespace osu.Game.Users
{
public class Country : IEquatable<Country>
{
/// <summary>
/// The name of this country.
/// </summary>
[JsonProperty(@"name")]
public string FullName;
/// <summary>
/// Two-letter flag acronym (ISO 3166 standard)
/// </summary>
[JsonProperty(@"code")]
public string FlagName;
public bool Equals(Country other) => FlagName == other.FlagName;
}
}
| mit | C# |
95db0c51873226dd61eff944ab756242a2a1dfc2 | Remove empty line | bradyholt/cron-expression-descriptor,bradyholt/cron-expression-descriptor | demo/controllers/DescriptorController.cs | demo/controllers/DescriptorController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace CronExpressionDescriptor.Demo.Controllers
{
[Route("api/[controller]")]
public class DescriptorController : Controller
{
[HttpGet]
public JsonResult Get(string expression, string locale)
{
var result = ExpressionDescriptor.GetDescription(expression, new Options()
{
ThrowExceptionOnParseError = false,
Verbose = false,
DayOfWeekStartIndexZero = true,
Locale = (locale ?? "en-US")
});
return Json(new { description = result });
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace CronExpressionDescriptor.Demo.Controllers
{
[Route("api/[controller]")]
public class DescriptorController : Controller
{
[HttpGet]
public JsonResult Get(string expression, string locale)
{
var result = ExpressionDescriptor.GetDescription(expression, new Options()
{
ThrowExceptionOnParseError = false,
Verbose = false,
DayOfWeekStartIndexZero = true,
Locale = (locale ?? "en-US")
});
return Json(new { description = result });
}
}
}
| mit | C# |
deb74939afb981f12cbf0b84147dd04c87e3e612 | Fix decimal property value converter to work on non EN-US cultures | robertjf/Umbraco-CMS,Phosworks/Umbraco-CMS,WebCentrum/Umbraco-CMS,rasmusfjord/Umbraco-CMS,NikRimington/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Phosworks/Umbraco-CMS,abjerner/Umbraco-CMS,sargin48/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,WebCentrum/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,WebCentrum/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS,rasmusfjord/Umbraco-CMS,aaronpowell/Umbraco-CMS,romanlytvyn/Umbraco-CMS,kasperhhk/Umbraco-CMS,gkonings/Umbraco-CMS,KevinJump/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,rustyswayne/Umbraco-CMS,tcmorris/Umbraco-CMS,aadfPT/Umbraco-CMS,robertjf/Umbraco-CMS,rustyswayne/Umbraco-CMS,leekelleher/Umbraco-CMS,abryukhov/Umbraco-CMS,aadfPT/Umbraco-CMS,hfloyd/Umbraco-CMS,Phosworks/Umbraco-CMS,KevinJump/Umbraco-CMS,leekelleher/Umbraco-CMS,sargin48/Umbraco-CMS,rasmuseeg/Umbraco-CMS,abryukhov/Umbraco-CMS,neilgaietto/Umbraco-CMS,tcmorris/Umbraco-CMS,gavinfaux/Umbraco-CMS,neilgaietto/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,lars-erik/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,kasperhhk/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,base33/Umbraco-CMS,lars-erik/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,leekelleher/Umbraco-CMS,romanlytvyn/Umbraco-CMS,gavinfaux/Umbraco-CMS,bjarnef/Umbraco-CMS,romanlytvyn/Umbraco-CMS,jchurchley/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,kasperhhk/Umbraco-CMS,NikRimington/Umbraco-CMS,mattbrailsford/Umbraco-CMS,rasmuseeg/Umbraco-CMS,gkonings/Umbraco-CMS,rustyswayne/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,bjarnef/Umbraco-CMS,gkonings/Umbraco-CMS,neilgaietto/Umbraco-CMS,gavinfaux/Umbraco-CMS,jchurchley/Umbraco-CMS,robertjf/Umbraco-CMS,gkonings/Umbraco-CMS,tompipe/Umbraco-CMS,tcmorris/Umbraco-CMS,Phosworks/Umbraco-CMS,lars-erik/Umbraco-CMS,sargin48/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,Phosworks/Umbraco-CMS,madsoulswe/Umbraco-CMS,sargin48/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,abryukhov/Umbraco-CMS,rasmusfjord/Umbraco-CMS,rasmuseeg/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,abjerner/Umbraco-CMS,base33/Umbraco-CMS,sargin48/Umbraco-CMS,neilgaietto/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,tompipe/Umbraco-CMS,robertjf/Umbraco-CMS,gavinfaux/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,lars-erik/Umbraco-CMS,hfloyd/Umbraco-CMS,lars-erik/Umbraco-CMS,marcemarc/Umbraco-CMS,romanlytvyn/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,aaronpowell/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,mattbrailsford/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,romanlytvyn/Umbraco-CMS,kasperhhk/Umbraco-CMS,NikRimington/Umbraco-CMS,jchurchley/Umbraco-CMS,kgiszewski/Umbraco-CMS,gkonings/Umbraco-CMS,marcemarc/Umbraco-CMS,rustyswayne/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,rasmusfjord/Umbraco-CMS,neilgaietto/Umbraco-CMS,madsoulswe/Umbraco-CMS,dawoe/Umbraco-CMS,base33/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,aadfPT/Umbraco-CMS,gavinfaux/Umbraco-CMS,kgiszewski/Umbraco-CMS,KevinJump/Umbraco-CMS,kasperhhk/Umbraco-CMS,kgiszewski/Umbraco-CMS,marcemarc/Umbraco-CMS,rustyswayne/Umbraco-CMS,hfloyd/Umbraco-CMS,aaronpowell/Umbraco-CMS,umbraco/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS | src/Umbraco.Core/PropertyEditors/ValueConverters/DecimalValueConverter.cs | src/Umbraco.Core/PropertyEditors/ValueConverters/DecimalValueConverter.cs | using System.Globalization;
using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Core.PropertyEditors.ValueConverters
{
[PropertyValueType(typeof(decimal))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class DecimalValueConverter : PropertyValueConverterBase
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return Constants.PropertyEditors.DecimalAlias.Equals(propertyType.PropertyEditorAlias);
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
if (source == null) return 0M;
// in XML a decimal is a string
var sourceString = source as string;
if (sourceString != null)
{
decimal d;
return (decimal.TryParse(sourceString, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d)) ? d : 0M;
}
// in the database an a decimal is an a decimal
// default value is zero
return (source is decimal) ? source : 0M;
}
}
}
| using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Core.PropertyEditors.ValueConverters
{
[PropertyValueType(typeof(decimal))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class DecimalValueConverter : PropertyValueConverterBase
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return Constants.PropertyEditors.DecimalAlias.Equals(propertyType.PropertyEditorAlias);
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
if (source == null) return 0M;
// in XML a decimal is a string
var sourceString = source as string;
if (sourceString != null)
{
decimal d;
return (decimal.TryParse(sourceString, out d)) ? d : 0M;
}
// in the database an a decimal is an a decimal
// default value is zero
return (source is decimal) ? source : 0M;
}
}
}
| mit | C# |
bc02d9fb2beeac6680545747285053c248bb62c8 | Remove RaiseAsync() method in Events class | lontivero/Open.HttpProxy | Open.HttpProxy/Utils/Events.cs | Open.HttpProxy/Utils/Events.cs | //
// - Events.cs
//
// Author:
// Lucas Ontivero <lucasontivero@gmail.com>
//
// Copyright 2013 Lucas E. Ontivero
//
// 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.
//
// <summary></summary>
using System;
using System.Threading.Tasks;
namespace Open.HttpProxy.Utils
{
static class Events
{
internal static void Raise<T>(EventHandler<T> handler, object sender, T args) where T : System.EventArgs
{
handler?.Invoke(sender, args);
}
}
} | //
// - Events.cs
//
// Author:
// Lucas Ontivero <lucasontivero@gmail.com>
//
// Copyright 2013 Lucas E. Ontivero
//
// 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.
//
// <summary></summary>
using System;
using System.Threading.Tasks;
namespace Open.HttpProxy.Utils
{
static class Events
{
internal static void RaiseAsync<T>(EventHandler<T> handler, object sender, T args) where T : System.EventArgs
{
if (handler == null) return;
// Task.Run(() => handler.Invoke(sender, args));
Task.Factory.StartNew(() => handler.Invoke(sender, args), TaskCreationOptions.LongRunning);
}
internal static void Raise<T>(EventHandler<T> handler, object sender, T args) where T : System.EventArgs
{
handler?.Invoke(sender, args);
}
}
} | mit | C# |
3143087f5c95627936da642cbfe7c0e929a85e28 | disable entry filter definition for now. | swaroop-sridhar/roslyn,MichalStrehovsky/roslyn,jmarolf/roslyn,jamesqo/roslyn,akrisiun/roslyn,VSadov/roslyn,bkoelman/roslyn,dpoeschl/roslyn,MattWindsor91/roslyn,dpoeschl/roslyn,Hosch250/roslyn,mattwar/roslyn,weltkante/roslyn,budcribar/roslyn,MattWindsor91/roslyn,jamesqo/roslyn,michalhosala/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,panopticoncentral/roslyn,michalhosala/roslyn,AArnott/roslyn,ErikSchierboom/roslyn,srivatsn/roslyn,swaroop-sridhar/roslyn,xasx/roslyn,aelij/roslyn,OmarTawfik/roslyn,drognanar/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,kelltrick/roslyn,physhi/roslyn,mmitche/roslyn,nguerrera/roslyn,davkean/roslyn,reaction1989/roslyn,tvand7093/roslyn,AmadeusW/roslyn,paulvanbrenk/roslyn,bartdesmet/roslyn,tannergooding/roslyn,mattwar/roslyn,tmeschter/roslyn,Hosch250/roslyn,budcribar/roslyn,cston/roslyn,jcouv/roslyn,VSadov/roslyn,yeaicc/roslyn,KevinRansom/roslyn,vslsnap/roslyn,genlu/roslyn,AnthonyDGreen/roslyn,panopticoncentral/roslyn,ljw1004/roslyn,ljw1004/roslyn,bbarry/roslyn,MattWindsor91/roslyn,shyamnamboodiripad/roslyn,ericfe-ms/roslyn,pdelvo/roslyn,genlu/roslyn,brettfo/roslyn,jaredpar/roslyn,wvdd007/roslyn,nguerrera/roslyn,cston/roslyn,xoofx/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,leppie/roslyn,xoofx/roslyn,zooba/roslyn,xasx/roslyn,Pvlerick/roslyn,a-ctor/roslyn,tvand7093/roslyn,stephentoub/roslyn,abock/roslyn,abock/roslyn,reaction1989/roslyn,jeffanders/roslyn,bkoelman/roslyn,shyamnamboodiripad/roslyn,mattscheffer/roslyn,KevinRansom/roslyn,khyperia/roslyn,orthoxerox/roslyn,KiloBravoLima/roslyn,wvdd007/roslyn,KevinRansom/roslyn,agocke/roslyn,CaptainHayashi/roslyn,eriawan/roslyn,leppie/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mavasani/roslyn,sharwell/roslyn,tvand7093/roslyn,AnthonyDGreen/roslyn,mmitche/roslyn,xasx/roslyn,jcouv/roslyn,AmadeusW/roslyn,eriawan/roslyn,vslsnap/roslyn,davkean/roslyn,khyperia/roslyn,balajikris/roslyn,mattwar/roslyn,bbarry/roslyn,akrisiun/roslyn,mmitche/roslyn,orthoxerox/roslyn,CyrusNajmabadi/roslyn,abock/roslyn,jmarolf/roslyn,gafter/roslyn,natidea/roslyn,ErikSchierboom/roslyn,mgoertz-msft/roslyn,yeaicc/roslyn,DustinCampbell/roslyn,ericfe-ms/roslyn,MattWindsor91/roslyn,OmarTawfik/roslyn,physhi/roslyn,mgoertz-msft/roslyn,leppie/roslyn,OmarTawfik/roslyn,TyOverby/roslyn,lorcanmooney/roslyn,ErikSchierboom/roslyn,MichalStrehovsky/roslyn,Pvlerick/roslyn,KirillOsenkov/roslyn,dotnet/roslyn,jeffanders/roslyn,jkotas/roslyn,jcouv/roslyn,agocke/roslyn,a-ctor/roslyn,diryboy/roslyn,paulvanbrenk/roslyn,heejaechang/roslyn,khyperia/roslyn,DustinCampbell/roslyn,pdelvo/roslyn,mattscheffer/roslyn,TyOverby/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,DustinCampbell/roslyn,ljw1004/roslyn,aelij/roslyn,shyamnamboodiripad/roslyn,davkean/roslyn,Hosch250/roslyn,brettfo/roslyn,TyOverby/roslyn,yeaicc/roslyn,jhendrixMSFT/roslyn,AArnott/roslyn,amcasey/roslyn,bkoelman/roslyn,VSadov/roslyn,jhendrixMSFT/roslyn,AlekseyTs/roslyn,panopticoncentral/roslyn,Giftednewt/roslyn,akrisiun/roslyn,Giftednewt/roslyn,CaptainHayashi/roslyn,weltkante/roslyn,balajikris/roslyn,CyrusNajmabadi/roslyn,zooba/roslyn,gafter/roslyn,michalhosala/roslyn,diryboy/roslyn,srivatsn/roslyn,amcasey/roslyn,tmeschter/roslyn,jhendrixMSFT/roslyn,stephentoub/roslyn,lorcanmooney/roslyn,natidea/roslyn,CaptainHayashi/roslyn,diryboy/roslyn,AmadeusW/roslyn,aelij/roslyn,AnthonyDGreen/roslyn,lorcanmooney/roslyn,drognanar/roslyn,KiloBravoLima/roslyn,brettfo/roslyn,KevinH-MS/roslyn,tannergooding/roslyn,robinsedlaczek/roslyn,gafter/roslyn,stephentoub/roslyn,balajikris/roslyn,bbarry/roslyn,tmat/roslyn,MatthieuMEZIL/roslyn,tmat/roslyn,sharwell/roslyn,bartdesmet/roslyn,drognanar/roslyn,jkotas/roslyn,CyrusNajmabadi/roslyn,jaredpar/roslyn,cston/roslyn,jkotas/roslyn,jamesqo/roslyn,orthoxerox/roslyn,Shiney/roslyn,jasonmalinowski/roslyn,nguerrera/roslyn,Giftednewt/roslyn,dotnet/roslyn,jaredpar/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,robinsedlaczek/roslyn,zooba/roslyn,AlekseyTs/roslyn,KiloBravoLima/roslyn,paulvanbrenk/roslyn,amcasey/roslyn,ericfe-ms/roslyn,xoofx/roslyn,natidea/roslyn,tmat/roslyn,Pvlerick/roslyn,KevinH-MS/roslyn,mgoertz-msft/roslyn,MatthieuMEZIL/roslyn,swaroop-sridhar/roslyn,genlu/roslyn,jmarolf/roslyn,tmeschter/roslyn,reaction1989/roslyn,KirillOsenkov/roslyn,dpoeschl/roslyn,robinsedlaczek/roslyn,sharwell/roslyn,AArnott/roslyn,KevinH-MS/roslyn,Shiney/roslyn,Shiney/roslyn,heejaechang/roslyn,budcribar/roslyn,physhi/roslyn,MatthieuMEZIL/roslyn,vslsnap/roslyn,eriawan/roslyn,MichalStrehovsky/roslyn,agocke/roslyn,weltkante/roslyn,srivatsn/roslyn,pdelvo/roslyn,tannergooding/roslyn,kelltrick/roslyn,mattscheffer/roslyn,mavasani/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,bartdesmet/roslyn,jeffanders/roslyn,kelltrick/roslyn,a-ctor/roslyn | src/VisualStudio/Core/Def/Implementation/TableDataSource/Suppression/SuppressionStateColumnFilterDefinition.cs | src/VisualStudio/Core/Def/Implementation/TableDataSource/Suppression/SuppressionStateColumnFilterDefinition.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Utilities;
using Microsoft.Internal.VisualStudio.Shell.TableControl;
using System;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource
{
// we are disabling this due to this issue. https://github.com/dotnet/roslyn/pull/9201
// <summary>
// Supporession column definition filter
// </summary>
// <remarks>
// TODO: Move this column down to the shell as it is shared by multiple issue sources (Roslyn and FxCop).
// </remarks>
// [Export(typeof(EntryFilterDefinition))]
// [Name(SuppressionStateColumnDefinition.ColumnName)]
// internal class SuppressionStateColumnFilterDefinition : EntryFilterDefinition
// {
// public override bool HasAttribute(string key) => string.Equals(NonActionable, key, StringComparison.OrdinalIgnoreCase);
// }
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Utilities;
using Microsoft.Internal.VisualStudio.Shell.TableControl;
using System;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource
{
/// <summary>
/// Supporession column definition filter
/// </summary>
/// <remarks>
/// TODO: Move this column down to the shell as it is shared by multiple issue sources (Roslyn and FxCop).
/// </remarks>
[Export(typeof(EntryFilterDefinition))]
[Name(SuppressionStateColumnDefinition.ColumnName)]
internal class SuppressionStateColumnFilterDefinition : EntryFilterDefinition
{
public override bool HasAttribute(string key) => string.Equals(NonActionable, key, StringComparison.OrdinalIgnoreCase);
}
}
| apache-2.0 | C# |
cc7b7a51486014abb7dfa96f91ff2616fcbb8fc4 | Fix broken test | domaindrivendev/Ahoy,domaindrivendev/Ahoy,domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Swashbuckle.AspNetCore | test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerUIIntegrationTests.cs | test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerUIIntegrationTests.cs | using System;
using System.Net;
using System.Threading.Tasks;
using Xunit;
namespace Swashbuckle.AspNetCore.IntegrationTests
{
public class SwaggerUIIntegrationTests
{
[Fact]
public async Task SwaggerUIIndex_ServesAnEmbeddedVersionOfTheSwaggerUI()
{
var client = new TestSite(typeof(Basic.Startup)).BuildClient();
var indexResponse = await client.GetAsync("/"); // Basic is configured to serve UI at root
var jsResponse = await client.GetAsync("/swagger-ui.js");
var cssResponse = await client.GetAsync("/swagger-ui.css");
var indexContent = await indexResponse.Content.ReadAsStringAsync();
Assert.Contains("SwaggerUIBundle", indexContent);
Assert.Equal(HttpStatusCode.OK, jsResponse.StatusCode);
Assert.Equal(HttpStatusCode.OK, cssResponse.StatusCode);
}
[Fact]
public async Task SwaggerUIIndex_RedirectsToTrailingSlash_IfNotProvided()
{
var client = new TestSite(typeof(CustomUIConfig.Startup)).BuildClient();
var response = await client.GetAsync("/swagger");
Assert.Equal(HttpStatusCode.MovedPermanently, response.StatusCode);
Assert.Equal("/swagger/", response.Headers.Location.ToString());
}
[Fact]
public async Task SwaggerUIIndex_IncludesCustomPageTitleAndStylesheets_IfConfigured()
{
var client = new TestSite(typeof(CustomUIConfig.Startup)).BuildClient();
var response = await client.GetAsync("/swagger/");
var content = await response.Content.ReadAsStringAsync();
Assert.Contains("<title>CustomUIConfig</title>", content);
Assert.Contains("<link href='/ext/custom-stylesheet.css' rel='stylesheet' media='screen' type='text/css' />", content);
}
[Fact]
public async Task SwaggerUIIndex_ServesCustomIndexHtml_IfConfigured()
{
var client = new TestSite(typeof(CustomUIIndex.Startup)).BuildClient();
var response = await client.GetAsync("/swagger/");
var content = await response.Content.ReadAsStringAsync();
Assert.Contains("Topbar", content);
}
}
} | using System;
using System.Net;
using System.Threading.Tasks;
using Xunit;
namespace Swashbuckle.AspNetCore.IntegrationTests
{
public class SwaggerUIIntegrationTests
{
[Fact]
public async Task SwaggerUIIndex_ServesAnEmbeddedVersionOfTheSwaggerUI()
{
var client = new TestSite(typeof(Basic.Startup)).BuildClient();
var indexResponse = await client.GetAsync("/"); // Basic is configured to serve UI at root
var jsResponse = await client.GetAsync("/swagger-ui.js");
var cssResponse = await client.GetAsync("/swagger-ui.css");
var indexContent = await indexResponse.Content.ReadAsStringAsync();
Assert.Contains("SwaggerUIBundle", indexContent);
Assert.Equal(HttpStatusCode.OK, jsResponse.StatusCode);
Assert.Equal(HttpStatusCode.OK, cssResponse.StatusCode);
}
[Fact]
public async Task SwaggerUIIndex_RedirectsToTrailingSlash_IfNotProvided()
{
var client = new TestSite(typeof(CustomUIConfig.Startup)).BuildClient();
var response = await client.GetAsync("/swagger");
Assert.Equal(HttpStatusCode.MovedPermanently, response.StatusCode);
Assert.Equal("/swagger/", response.Headers.Location.ToString());
}
[Fact]
public async Task SwaggerUIIndex_IncludesCustomPageTitleAndStylesheets_IfConfigured()
{
var client = new TestSite(typeof(CustomUIConfig.Startup)).BuildClient();
var response = await client.GetAsync("/swagger/");
var content = await response.Content.ReadAsStringAsync();
Assert.Contains("<title>CustomUIConfig</title>", content);
Assert.Contains("<link href='/ext/custom-stylesheet.css' rel='stylesheet' media='screen' type='text/css' />", content);
}
[Fact]
public async Task SwaggerUIIndex_ServesCustomIndexHtml_IfConfigured()
{
var client = new TestSite(typeof(CustomUIIndex.Startup)).BuildClient();
var response = await client.GetAsync("/swagger/");
var content = await response.Content.ReadAsStringAsync();
Assert.Contains("HideInfoPlugin", content);
}
}
} | mit | C# |
941f4025708aee8c74ef95585dd9f441aa37ebf0 | Correct typo and broader applicability. (#742) | tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools | tools/pipeline-witness/Azure.Sdk.Tools.PipelineWitness/Services/FailureAnalysis/DownloadSecretsFailureClassifier.cs | tools/pipeline-witness/Azure.Sdk.Tools.PipelineWitness/Services/FailureAnalysis/DownloadSecretsFailureClassifier.cs | using Microsoft.TeamFoundation.Build.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace Azure.Sdk.Tools.PipelineWitness.Services.FailureAnalysis
{
public class DownloadSecretsFailureClassifier : IFailureClassifier
{
public async Task ClassifyAsync(FailureAnalyzerContext context)
{
var failedTasks = from r in context.Timeline.Records
where r.RecordType == "Task"
where r.Result == TaskResult.Failed
where r.Name.Contains("Download secrets")
select r;
if (failedTasks.Count() > 0)
{
foreach (var failedTask in failedTasks)
{
context.AddFailure(failedTask, "Secrets Failure");
}
}
}
}
}
| using Microsoft.TeamFoundation.Build.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace Azure.Sdk.Tools.PipelineWitness.Services.FailureAnalysis
{
public class DownloadSecretsFailureClassifier : IFailureClassifier
{
public async Task ClassifyAsync(FailureAnalyzerContext context)
{
var failedTasks = from r in context.Timeline.Records
where r.RecordType == "Task"
where r.Result == TaskResult.Failed
where r.Name.StartsWith("Download secrets")
select r;
if (failedTasks.Count() > 0)
{
foreach (var failedTask in failedTasks)
{
context.AddFailure(failedTask, "Secerts Failure");
}
}
}
}
}
| mit | C# |
5847e12f8b35fdaa5751db9719c4ce089b1941f6 | Fix typo | thedillonb/RepoStumble,thedillonb/RepoStumble | RepositoryStumble.iOS/ViewControllers/Languages/LanguagesViewController.cs | RepositoryStumble.iOS/ViewControllers/Languages/LanguagesViewController.cs | using System;
using UIKit;
using RepositoryStumble.Core.ViewModels.Languages;
using Xamarin.Utilities.DialogElements;
using ReactiveUI;
namespace RepositoryStumble.ViewControllers.Languages
{
public class LanguagesViewController : ViewModelCollectionViewController<LanguagesViewModel>
{
public LanguagesViewController()
{
Title = "Languages";
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
SearchTextChanging.Subscribe(x => ViewModel.SearchKeyword = x);
this.BindList(ViewModel.Languages, x =>
{
var el = new StringElement(x.Name);
el.Tapped += () => ViewModel.SelectedLanguage = x;
if (ViewModel.SelectedLanguage != null && string.Equals(x.Slug, ViewModel.SelectedLanguage.Slug))
el.Accessory = UITableViewCellAccessory.Checkmark;
return el;
});
}
}
}
| using System;
using UIKit;
using RepositoryStumble.Core.ViewModels.Languages;
using Xamarin.Utilities.DialogElements;
using ReactiveUI;
namespace RepositoryStumble.ViewControllers.Languages
{
public class LanguagesViewController : ViewModelCollectionViewController<LanguagesViewModel>
{
public LanguagesViewController()
{
Title = "Langauges";
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
SearchTextChanging.Subscribe(x => ViewModel.SearchKeyword = x);
this.BindList(ViewModel.Languages, x =>
{
var el = new StringElement(x.Name);
el.Tapped += () => ViewModel.SelectedLanguage = x;
if (ViewModel.SelectedLanguage != null && string.Equals(x.Slug, ViewModel.SelectedLanguage.Slug))
el.Accessory = UITableViewCellAccessory.Checkmark;
return el;
});
}
}
}
| apache-2.0 | C# |
fc86452b071d0e6530480e43acb292aa2852e8fc | Add missing xml documentation | SimplyCodeUK/packer-strategy,SimplyCodeUK/packer-strategy,SimplyCodeUK/packer-strategy | PackIt/Controllers/AboutController.cs | PackIt/Controllers/AboutController.cs | // <copyright company="Simply Code Ltd.">
// Copyright (c) Simply Code Ltd. All rights reserved.
// Licensed under the MIT License.
// See LICENSE file in the project root for full license information.
// </copyright>
namespace PackIt.Controllers
{
using Microsoft.AspNetCore.Mvc;
/// <summary> The root contoller of the service. </summary>
[ApiVersion("1")]
[Route("api/v{version:apiVersion}/about")]
public class AboutController : Controller
{
/// <summary> Data about the service. </summary>
public class AboutService
{
/// <summary> Gets the version version of the service. </summary>
///
/// <value> The version of the service. </value>
public string Version { get; }
/// <summary> Gets information about the service. </summary>
///
/// <value> The about information. </value>
public string About { get; }
/// <summary>
/// Initializes a new instance of the <see cref="AboutService"/> class.
/// </summary>
public AboutService()
{
Version = "1";
About = "Single controller for Materials, Plans and Packs";
}
}
/// <summary>
/// (An Action that handles HTTP GET requests) enumerates the items in this collection that
/// meet given criteria.
/// </summary>
///
/// <returns> An enumerator that allows foreach to be used to process the matched items. </returns>
[HttpGet]
public IActionResult Get()
{
return this.Ok(new AboutService());
}
}
}
| // <copyright company="Simply Code Ltd.">
// Copyright (c) Simply Code Ltd. All rights reserved.
// Licensed under the MIT License.
// See LICENSE file in the project root for full license information.
// </copyright>
namespace PackIt.Controllers
{
using Microsoft.AspNetCore.Mvc;
/// <summary> The root contoller of the service. </summary>
[ApiVersion("1")]
[Route("api/v{version:apiVersion}/about")]
public class AboutController : Controller
{
public class AboutService
{
public string Version { get; }
public string About { get; }
public AboutService()
{
Version = "1";
About = "Single controller for Materials, Plans and Packs";
}
}
/// <summary>
/// (An Action that handles HTTP GET requests) enumerates the items in this collection that
/// meet given criteria.
/// </summary>
///
/// <returns> An enumerator that allows foreach to be used to process the matched items. </returns>
[HttpGet]
public IActionResult Get()
{
return this.Ok(new AboutService());
}
}
}
| mit | C# |
92d20eea8cb5d2cc7165847ba71891579f91ffc9 | Add missing licence header | smoogipooo/osu,ppy/osu,smoogipoo/osu,Nabile-Rahmani/osu,ZLima12/osu,johnneijzen/osu,EVAST9919/osu,DrabWeb/osu,UselessToucan/osu,smoogipoo/osu,naoey/osu,Frontear/osuKyzer,naoey/osu,johnneijzen/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,DrabWeb/osu,EVAST9919/osu,peppy/osu,peppy/osu,DrabWeb/osu,smoogipoo/osu,2yangk23/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,ZLima12/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,naoey/osu,2yangk23/osu | osu.Game/Skinning/DefaultSkin.cs | osu.Game/Skinning/DefaultSkin.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
namespace osu.Game.Skinning
{
public class DefaultSkin : Skin
{
public DefaultSkin()
: base(SkinInfo.Default)
{
}
public override Drawable GetDrawableComponent(string componentName)
{
return null;
}
public override SampleChannel GetSample(string sampleName)
{
return null;
}
}
}
| using osu.Framework.Audio.Sample;
using osu.Framework.Graphics;
namespace osu.Game.Skinning
{
public class DefaultSkin : Skin
{
public DefaultSkin()
: base(SkinInfo.Default)
{
}
public override Drawable GetDrawableComponent(string componentName) => null;
public override SampleChannel GetSample(string sampleName) => null;
}
}
| mit | C# |
1a2d50c4e93ceba4e1a3836aac51ba3b610e9f9c | Add link to SO question | bigfont/StackOverflow,bigfont/StackOverflow,bigfont/StackOverflow,bigfont/StackOverflow | AspNetCoreIDistributedCache/Startup.cs | AspNetCoreIDistributedCache/Startup.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
// required for IDistributedCache
using Microsoft.Extensions.Caching.Distributed;
// required for Encoding
using System.Text;
// See StackOverflow question here:
// https://stackoverflow.com/questions/50822279/multiple-instances-of-idistributedcache
namespace AspNetCoreIDistributedCache
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// dotnet add package Microsoft.Extensions.Caching.Redis
services.AddDistributedRedisCache(options =>
{
options.Configuration = "localhost";
options.InstanceName = "SampleInstance";
});
}
// Install and start Redis locally:
//
// PS> Set-ExecutionPolicy Bypass -Scope Process -Force;
// PS> iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
// PS> choco install redis-64
// PS> redis-server
//
public void Configure(
IApplicationBuilder app,
IHostingEnvironment env,
IDistributedCache cache)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.Run(async (context) =>
{
var bytes = await cache.GetAsync("lastRequestTime");
var last = bytes == null
? "There has not been a request recently."
: Encoding.UTF8.GetString(bytes);
var now = DateTime.Now.ToString();
var val = Encoding.UTF8.GetBytes(now);
var options = new DistributedCacheEntryOptions()
.SetSlidingExpiration(TimeSpan.FromSeconds(30));
cache.Set("lastRequestTime", val, options);
await context.Response.WriteAsync($"Hello World! {last}");
});
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
// required for IDistributedCache
using Microsoft.Extensions.Caching.Distributed;
// required for Encoding
using System.Text;
namespace AspNetCoreIDistributedCache
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// dotnet add package Microsoft.Extensions.Caching.Redis
services.AddDistributedRedisCache(options =>
{
options.Configuration = "localhost";
options.InstanceName = "SampleInstance";
});
}
// Install and start Redis locally:
//
// PS> Set-ExecutionPolicy Bypass -Scope Process -Force;
// PS> iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
// PS> choco install redis-64
// PS> redis-server
//
public void Configure(
IApplicationBuilder app,
IHostingEnvironment env,
IDistributedCache cache)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.Run(async (context) =>
{
var bytes = await cache.GetAsync("lastRequestTime");
var last = bytes == null
? "There has not been a request recently."
: Encoding.UTF8.GetString(bytes);
var now = DateTime.Now.ToString();
var val = Encoding.UTF8.GetBytes(now);
var options = new DistributedCacheEntryOptions()
.SetSlidingExpiration(TimeSpan.FromSeconds(30));
cache.Set("lastRequestTime", val, options);
await context.Response.WriteAsync($"Hello World! {last}");
});
}
}
}
| mit | C# |
e854ad954f5170417343baf2068809b1036cf40d | Format document | farity/farity | Farity/Subtract.cs | Farity/Subtract.cs | using System;
namespace Farity
{
public static partial class F
{
public static decimal Subtract(decimal a, decimal b) => a - b;
public static double Subtract(double a, double b) => a - b;
public static float Subtract(float a, float b) => a - b;
public static int Subtract(int a, int b) => a - b;
public static long Subtract(long a, long b) => a - b;
public static uint Subtract(uint a, uint b) => b > a ? 0 : a - b;
public static ulong Subtract(ulong a, ulong b) => b > a ? 0 : a - b;
public static TimeSpan Subtract(TimeSpan a, TimeSpan b) => a - b;
public static decimal? Subtract(decimal? a, decimal? b)
=> a == null && b == null ? (decimal?) null : Subtract(a ?? 0, b ?? 0);
public static double? Subtract(double? a, double? b)
=> a == null && b == null ? (double?) null : Subtract(a ?? 0, b ?? 0);
public static float? Subtract(float? a, float? b)
=> a == null && b == null ? (float?) null : Subtract(a ?? 0, b ?? 0);
public static int? Subtract(int? a, int? b)
=> a == null && b == null ? (int?) null : Subtract(a ?? 0, b ?? 0);
public static long? Subtract(long? a, long? b)
=> a == null && b == null ? (long?) null : Subtract(a ?? 0, b ?? 0);
public static uint? Subtract(uint? a, uint? b)
=> a == null && b == null ? (uint?) null : Subtract(a ?? 0, b ?? 0);
public static ulong? Subtract(ulong? a, ulong? b)
=> a == null && b == null ? (ulong?) null : Subtract(a ?? 0, b ?? 0);
public static TimeSpan? Subtract(TimeSpan? a, TimeSpan? b)
=> a == null && b == null ? (TimeSpan?) null : Subtract(a ?? TimeSpan.Zero, b ?? TimeSpan.Zero);
}
} | using System;
namespace Farity
{
public static partial class F
{
public static decimal Subtract(decimal a, decimal b) => a - b;
public static double Subtract(double a, double b) => a - b;
public static float Subtract(float a, float b) => a - b;
public static int Subtract(int a, int b) => a - b;
public static long Subtract(long a, long b) => a - b;
public static uint Subtract(uint a, uint b) => b > a ? 0 : a - b;
public static ulong Subtract(ulong a, ulong b) => b > a ? 0 : a - b;
public static TimeSpan Subtract(TimeSpan a, TimeSpan b) => a - b;
public static decimal? Subtract(decimal? a, decimal? b)
=> a == null && b == null ? (decimal?) null : Subtract(a ?? 0,b ?? 0);
public static double? Subtract(double? a, double? b)
=> a == null && b == null ? (double?) null : Subtract(a ?? 0,b ?? 0);
public static float? Subtract(float? a, float? b)
=> a == null && b == null ? (float?) null : Subtract(a ?? 0, b ?? 0);
public static int? Subtract(int? a, int? b)
=> a == null && b == null ? (int?) null : Subtract(a ?? 0,b ?? 0);
public static long? Subtract(long? a, long? b)
=> a == null && b == null ? (long?) null : Subtract(a ?? 0, b ?? 0);
public static uint? Subtract(uint? a, uint? b)
=> a == null && b == null ? (uint?) null : Subtract(a ?? 0, b ?? 0);
public static ulong? Subtract(ulong? a, ulong? b)
=> a == null && b == null ? (ulong?) null : Subtract(a ?? 0, b ?? 0);
public static TimeSpan? Subtract(TimeSpan? a, TimeSpan? b)
=> a == null && b == null ? (TimeSpan?) null : Subtract(a ?? TimeSpan.Zero, b ?? TimeSpan.Zero);
}
} | mit | C# |
a385695fbf7ab75939f81cefa0a331a06a00feac | Fix bitmap serialization with indexed format bitmaps | MHeasell/Mappy,MHeasell/Mappy | TAUtil.Gdi/Bitmap/BitmapSerializer.cs | TAUtil.Gdi/Bitmap/BitmapSerializer.cs | namespace TAUtil.Gdi.Bitmap
{
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using TAUtil.Gdi.Palette;
/// <summary>
/// Serializes a 32-bit Bitmap instance into raw 8-bit indexed color data.
/// The mapping from color to index is done according to the given
/// reverse palette lookup.
/// </summary>
public class BitmapSerializer
{
private readonly IPalette palette;
public BitmapSerializer(IPalette palette)
{
this.palette = palette;
}
public byte[] ToBytes(Bitmap bitmap)
{
int length = bitmap.Width * bitmap.Height;
byte[] output = new byte[length];
this.Serialize(new MemoryStream(output, true), bitmap);
return output;
}
public void Serialize(Stream output, Bitmap bitmap)
{
Rectangle r = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
BitmapData data = bitmap.LockBits(r, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
int length = bitmap.Width * bitmap.Height;
unsafe
{
int* pointer = (int*)data.Scan0;
for (int i = 0; i < length; i++)
{
Color c = Color.FromArgb(pointer[i]);
output.WriteByte((byte)this.palette.LookUp(c));
}
}
bitmap.UnlockBits(data);
}
}
} | namespace TAUtil.Gdi.Bitmap
{
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using TAUtil.Gdi.Palette;
/// <summary>
/// Serializes a 32-bit Bitmap instance into raw 8-bit indexed color data.
/// The mapping from color to index is done according to the given
/// reverse palette lookup.
/// </summary>
public class BitmapSerializer
{
private readonly IPalette palette;
public BitmapSerializer(IPalette palette)
{
this.palette = palette;
}
public byte[] ToBytes(Bitmap bitmap)
{
int length = bitmap.Width * bitmap.Height;
byte[] output = new byte[length];
this.Serialize(new MemoryStream(output, true), bitmap);
return output;
}
public void Serialize(Stream output, Bitmap bitmap)
{
Rectangle r = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
BitmapData data = bitmap.LockBits(r, ImageLockMode.ReadOnly, bitmap.PixelFormat);
int length = bitmap.Width * bitmap.Height;
unsafe
{
int* pointer = (int*)data.Scan0;
for (int i = 0; i < length; i++)
{
Color c = Color.FromArgb(pointer[i]);
output.WriteByte((byte)this.palette.LookUp(c));
}
}
bitmap.UnlockBits(data);
}
}
} | mit | C# |
614e31bef15442807635f3f2351398006ae32d8d | remove old handshake | badgeir/ule,badgeir/ule | unityproj/Assets/Scripts/Agent/ReinforcementAgent.cs | unityproj/Assets/Scripts/Agent/ReinforcementAgent.cs | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using SimpleJSON;
public class ReinforcementAgent : MonoBehaviour {
ReinforcementAgentTCPIface mIface;
SceneManager mManager;
public VirtualCamera mCamera;
public List<Sensor> mSensors;
public List<Motor> mMotors;
private float mReward;
// Use this for initialization
void Start()
{
mManager = GameObject.Find("SceneManager").GetComponent<SceneManager>();
mIface = new ReinforcementAgentTCPIface("127.0.0.1", 3000, 3001, 3002, mManager.QueueAction);
StartCoroutine(ConnectToAgent());
}
IEnumerator ConnectToAgent()
{
mIface.Connect();
while(!mIface.Connected())
{
yield return new WaitForSeconds(0.1f);
}
// oneway handshake, tell client it's ok to start sending actions
mIface.SendAvailableMotors(mMotors);
}
public void PerformActions(string actions)
{
foreach(Motor m in mMotors)
{
m.SetOutput(actions);
}
}
public void SendReinforcementFeedback(int gamestatus)
{
byte[] image = mCamera.GetImageBytes();
mIface.SendImage(image);
mIface.SendInfo(mReward, gamestatus, mSensors);
mReward = 0;
}
public void AddReward(float amount)
{
mReward += amount;
}
void OnDestroy()
{
mIface.Close();
}
}
| using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using SimpleJSON;
public class ReinforcementAgent : MonoBehaviour {
ReinforcementAgentTCPIface mIface;
SceneManager mManager;
public VirtualCamera mCamera;
public List<Sensor> mSensors;
public List<Motor> mMotors;
private float mReward;
// Use this for initialization
void Start()
{
mManager = GameObject.Find("SceneManager").GetComponent<SceneManager>();
mIface = new ReinforcementAgentTCPIface("127.0.0.1", 3000, 3001, 3002, mManager.QueueAction);
StartCoroutine(ConnectToAgent());
}
IEnumerator ConnectToAgent()
{
mIface.Connect();
while(!mIface.Connected())
{
yield return new WaitForSeconds(0.1f);
}
// oneway handshake, tell client it's ok to start sending actions
mIface.SendAvailableMotors(mMotors);
mIface.SendInfo(0, 0, mSensors);
}
public void PerformActions(string actions)
{
foreach(Motor m in mMotors)
{
m.SetOutput(actions);
}
}
public void SendReinforcementFeedback(int gamestatus)
{
byte[] image = mCamera.GetImageBytes();
mIface.SendImage(image);
mIface.SendInfo(mReward, gamestatus, mSensors);
mReward = 0;
}
public void AddReward(float amount)
{
mReward += amount;
}
void OnDestroy()
{
mIface.Close();
}
}
| mit | C# |
56f7b4e647fc8b29874e5956525280afe7d15a26 | Revert "TEMP: test env vars on prod" | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | src/FilterLists.Agent/Program.cs | src/FilterLists.Agent/Program.cs | using System;
using System.Threading.Tasks;
using FilterLists.Agent.Extensions;
using FilterLists.Agent.Features.Lists;
using FilterLists.Agent.Features.Urls;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
namespace FilterLists.Agent
{
public static class Program
{
private static IServiceProvider _serviceProvider;
public static async Task Main()
{
BuildServiceProvider();
var mediator = _serviceProvider.GetService<IMediator>();
await mediator.Send(new CaptureLists.Command());
await mediator.Send(new ValidateAllUrls.Command());
}
private static void BuildServiceProvider()
{
var serviceCollection = new ServiceCollection();
serviceCollection.RegisterAgentServices();
_serviceProvider = serviceCollection.BuildServiceProvider();
}
}
} | using System;
using System.Threading.Tasks;
using FilterLists.Agent.AppSettings;
using FilterLists.Agent.Extensions;
using FilterLists.Agent.Features.Lists;
using FilterLists.Agent.Features.Urls;
using FilterLists.Agent.Features.Urls.Models.DataFileUrls;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace FilterLists.Agent
{
public static class Program
{
private static IServiceProvider _serviceProvider;
public static async Task Main()
{
BuildServiceProvider();
var mediator = _serviceProvider.GetService<IOptions<GitHub>>().Value;
Console.WriteLine(mediator.ProductHeaderValue);
//await mediator.Send(new CaptureLists.Command());
//await mediator.Send(new ValidateAllUrls.Command());
}
private static void BuildServiceProvider()
{
var serviceCollection = new ServiceCollection();
serviceCollection.RegisterAgentServices();
_serviceProvider = serviceCollection.BuildServiceProvider();
}
}
} | mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.