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 |
---|---|---|---|---|---|---|---|---|
2216ad4f10ac3155e1a4912c0fa6294b22831381 | Fix SQL Server tests | danielgerlag/workflow-core | test/WorkflowCore.Tests.SqlServer/DockerSetup.cs | test/WorkflowCore.Tests.SqlServer/DockerSetup.cs | using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using Docker.Testify;
using Xunit;
namespace WorkflowCore.Tests.SqlServer
{
public class SqlDockerSetup : DockerSetup
{
public static string ConnectionString { get; set; }
public static string ScenarioConnectionString { get; set; }
public override string ImageName => "mcr.microsoft.com/mssql/server";
public override int InternalPort => 1433;
public override TimeSpan TimeOut => TimeSpan.FromSeconds(120);
public const string SqlPassword = "I@mJustT3st1ing";
public override IList<string> EnvironmentVariables => new List<string> {"ACCEPT_EULA=Y", $"SA_PASSWORD={SqlPassword}"};
public override void PublishConnectionInfo()
{
ConnectionString = $"Server=127.0.0.1,{ExternalPort};Database=workflowcore-tests;User Id=sa;Password={SqlPassword};";
ScenarioConnectionString = $"Server=127.0.0.1,{ExternalPort};Database=workflowcore-scenario-tests;User Id=sa;Password={SqlPassword};";
}
public override bool TestReady()
{
try
{
var client = new SqlConnection($"Server=127.0.0.1,{ExternalPort};Database=master;User Id=sa;Password={SqlPassword};");
client.Open();
client.Close();
return true;
}
catch
{
return false;
}
}
}
[CollectionDefinition("SqlServer collection")]
public class SqlServerCollection : ICollectionFixture<SqlDockerSetup>
{
}
} | using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using Docker.Testify;
using Xunit;
namespace WorkflowCore.Tests.SqlServer
{
public class SqlDockerSetup : DockerSetup
{
public static string ConnectionString { get; set; }
public static string ScenarioConnectionString { get; set; }
public override string ImageName => "microsoft/mssql-server-linux";
public override int InternalPort => 1433;
public override TimeSpan TimeOut => TimeSpan.FromSeconds(120);
public const string SqlPassword = "I@mJustT3st1ing";
public override IList<string> EnvironmentVariables => new List<string> {"ACCEPT_EULA=Y", $"SA_PASSWORD={SqlPassword}"};
public override void PublishConnectionInfo()
{
ConnectionString = $"Server=127.0.0.1,{ExternalPort};Database=workflowcore-tests;User Id=sa;Password={SqlPassword};";
ScenarioConnectionString = $"Server=127.0.0.1,{ExternalPort};Database=workflowcore-scenario-tests;User Id=sa;Password={SqlPassword};";
}
public override bool TestReady()
{
try
{
var client = new SqlConnection($"Server=127.0.0.1,{ExternalPort};Database=master;User Id=sa;Password={SqlPassword};");
client.Open();
client.Close();
return true;
}
catch
{
return false;
}
}
}
[CollectionDefinition("SqlServer collection")]
public class SqlServerCollection : ICollectionFixture<SqlDockerSetup>
{
}
} | mit | C# |
3d79534d9896370c7431e2af8c433e6624d8d342 | update AsyncLock | WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common | src/WeihanLi.Common/AsyncLock.cs | src/WeihanLi.Common/AsyncLock.cs | using System;
using System.Threading;
using System.Threading.Tasks;
namespace WeihanLi.Common
{
/// <summary>
/// AsyncLock basedOn SemaphoreSlim
/// 基于 SemaphoreSlim 的 异步锁
/// </summary>
public sealed class AsyncLock : IDisposable
{
private readonly SemaphoreSlim _mutex = new SemaphoreSlim(1, 1);
public IDisposable Lock()
{
_mutex.Wait();
return new AsyncLockReleaser(_mutex);
}
public Task<IDisposable> LockAsync() => LockAsync(CancellationToken.None);
public Task<IDisposable> LockAsync(CancellationToken cancellationToken) => LockAsync(TimeSpan.Zero, cancellationToken);
public async Task<IDisposable> LockAsync(TimeSpan timeout, CancellationToken cancellationToken)
{
if (timeout <= TimeSpan.Zero)
{
await _mutex.WaitAsync(cancellationToken);
}
else
{
await _mutex.WaitAsync(timeout, cancellationToken);
}
return new AsyncLockReleaser(_mutex);
}
public void Dispose()
{
_mutex?.Dispose();
}
#region AsyncLockReleaser
private struct AsyncLockReleaser : IDisposable
{
private readonly SemaphoreSlim _semaphoreSlim;
public AsyncLockReleaser(SemaphoreSlim semaphoreSlim) => _semaphoreSlim = semaphoreSlim;
public void Dispose()
{
_semaphoreSlim?.Release();
}
}
#endregion AsyncLockReleaser
}
}
| using System;
using System.Threading;
using System.Threading.Tasks;
namespace WeihanLi.Common
{
/// <summary>
/// AsyncLock basedOn SemaphoreSlim
/// 基于 SemaphoreSlim 的 异步锁
/// </summary>
public sealed class AsyncLock : IDisposable
{
private readonly SemaphoreSlim _mutex = new SemaphoreSlim(1, 1);
public Task<IDisposable> LockAsync() => LockAsync(CancellationToken.None);
public Task<IDisposable> LockAsync(CancellationToken cancellationToken) => LockAsync(TimeSpan.Zero, cancellationToken);
public async Task<IDisposable> LockAsync(TimeSpan timeout, CancellationToken cancellationToken)
{
if (timeout <= TimeSpan.Zero)
{
await _mutex.WaitAsync(cancellationToken);
}
else
{
await _mutex.WaitAsync(timeout, cancellationToken);
}
return new AsyncLockReleaser(_mutex);
}
#region IDisposable Support
private bool _disposed; // 要检测冗余调用
private void Dispose(bool disposing)
{
if (!_disposed)
{
if (disposing)
{
// 释放托管状态(托管对象)。
}
_mutex.Dispose();
_disposed = true;
}
}
// 添加此代码以正确实现可处置模式。
public void Dispose()
{
// 请勿更改此代码。将清理代码放入以上 Dispose(bool disposing) 中。
Dispose(true);
// 如果在以上内容中替代了终结器,则取消注释以下行。
GC.SuppressFinalize(this);
}
#endregion IDisposable Support
#region AsyncLockReleaser
private struct AsyncLockReleaser : IDisposable
{
private readonly SemaphoreSlim _semaphoreSlim;
public AsyncLockReleaser(SemaphoreSlim semaphoreSlim) => _semaphoreSlim = semaphoreSlim;
public void Dispose()
{
_semaphoreSlim?.Release();
}
}
#endregion AsyncLockReleaser
}
}
| mit | C# |
0400f88da8c4f556aecc9e43f9c35d92788280e2 | Add Func with 3 params | dahall/vanara | Core/BkwdComp/Func.NET2.cs | Core/BkwdComp/Func.NET2.cs | #if (NET20)
namespace System
{
/// <summary>Encapsulates a method that returns a value of the type specified by the TResult parameter.</summary>
/// <typeparam name="TResult">The type of the return value of the method that this delegate encapsulates.</typeparam>
/// <returns>The return value of the method that this delegate encapsulates.</returns>
public delegate TResult Func<out TResult>();
/// <summary>Encapsulates a method that has one parameter and returns a value of the type specified by the TResult parameter.</summary>
/// <typeparam name="T">The type of the parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="TResult">The type of the return value of the method that this delegate encapsulates.</typeparam>
/// <param name="arg">The parameter of the method that this delegate encapsulates.</param>
/// <returns>The return value of the method that this delegate encapsulates.</returns>
public delegate TResult Func<in T, out TResult>(T arg);
/// <summary>Encapsulates a method that has two parameters and returns a value of the type specified by the TResult parameter.</summary>
/// <typeparam name="T1">The type of the first parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="T2">The type of the second parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="TResult">The type of the return value of the method that this delegate encapsulates.</typeparam>
/// <param name="arg1">The first parameter of the method that this delegate encapsulates.</param>
/// <param name="arg2">The second parameter of the method that this delegate encapsulates.</param>
/// <returns>The return value of the method that this delegate encapsulates.</returns>
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
/// <summary>Encapsulates a method that has two parameters and returns a value of the type specified by the TResult parameter.</summary>
/// <typeparam name="T1">The type of the first parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="T2">The type of the second parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="T3">The type of the third parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="TResult">The type of the return value of the method that this delegate encapsulates.</typeparam>
/// <param name="arg1">The first parameter of the method that this delegate encapsulates.</param>
/// <param name="arg2">The second parameter of the method that this delegate encapsulates.</param>
/// <param name="arg3">The third parameter of the method that this delegate encapsulates.</param>
/// <returns>The return value of the method that this delegate encapsulates.</returns>
public delegate TResult Func<in T1, in T2, in T3, out TResult>(T1 arg1, T2 arg2, T3 arg3);
/// <summary>Encapsulates a method that has no parameters and does not return a value.</summary>
public delegate void Action();
/// <summary>Encapsulates a method that has two parameters and does not return a value.</summary>
/// <typeparam name="T1">The type of the first parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="T2">The type of the second parameter of the method that this delegate encapsulates.</typeparam>
/// <param name="arg1">The first parameter of the method that this delegate encapsulates.</param>
/// <param name="arg2">The second parameter of the method that this delegate encapsulates.</param>
public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2);
}
#endif | #if (NET20)
namespace System
{
/// <summary>Encapsulates a method that returns a value of the type specified by the TResult parameter.</summary>
/// <typeparam name="TResult">The type of the return value of the method that this delegate encapsulates.</typeparam>
/// <returns>The return value of the method that this delegate encapsulates.</returns>
public delegate TResult Func<out TResult>();
/// <summary>Encapsulates a method that has one parameter and returns a value of the type specified by the TResult parameter.</summary>
/// <typeparam name="T">The type of the parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="TResult">The type of the return value of the method that this delegate encapsulates.</typeparam>
/// <param name="arg">The parameter of the method that this delegate encapsulates.</param>
/// <returns>The return value of the method that this delegate encapsulates.</returns>
public delegate TResult Func<in T, out TResult>(T arg);
/// <summary>Encapsulates a method that has two parameters and returns a value of the type specified by the TResult parameter.</summary>
/// <typeparam name="T1">The type of the first parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="T2">The type of the second parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="TResult">The type of the return value of the method that this delegate encapsulates.</typeparam>
/// <param name="arg1">The first parameter of the method that this delegate encapsulates.</param>
/// <param name="arg2">The second parameter of the method that this delegate encapsulates.</param>
/// <returns>The return value of the method that this delegate encapsulates.</returns>
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
/// <summary>Encapsulates a method that has no parameters and does not return a value.</summary>
public delegate void Action();
/// <summary>Encapsulates a method that has two parameters and does not return a value.</summary>
/// <typeparam name="T1">The type of the first parameter of the method that this delegate encapsulates.</typeparam>
/// <typeparam name="T2">The type of the second parameter of the method that this delegate encapsulates.</typeparam>
/// <param name="arg1">The first parameter of the method that this delegate encapsulates.</param>
/// <param name="arg2">The second parameter of the method that this delegate encapsulates.</param>
public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2);
}
#endif | mit | C# |
21ae453289ff2bbac0d80307c7c2767dc0aa0db8 | Fix tests not running on windows | EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework | osu.Framework.Tests/Platform/TrackBassTest.cs | osu.Framework.Tests/Platform/TrackBassTest.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 ManagedBass;
using NUnit.Framework;
using osu.Framework.Audio.Track;
using osu.Framework.IO.Stores;
using osu.Framework.Platform;
namespace osu.Framework.Tests.Platform
{
[TestFixture]
public class TrackBassTest
{
private readonly TrackBass track;
public TrackBassTest()
{
Architecture.SetIncludePath();
// Initialize bass with no audio to make sure the test remains consistent even if there is no audio device.
Bass.Init(0);
var resources = new DllResourceStore("osu.Framework.Tests.dll");
var fileStream = resources.GetStream("Resources.Tracks.sample-track.mp3");
track = new TrackBass(fileStream);
}
[SetUp]
public void Setup()
{
#pragma warning disable 4014
track.SeekAsync(1000);
#pragma warning restore 4014
track.Update();
Assert.AreEqual(1000, track.CurrentTime);
}
/// <summary>
/// Bass does not allow seeking to the end of the track. It should fail and the current time should not change.
/// </summary>
[Test]
public void TestTrackSeekingToEndFails()
{
#pragma warning disable 4014
track.SeekAsync(track.Length);
#pragma warning restore 4014
track.Update();
Assert.AreEqual(1000, track.CurrentTime);
}
/// <summary>
/// Bass restarts the track from the beginning if Start is called when the track has been completed.
/// This is blocked locally in <see cref="TrackBass"/>, so this test expects the track to not restart.
/// </summary>
[Test]
public void TestTrackPlaybackBlocksAtTrackEnd()
{
#pragma warning disable 4014
track.SeekAsync(track.Length - 1);
#pragma warning restore 4014
track.StartAsync();
track.Update();
Thread.Sleep(50);
track.Update();
Assert.IsFalse(track.IsRunning);
Assert.AreEqual(track.Length, track.CurrentTime);
track.StartAsync();
track.Update();
Assert.AreEqual(track.Length, track.CurrentTime);
}
}
}
| // 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 ManagedBass;
using NUnit.Framework;
using osu.Framework.Audio.Track;
using osu.Framework.IO.Stores;
namespace osu.Framework.Tests.Platform
{
[TestFixture]
public class TrackBassTest
{
private readonly TrackBass track;
public TrackBassTest()
{
// Initialize bass with no audio to make sure the test remains consistent even if there is no audio device.
Bass.Init(0);
var resources = new DllResourceStore("osu.Framework.Tests.dll");
var fileStream = resources.GetStream("Resources.Tracks.sample-track.mp3");
track = new TrackBass(fileStream);
}
[SetUp]
public void Setup()
{
#pragma warning disable 4014
track.SeekAsync(1000);
#pragma warning restore 4014
track.Update();
Assert.AreEqual(1000, track.CurrentTime);
}
/// <summary>
/// Bass does not allow seeking to the end of the track. It should fail and the current time should not change.
/// </summary>
[Test]
public void TestTrackSeekingToEndFails()
{
#pragma warning disable 4014
track.SeekAsync(track.Length);
#pragma warning restore 4014
track.Update();
Assert.AreEqual(1000, track.CurrentTime);
}
/// <summary>
/// Bass restarts the track from the beginning if Start is called when the track has been completed.
/// This is blocked locally in <see cref="TrackBass"/>, so this test expects the track to not restart.
/// </summary>
[Test]
public void TestTrackPlaybackBlocksAtTrackEnd()
{
#pragma warning disable 4014
track.SeekAsync(track.Length - 1);
#pragma warning restore 4014
track.StartAsync();
track.Update();
Thread.Sleep(50);
track.Update();
Assert.IsFalse(track.IsRunning);
Assert.AreEqual(track.Length, track.CurrentTime);
track.StartAsync();
track.Update();
Assert.AreEqual(track.Length, track.CurrentTime);
}
}
}
| mit | C# |
2df71a5c9b7576594679d0a79d3e7704d0a18f1d | Add whitespace to type enum definitions | SICU-Stress-Measurement-System/frontend-cs | StressMeasurementSystem/Models/Patient.cs | StressMeasurementSystem/Models/Patient.cs | using System.Collections.Generic;
using System.Net.Mail;
namespace StressMeasurementSystem.Models
{
public class Patient
{
#region Structs
public struct Name
{
public string Prefix { get; set; }
public string First { get; set; }
public string Middle { get; set; }
public string Last { get; set; }
public string Suffix { get; set; }
}
public struct Organization
{
public string Company { get; set; }
public string JobTitle { get; set; }
}
public struct PhoneNumber
{
public enum Type { Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other }
public string Number { get; set; }
public Type T { get; set; }
}
public struct Email
{
public enum Type { Home, Work, Other }
public MailAddress Address { get; set; }
public Type T { get; set; }
}
#endregion
#region Fields
private Name _name;
private uint _age;
private Organization _organization;
private List<PhoneNumber> _phoneNumbers;
private List<Email> _emails;
#endregion
#region Constructors
public Patient(Name name, uint age, Organization organization,
List<PhoneNumber> phoneNumbers, List<Email> emails)
{
_name = name;
_age = age;
_organization = organization;
_phoneNumbers = phoneNumbers;
_emails = emails;
}
#endregion
}
}
| using System.Collections.Generic;
using System.Net.Mail;
namespace StressMeasurementSystem.Models
{
public class Patient
{
#region Structs
public struct Name
{
public string Prefix { get; set; }
public string First { get; set; }
public string Middle { get; set; }
public string Last { get; set; }
public string Suffix { get; set; }
}
public struct Organization
{
public string Company { get; set; }
public string JobTitle { get; set; }
}
public struct PhoneNumber
{
public enum Type {Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other}
public string Number { get; set; }
public Type T { get; set; }
}
public struct Email
{
public enum Type {Home, Work, Other}
public MailAddress Address { get; set; }
public Type T { get; set; }
}
#endregion
#region Fields
private Name _name;
private uint _age;
private Organization _organization;
private List<PhoneNumber> _phoneNumbers;
private List<Email> _emails;
#endregion
#region Constructors
public Patient(Name name, uint age, Organization organization,
List<PhoneNumber> phoneNumbers, List<Email> emails)
{
_name = name;
_age = age;
_organization = organization;
_phoneNumbers = phoneNumbers;
_emails = emails;
}
#endregion
}
}
| apache-2.0 | C# |
faff413575d5bfe426fe24ddc82c1ce8563e29fa | Fix to avoid CA1307 | y-iihoshi/ThScoreFileConverter,y-iihoshi/ThScoreFileConverter | ThScoreFileConverter/Squirrel/SQString.cs | ThScoreFileConverter/Squirrel/SQString.cs | //-----------------------------------------------------------------------
// <copyright file="SQString.cs" company="None">
// Copyright (c) IIHOSHI Yoshinori.
// Licensed under the BSD-2-Clause license. See LICENSE.txt file in the project root for full license information.
// </copyright>
//-----------------------------------------------------------------------
#pragma warning disable SA1600 // Elements should be documented
using System;
using System.IO;
using ThScoreFileConverter.Extensions;
using ThScoreFileConverter.Models;
using ThScoreFileConverter.Properties;
namespace ThScoreFileConverter.Squirrel
{
internal sealed class SQString : SQObject, IEquatable<SQString>
{
public SQString(string value = "")
: base(SQObjectType.String)
{
this.Value = value;
}
public new string Value
{
get => (string)base.Value;
private set => base.Value = value;
}
public static implicit operator string(SQString sq)
{
return sq.Value;
}
public static SQString Create(BinaryReader reader, bool skipType = false)
{
if (reader is null)
throw new ArgumentNullException(nameof(reader));
if (!skipType)
{
var type = reader.ReadInt32();
if (type != (int)SQObjectType.String)
throw new InvalidDataException(Resources.InvalidDataExceptionWrongType);
}
var size = reader.ReadInt32();
return new SQString(
(size > 0) ? Encoding.CP932.GetString(reader.ReadExactBytes(size)) : string.Empty);
}
public override bool Equals(object obj)
{
return (obj is SQString value) && this.Equals(value);
}
public override int GetHashCode()
{
#if NETFRAMEWORK
return this.Type.GetHashCode() ^ this.Value.GetHashCode();
#else
return this.Type.GetHashCode() ^ this.Value.GetHashCode(StringComparison.InvariantCulture);
#endif
}
public bool Equals(SQString other)
{
if (other is null)
return false;
return (this.Type == other.Type) && (this.Value == other.Value);
}
}
}
| //-----------------------------------------------------------------------
// <copyright file="SQString.cs" company="None">
// Copyright (c) IIHOSHI Yoshinori.
// Licensed under the BSD-2-Clause license. See LICENSE.txt file in the project root for full license information.
// </copyright>
//-----------------------------------------------------------------------
#pragma warning disable SA1600 // Elements should be documented
using System;
using System.IO;
using ThScoreFileConverter.Extensions;
using ThScoreFileConverter.Models;
using ThScoreFileConverter.Properties;
namespace ThScoreFileConverter.Squirrel
{
internal sealed class SQString : SQObject, IEquatable<SQString>
{
public SQString(string value = "")
: base(SQObjectType.String)
{
this.Value = value;
}
public new string Value
{
get => (string)base.Value;
private set => base.Value = value;
}
public static implicit operator string(SQString sq)
{
return sq.Value;
}
public static SQString Create(BinaryReader reader, bool skipType = false)
{
if (reader is null)
throw new ArgumentNullException(nameof(reader));
if (!skipType)
{
var type = reader.ReadInt32();
if (type != (int)SQObjectType.String)
throw new InvalidDataException(Resources.InvalidDataExceptionWrongType);
}
var size = reader.ReadInt32();
return new SQString(
(size > 0) ? Encoding.CP932.GetString(reader.ReadExactBytes(size)) : string.Empty);
}
public override bool Equals(object obj)
{
return (obj is SQString value) && this.Equals(value);
}
public override int GetHashCode()
{
return this.Type.GetHashCode() ^ this.Value.GetHashCode();
}
public bool Equals(SQString other)
{
if (other is null)
return false;
return (this.Type == other.Type) && (this.Value == other.Value);
}
}
}
| bsd-2-clause | C# |
4391885572aba25e27013ad8699a303fc61d068e | fix build error | steven-r/Oberon0Compiler | oberon0/Expressions/Arithmetic/ArithmeticRepository.cs | oberon0/Expressions/Arithmetic/ArithmeticRepository.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using Oberon0.Compiler.Solver;
namespace Oberon0.Compiler.Expressions.Arithmetic
{
class ArithmeticRepository
{
#pragma warning disable 649
[ImportMany(typeof(ICalculatable))]
// ReSharper disable once CollectionNeverUpdated.Global
public List<ICalculatable> ClassRepository;
#pragma warning restore 649
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly CompositionContainer _container;
public ArithmeticRepository()
{
var catalog = new AggregateCatalog();
catalog.Catalogs.Add(new AssemblyCatalog(typeof(ICalculatable).Assembly));
_container = new CompositionContainer(catalog,
CompositionOptions.DisableSilentRejection |
CompositionOptions.IsThreadSafe);
_container.ComposeParts(this);
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Registration;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Oberon0.Compiler.Solver;
namespace Oberon0.Compiler.Expressions.Arithmetic
{
class ArithmeticRepository
{
#pragma warning disable 649
[ImportMany(typeof(ICalculatable))]
public List<ICalculatable> ClassRepository;
#pragma warning restore 649
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly CompositionContainer _container;
public ArithmeticRepository()
{
var catalog = new AggregateCatalog();
catalog.Catalogs.Add(new AssemblyCatalog(typeof(ICalculatable).Assembly));
_container = new CompositionContainer(catalog,
CompositionOptions.DisableSilentRejection |
CompositionOptions.IsThreadSafe);
_container.ComposeParts(this);
}
}
}
| mit | C# |
0a7b64e0fd8a61f51d87a538b830888d5700bb6f | Bump version | alecgorge/adzerk-dot-net | StackExchange.Adzerk/Properties/AssemblyInfo.cs | StackExchange.Adzerk/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("StackExchange.Adzerk")]
[assembly: AssemblyDescription("Unofficial Adzerk API client.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Stack Overflow")]
[assembly: AssemblyProduct("StackExchange.Adzerk")]
[assembly: AssemblyCopyright("Copyright © 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("d05e1e25-d95d-43d6-a74b-3cb38492fa7e")]
// 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.0.0.41")]
[assembly: AssemblyFileVersion("0.0.0.41")]
| 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("StackExchange.Adzerk")]
[assembly: AssemblyDescription("Unofficial Adzerk API client.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Stack Overflow")]
[assembly: AssemblyProduct("StackExchange.Adzerk")]
[assembly: AssemblyCopyright("Copyright © 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("d05e1e25-d95d-43d6-a74b-3cb38492fa7e")]
// 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.0.0.40")]
[assembly: AssemblyFileVersion("0.0.0.40")]
| mit | C# |
81cfe057e95ffb27605716c3fd7f8f8281fc5b6b | Update DotNetXmlSerializer.cs | tiksn/TIKSN-Framework | TIKSN.Core/Serialization/DotNetXmlSerializer.cs | TIKSN.Core/Serialization/DotNetXmlSerializer.cs | using System.IO;
using System.Xml.Serialization;
namespace TIKSN.Serialization
{
public class DotNetXmlSerializer : SerializerBase<string>
{
protected override string SerializeInternal<T>(T obj)
{
var serializer = new XmlSerializer(obj.GetType());
var writer = new StringWriter();
serializer.Serialize(writer, obj);
return writer.ToString();
}
}
}
| using System.IO;
using System.Xml.Serialization;
namespace TIKSN.Serialization
{
public class DotNetXmlSerializer : SerializerBase<string>
{
protected override string SerializeInternal<T>(T obj)
{
var serializer = new XmlSerializer(obj.GetType());
var writer = new StringWriter();
serializer.Serialize(writer, obj);
return writer.ToString();
}
}
} | mit | C# |
96bfb808a8e554f0c78be0a395fd371ffbc6f758 | add missing registration | zmira/abremir.AllMyBricks | abremir.AllMyBricks.Device/Configuration/IoC.cs | abremir.AllMyBricks.Device/Configuration/IoC.cs | using abremir.AllMyBricks.Device.Interfaces;
using abremir.AllMyBricks.Device.Services;
using SimpleInjector;
using Xamarin.Essentials.Implementation;
using Xamarin.Essentials.Interfaces;
namespace abremir.AllMyBricks.Device.Configuration
{
public static class IoC
{
public static Container Configure(Container container = null)
{
container = container ?? new Container();
container.Register<IFileSystem, FileSystemImplementation>(Lifestyle.Transient);
container.Register<IVersionTracking, VersionTrackingImplementation>(Lifestyle.Transient);
container.Register<IConnectivity, ConnectivityImplementation>(Lifestyle.Transient);
container.Register<ISecureStorage, SecureStorageImplementation>(Lifestyle.Transient);
container.Register<IDeviceInfo, DeviceInfoImplementation>(Lifestyle.Transient);
container.Register<IFileSystemService, FileSystemService>(Lifestyle.Transient);
container.Register<IVersionTrackingService, VersionTrackingService>(Lifestyle.Transient);
container.Register<IConnectivityService, ConnectivityService>(Lifestyle.Transient);
container.Register<ISecureStorageService, SecureStorageService>(Lifestyle.Transient);
container.Register<IDeviceInformationService, DeviceInformationService>(Lifestyle.Transient);
return container;
}
}
} | using abremir.AllMyBricks.Device.Interfaces;
using abremir.AllMyBricks.Device.Services;
using SimpleInjector;
using Xamarin.Essentials.Implementation;
using Xamarin.Essentials.Interfaces;
namespace abremir.AllMyBricks.Device.Configuration
{
public static class IoC
{
public static Container Configure(Container container = null)
{
container = container ?? new Container();
container.Register<IFileSystem, FileSystemImplementation>(Lifestyle.Transient);
container.Register<IVersionTracking, VersionTrackingImplementation>(Lifestyle.Transient);
container.Register<IConnectivity, ConnectivityImplementation>(Lifestyle.Transient);
container.Register<ISecureStorage, SecureStorageImplementation>(Lifestyle.Transient);
container.Register<IFileSystemService, FileSystemService>(Lifestyle.Transient);
container.Register<IVersionTrackingService, VersionTrackingService>(Lifestyle.Transient);
container.Register<IConnectivityService, ConnectivityService>(Lifestyle.Transient);
container.Register<ISecureStorageService, SecureStorageService>(Lifestyle.Transient);
return container;
}
}
} | mit | C# |
67dd07c8d0486d4758be62701d7be0300808673d | Fix migration | CollActionteam/CollAction,CollActionteam/CollAction,CollActionteam/CollAction,CollActionteam/CollAction,CollActionteam/CollAction | CollAction/Migrations/20180710223436_ProjectEmails.cs | CollAction/Migrations/20180710223436_ProjectEmails.cs | using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace CollAction.Migrations
{
public partial class unsubscribetoken : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "NumberProjectEmailsSend",
table: "Projects",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<bool>(
name: "SubscribedToProjectEmails",
table: "ProjectParticipants",
nullable: false,
defaultValue: true);
migrationBuilder.AddColumn<Guid>(
name: "UnsubscribeToken",
table: "ProjectParticipants",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.Sql("UPDATE public.\"ProjectParticipants\" SET \"UnsubscribeToken\"= uuid_in(md5(random()::text || now()::text || \"UserId\" || \"ProjectId\")::cstring);");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UnsubscribeToken",
table: "ProjectParticipants");
migrationBuilder.DropColumn(
name: "NumberProjectEmailsSend",
table: "Projects");
migrationBuilder.DropColumn(
name: "SubscribedToProjectEmails",
table: "ProjectParticipants");
}
}
}
| using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace CollAction.Migrations
{
public partial class unsubscribetoken : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "NumberProjectEmailsSend",
table: "Projects",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<bool>(
name: "SubscribedToProjectEmails",
table: "ProjectParticipants",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<Guid>(
name: "UnsubscribeToken",
table: "ProjectParticipants",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.Sql("UPDATE public.\"ProjectParticipants\" SET \"UnsubscribeToken\"= uuid_in(md5(random()::text || now()::text || \"UserId\" || \"ProjectId\")::cstring);");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UnsubscribeToken",
table: "ProjectParticipants");
migrationBuilder.DropColumn(
name: "NumberProjectEmailsSend",
table: "Projects");
migrationBuilder.DropColumn(
name: "SubscribedToProjectEmails",
table: "ProjectParticipants");
}
}
}
| agpl-3.0 | C# |
1039d82d161681ab35048720fb751531eb056cfc | Update KpsHandler.cs | yugecin/osukps | osukps/KpsHandler.cs | osukps/KpsHandler.cs | using System.Drawing;
using System.Windows.Forms;
namespace osukps
{
class KpsHandler
{
private Label lblKps;
private Label lblTotal;
private byte index;
private byte[] kps;
private int total;
private int max=0;
public KpsHandler( Label lblKps, Label lblTotal )
{
this.lblKps = lblKps;
this.lblTotal = lblTotal;
kps = new byte[10];
Timer timer = new Timer();
timer.Interval = 100;
timer.Tick += t_Tick;
timer.Start();
}
private void t_Tick( object sender, System.EventArgs e )
{
kps[index] = 0;
if( ++index >= 10 )
{
index = 0;
}
}
public void Update( byte keyCount )
{
for( byte i = 0; i < 10; i++ )
{
kps[i] += keyCount;
}
total += keyCount;
UpdateLabels();
}
private void UpdateLabels()
{
byte kps = this.kps[index];
if(kps>max)
{
max = kps;
}
if( kps >= 10 )
{
lblKps.ForeColor = Color.FromArgb( 255, 248, 0, 0 );
}
else if( kps >= 5 )
{
lblKps.ForeColor = Color.FromArgb( 255, 0, 190, 255 );
}
else
{
lblKps.ForeColor = Color.White;
}
if (kps == 0) {
lblKps.Text = string.Format("{0} Max", max);
}
else lblKps.Text = string.Format("{0} Kps", kps);
lblTotal.Text = total.ToString();
//frmMain.kpsmax(kps);
}
public void ResetTotal()
{
total = 0;
UpdateLabels();
}
public void resetmax()
{
max = 0;
UpdateLabels();
}
}
}
| using System.Drawing;
using System.Windows.Forms;
namespace osukps
{
class KpsHandler
{
private Label lblKps;
private Label lblTotal;
private byte index;
private byte[] kps;
private int total;
private int max=0;
public KpsHandler( Label lblKps, Label lblTotal )
{
this.lblKps = lblKps;
this.lblTotal = lblTotal;
kps = new byte[10];
Timer timer = new Timer();
timer.Interval = 100;
timer.Tick += t_Tick;
timer.Start();
}
private void t_Tick( object sender, System.EventArgs e )
{
kps[index] = 0;
if( ++index >= 10 )
{
index = 0;
}
}
public void Update( byte keyCount )
{
for( byte i = 0; i < 10; i++ )
{
kps[i] += keyCount;
}
total += keyCount;
UpdateLabels();
}
public void resetmax()
{
max = 0;
}
private void UpdateLabels()
{
byte kps = this.kps[index];
if(kps>max)
{
max = kps;
}
if( kps >= 10 )
{
lblKps.ForeColor = Color.FromArgb( 255, 248, 0, 0 );
}
else if( kps >= 5 )
{
lblKps.ForeColor = Color.FromArgb( 255, 0, 190, 255 );
}
else
{
lblKps.ForeColor = Color.White;
}
if (kps == 0) {
lblKps.Text = string.Format("{0} Max", max);
}
else lblKps.Text = string.Format("{0} Kps", kps);
lblTotal.Text = total.ToString();
//frmMain.kpsmax(kps);
}
public void ResetTotal()
{
total = 0;
UpdateLabels();
}
}
}
| mit | C# |
e17cd9e964e5eaeded62b3b2a4584a813bec5470 | Reduce length of tests | johnneijzen/osu,peppy/osu-new,peppy/osu,smoogipoo/osu,EVAST9919/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,EVAST9919/osu,UselessToucan/osu,smoogipoo/osu,ZLima12/osu,peppy/osu,UselessToucan/osu,2yangk23/osu,johnneijzen/osu,ZLima12/osu,smoogipoo/osu,smoogipooo/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,2yangk23/osu | osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.cs | osu.Game.Tests/Visual/Gameplay/TestSceneAutoplay.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.ComponentModel;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual.Gameplay
{
[Description("Player instantiated with an autoplay mod.")]
public class TestSceneAutoplay : AllPlayersTestScene
{
private ClockBackedTestWorkingBeatmap.TrackVirtualManual track;
protected override Player CreatePlayer(Ruleset ruleset)
{
Mods.Value = Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() }).ToArray();
return new ScoreAccessiblePlayer();
}
protected override void AddCheckSteps()
{
AddUntilStep("score above zero", () => ((ScoreAccessiblePlayer)Player).ScoreProcessor.TotalScore.Value > 0);
AddUntilStep("key counter counted keys", () => ((ScoreAccessiblePlayer)Player).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 2));
AddStep("rewind", () => track.Seek(-10000));
AddUntilStep("key counter reset", () => ((ScoreAccessiblePlayer)Player).HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0));
}
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap)
{
var working = base.CreateWorkingBeatmap(beatmap);
track = (ClockBackedTestWorkingBeatmap.TrackVirtualManual)working.Track;
return working;
}
private class ScoreAccessiblePlayer : TestPlayer
{
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
public new HUDOverlay HUDOverlay => base.HUDOverlay;
public new GameplayClockContainer GameplayClockContainer => base.GameplayClockContainer;
public ScoreAccessiblePlayer()
: base(false, false)
{
}
}
}
}
| // 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.ComponentModel;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual.Gameplay
{
[Description("Player instantiated with an autoplay mod.")]
public class TestSceneAutoplay : AllPlayersTestScene
{
private ClockBackedTestWorkingBeatmap.TrackVirtualManual track;
protected override Player CreatePlayer(Ruleset ruleset)
{
Mods.Value = Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() }).ToArray();
return new ScoreAccessiblePlayer();
}
protected override void AddCheckSteps()
{
AddUntilStep("score above zero", () => ((ScoreAccessiblePlayer)Player).ScoreProcessor.TotalScore.Value > 0);
AddUntilStep("key counter counted keys", () => ((ScoreAccessiblePlayer)Player).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 5));
AddStep("rewind", () => track.Seek(-10000));
AddUntilStep("key counter reset", () => ((ScoreAccessiblePlayer)Player).HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0));
}
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap)
{
var working = base.CreateWorkingBeatmap(beatmap);
track = (ClockBackedTestWorkingBeatmap.TrackVirtualManual)working.Track;
return working;
}
private class ScoreAccessiblePlayer : TestPlayer
{
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
public new HUDOverlay HUDOverlay => base.HUDOverlay;
public new GameplayClockContainer GameplayClockContainer => base.GameplayClockContainer;
public ScoreAccessiblePlayer()
: base(false, false)
{
}
}
}
}
| mit | C# |
df975d5aa7d55c5d5cad2162060b93da01f81830 | Fix build problem | Nabile-Rahmani/osu-framework,ppy/osu-framework,RedNesto/osu-framework,DrabWeb/osu-framework,naoey/osu-framework,EVAST9919/osu-framework,default0/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,naoey/osu-framework,ppy/osu-framework,Tom94/osu-framework,peppy/osu-framework,paparony03/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ZLima12/osu-framework,Tom94/osu-framework,default0/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,paparony03/osu-framework,peppy/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework | osu.Framework.VisualTests/Tests/TestCaseSliderbar.cs | osu.Framework.VisualTests/Tests/TestCaseSliderbar.cs | using System;
using osu.Framework.Configuration;
using osu.Framework.GameModes.Testing;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Framework.VisualTests.Tests
{
public class TestCaseSliderbar : TestCase
{
public override string Name => @"Sliderbar";
public override string Description => @"Sliderbar tests.";
private SliderBar<double> sliderBar;
private BindableDouble sliderBarValue;
private SpriteText sliderbarText;
public override void Reset()
{
base.Reset();
sliderBarValue = new BindableDouble(8)
{
MinValue = -10,
MaxValue = 10
};
sliderBarValue.ValueChanged += sliderBarValueChanged;
sliderbarText = new SpriteText
{
Text = $"Selected value: {sliderBarValue.Value}",
Position = new Vector2(25, 0)
};
sliderBar = new SliderBar<double>
{
Size = new Vector2(200, 10),
Position = new Vector2(25, 25),
Bindable = sliderBarValue,
Color = Color4.White,
SelectionColor = Color4.Pink,
KeyboardStep = 1
};
Add(sliderBar);
Add(sliderbarText);
}
private void sliderBarValueChanged(object sender, EventArgs e)
{
sliderbarText.Text = $"Selected value: {sliderBarValue.Value:N}";
}
}
}
| using System;
using osu.Framework.Configuration;
using osu.Framework.GameModes.Testing;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Framework.VisualTests.Tests
{
public class TestCaseSliderbar : TestCase
{
public override string Name => @"Sliderbar";
public override string Description => @"Sliderbar tests.";
private SliderBar sliderBar;
private BindableDouble sliderBarValue;
private SpriteText sliderbarText;
public override void Reset()
{
base.Reset();
sliderBarValue = new BindableDouble(8)
{
MinValue = -10,
MaxValue = 10
};
sliderBarValue.ValueChanged += sliderBarValueChanged;
sliderbarText = new SpriteText
{
Text = $"Selected value: {sliderBarValue.Value}",
Position = new Vector2(25, 0)
};
sliderBar = new SliderBar
{
Size = new Vector2(200, 10),
Position = new Vector2(25, 25),
Bindable = sliderBarValue,
Color = Color4.White,
SelectionColor = Color4.Pink,
KeyboardStep = 1
};
Add(sliderBar);
Add(sliderbarText);
}
private void sliderBarValueChanged(object sender, EventArgs e)
{
sliderbarText.Text = $"Selected value: {sliderBarValue.Value:N}";
}
}
}
| mit | C# |
bd351535177d0ba388b00cacae85aef856a04f57 | Fix incorrect default value in interface. | NeoAdonis/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,naoey/osu-framework,ppy/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework,smoogipooo/osu-framework,paparony03/osu-framework,peppy/osu-framework,Tom94/osu-framework,RedNesto/osu-framework,DrabWeb/osu-framework,NeoAdonis/osu-framework,Tom94/osu-framework,ppy/osu-framework,naoey/osu-framework,ZLima12/osu-framework,default0/osu-framework,DrabWeb/osu-framework,paparony03/osu-framework,RedNesto/osu-framework,Nabile-Rahmani/osu-framework,default0/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework | osu.Framework/Graphics/Transformations/ITransform.cs | osu.Framework/Graphics/Transformations/ITransform.cs | //Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
namespace osu.Framework.Graphics.Transformations
{
public interface ITransform
{
double Duration { get; }
bool IsAlive { get; }
double StartTime { get; set; }
double EndTime { get; set; }
void Apply(Drawable d);
ITransform Clone();
ITransform CloneReverse();
void Reverse();
void Loop(double delay, int loopCount = -1);
}
} | //Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
namespace osu.Framework.Graphics.Transformations
{
public interface ITransform
{
double Duration { get; }
bool IsAlive { get; }
double StartTime { get; set; }
double EndTime { get; set; }
void Apply(Drawable d);
ITransform Clone();
ITransform CloneReverse();
void Reverse();
void Loop(double delay, int loopCount = 0);
}
} | mit | C# |
f085c0c60117c8669aa0b6e5f1225c2ab0f4a4ed | update version | rajfidel/appium-dotnet-driver,appium/appium-dotnet-driver,Astro03/appium-dotnet-driver,rajfidel/appium-dotnet-driver,suryarend/appium-dotnet-driver | appium-dotnet-driver/Properties/AssemblyInfo.cs | appium-dotnet-driver/Properties/AssemblyInfo.cs | using System.Reflection;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("appium-dotnet-driver")]
[assembly: AssemblyDescription ("Appium Dotnet Driver")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Appium Contributors")]
[assembly: AssemblyProduct ("Appium-Dotnet-Driver")]
[assembly: AssemblyCopyright ("Copyright © 2014")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.3.0.1")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| using System.Reflection;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("appium-dotnet-driver")]
[assembly: AssemblyDescription ("Appium Dotnet Driver")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Appium Contributors")]
[assembly: AssemblyProduct ("Appium-Dotnet-Driver")]
[assembly: AssemblyCopyright ("Copyright © 2014")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.2.0.8")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| apache-2.0 | C# |
8446d8b8dedba9a89c6397e98cc5fc6d797ab597 | Fix to read in dlv attribute A correctly from xml --Signed-off-by Kathleen Oneal | ADAPT/ISOv4Plugin | ISOv4Plugin/ImportMappers/LogMappers/XmlReaders/DlvReader.cs | ISOv4Plugin/ImportMappers/LogMappers/XmlReaders/DlvReader.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
namespace AgGateway.ADAPT.ISOv4Plugin.ImportMappers.LogMappers.XmlReaders
{
public interface IDlvReader
{
IEnumerable<DLVHeader> Read(List<XElement> dlvElement);
}
public class DlvReader : IDlvReader
{
public IEnumerable<DLVHeader> Read(List<XElement> dlvElements)
{
if(dlvElements == null)
return null;
return dlvElements.Select(Read);
}
private DLVHeader Read(XElement dlvElement)
{
return new DLVHeader
{
ProcessDataDDI = GetProcessDataDdi(dlvElement),
ProcessDataValue = new HeaderProperty(dlvElement.Attribute("B")),
DeviceElementIdRef = new HeaderProperty(dlvElement.Attribute("C")),
DataLogPGN = new HeaderProperty(dlvElement.Attribute("D")),
DataLogPGNStartBit = new HeaderProperty(dlvElement.Attribute("E")),
DataLogPGNStopBit = new HeaderProperty(dlvElement.Attribute("F"))
};
}
private static HeaderProperty GetProcessDataDdi(XElement dlvElement)
{
if(dlvElement.Attribute("A") == null)
return new HeaderProperty{ State = HeaderPropertyState.IsNull };
var hexDdi = dlvElement.Attribute("A").Value;
var intDdi = int.Parse(hexDdi, System.Globalization.NumberStyles.HexNumber);
return new HeaderProperty { State = HeaderPropertyState.HasValue, Value = intDdi };
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
namespace AgGateway.ADAPT.ISOv4Plugin.ImportMappers.LogMappers.XmlReaders
{
public interface IDlvReader
{
IEnumerable<DLVHeader> Read(List<XElement> dlvElement);
}
public class DlvReader : IDlvReader
{
public IEnumerable<DLVHeader> Read(List<XElement> dlvElements)
{
if(dlvElements == null)
return null;
return dlvElements.Select(Read);
}
private DLVHeader Read(XElement dlvElement)
{
return new DLVHeader
{
ProcessDataDDI = GetProcessDataDdi(dlvElement),
ProcessDataValue = new HeaderProperty(dlvElement.Attribute("B")),
DeviceElementIdRef = new HeaderProperty(dlvElement.Attribute("C")),
DataLogPGN = new HeaderProperty(dlvElement.Attribute("D")),
DataLogPGNStartBit = new HeaderProperty(dlvElement.Attribute("E")),
DataLogPGNStopBit = new HeaderProperty(dlvElement.Attribute("F"))
};
}
private static HeaderProperty GetProcessDataDdi(XElement dlvElement)
{
if(dlvElement.Attribute("A") == null)
return new HeaderProperty{ State = HeaderPropertyState.IsNull };
var stringDdi = dlvElement.Attribute("A").Value;
var byteDdi = Convert.ToByte(stringDdi, 16);
var intDdi = Convert.ToInt32(byteDdi);
return new HeaderProperty { State = HeaderPropertyState.HasValue, Value = intDdi };
}
}
}
| epl-1.0 | C# |
72023606ff239d07092f661d5cba6cb4b7267b30 | Fix typo in exception message | gael-ltd/NEventStore | src/NEventStore/CommonDomain/Core/ExtensionMethods.cs | src/NEventStore/CommonDomain/Core/ExtensionMethods.cs | namespace CommonDomain.Core
{
using System.Globalization;
internal static class ExtensionMethods
{
public static string FormatWith(this string format, params object[] args)
{
return string.Format(CultureInfo.InvariantCulture, format ?? string.Empty, args);
}
public static void ThrowHandlerNotFound(this IAggregate aggregate, object eventMessage)
{
string exceptionMessage =
"Aggregate of type '{0}' raised an event of type '{1}' but no handler could be found to handle the message."
.FormatWith(aggregate.GetType().Name, eventMessage.GetType().Name);
throw new HandlerForDomainEventNotFoundException(exceptionMessage);
}
}
} | namespace CommonDomain.Core
{
using System.Globalization;
internal static class ExtensionMethods
{
public static string FormatWith(this string format, params object[] args)
{
return string.Format(CultureInfo.InvariantCulture, format ?? string.Empty, args);
}
public static void ThrowHandlerNotFound(this IAggregate aggregate, object eventMessage)
{
string exceptionMessage =
"Aggregate of type '{0}' raised an event of type '{1}' but not handler could be found to handle the message."
.FormatWith(aggregate.GetType().Name, eventMessage.GetType().Name);
throw new HandlerForDomainEventNotFoundException(exceptionMessage);
}
}
} | mit | C# |
848d422bd1865df4920504ece278eb2a628b12e2 | Make NegotiationToken public for manual check type (#141) | SteveSyfuhs/Kerberos.NET | Kerberos.NET/Entities/SpNego/NegotiateContextToken.cs | Kerberos.NET/Entities/SpNego/NegotiateContextToken.cs | using Kerberos.NET.Crypto;
using System;
namespace Kerberos.NET.Entities
{
public sealed class NegotiateContextToken : ContextToken
{
public NegotiateContextToken(GssApiToken gssToken)
{
// SPNego tokens optimistically include a token of the first MechType
// so if mechType[0] == Ntlm process as ntlm, == kerb process as kerb, etc.
Token = NegotiationToken.Decode(gssToken.Token);
}
public NegotiationToken Token { get; }
public override DecryptedKrbApReq DecryptApReq(KeyTable keys)
{
var mechToken = Token.InitialToken.MechToken;
var apReq = MessageParser.Parse<ContextToken>(mechToken.Value);
if (apReq is NegotiateContextToken)
{
throw new InvalidOperationException(
"Negotiated ContextToken is another negotiated token. Failing to prevent stack overflow."
);
}
return apReq.DecryptApReq(keys);
}
}
}
| using Kerberos.NET.Crypto;
using System;
namespace Kerberos.NET.Entities
{
public sealed class NegotiateContextToken : ContextToken
{
private readonly NegotiationToken token;
public NegotiateContextToken(GssApiToken gssToken)
{
// SPNego tokens optimistically include a token of the first MechType
// so if mechType[0] == Ntlm process as ntlm, == kerb process as kerb, etc.
token = NegotiationToken.Decode(gssToken.Token);
}
public override DecryptedKrbApReq DecryptApReq(KeyTable keys)
{
var mechToken = token.InitialToken.MechToken;
var apReq = MessageParser.Parse<ContextToken>(mechToken.Value);
if (apReq is NegotiateContextToken)
{
throw new InvalidOperationException(
"Negotiated ContextToken is another negotiated token. Failing to prevent stack overflow."
);
}
return apReq.DecryptApReq(keys);
}
}
}
| mit | C# |
3b32ff1a0ff754c6c8a59ef3a90202353564b1c0 | fix encoding of GlobalSuppressions | adamralph/xbehave.net,hitesh97/xbehave.net,xbehave/xbehave.net,mvalipour/xbehave.net,modulexcite/xbehave.net,modulexcite/xbehave.net,mvalipour/xbehave.net,hitesh97/xbehave.net | src/Xbehave.2.Execution.desktop/GlobalSuppressions.cs | src/Xbehave.2.Execution.desktop/GlobalSuppressions.cs | // <copyright file="GlobalSuppressions.cs" company="xBehave.net contributors">
// Copyright (c) xBehave.net contributors. All rights reserved.
// </copyright>
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
//
// To add a suppression to this file, right-click the message in the
// Code Analysis results, point to "Suppress Message", and click
// "In Suppression File".
// You do not need to add suppressions to this file manually.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "desktop", Justification = "Matching xunit casing.")]
| // <copyright file="GlobalSuppressions.cs" company="xBehave.net contributors">
// Copyright (c) xBehave.net contributors. All rights reserved.
// </copyright>
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
//
// To add a suppression to this file, right-click the message in the
// Code Analysis results, point to "Suppress Message", and click
// "In Suppression File".
// You do not need to add suppressions to this file manually.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "desktop", Justification = "Matching xunit casing.")]
| mit | C# |
4dc476313630b8563dd99063b36525d5092a9aa0 | Order elements | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/Behaviors/CheckMarkVisibilityBehavior.cs | WalletWasabi.Fluent/Behaviors/CheckMarkVisibilityBehavior.cs | using Avalonia;
using Avalonia.Controls;
using ReactiveUI;
using System;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Avalonia.Xaml.Interactivity;
namespace WalletWasabi.Fluent.Behaviors
{
public class CheckMarkVisibilityBehavior : Behavior<PathIcon>
{
private CompositeDisposable? _disposables;
public static readonly StyledProperty<TextBox> OwnerTextBoxProperty =
AvaloniaProperty.Register<CheckMarkVisibilityBehavior, TextBox>(nameof(OwnerTextBox));
[ResolveByName]
public TextBox OwnerTextBox
{
get => GetValue(OwnerTextBoxProperty);
set => SetValue(OwnerTextBoxProperty, value);
}
protected override void OnAttached()
{
this.WhenAnyValue(x => x.OwnerTextBox)
.Subscribe(
x =>
{
_disposables?.Dispose();
if (x != null)
{
_disposables = new CompositeDisposable();
var hasErrors = OwnerTextBox.GetObservable(DataValidationErrors.HasErrorsProperty);
var text = OwnerTextBox.GetObservable(TextBox.TextProperty);
hasErrors.Select(_ => Unit.Default)
.Merge(text.Select(_ => Unit.Default))
.Throttle(TimeSpan.FromMilliseconds(100))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(
_ =>
{
if (AssociatedObject is { })
{
AssociatedObject.Opacity =
!DataValidationErrors.GetHasErrors(OwnerTextBox) &&
!string.IsNullOrEmpty(OwnerTextBox.Text)
? 1
: 0;
}
})
.DisposeWith(_disposables);
}
});
}
}
} | using Avalonia;
using Avalonia.Controls;
using ReactiveUI;
using System;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Avalonia.Xaml.Interactivity;
namespace WalletWasabi.Fluent.Behaviors
{
public class CheckMarkVisibilityBehavior : Behavior<PathIcon>
{
public static readonly StyledProperty<TextBox> OwnerTextBoxProperty =
AvaloniaProperty.Register<CheckMarkVisibilityBehavior, TextBox>(nameof(OwnerTextBox));
[ResolveByName]
public TextBox OwnerTextBox
{
get => GetValue(OwnerTextBoxProperty);
set => SetValue(OwnerTextBoxProperty, value);
}
private CompositeDisposable? _disposables;
protected override void OnAttached()
{
this.WhenAnyValue(x => x.OwnerTextBox)
.Subscribe(
x =>
{
_disposables?.Dispose();
if (x != null)
{
_disposables = new CompositeDisposable();
var hasErrors = OwnerTextBox.GetObservable(DataValidationErrors.HasErrorsProperty);
var text = OwnerTextBox.GetObservable(TextBox.TextProperty);
hasErrors.Select(_ => Unit.Default)
.Merge(text.Select(_ => Unit.Default))
.Throttle(TimeSpan.FromMilliseconds(100))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(
_ =>
{
if (AssociatedObject is { })
{
AssociatedObject.Opacity =
!DataValidationErrors.GetHasErrors(OwnerTextBox) &&
!string.IsNullOrEmpty(OwnerTextBox.Text)
? 1
: 0;
}
})
.DisposeWith(_disposables);
}
});
}
}
} | mit | C# |
db4339dc552f02aa0330a6ed0480766f2887a889 | Change the switch to set/update key to "/newkey:" | IoTChinaTeam/PCSBingMapKeyManagerFX | Program.cs | Program.cs | using System;
using System.IO;
using System.Linq;
using System.Reflection;
namespace PCSBingMapKeyManager
{
class Program
{
private const string NewKeySwitch = "/newkey:";
static void Main(string[] args)
{
if (args.Length > 1 || args.Any() && !args[0].StartsWith(NewKeySwitch))
{
Usage();
return;
}
var manager = new BingMapKeyManager();
if (!args.Any())
{
var key = manager.GetAsync().Result;
if (string.IsNullOrEmpty(key))
{
Console.WriteLine("No bing map key set");
}
else
{
Console.WriteLine($"Bing map key = {key}");
}
Console.WriteLine($"\nHint: Use {NewKeySwitch}<key> to set or update the key");
}
else
{
var key = args[0].Substring(NewKeySwitch.Length);
if (manager.SetAsync(key).Result)
{
Console.WriteLine($"Bing map key set as '{key}'");
}
}
}
private static void Usage()
{
var entry = Path.GetFileName(Assembly.GetEntryAssembly().CodeBase);
Console.WriteLine($"Usage: {entry} [{NewKeySwitch}<new key>]");
}
}
}
| using System;
using System.IO;
using System.Linq;
using System.Reflection;
namespace PCSBingMapKeyManager
{
class Program
{
private const string NewKeySwitch = "/a:";
static void Main(string[] args)
{
if (args.Length > 1 || args.Any() && !args[0].StartsWith(NewKeySwitch))
{
Usage();
return;
}
var manager = new BingMapKeyManager();
if (!args.Any())
{
var key = manager.GetAsync().Result;
if (string.IsNullOrEmpty(key))
{
Console.WriteLine("No bing map key set");
}
else
{
Console.WriteLine($"Bing map key = {key}");
}
Console.WriteLine($"\nHint: Use {NewKeySwitch}<key> to set or update the key");
}
else
{
var key = args[0].Substring(NewKeySwitch.Length);
if (manager.SetAsync(key).Result)
{
Console.WriteLine($"Bing map key set as '{key}'");
}
}
}
private static void Usage()
{
var entry = Path.GetFileName(Assembly.GetEntryAssembly().CodeBase);
Console.WriteLine($"Usage: {entry} [{NewKeySwitch}<new key>]");
}
}
}
| mit | C# |
b55bb87980689006389c991144833a7f52e31608 | Update RegisterHandlersWithAutofac to only register types once | Lavinski/Enexure.MicroBus | src/Enexure.MicroBus.Autofac/ContainerExtensions.cs | src/Enexure.MicroBus.Autofac/ContainerExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
using Autofac;
namespace Enexure.MicroBus.Autofac
{
public static class ContainerExtensions
{
public static ContainerBuilder RegisterMicroBus(this ContainerBuilder containerBuilder, Func<IHandlerRegister, IHandlerRegister> registerHandlers)
{
return RegisterMicroBus(containerBuilder, registerHandlers, new BusSettings());
}
public static ContainerBuilder RegisterMicroBus(this ContainerBuilder containerBuilder, Func<IHandlerRegister, IHandlerRegister> registerHandlers, BusSettings busSettings)
{
var register = registerHandlers(new HandlerRegister());
var registrations = register.GetMessageRegistrations();
RegisterHandlersWithAutofac(containerBuilder, registrations);
var handlerProvider = HandlerProvider.Create(registrations);
containerBuilder.RegisterInstance(handlerProvider).As<IHandlerProvider>().SingleInstance();
containerBuilder.RegisterType<PipelineBuilder>().As<IPipelineBuilder>();
containerBuilder.RegisterType<AutofacDependencyResolver>().As<IDependencyResolver>();
containerBuilder.RegisterType<AutofacDependencyScope>().As<IDependencyScope>();
containerBuilder.RegisterType<MicroBus>().As<IMicroBus>();
containerBuilder.RegisterInstance(busSettings).AsSelf();
return containerBuilder;
}
public static void RegisterHandlersWithAutofac(ContainerBuilder containerBuilder, IReadOnlyCollection<MessageRegistration> registrations)
{
var handlers = registrations.Select(x => x.Handler).Distinct();
var piplelineHandlers = registrations.Select(x => x.Pipeline).Distinct().SelectMany(x => x).Distinct();
foreach (var handlerType in handlers) {
containerBuilder.RegisterType(handlerType).AsSelf().InstancePerLifetimeScope();
}
foreach (var piplelineHandler in piplelineHandlers) {
containerBuilder.RegisterType(piplelineHandler).AsSelf().AsImplementedInterfaces().InstancePerLifetimeScope();
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using Autofac;
namespace Enexure.MicroBus.Autofac
{
public static class ContainerExtensions
{
public static ContainerBuilder RegisterMicroBus(this ContainerBuilder containerBuilder,
Func<IHandlerRegister, IHandlerRegister> registerHandlers)
{
return RegisterMicroBus(containerBuilder, registerHandlers, new BusSettings());
}
public static ContainerBuilder RegisterMicroBus(this ContainerBuilder containerBuilder, Func<IHandlerRegister, IHandlerRegister> registerHandlers, BusSettings busSettings)
{
var register = registerHandlers(new HandlerRegister());
var registrations = register.GetMessageRegistrations();
RegisterHandlersWithAutofac(containerBuilder, registrations);
var handlerProvider = HandlerProvider.Create(registrations);
containerBuilder.RegisterInstance(handlerProvider).As<IHandlerProvider>().SingleInstance();
containerBuilder.RegisterType<PipelineBuilder>().As<IPipelineBuilder>();
containerBuilder.RegisterType<AutofacDependencyResolver>().As<IDependencyResolver>();
containerBuilder.RegisterType<AutofacDependencyScope>().As<IDependencyScope>();
containerBuilder.RegisterType<MicroBus>().As<IMicroBus>();
containerBuilder.RegisterInstance(busSettings).AsSelf();
return containerBuilder;
}
public static void RegisterHandlersWithAutofac(ContainerBuilder containerBuilder, IEnumerable<MessageRegistration> registrations)
{
var pipelines = new List<Pipeline>();
foreach (var registration in registrations) {
if (!pipelines.Contains(registration.Pipeline)) {
pipelines.Add(registration.Pipeline);
}
containerBuilder.RegisterType(registration.Handler).AsSelf().InstancePerLifetimeScope();
}
var piplelineHandlers = pipelines.SelectMany(x => x).Distinct();
foreach (var piplelineHandler in piplelineHandlers) {
containerBuilder.RegisterType(piplelineHandler).AsSelf().AsImplementedInterfaces().InstancePerLifetimeScope();
}
}
}
}
| mit | C# |
4448cb52e9a83ff4cf9450bfffd2b77dac3b59e8 | add setup and teardown for drone tests to fix unit tests | gep13/GitVersion,gep13/GitVersion,ermshiperete/GitVersion,ParticularLabs/GitVersion,ParticularLabs/GitVersion,asbjornu/GitVersion,GitTools/GitVersion,ermshiperete/GitVersion,asbjornu/GitVersion,dazinator/GitVersion,GitTools/GitVersion,ermshiperete/GitVersion,dazinator/GitVersion,ermshiperete/GitVersion | src/GitVersionCore.Tests/BuildServers/DroneTests.cs | src/GitVersionCore.Tests/BuildServers/DroneTests.cs | namespace GitVersionCore.Tests.BuildServers
{
using System;
using GitVersion;
using NUnit.Framework;
using Shouldly;
[TestFixture]
public class DroneTests : TestBase
{
[SetUp]
public void SetUp()
{
Environment.SetEnvironmentVariable("DRONE", "true");
}
[TearDown]
public void TearDown()
{
Environment.SetEnvironmentVariable("DRONE", null);
}
[Test]
public void CanApplyToCurrentContext_ShouldBeTrue_WhenEnvironmentVariableIsSet()
{
// Arrange
var buildServer = new Drone();
// Act
var result = buildServer.CanApplyToCurrentContext();
// Assert
result.ShouldBeTrue();
}
[Test]
public void CanApplyToCurrentContext_ShouldBeFalse_WhenEnvironmentVariableIsNotSet()
{
// Arrange
Environment.SetEnvironmentVariable("DRONE", "");
var buildServer = new Drone();
// Act
var result = buildServer.CanApplyToCurrentContext();
// Assert
result.ShouldBeFalse();
}
}
}
| namespace GitVersionCore.Tests.BuildServers
{
using System;
using GitVersion;
using NUnit.Framework;
using Shouldly;
[TestFixture]
public class DroneTests : TestBase
{
[Test]
public void CanApplyToCurrentContext_ShouldBeTrue_WhenEnvironmentVariableIsSet()
{
// Arrange
Environment.SetEnvironmentVariable("DRONE", "true");
var buildServer = new Drone();
// Act
var result = buildServer.CanApplyToCurrentContext();
// Assert
result.ShouldBeTrue();
}
[Test]
public void CanApplyToCurrentContext_ShouldBeFalse_WhenEnvironmentVariableIsNotSet()
{
// Arrange
Environment.SetEnvironmentVariable("DRONE", "");
var buildServer = new Drone();
// Act
var result = buildServer.CanApplyToCurrentContext();
// Assert
result.ShouldBeFalse();
}
}
}
| mit | C# |
2e2eee75f57f337204053e28b81bdc4b9559b2ee | Use NaturalStringComparer to compare titles | bra1nb3am3r/simpleDLNA,itamar82/simpleDLNA,antonio-bakula/simpleDLNA,nmaier/simpleDLNA | fsserver/Comparers/TitleComparer.cs | fsserver/Comparers/TitleComparer.cs | using System;
using System.Collections;
using NMaier.sdlna.Server;
using NMaier.sdlna.Util;
namespace NMaier.sdlna.FileMediaServer.Comparers
{
class TitleComparer : IItemComparer, IComparer
{
private static StringComparer comp = new NaturalStringComparer();
public virtual string Description
{
get { return "Sort alphabetically"; }
}
public virtual string Name
{
get { return "title"; }
}
public virtual int Compare(IMediaItem x, IMediaItem y)
{
return comp.Compare(x.Title, y.Title);
}
public int Compare(object x, object y)
{
return comp.Compare(x, y);
}
}
} | using NMaier.sdlna.Server;
namespace NMaier.sdlna.FileMediaServer.Comparers
{
class TitleComparer : IItemComparer
{
public virtual string Description
{
get { return "Sort alphabetically"; }
}
public virtual string Name
{
get { return "title"; }
}
public virtual int Compare(IMediaItem x, IMediaItem y)
{
return x.Title.ToLower().CompareTo(y.Title.ToLower());
}
}
} | bsd-2-clause | C# |
0aa73f7a6caae10c61481081dd24205c4b1a3412 | fix test fixture dispose order | andrewboudreau/Groceries.Boudreau.Cloud,andrewboudreau/Groceries.Boudreau.Cloud,andrewboudreau/Groceries.Boudreau.Cloud,andrewboudreau/Groceries.Boudreau.Cloud | test/Groceries.Boudreau.Cloud.Integration/TestServerFixture.cs | test/Groceries.Boudreau.Cloud.Integration/TestServerFixture.cs | namespace IntegrationTests
{
using System;
using System.Net.Http;
using System.IO;
using Microsoft.AspNetCore.TestHost;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.PlatformAbstractions;
/// <summary>
/// TestFixture for Creating and Destroying <see cref="Groceries.Boudreau.Cloud.Program"/> web server. Also provides an <see cref="HttpClient"/>.
/// </summary>
public class TestServerFixture : IDisposable
{
public TestServer TestServer { get; }
/// <summary>
/// HttpClient ready for integration testing <see cref="Groceries.Boudreau.Cloud.Program"/>.
/// </summary>
public HttpClient Client { get; }
public TestServerFixture()
{
var webAppContentRoot = Path.GetFullPath(Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "..", "..", "..", "..", "..", "src", "Groceries.Boudreau.Cloud.WebApp"));
var TestServer = new TestServer(new WebHostBuilder()
.UseEnvironment("Development")
.UseContentRoot(webAppContentRoot)
.UseStartup<Groceries.Boudreau.Cloud.Startup>());
Client = TestServer.CreateClient();
}
public void Dispose()
{
Client.Dispose();
TestServer.Dispose();
}
}
}
| namespace IntegrationTests
{
using System;
using System.Net.Http;
using System.IO;
using Microsoft.AspNetCore.TestHost;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.PlatformAbstractions;
/// <summary>
/// TestFixture for Creating and Destroying <see cref="Groceries.Boudreau.Cloud.Program"/> web server. Also provides an <see cref="HttpClient"/>.
/// </summary>
public class TestServerFixture : IDisposable
{
public TestServer TestServer { get; }
/// <summary>
/// HttpClient ready for integration testing <see cref="Groceries.Boudreau.Cloud.Program"/>.
/// </summary>
public HttpClient Client { get; }
public TestServerFixture()
{
var webAppContentRoot = Path.GetFullPath(Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "..", "..", "..", "..", "..", "src", "Groceries.Boudreau.Cloud.WebApp"));
var TestServer = new TestServer(new WebHostBuilder()
.UseEnvironment("Development")
.UseContentRoot(webAppContentRoot)
.UseStartup<Groceries.Boudreau.Cloud.Startup>());
Client = TestServer.CreateClient();
}
public void Dispose()
{
TestServer.Dispose();
Client.Dispose();
}
}
}
| mit | C# |
a824a1d969958191ad98200b6ca3425018eadb20 | Remove unused variable. | jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000 | binder/Generators/ObjC/ObjCGenerator.cs | binder/Generators/ObjC/ObjCGenerator.cs | using System;
using System.Collections.Generic;
using System.Linq;
using CppSharp.AST;
using CppSharp.Generators;
namespace MonoEmbeddinator4000.Generators
{
public class ObjCGenerator : CGenerator
{
public ObjCGenerator(BindingContext context)
: base(context)
{
}
public override List<CodeGenerator> Generate(IEnumerable<TranslationUnit> units)
{
var unit = units.First();
var headers = new ObjCHeaders(Context, unit);
var sources = new ObjCSources(Context, unit);
return new List<CodeGenerator> { headers, sources };
}
}
public static class ObjCExtensions
{
public static void GenerateObjCMethodSignature(this CCodeGenerator gen,
Method method)
{
gen.Write("{0}", method.IsStatic ? "+" : "-");
var retType = method.ReturnType.Visit(gen.CTypePrinter);
gen.Write(" ({0}){1}", retType, method.Name);
gen.Write(gen.CTypePrinter.VisitParameters(method.Parameters));
}
public static string GetObjCAccessKeyword(AccessSpecifier access)
{
switch (access)
{
case AccessSpecifier.Private:
return "@private";
case AccessSpecifier.Protected:
return "@protected";
case AccessSpecifier.Public:
return "@public";
case AccessSpecifier.Internal:
throw new Exception($"Unmappable Objective-C access specifier: {access}");
}
throw new NotSupportedException();
}
public static bool GenerateObjCField(this CCodeGenerator gen, Field field)
{
gen.WriteLine($"{GetObjCAccessKeyword(field.Access)} {field.Type} {field.Name};");
return true;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using CppSharp.AST;
using CppSharp.Generators;
namespace MonoEmbeddinator4000.Generators
{
public class ObjCGenerator : CGenerator
{
public ObjCGenerator(BindingContext context)
: base(context)
{
}
public override List<CodeGenerator> Generate(IEnumerable<TranslationUnit> units)
{
var unit = units.First();
var headers = new ObjCHeaders(Context, unit);
var sources = new ObjCSources(Context, unit);
return new List<CodeGenerator> { headers, sources };
}
}
public static class ObjCExtensions
{
public static void GenerateObjCMethodSignature(this CCodeGenerator gen,
Method method)
{
var @class = method.Namespace as Class;
var retType = method.ReturnType.Visit(gen.CTypePrinter);
gen.Write("{0}", method.IsStatic ? "+" : "-");
gen.Write(" ({0}){1}", retType, method.Name);
gen.Write(gen.CTypePrinter.VisitParameters(method.Parameters));
}
public static string GetObjCAccessKeyword(AccessSpecifier access)
{
switch (access)
{
case AccessSpecifier.Private:
return "@private";
case AccessSpecifier.Protected:
return "@protected";
case AccessSpecifier.Public:
return "@public";
case AccessSpecifier.Internal:
throw new Exception($"Unmappable Objective-C access specifier: {access}");
}
throw new NotSupportedException();
}
public static bool GenerateObjCField(this CCodeGenerator gen, Field field)
{
gen.WriteLine($"{GetObjCAccessKeyword(field.Access)} {field.Type} {field.Name};");
return true;
}
}
}
| mit | C# |
e66581f5501d9baf8f0102ec9e0f0f43af07d2a6 | Fix DelayablePathfinderAction | Arkhist/Hacknet-Pathfinder,Arkhist/Hacknet-Pathfinder,Arkhist/Hacknet-Pathfinder,Arkhist/Hacknet-Pathfinder | PathfinderAPI/Action/DelayablePathfinderAction.cs | PathfinderAPI/Action/DelayablePathfinderAction.cs | using System;
using System.Xml;
using Hacknet;
using Pathfinder.Util;
using Pathfinder.Util.XML;
namespace Pathfinder.Action
{
public abstract class DelayablePathfinderAction : PathfinderAction
{
[XMLStorage]
public string DelayHost;
[XMLStorage]
public string Delay;
private DelayableActionSystem delayHost;
private float delay = 0f;
public sealed override void Trigger(object os_obj)
{
if (delayHost == null && DelayHost != null)
{
var delayComp = Programs.getComputer(OS.currentInstance, DelayHost);
if (delayComp == null)
throw new FormatException($"{this.GetType().Name}: DelayHost could not be found");
delayHost = DelayableActionSystem.FindDelayableActionSystemOnComputer(delayComp);
}
if (delay <= 0f || delayHost == null)
{
Trigger((OS)os_obj);
return;
}
delayHost.AddAction(this, delay);
delay = 0f;
}
public abstract void Trigger(OS os);
public override void LoadFromXml(ElementInfo info)
{
base.LoadFromXml(info);
if (Delay != null && !float.TryParse(Delay, out delay))
throw new FormatException($"{this.GetType().Name}: Couldn't parse delay time!");
}
}
}
| using System;
using System.Xml;
using Hacknet;
using Pathfinder.Util;
using Pathfinder.Util.XML;
namespace Pathfinder.Action
{
public abstract class DelayablePathfinderAction : PathfinderAction
{
[XMLStorage]
public string DelayHost;
[XMLStorage]
public string Delay;
private DelayableActionSystem delayHost;
private float delay = 0f;
public sealed override void Trigger(object os_obj)
{
if (delay <= 0f || delayHost == null)
{
Trigger((OS)os_obj);
return;
}
delayHost.AddAction(this, delay);
delay = 0f;
}
public abstract void Trigger(OS os);
public override void LoadFromXml(ElementInfo info)
{
base.LoadFromXml(info);
if (Delay != null && !float.TryParse(Delay, out delay))
throw new FormatException($"{this.GetType().Name}: Couldn't parse delay time!");
if (DelayHost != null)
{
var delayComp = Programs.getComputer(OS.currentInstance, DelayHost);
if (delayComp == null)
throw new FormatException($"{this.GetType().Name}: DelayHost could not be found");
delayHost = DelayableActionSystem.FindDelayableActionSystemOnComputer(delayComp);
}
}
}
}
| mit | C# |
63ce82888d4691818d9dc63447f4d5ad3db44f2f | Make IEnumerable.IsNullOrEmpty extension method generic | roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University | R7.University/ModelExtensions/EnumerableExtensions.cs | R7.University/ModelExtensions/EnumerableExtensions.cs | //
// EnumerableExtensions.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2016 Roman M. Yagodin
//
// This program 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/>.
using System.Collections.Generic;
using System.Linq;
namespace R7.University.ModelExtensions
{
public static class EnumerableExtensions
{
// TODO: Move to the base library
public static bool IsNullOrEmpty<T> (this IEnumerable<T> enumerable)
{
return enumerable == null || !enumerable.Any ();
}
}
}
| //
// EnumerableExtensions.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2016 Roman M. Yagodin
//
// This program 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/>.
using System.Collections.Generic;
using System.Linq;
namespace R7.University.ModelExtensions
{
public static class EnumerableExtensions
{
public static bool IsNullOrEmpty (this IEnumerable<object> enumerable)
{
return enumerable == null || !enumerable.Any ();
}
}
}
| agpl-3.0 | C# |
3d67e7f4df9aa63071824e667cc48c43fe08643e | Simplify ThreadSafeLong.Add() | andrasm/prometheus-net | Prometheus.NetStandard/Advanced/ThreadSafeLong.cs | Prometheus.NetStandard/Advanced/ThreadSafeLong.cs | using System.Threading;
namespace Prometheus.Advanced
{
public struct ThreadSafeLong
{
private long _value;
public ThreadSafeLong(long value)
{
_value = value;
}
public long Value
{
get
{
return Interlocked.Read(ref _value);
}
set
{
Interlocked.Exchange(ref _value, value);
}
}
public void Add(long increment)
{
Interlocked.Add(ref _value, increment);
}
public override string ToString()
{
return Value.ToString();
}
public override bool Equals(object obj)
{
if (obj is ThreadSafeLong)
return Value.Equals(((ThreadSafeLong)obj).Value);
return Value.Equals(obj);
}
public override int GetHashCode()
{
return Value.GetHashCode();
}
}
}
| using System.Threading;
namespace Prometheus.Advanced
{
public struct ThreadSafeLong
{
private long _value;
public ThreadSafeLong(long value)
{
_value = value;
}
public long Value
{
get
{
return Interlocked.Read(ref _value);
}
set
{
Interlocked.Exchange(ref _value, value);
}
}
public void Add(long increment)
{
while (true)
{
long initialValue = _value;
long computedValue = initialValue + increment;
//Compare exchange will only set the computed value if it is equal to the expected value
//It will always return the the value of _value prior to the exchange (whether it happens or not)
//So, only exit the loop if the value was what we expected it to be (initialValue) at the time of exchange otherwise another thread updated and we need to try again.
if (initialValue == Interlocked.CompareExchange(ref _value, computedValue, initialValue))
return;
}
}
public override string ToString()
{
return Value.ToString();
}
public override bool Equals(object obj)
{
if (obj is ThreadSafeLong)
return Value.Equals(((ThreadSafeLong)obj).Value);
return Value.Equals(obj);
}
public override int GetHashCode()
{
return Value.GetHashCode();
}
}
}
| mit | C# |
80046d8c49a37739f1486134fc9a226dc0efe098 | Fix assembly title and product. | CamTechConsultants/CvsntGitImporter | 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("CvsntGitImporter")]
[assembly: AssemblyDescription("CVSNT to Git Importer")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cambridge Technology Consultants")]
[assembly: AssemblyProduct("CvsntGitImporter")]
[assembly: AssemblyCopyright("Copyright © 2013 Cambridge Technology Consultants Ltd.")]
[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("ec661d49-de7f-45ce-85a6-e1b2319499f4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: InternalsVisibleTo("CvsntGitImporterTest")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] | 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("CvsntGitConverter")]
[assembly: AssemblyDescription("CVSNT to Git Importer")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cambridge Technology Consultants")]
[assembly: AssemblyProduct("CvsntGitConverter")]
[assembly: AssemblyCopyright("Copyright © 2013 Cambridge Technology Consultants Ltd.")]
[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("ec661d49-de7f-45ce-85a6-e1b2319499f4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: InternalsVisibleTo("CvsntGitImporterTest")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] | mit | C# |
4aa47f54aaebafe701de9912031282fafce9d1c4 | Revert "git files" | bpfz/SharprWowApi | SharprWowApi/Models/Character/CharacterPVPBrackets.cs | SharprWowApi/Models/Character/CharacterPVPBrackets.cs | using Newtonsoft.Json;
namespace SharprWowApi.Models.Character
{
public class CharacterPVPBrackets
{
[JsonProperty("Arena_Bracket_2v2")]
public ArenaBracket ArenaBracket2v2 { get; set; }
[JsonProperty("Arena_Bracket_3v3")]
public ArenaBracket ArenaBracket3v3 { get; set; }
[JsonProperty("Arena_Bracket_5v5")]
public ArenaBracket ArenaBracket5v5 { get; set; }
[JsonProperty("Arena_Bracket_RBG")]
public ArenaBracket ArenaBracketRBG { get; set; }
}
}
| using Newtonsoft.Json;
namespace SharprWowApi.Models.Character
{
public class CharacterPVPBrackets
{
[JsonProperty("Arena_Bracket_2v2")]
public ArenaBracket ArenaBracket2v2 { get; set; }
[JsonProperty("Arena_Bracket_3v3")]
public ArenaBracket ArenaBracket3v3 { get; set; }
[JsonProperty("Arena_Bracket_RBG")]
public ArenaBracket ArenaBracketRBG { get; set; }
}
}
| unlicense | C# |
74fc35bfe2285e7614bc63cf6aa835c7ffa9bbae | update Header | csyntax/BlogSystem | Source/BlogSystem.Web/Views/Shared/_Header.cshtml | Source/BlogSystem.Web/Views/Shared/_Header.cshtml | <header>
<div class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="@Url.Action("Index", "Home", new { area = string.Empty })" class="navbar-brand">
@ViewBag.Settings["Title"]
</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
@{
Html.RenderAction("Menu", "Nav");
}
<li class="dropdown">
@{
Html.RenderAction("AdminMenu", "Nav");
}
</li>
</ul>
</div>
</div>
</div>
</header> | @using BlogSystem.Common
<header>
<div class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="@Url.Action("Index", "Home", new { area = string.Empty })" class="navbar-brand">
@ViewBag.Settings["Title"]
</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
@{
Html.RenderAction("Menu", "Nav");
}
<li class="dropdown">
@{
Html.RenderAction("AdminMenu", "Nav");
}
</li>
</ul>
</div>
</div>
</div>
</header> | mit | C# |
76dd525adad1f3ae5fa263b873e96f1b5cfa4350 | Bump version to 2.4.0 | Coding-Enthusiast/Watch-Only-Bitcoin-Wallet | WatchOnlyBitcoinWallet/Properties/AssemblyInfo.cs | WatchOnlyBitcoinWallet/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WatchOnlyBitcoinWallet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Coding Enthusiast Coders")]
[assembly: AssemblyProduct("WatchOnlyBitcoinWallet")]
[assembly: AssemblyCopyright("Copyright © C.E. 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.0.*")]
[assembly: AssemblyFileVersion("2.4.0.0")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WatchOnlyBitcoinWallet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Coding Enthusiast Coders")]
[assembly: AssemblyProduct("WatchOnlyBitcoinWallet")]
[assembly: AssemblyCopyright("Copyright © C.E. 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.0.*")]
[assembly: AssemblyFileVersion("2.3.0.0")]
| mit | C# |
b98d7460df93ccce345965753df882b74d4468a0 | Update ShapesContainerRenderView.cs | wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D | src/Draw2D.Wpf/Controls/ShapesContainerRenderView.cs | src/Draw2D.Wpf/Controls/ShapesContainerRenderView.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 System.Windows.Controls;
using System.Windows.Media;
using Draw2D.Core.ViewModels.Containers;
namespace Draw2D.Wpf.Controls
{
public class ShapesContainerRenderView : Canvas
{
private bool _drawWorking = false;
protected override void OnMouseEnter(MouseEventArgs e)
{
base.OnMouseEnter(e);
_drawWorking = true;
this.InvalidateVisual();
}
protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
_drawWorking = false;
this.InvalidateVisual();
}
protected override void OnRender(DrawingContext dc)
{
base.OnRender(dc);
if (this.DataContext is ShapesContainerViewModel vm)
{
vm.Presenter.DrawContent(dc, vm);
if (_drawWorking)
{
vm.Presenter.DrawWorking(dc, vm);
}
vm.Presenter.DrawHelpers(dc, vm);
}
}
}
}
| // 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 System.Windows.Controls;
using System.Windows.Media;
using Draw2D.Core.ViewModels.Containers;
namespace Draw2D.Wpf.Controls
{
public class ShapesContainerRenderView : Canvas
{
protected override void OnRender(DrawingContext dc)
{
base.OnRender(dc);
if (this.DataContext is ShapesContainerViewModel vm)
{
vm.Presenter.Draw(dc, vm);
vm.Presenter.DrawHelpers(dc, vm);
}
}
}
}
| mit | C# |
69b6c40e74eb69523c94e794fc71dbed5169e38e | Update Response.Redirect in PreferredDomainMiddleware #130 | FanrayMedia/Fanray,FanrayMedia/Fanray,FanrayMedia/Fanray | src/Fan.Web/Middlewares/PreferredDomainMiddleware.cs | src/Fan.Web/Middlewares/PreferredDomainMiddleware.cs | using Fan.Settings;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Threading.Tasks;
namespace Fan.Web.Middlewares
{
/// <summary>
/// A middleware that does preferred domain URL forward based on user option in <see cref="AppSettings.PreferredDomain"/>.
/// </summary>
/// <remarks>
/// It does a 301 permanent redirect as recommended by Google for preferred domain https://support.google.com/webmasters/answer/44231
/// </remarks>
public class PreferredDomainMiddleware
{
private readonly RequestDelegate _next;
private ILogger<PreferredDomainMiddleware> _logger;
/// <summary>
/// Initializes the PreferredDomainMiddleware.
/// </summary>
/// <param name="next"></param>
/// <param name="loggerFactory"></param>
public PreferredDomainMiddleware(RequestDelegate next, ILoggerFactory loggerFactory)
{
_next = next ?? throw new ArgumentNullException(nameof(next));
_logger = loggerFactory.CreateLogger<PreferredDomainMiddleware>();
}
/// <summary>
/// Invokes the PreferredDomainMiddleware.
/// </summary>
/// <param name="context">The http context.</param>
/// <param name="settings"><see cref="AppSettings"/></param>
/// <param name="rewriter"><see cref="IPreferredDomainRewriter"/></param>
/// <returns></returns>
public Task Invoke(HttpContext context, IOptionsSnapshot<AppSettings> settings, IPreferredDomainRewriter rewriter)
{
var url = rewriter.Rewrite(context.Request, settings.Value.PreferredDomain);
if (url == null)
{
// no rewrite is needed
return _next(context);
}
_logger.LogInformation("RewriteUrl: {@RewriteUrl}", url);
//context.Response.Headers[HeaderNames.Location] = url;
//context.Response.StatusCode = StatusCodes.Status301MovedPermanently;
context.Response.Redirect(url, permanent: true);
return Task.CompletedTask;
}
}
} | using Fan.Settings;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Net.Http.Headers;
using System;
using System.Threading.Tasks;
namespace Fan.Web.Middlewares
{
/// <summary>
/// A middleware that does preferred domain URL forward based on user option in <see cref="AppSettings.PreferredDomain"/>.
/// </summary>
/// <remarks>
/// It does a 301 permanent redirect as recommended by Google for preferred domain https://support.google.com/webmasters/answer/44231
/// </remarks>
public class PreferredDomainMiddleware
{
private readonly RequestDelegate _next;
private ILogger<PreferredDomainMiddleware> _logger;
/// <summary>
/// Initializes the PreferredDomainMiddleware.
/// </summary>
/// <param name="next"></param>
/// <param name="loggerFactory"></param>
public PreferredDomainMiddleware(RequestDelegate next, ILoggerFactory loggerFactory)
{
_next = next ?? throw new ArgumentNullException(nameof(next));
_logger = loggerFactory.CreateLogger<PreferredDomainMiddleware>();
}
/// <summary>
/// Invokes the PreferredDomainMiddleware.
/// </summary>
/// <param name="context">The http context.</param>
/// <param name="settings"><see cref="AppSettings"/></param>
/// <param name="rewriter"><see cref="IPreferredDomainRewriter"/></param>
/// <returns></returns>
public Task Invoke(HttpContext context, IOptionsSnapshot<AppSettings> settings, IPreferredDomainRewriter rewriter)
{
var url = rewriter.Rewrite(context.Request, settings.Value.PreferredDomain);
if (url == null)
{
// no rewrite is needed
return _next(context);
}
_logger.LogInformation("RewriteUrl: {@RewriteUrl}", url);
context.Response.Headers[HeaderNames.Location] = url;
context.Response.StatusCode = 301;
return Task.CompletedTask;
}
}
} | apache-2.0 | C# |
7dbfa296d4c716cc67e7563e23899a86c6d34bed | remove space | SneakyPeet/Fletcher | src/Fletcher.IntegrationTests/TestHelpers/Constants.cs | src/Fletcher.IntegrationTests/TestHelpers/Constants.cs | namespace Fletcher.IntegrationTests.TestHelpers
{
public class Constants
{
public const string SqlCeDatabaseFileName = "FletcherIntegration.db";
public const string SqlCeConnectionString = "Data Source = " + SqlCeDatabaseFileName + ";Version=3;";
public const string ProductsTableName = "[Products]";
}
} | namespace Fletcher.IntegrationTests.TestHelpers
{
public class Constants
{
public const string SqlCeDatabaseFileName = "FletcherIntegration.db";
public const string SqlCeConnectionString = "Data Source = " + SqlCeDatabaseFileName + ";Version=3;";
public const string ProductsTableName = "[Products]";
}
} | mit | C# |
49a069f2210c776e75c1e9e3d94323612b36e426 | Clean and summary | jamesmontemagno/GeolocatorPlugin,jamesmontemagno/GeolocatorPlugin | src/Geolocator.Plugin.Abstractions/Address.cs | src/Geolocator.Plugin.Abstractions/Address.cs | using System;
namespace Plugin.Geolocator.Abstractions
{
public class Address
{
public Address()
{
}
public Address(Address address)
{
if (address == null)
throw new ArgumentNullException(nameof(address));
CountryCode = address.CountryCode;
CountryName = address.CountryName;
Latitude = address.Latitude;
Longitude = address.Longitude;
FeatureName = address.FeatureName;
PostalCode = address.PostalCode;
SubLocality = address.SubLocality;
Thoroughfare = address.Thoroughfare;
SubThoroughfare = address.SubThoroughfare;
}
/// <summary>
/// Gets or sets the latitude.
/// </summary>
public double Latitude { get; set; }
/// <summary>
/// Gets or sets the longitude.
/// </summary>
public double Longitude { get; set; }
/// <summary>
/// Gets or sets the country ISO code.
/// </summary>
public string CountryCode { get; set; }
/// <summary>
/// Gets or sets the country name.
/// </summary>
public string CountryName { get; set; }
/// <summary>
/// Gets or sets a featured name.
/// </summary>
public string FeatureName { get; set; }
/// <summary>
/// Gets or sets a postal code.
/// </summary>
public string PostalCode { get; set; }
/// <summary>
/// Gets or sets a sub locality.
/// </summary>
public string SubLocality { get; set; }
/// <summary>
/// Gets or sets a street name.
/// </summary>
public string Thoroughfare { get; set; }
/// <summary>
/// Gets or sets optional info: sub street or region.
/// </summary>
public string SubThoroughfare { get; set; }
/// <summary>
/// Gets or sets a city/town.
/// </summary>
public string Locality { get; set; }
}
}
|
//
// Copyright 2011-2013, Xamarin Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
namespace Plugin.Geolocator.Abstractions
{
public class Address
{
public Address()
{
}
public Address(Address address)
{
if (address == null)
throw new ArgumentNullException("address");
CountryCode = address.CountryCode;
CountryName = address.CountryName;
Latitude = address.Latitude;
Longitude = address.Longitude;
FeatureName = address.FeatureName;
PostalCode = address.PostalCode;
SubLocality = address.SubLocality;
Thoroughfare = address.Thoroughfare;
SubThoroughfare = address.SubThoroughfare;
}
/// <summary>
/// Gets or sets the latitude.
/// </summary>
public double Latitude { get; set; }
/// <summary>
/// Gets or sets the longitude.
/// </summary>
public double Longitude { get; set; }
/// <summary>
/// Gets or sets the latitude.
/// </summary>
public string CountryCode { get; set; }
/// <summary>
/// Gets or sets the longitude.
/// </summary>
public string CountryName { get; set; }
public string FeatureName { get; set; }
public string PostalCode { get; set; }
public string SubLocality { get; set; }
public string Thoroughfare { get; set; }
public string SubThoroughfare { get; set; }
public string Locality { get; set; }
}
}
| mit | C# |
45bbca0381fdc6612047b2b8e86426d1ca8316ac | Update MarkdownSnippets API to use new DirectoryMarkdownProcessor | SeanFeldman/ServiceBus.AttachmentPlugin | src/ServiceBus.AttachmentPlugin.Tests/DocoUpdater.cs | src/ServiceBus.AttachmentPlugin.Tests/DocoUpdater.cs | using MarkdownSnippets;
using Xunit;
public class DocoUpdater
{
[Fact]
public void Run()
{
DirectoryMarkdownProcessor.RunForFilePath();
}
} | using MarkdownSnippets;
using Xunit;
public class DocoUpdater
{
[Fact]
public void Run()
{
GitHubMarkdownProcessor.RunForFilePath();
}
} | mit | C# |
7a593e76c688359c76703dedcf24e834186dfaa9 | Build fixed. | Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex | src/Squidex.Infrastructure/Orleans/GrainBootstrap.cs | src/Squidex.Infrastructure/Orleans/GrainBootstrap.cs | // ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Orleans;
using Orleans.Runtime;
namespace Squidex.Infrastructure.Orleans
{
public sealed class GrainBootstrap<T> : IBackgroundProcess where T : IBackgroundGrain
{
private const int NumTries = 10;
private readonly IGrainFactory grainFactory;
public GrainBootstrap(IGrainFactory grainFactory)
{
Guard.NotNull(grainFactory, nameof(grainFactory));
this.grainFactory = grainFactory;
}
public async Task StartAsync(CancellationToken ct = default)
{
for (var i = 1; i <= NumTries; i++)
{
try
{
var grain = grainFactory.GetGrain<T>(SingleGrain.Id);
await grain.ActivateAsync();
return;
}
catch (OrleansException)
{
if (i == NumTries)
{
throw;
}
}
}
}
}
}
| // ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Threading;
using System.Threading.Tasks;
using Orleans;
using Orleans.Runtime;
namespace Squidex.Infrastructure.Orleans
{
public sealed class GrainBootstrap<T> : IBackgroundProcess where T : IBackgroundGrain
{
private const int NumTries = 10;
private readonly IGrainFactory grainFactory;
public GrainBootstrap(IGrainFactory grainFactory)
{
Guard.NotNull(grainFactory, nameof(grainFactory));
this.grainFactory = grainFactory;
}
public async Task StartAsync(CancellationToken ct = CancellationToken.None)
{
for (var i = 1; i <= NumTries; i++)
{
try
{
var grain = grainFactory.GetGrain<T>(SingleGrain.Id);
await grain.ActivateAsync();
return;
}
catch (OrleansException)
{
if (i == NumTries)
{
throw;
}
}
}
}
}
}
| mit | C# |
0c2e4ca31b35533c427dc106e24db157d5ee9ed2 | Change Function.Arguments from IList to IEnumerable | modulexcite/dotless,NickCraver/dotless,modulexcite/dotless,NickCraver/dotless,modulexcite/dotless,dotless/dotless,rytmis/dotless,r2i-sitecore/dotless,modulexcite/dotless,NickCraver/dotless,r2i-sitecore/dotless,modulexcite/dotless,r2i-sitecore/dotless,rytmis/dotless,rytmis/dotless,r2i-sitecore/dotless,rytmis/dotless,dotless/dotless,modulexcite/dotless,r2i-sitecore/dotless,rytmis/dotless,r2i-sitecore/dotless,rytmis/dotless,modulexcite/dotless,r2i-sitecore/dotless,rytmis/dotless,NickCraver/dotless | src/dotless.Core/engine/LessNodes/Literals/Function.cs | src/dotless.Core/engine/LessNodes/Literals/Function.cs | /* Copyright 2009 dotless project, http://www.dotlesscss.com
*
* 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 System.Linq;
using System.Reflection;
using dotless.Core.engine.Functions;
using dotless.Core.utils;
namespace dotless.Core.engine
{
using System.Collections.Generic;
using System.Text;
public class Function : Literal, IEvaluatable
{
public IEnumerable<INode> Args { get; set; }
public Function(string value, IEnumerable<INode> args)
: base(value)
{
Args = args;
}
public override string ToCss()
{
return Evaluate().ToCss();
}
public INode Evaluate()
{
Type functionType = Type.GetType("dotless.Core.engine.Functions." + Value + "Function", false, true);
if(functionType == null)
{
return new Literal(string.Format("{0}({1})", Value.ToUpper(), ArgsString));
}
var function = (FunctionBase)Activator.CreateInstance(functionType);
var args = Args
.Select(a => a is IEvaluatable ? (a as IEvaluatable).Evaluate() : a)
.ToArray();
function.SetArguments(args);
function.Name = Value.ToLowerInvariant();
return function.Evaluate();
}
protected string ArgsString
{
get
{
return string.Join(", ", Args.Select(arg => arg.ToCss()).ToArray());
}
}
public override INode AdoptClone(INode newParent)
{
var clone = (Function) base.AdoptClone(newParent);
clone.Args = Args.Select(a => a.AdoptClone(newParent)).ToList();
return clone;
}
}
} | /* Copyright 2009 dotless project, http://www.dotlesscss.com
*
* 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 System.Linq;
using System.Reflection;
using dotless.Core.engine.Functions;
using dotless.Core.utils;
namespace dotless.Core.engine
{
using System.Collections.Generic;
using System.Text;
public class Function : Literal, IEvaluatable
{
public IList<INode> Args
{
get; set;
}
public Function(string value, IList<INode> args)
: base(value)
{
Args = args;
}
public override string ToCss()
{
return Evaluate().ToCss();
}
public INode Evaluate()
{
Type functionType = Type.GetType("dotless.Core.engine.Functions." + Value + "Function", false, true);
if(functionType == null)
{
return new Literal(string.Format("{0}({1})", Value.ToUpper(), ArgsString));
}
var function = (FunctionBase)Activator.CreateInstance(functionType);
var args = Args
.Select(a => a is IEvaluatable ? (a as IEvaluatable).Evaluate() : a)
.ToArray();
function.SetArguments(args);
function.Name = Value.ToLowerInvariant();
return function.Evaluate();
}
protected string ArgsString
{
get
{
return string.Join(", ", Args.Select(arg => arg.ToCss()).ToArray());
}
}
public override INode AdoptClone(INode newParent)
{
var clone = (Function) base.AdoptClone(newParent);
clone.Args = Args.Select(a => a.AdoptClone(newParent)).ToList();
return clone;
}
}
} | apache-2.0 | C# |
39efd5830a170eeb44d5ab5f9c01f3b9f23dba33 | Return result when dispatch a command | Vtek/Bartender | test/Bartender.Tests/AsyncCommandDispatcherTests.cs | test/Bartender.Tests/AsyncCommandDispatcherTests.cs | using Bartender.Tests.Context;
using Moq;
using Shouldly;
using Xunit;
namespace Bartender.Tests
{
public class AsyncCommandDispatcherTests : DispatcherTests
{
[Fact]
public async void ShouldHandleCommandOnce_WhenCallDispatchAsyncMethod()
{
await AsyncCommandDispatcher.DispatchAsync<Command, Result>(Command);
MockedAsyncCommandHandler.Verify(x => x.HandleAsync(It.IsAny<Command>()), Times.Once);
}
[Fact]
public async void ShouldHandleCommandOnce_WhenCallDispatchAsyncMethodWithoutResult()
{
await AsyncCommandDispatcher.DispatchAsync<Command>(Command);
MockedAsyncCommandWithoutResultHandler.Verify(x => x.HandleAsync(It.IsAny<Command>()), Times.Once);
}
[Fact]
public async void ShouldReturnResult_WhenCallDispatchMethod()
{
var result = await AsyncCommandDispatcher.DispatchAsync<Command, Result>(Command);
result.ShouldBeSameAs(Result);
}
}
} | using Bartender.Tests.Context;
using Moq;
using Xunit;
namespace Bartender.Tests
{
public class AsyncCommandDispatcherTests : DispatcherTests
{
[Fact]
public async void ShouldHandleCommandOnce_WhenCallDispatchAsyncMethod()
{
await AsyncCommandDispatcher.DispatchAsync<Command, Result>(Command);
MockedAsyncCommandHandler.Verify(x => x.HandleAsync(It.IsAny<Command>()), Times.Once);
}
[Fact]
public async void ShouldHandleCommandOnce_WhenCallDispatchAsyncMethodWithoutResult()
{
await AsyncCommandDispatcher.DispatchAsync<Command>(Command);
MockedAsyncCommandWithoutResultHandler.Verify(x => x.HandleAsync(It.IsAny<Command>()), Times.Once);
}
}
} | mit | C# |
534617e98e382ca7b9dd8638818c9db5a94268f5 | Add TermsConditionOfText property to ComponentScopeXPathBuilder | YevgeniyShunevych/Atata,atata-framework/atata,atata-framework/atata,YevgeniyShunevych/Atata | src/Atata/ScopeSearch/ComponentScopeXPathBuilder.cs | src/Atata/ScopeSearch/ComponentScopeXPathBuilder.cs | using System;
namespace Atata
{
public class ComponentScopeXPathBuilder : XPathBuilder<ComponentScopeXPathBuilder>
{
public ComponentScopeXPathBuilder(ComponentScopeLocateOptions options)
{
Options = options;
}
public ComponentScopeLocateOptions Options { get; private set; }
public ComponentScopeXPathBuilder OuterXPath
{
get { return Options.OuterXPath != null ? _(Options.OuterXPath) : Descendant; }
}
public ComponentScopeXPathBuilder ComponentXPath
{
get { return _(Options.ElementXPath); }
}
public ComponentScopeXPathBuilder TermsConditionOfContent
{
get { return _(Options.Match.CreateXPathCondition(Options.Terms)); }
}
public ComponentScopeXPathBuilder TermsConditionOfText
{
get { return _(Options.Match.CreateXPathCondition(Options.Terms, "text()")); }
}
public static implicit operator string(ComponentScopeXPathBuilder builder)
{
return builder?.XPath;
}
public ComponentScopeXPathBuilder TermsConditionOf(string attributeName)
{
return _(Options.Match.CreateXPathCondition(Options.Terms, "@" + attributeName));
}
public ComponentScopeXPathBuilder WrapWithIndex(Func<ComponentScopeXPathBuilder, string> buildFunction)
{
string subPath = CreateSubPath(buildFunction);
if (Options.Index.HasValue)
{
subPath = subPath.StartsWith("(") && subPath.EndsWith(")") ? subPath : $"({subPath})";
return _($"{subPath}[{Options.Index + 1}]");
}
else
{
return _(subPath);
}
}
protected override ComponentScopeXPathBuilder CreateInstance()
{
return new ComponentScopeXPathBuilder(Options);
}
}
}
| using System;
namespace Atata
{
public class ComponentScopeXPathBuilder : XPathBuilder<ComponentScopeXPathBuilder>
{
public ComponentScopeXPathBuilder(ComponentScopeLocateOptions options)
{
Options = options;
}
public ComponentScopeLocateOptions Options { get; private set; }
public ComponentScopeXPathBuilder OuterXPath
{
get { return Options.OuterXPath != null ? _(Options.OuterXPath) : Descendant; }
}
public ComponentScopeXPathBuilder ComponentXPath
{
get { return _(Options.ElementXPath); }
}
public ComponentScopeXPathBuilder TermsConditionOfContent
{
get { return _(Options.Match.CreateXPathCondition(Options.Terms)); }
}
public static implicit operator string(ComponentScopeXPathBuilder builder)
{
return builder?.XPath;
}
public ComponentScopeXPathBuilder TermsConditionOf(string attributeName)
{
return _(Options.Match.CreateXPathCondition(Options.Terms, "@" + attributeName));
}
public ComponentScopeXPathBuilder WrapWithIndex(Func<ComponentScopeXPathBuilder, string> buildFunction)
{
string subPath = CreateSubPath(buildFunction);
if (Options.Index.HasValue)
{
subPath = subPath.StartsWith("(") && subPath.EndsWith(")") ? subPath : $"({subPath})";
return _($"{subPath}[{Options.Index + 1}]");
}
else
{
return _(subPath);
}
}
protected override ComponentScopeXPathBuilder CreateInstance()
{
return new ComponentScopeXPathBuilder(Options);
}
}
}
| apache-2.0 | C# |
0037bd155873773542d4dd763d70cd00228d7bc0 | Add missing method | StefanoFiumara/Harry-Potter-Unity | Assets/Scripts/HarryPotterUnity/Cards/Generic/LessonProvider.cs | Assets/Scripts/HarryPotterUnity/Cards/Generic/LessonProvider.cs | using System;
using System.Collections.Generic;
using HarryPotterUnity.Cards.Generic.Interfaces;
using JetBrains.Annotations;
using UnityEngine;
namespace HarryPotterUnity.Cards.Generic {
[UsedImplicitly]
public class LessonProvider : GenericCard, IPersistentCard, ILessonProvider
{
#region Inspector Settings
[Header("Lesson Provider Settings")]
[SerializeField, UsedImplicitly] private LessonTypes _lessonType;
[SerializeField, UsedImplicitly] private int _amountLessonsProvided;
#endregion
#region Properties
public LessonTypes LessonType
{
get { return _lessonType; }
}
public int AmountLessonsProvided
{
get { return _amountLessonsProvided; }
}
#endregion
protected override void OnClickAction(List<GenericCard> targets)
{
Player.InPlay.Add(this);
Player.Hand.Remove(this);
}
public void OnEnterInPlayAction()
{
if (!Player.LessonTypesInPlay.Contains(LessonType))
{
Player.LessonTypesInPlay.Add(LessonType);
}
Player.AmountLessonsInPlay += AmountLessonsProvided;
State = CardStates.InPlay;
}
public void OnExitInPlayAction()
{
Player.AmountLessonsInPlay -= AmountLessonsProvided;
Player.UpdateLessonTypesInPlay();
}
public bool CanPerformInPlayAction() { return false; }
public void OnInPlayBeforeTurnAction() { }
public void OnInPlayAfterTurnAction() { }
public void OnSelectedAction() { }
}
}
| using System;
using System.Collections.Generic;
using HarryPotterUnity.Cards.Generic.Interfaces;
using JetBrains.Annotations;
using UnityEngine;
namespace HarryPotterUnity.Cards.Generic {
[UsedImplicitly]
public class LessonProvider : GenericCard, IPersistentCard, ILessonProvider
{
#region Inspector Settings
[Header("Lesson Provider Settings")]
[SerializeField, UsedImplicitly] private LessonTypes _lessonType;
[SerializeField, UsedImplicitly] private int _amountLessonsProvided;
#endregion
#region Properties
public LessonTypes LessonType
{
get { return _lessonType; }
}
public int AmountLessonsProvided
{
get { return _amountLessonsProvided; }
}
#endregion
protected override void OnClickAction(List<GenericCard> targets)
{
Player.InPlay.Add(this);
Player.Hand.Remove(this);
}
public void OnEnterInPlayAction()
{
if (!Player.LessonTypesInPlay.Contains(LessonType))
{
Player.LessonTypesInPlay.Add(LessonType);
}
Player.AmountLessonsInPlay += AmountLessonsProvided;
State = CardStates.InPlay;
}
public void OnExitInPlayAction()
{
Player.AmountLessonsInPlay -= AmountLessonsProvided;
Player.UpdateLessonTypesInPlay();
}
public void OnInPlayBeforeTurnAction() { }
public void OnInPlayAfterTurnAction() { }
public void OnSelectedAction() { }
}
}
| mit | C# |
9f0d7a3239a3f67c26145a9ed5e8e7308e7e1f8e | Revert "Revert "Multiple ininitialisations"" | agileobjects/ReadableExpressions | ReadableExpressions.UnitTests/WhenTranslatingObjectCreations.cs | ReadableExpressions.UnitTests/WhenTranslatingObjectCreations.cs | namespace AgileObjects.ReadableExpressions.UnitTests
{
using System;
using System.IO;
using System.Linq.Expressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class WhenTranslatingObjectCreations
{
[TestMethod]
public void ShouldTranslateAParameterlessNewExpression()
{
Expression<Func<object>> createObject = () => new object();
var translated = createObject.ToReadableString();
Assert.AreEqual("() => new Object()", translated);
}
[TestMethod]
public void ShouldTranslateANewExpressionWithParameters()
{
Expression<Func<DateTime>> createToday = () => new DateTime(2014, 08, 23);
var translated = createToday.ToReadableString();
Assert.AreEqual("() => new DateTime(2014, 8, 23)", translated);
}
[TestMethod]
public void ShouldTranslateANewExpressionWithInitialisation()
{
Expression<Func<MemoryStream>> createToday = () => new MemoryStream { Position = 0 };
var translated = createToday.ToReadableString();
const string EXPECTED =
@"() => new MemoryStream
{
Position = 0
}";
Assert.AreEqual(EXPECTED, translated);
}
[TestMethod]
public void ShouldTranslateANewExpressionWithMultipleInitialisations()
{
Expression<Func<MemoryStream>> createToday =
() => new MemoryStream { Capacity = 10000, Position = 100 };
var translated = createToday.ToReadableString();
const string EXPECTED =
@"() => new MemoryStream
{
Capacity = 10000,
Position = 100
}";
Assert.AreEqual(EXPECTED, translated);
}
}
}
| namespace AgileObjects.ReadableExpressions.UnitTests
{
using System;
using System.IO;
using System.Linq.Expressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class WhenTranslatingObjectCreations
{
[TestMethod]
public void ShouldTranslateAParameterlessNewExpression()
{
Expression<Func<object>> createObject = () => new object();
var translated = createObject.ToReadableString();
Assert.AreEqual("() => new Object()", translated);
}
[TestMethod]
public void ShouldTranslateANewExpressionWithParameters()
{
Expression<Func<DateTime>> createToday = () => new DateTime(2014, 08, 23);
var translated = createToday.ToReadableString();
Assert.AreEqual("() => new DateTime(2014, 8, 23)", translated);
}
[TestMethod]
public void ShouldTranslateANewExpressionWithInitialisation()
{
Expression<Func<MemoryStream>> createToday = () => new MemoryStream { Position = 0 };
var translated = createToday.ToReadableString();
const string EXPECTED =
@"() => new MemoryStream
{
Position = 0
}";
Assert.AreEqual(EXPECTED, translated);
}
}
}
| mit | C# |
5898108ad68c59d0bf1cdcfd89a9c73c6d72a2e0 | Update DistributedCacheRepository.cs | tiksn/TIKSN-Framework | TIKSN.Core/Data/Cache/Distributed/DistributedCacheRepository.cs | TIKSN.Core/Data/Cache/Distributed/DistributedCacheRepository.cs | using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Options;
using TIKSN.Serialization;
namespace TIKSN.Data.Cache.Distributed
{
public class DistributedCacheRepository<TEntity, TIdentity> : DistributedCacheDecoratorBase<TEntity>,
IRepository<TEntity>
where TEntity : IEntity<TIdentity>
where TIdentity : IEquatable<TIdentity>
{
protected HashSet<TIdentity> _cachedIdentities;
public DistributedCacheRepository(
IDistributedCache distributedCache,
ISerializer<byte[]> serializer,
IDeserializer<byte[]> deserializer,
IOptions<DistributedCacheDecoratorOptions> genericOptions,
IOptions<DistributedCacheDecoratorOptions<TEntity>> specificOptions) : base(distributedCache, serializer,
deserializer, genericOptions, specificOptions) =>
this._cachedIdentities = new HashSet<TIdentity>();
public async Task AddAsync(TEntity entity, CancellationToken cancellationToken)
{
await this.SetToDistributedCacheAsync(this.CreateEntryCacheKey(entity.ID), entity, cancellationToken);
this._cachedIdentities.Add(entity.ID);
}
public Task AddRangeAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken) =>
BatchOperationHelper.BatchOperationAsync(entities, cancellationToken, this.AddAsync);
public async Task RemoveAsync(TEntity entity, CancellationToken cancellationToken)
{
await this._distributedCache.RemoveAsync(this.CreateEntryCacheKey(entity.ID), cancellationToken);
this._cachedIdentities.Remove(entity.ID);
}
public Task RemoveRangeAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken) =>
BatchOperationHelper.BatchOperationAsync(entities, cancellationToken, this.RemoveAsync);
public Task UpdateAsync(TEntity entity, CancellationToken cancellationToken) =>
this.SetToDistributedCacheAsync(this.CreateEntryCacheKey(entity.ID), entity, cancellationToken);
public Task UpdateRangeAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken) =>
BatchOperationHelper.BatchOperationAsync(entities, cancellationToken, this.UpdateAsync);
protected string CreateEntryCacheKey(TIdentity identity) =>
Tuple.Create(entityType, CacheKeyKind.Entity, identity).ToString();
}
}
| using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using TIKSN.Serialization;
namespace TIKSN.Data.Cache.Distributed
{
public class DistributedCacheRepository<TEntity, TIdentity> : DistributedCacheDecoratorBase<TEntity>, IRepository<TEntity>
where TEntity : IEntity<TIdentity>
where TIdentity : IEquatable<TIdentity>
{
protected HashSet<TIdentity> _cachedIdentities;
public DistributedCacheRepository(
IDistributedCache distributedCache,
ISerializer<byte[]> serializer,
IDeserializer<byte[]> deserializer,
IOptions<DistributedCacheDecoratorOptions> genericOptions,
IOptions<DistributedCacheDecoratorOptions<TEntity>> specificOptions) : base(distributedCache, serializer, deserializer, genericOptions, specificOptions)
{
_cachedIdentities = new HashSet<TIdentity>();
}
public async Task AddAsync(TEntity entity, CancellationToken cancellationToken)
{
await SetToDistributedCacheAsync(CreateEntryCacheKey(entity.ID), entity, cancellationToken);
_cachedIdentities.Add(entity.ID);
}
public Task AddRangeAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken)
{
return BatchOperationHelper.BatchOperationAsync(entities, cancellationToken, AddAsync);
}
public async Task RemoveAsync(TEntity entity, CancellationToken cancellationToken)
{
await _distributedCache.RemoveAsync(CreateEntryCacheKey(entity.ID), cancellationToken);
_cachedIdentities.Remove(entity.ID);
}
public Task RemoveRangeAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken)
{
return BatchOperationHelper.BatchOperationAsync(entities, cancellationToken, RemoveAsync);
}
public Task UpdateAsync(TEntity entity, CancellationToken cancellationToken)
{
return SetToDistributedCacheAsync(CreateEntryCacheKey(entity.ID), entity, cancellationToken);
}
public Task UpdateRangeAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken)
{
return BatchOperationHelper.BatchOperationAsync(entities, cancellationToken, UpdateAsync);
}
protected string CreateEntryCacheKey(TIdentity identity)
{
return Tuple.Create(entityType, CacheKeyKind.Entity, identity).ToString();
}
}
} | mit | C# |
7a1d4cb34b91f8ac3a88a735ce8cd6a374a36cce | update example | myloveCc/NETCore.RedisKit,myloveCc/NETCore.RedisKit | example/NETCore.RedisKit.Web/Controllers/ValuesController.cs | example/NETCore.RedisKit.Web/Controllers/ValuesController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NETCore.RedisKit;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace NETCore.RedisKit.Web.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
private readonly IRedisProvider _RedisProvider;
public ValuesController(IRedisProvider redisProvider)
{
_RedisProvider = redisProvider;
}
// GET: api/values
[HttpGet]
public string Get()
{
using (var redis = _RedisProvider.Redis)
{
var db = redis.GetDatabase();
return db.StringGet("hello");
}
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NETCore.RedisKit;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace NETCore.RedisKit.Web.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
private readonly IRedisProvider _RedisProvider;
public ValuesController(IRedisProvider redisProvider)
{
_RedisProvider = redisProvider;
}
// GET: api/values
[HttpGet]
public string Get()
{
using (var redis = _RedisProvider.Redis)
{
var db = redis.GetDatabase();
return db.ListGetByIndex("redis key", 1);
}
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
| mit | C# |
77f119a49b20963a75ae997dc115166d04e76fc1 | Fix the search box. | Ref12/Codex,Ref12/Codex,Ref12/Codex,Ref12/Codex,Ref12/Codex,Ref12/Codex | src/Codex.Web.Monaco/Views/Shared/_Layout.cshtml | src/Codex.Web.Monaco/Views/Shared/_Layout.cshtml | <!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Index</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/header")
</head>
<body onload="onBodyLoad();">
<div class="header">
<span id="searchBoxAndImages">
<input type="search"
maxlength="260"
id="search-box"
value=""
tabindex="1" />
<a id="logoText" href="/">Codex</a>
<span id="headerMenu">
<a id="feedbackButtonLink" class="headerText">Feedback</a>
<a id="helpButtonLink" class="headerText" href="/overview/" onclick="LoadOverview(); return false;">Help</a>
</span>
</span>
</div>
@RenderBody()
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Index</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/header")
</head>
<body onload="onBodyLoad();">
<div class="header">
<span id="searchBoxAndImages">
<input type="text"
name="name"
maxlength="260"
id="search-box"
value=""
tabindex="1" />
<a id="logoText" href="/">Codex</a>
<span id="headerMenu">
<a id="feedbackButtonLink" class="headerText">Feedback</a>
<a id="helpButtonLink" class="headerText" href="/overview/" onclick="LoadOverview(); return false;">Help</a>
</span>
</span>
</div>
@RenderBody()
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
| mit | C# |
360f3c9aaa3fdd745f5a5a457763e27a4200c6b1 | Simplify InputAttributeParameterSource implementation. | fixie/fixie | src/Fixie.Tests/InputAttributeParameterSource.cs | src/Fixie.Tests/InputAttributeParameterSource.cs | namespace Fixie.Tests
{
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
public class InputAttributeParameterSource : ParameterSource
{
public IEnumerable<object?[]> GetParameters(MethodInfo method)
=> method
.GetCustomAttributes<InputAttribute>(true)
.OrderBy(x => x.Order)
.Select(input => input.Parameters);
}
} | namespace Fixie.Tests
{
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
public class InputAttributeParameterSource : ParameterSource
{
public IEnumerable<object?[]> GetParameters(MethodInfo method)
{
var inputAttributes = method.GetCustomAttributes<InputAttribute>(true)
.OrderBy(x => x.Order)
.ToArray();
if (inputAttributes.Any())
foreach (var input in inputAttributes)
yield return input.Parameters;
}
}
} | mit | C# |
5e5a07fd413aed3e678f6698a0602caedb386af8 | Fix RandomNumber documentation | OpenMagic/OpenMagic | source/OpenMagic/RandomNumber.cs | source/OpenMagic/RandomNumber.cs | using System;
namespace OpenMagic
{
/// <summary>
/// Collection of methods to get a random number.
/// </summary>
public static class RandomNumber
{
private static readonly Random Random = new Random();
/// <summary>
/// Returns a random <see cref="int" />.
/// </summary>
public static int NextInt()
{
return NextInt(int.MinValue, int.MaxValue);
}
/// <summary>
/// Returns a random <see cref="int" /> within a specified range.
/// </summary>
/// <param name="minValue">
/// The inclusive lower bound of the random number returned.
/// </param>
/// <param name="maxValue">
/// The exclusive upper bound of the random number returned. maxValue must be greater than or equal
/// to minValue.
/// </param>
/// <returns>
/// A signed integer greater than or equal to minValue and less than maxValue; that is, the range of return values
/// includes minValue but not maxValue. If minValue equals maxValue, minValue is returned.
/// </returns>
public static int NextInt(int minValue, int maxValue)
{
return Random.Next(minValue, maxValue);
}
}
} | using System;
namespace OpenMagic
{
/// <summary>
/// Collection of methods to get a random number.
/// </summary>
public static class RandomNumber
{
private static readonly Random Random = new Random();
/// <summary>
/// Returns a random <see cref="Integer" />.
/// </summary>
public static int NextInt()
{
return NextInt(int.MinValue, int.MaxValue);
}
/// <summary>
/// Returns a random <see cref="Integer" /> within a specified range.
/// </summary>
/// <param name="minValue">The inclusive lower bound of the random number returned.</param>
/// <param name="maxValue">
/// The exclusive upper bound of the random number returned. maxValue must be greater than or equal
/// to minValue.
/// </param>
/// <returns>
/// A signed integer greater than or equal to minValue and less than maxValue; that is, the range of return values
/// includes minValue but not maxValue. If minValue equals maxValue, minValue is returned.
/// </returns>
public static int NextInt(int minValue, int maxValue)
{
return Random.Next(minValue, maxValue);
}
}
} | mit | C# |
0f5de3ed04d3d48625a9d9be1477ff5994b29b79 | fix build | Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek | core/Engine/Engine.Tests/TestDrivers/TestScope.cs | core/Engine/Engine.Tests/TestDrivers/TestScope.cs | using System;
using System.Threading.Tasks;
using Engine.Drivers.Context;
using Engine.Drivers.Rules;
using Tweek.JPad;
using System.Collections.Generic;
using System.Security.Cryptography;
using Microsoft.FSharp.Core;
using Tweek.JPad.Utils;
namespace Engine.Tests.TestDrivers
{
public class TestScope
{
private readonly Func<Task> _dispose;
private readonly IRulesDriver _rulesDriver;
private readonly IContextDriver _contextDriver;
private readonly Func<Task> _init;
public TestScope(IRulesDriver rules, IContextDriver context, Func<Task> init, Func<Task> dispose)
{
_rulesDriver = rules;
_contextDriver = context;
_init = init;
_dispose = dispose;
}
public async Task Run(Func<ITweek, IContextDriver, Task> test)
{
Exception e = null;
try
{
await _init();
var parserSettings = new ParserSettings((b) =>
{
using (var sha1 = SHA1.Create())
{
return sha1.ComputeHash(b);
}
},FSharpOption<IDictionary<string, ComparerDelegate>>.Some(new Dictionary<string, ComparerDelegate>())
);
var tweek = await Tweek.Create(_rulesDriver, (any)=> JPadRulesParserAdapter.Convert(new JPadParser(parserSettings)));
await test(tweek, _contextDriver);
}
catch (Exception ex)
{
e = ex;
}
await _dispose();
if (e != null) throw e;
}
}
} | using System;
using System.Threading.Tasks;
using Engine.Drivers.Context;
using Engine.Drivers.Rules;
using Tweek.JPad;
using System.Collections.Generic;
using System.Security.Cryptography;
using Microsoft.FSharp.Core;
using Tweek.JPad.Utils;
namespace Engine.Tests.TestDrivers
{
public class TestScope
{
private readonly Func<Task> _dispose;
private readonly IRulesDriver _rulesDriver;
private readonly IContextDriver _contextDriver;
private readonly Func<Task> _init;
public TestScope(IRulesDriver rules, IContextDriver context, Func<Task> init, Func<Task> dispose)
{
_rulesDriver = rules;
_contextDriver = context;
_init = init;
_dispose = dispose;
}
public async Task Run(Func<ITweek, IContextDriver, Task> test)
{
Exception e = null;
try
{
await _init();
var parserSettings = new ParserSettings((b) =>
{
using (var sha1 = SHA1.Create())
{
return sha1.ComputeHash(b);
}
},FSharpOption<IDictionary<string, ComparerDelegate>>.Some(new Dictionary<string, ComparerDelegate>())
);
var tweek = await Tweek.Create(_rulesDriver, JPadRulesParserAdapter.Convert(new JPadParser(parserSettings)));
await test(tweek, _contextDriver);
}
catch (Exception ex)
{
e = ex;
}
await _dispose();
if (e != null) throw e;
}
}
} | mit | C# |
b456c0d4dd5b7ead577eb623ae277d9eba58b2f5 | clean up | asipe/DeleteStuff | src/DeleteStuff.Properties/AssemblyInfo.cs | src/DeleteStuff.Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Z Bar Technologies, LLC")]
[assembly: AssemblyProduct("Delete Stuff")]
[assembly: AssemblyCopyright("Copyright © Andy Sipe 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Z Bar Technologies, LLC")]
[assembly: AssemblyProduct("Delete Stuff")]
[assembly: AssemblyCopyright("Copyright © Andy Sipe 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
16491199894638b709acb26fccb678adec5756b1 | Load comparer assembly from bytes | xirqlz/blueprint41 | Blueprint41.Modeller.Schemas/DatastoreModelComparer.cs | Blueprint41.Modeller.Schemas/DatastoreModelComparer.cs | using System;
using System.IO;
using System.Linq;
using System.Reflection;
namespace Blueprint41.Modeller.Schemas
{
public abstract class DatastoreModelComparer
{
public static DatastoreModelComparer Instance { get { return instance.Value; } }
private static Lazy<DatastoreModelComparer> instance = new Lazy<DatastoreModelComparer>(delegate ()
{
string dll = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Blueprint41.Modeller.Compare.dll");
if (!File.Exists(dll))
return null;
byte[] assembly = File.ReadAllBytes(dll);
Assembly asm = Assembly.Load(assembly);
Type type = asm.GetTypes().First(x => x.Name == "DatastoreModelComparerImpl");
return (DatastoreModelComparer)Activator.CreateInstance(type);
}, true);
public abstract void GenerateUpgradeScript(modeller model, string storagePath);
}
}
| using System;
using System.IO;
using System.Reflection;
namespace Blueprint41.Modeller.Schemas
{
public abstract class DatastoreModelComparer
{
static public DatastoreModelComparer Instance { get { return instance.Value; } }
static private Lazy<DatastoreModelComparer> instance = new Lazy<DatastoreModelComparer>(delegate()
{
string dll = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Blueprint41.Modeller.Compare.dll");
if (!File.Exists(dll))
return null;
Assembly a = Assembly.LoadFile(dll);
Type t = a.GetType("Blueprint41.Modeller.Schemas.DatastoreModelComparerImpl");
return (DatastoreModelComparer)Activator.CreateInstance(t);
}, true);
public abstract void GenerateUpgradeScript(modeller model, string storagePath);
}
}
| mit | C# |
55d81bb90e0d3d049a60da09dad06da877445ba9 | Add Hex/Base64 functions | ektrah/nsec | src/Experimental/CryptographicUtilities.cs | src/Experimental/CryptographicUtilities.cs | using System;
using System.Runtime.CompilerServices;
namespace NSec.Experimental
{
public static class CryptographicUtilities
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] Base64Decode(string base64)
{
return NSec.Experimental.Text.Base64.Decode(base64);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Base64Encode(ReadOnlySpan<byte> bytes)
{
return NSec.Experimental.Text.Base64.Encode(bytes);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void FillRandomBytes(Span<byte> data)
{
System.Security.Cryptography.RandomNumberGenerator.Fill(data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool FixedTimeEquals(ReadOnlySpan<byte> left, ReadOnlySpan<byte> right)
{
return System.Security.Cryptography.CryptographicOperations.FixedTimeEquals(left, right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] HexDecode(string base16)
{
return NSec.Experimental.Text.Base16.Decode(base16);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string HexEncode(ReadOnlySpan<byte> bytes)
{
return NSec.Experimental.Text.Base16.Encode(bytes);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ZeroMemory(Span<byte> buffer)
{
System.Security.Cryptography.CryptographicOperations.ZeroMemory(buffer);
}
}
}
| using System;
using System.Runtime.CompilerServices;
namespace NSec.Experimental
{
public static class CryptographicUtilities
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void FillRandomBytes(Span<byte> data)
{
System.Security.Cryptography.RandomNumberGenerator.Fill(data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool FixedTimeEquals(ReadOnlySpan<byte> left, ReadOnlySpan<byte> right)
{
return System.Security.Cryptography.CryptographicOperations.FixedTimeEquals(left, right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ZeroMemory(Span<byte> buffer)
{
System.Security.Cryptography.CryptographicOperations.ZeroMemory(buffer);
}
}
}
| mit | C# |
71a2a847c0d7417e28cd2d5767c96df362847bc2 | Delete Edit Link | kiyokura/DapperSampleWeb | DapperSampleWeb/Views/StoredProc/OutputByRecord.cshtml | DapperSampleWeb/Views/StoredProc/OutputByRecord.cshtml | @model IEnumerable<DapperSampleWeb.Models.UserEntity>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>OutputByRecord</title>
</head>
<body>
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.FirstName)
</th>
<th>
@Html.DisplayNameFor(model => model.LastName)
</th>
<th>
@Html.DisplayNameFor(model => model.Email)
</th>
<th>
@Html.DisplayNameFor(model => model.Age)
</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.FirstName)
</td>
<td>
@Html.DisplayFor(modelItem => item.LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Email)
</td>
<td>
@Html.DisplayFor(modelItem => item.Age)
</td>
</tr>
}
</table>
</body>
</html>
| @model IEnumerable<DapperSampleWeb.Models.UserEntity>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>OutputByRecord</title>
</head>
<body>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.FirstName)
</th>
<th>
@Html.DisplayNameFor(model => model.LastName)
</th>
<th>
@Html.DisplayNameFor(model => model.Email)
</th>
<th>
@Html.DisplayNameFor(model => model.Age)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.FirstName)
</td>
<td>
@Html.DisplayFor(modelItem => item.LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Email)
</td>
<td>
@Html.DisplayFor(modelItem => item.Age)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>
</tr>
}
</table>
</body>
</html>
| mit | C# |
ad65cbb12b62baf1c8fd15c628eb82fb14f8588e | fix order (CF) | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Models/Sorting/SortingPreference.cs | WalletWasabi.Gui/Models/Sorting/SortingPreference.cs | using System;
using System.Diagnostics.CodeAnalysis;
namespace WalletWasabi.Gui.Models.Sorting
{
public struct SortingPreference : IEquatable<SortingPreference>
{
public SortingPreference(SortOrder sortOrder, string colTarget)
{
SortOrder = sortOrder;
ColumnTarget = colTarget;
}
public SortOrder SortOrder { get; set; }
public string ColumnTarget { get; set; }
#region EqualityAndComparison
public static bool operator ==(SortingPreference x, SortingPreference y)
=> (x.SortOrder, x.ColumnTarget) == (y.SortOrder, y.ColumnTarget);
public static bool operator !=(SortingPreference x, SortingPreference y) => !(x == y);
public override bool Equals(object obj)
{
if (obj is SortingPreference sp)
{
return Equals(sp);
}
else
{
return false;
}
}
public bool Equals(SortingPreference other) => this == other;
public override int GetHashCode() => (SortOrder, ColumnTarget).GetHashCode();
#endregion EqualityAndComparison
public SortOrder Match(SortOrder targetOrd, string match)
{
return ColumnTarget == match ? targetOrd : SortOrder.None;
}
}
}
| using System;
using System.Diagnostics.CodeAnalysis;
namespace WalletWasabi.Gui.Models.Sorting
{
public struct SortingPreference : IEquatable<SortingPreference>
{
public SortingPreference(SortOrder sortOrder, string colTarget)
{
SortOrder = sortOrder;
ColumnTarget = colTarget;
}
public SortOrder SortOrder { get; set; }
public string ColumnTarget { get; set; }
public SortOrder Match(SortOrder targetOrd, string match)
{
return ColumnTarget == match ? targetOrd : SortOrder.None;
}
#region EqualityAndComparison
public static bool operator ==(SortingPreference x, SortingPreference y)
=> (x.SortOrder, x.ColumnTarget) == (y.SortOrder, y.ColumnTarget);
public static bool operator !=(SortingPreference x, SortingPreference y) => !(x == y);
public override bool Equals(object obj)
{
if (obj is SortingPreference sp)
{
return Equals(sp);
}
else
{
return false;
}
}
public bool Equals(SortingPreference other) => this == other;
public override int GetHashCode() => (SortOrder, ColumnTarget).GetHashCode();
#endregion EqualityAndComparison
}
}
| mit | C# |
5f8aa8a801652540a8cda89b2de7aef500cba387 | Fix default order | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Shell/MainMenu/FileMainMenuItems.cs | WalletWasabi.Gui/Shell/MainMenu/FileMainMenuItems.cs | using AvalonStudio.MainMenu;
using AvalonStudio.Menus;
using System;
using System.Collections.Generic;
using System.Composition;
using System.Text;
namespace WalletWasabi.Gui.Shell.MainMenu
{
internal class FileMainMenuItems
{
private IMenuItemFactory MenuItemFactory { get; }
[ImportingConstructor]
public FileMainMenuItems(IMenuItemFactory menuItemFactory)
{
MenuItemFactory = menuItemFactory;
}
#region MainMenu
[ExportMainMenuItem("File")]
[DefaultOrder(0)]
public IMenuItem File => MenuItemFactory.CreateHeaderMenuItem("File", null);
#endregion MainMenu
#region Group
[ExportMainMenuDefaultGroup("File", "Wallet")]
[DefaultOrder(0)]
public object WalletGroup => null;
[ExportMainMenuDefaultGroup("File", "Disk")]
[DefaultOrder(1)]
public object DiskGroup => null;
[ExportMainMenuDefaultGroup("File", "System")]
[DefaultOrder(2)]
public object SystemGroup => null;
#endregion Group
#region MenuItem
[ExportMainMenuItem("File", "Generate Wallet")]
[DefaultOrder(0)]
[DefaultGroup("Wallet")]
public IMenuItem GenerateWallet => MenuItemFactory.CreateCommandMenuItem("File.GenerateWallet");
[ExportMainMenuItem("File", "Recover Wallet")]
[DefaultOrder(1)]
[DefaultGroup("Wallet")]
public IMenuItem Recover => MenuItemFactory.CreateCommandMenuItem("File.RecoverWallet");
[ExportMainMenuItem("File", "Load Wallet")]
[DefaultOrder(2)]
[DefaultGroup("Wallet")]
public IMenuItem LoadWallet => MenuItemFactory.CreateCommandMenuItem("File.LoadWallet");
[ExportMainMenuItem("File", "Open")]
[DefaultOrder(3)]
public IMenuItem Open => MenuItemFactory.CreateHeaderMenuItem("Open", null);
[ExportMainMenuItem("File", "Exit")]
[DefaultOrder(4)]
[DefaultGroup("System")]
public IMenuItem Exit => MenuItemFactory.CreateCommandMenuItem("File.Exit");
#endregion MenuItem
#region SubMenuItem
[ExportMainMenuItem("File", "Open", "Data Folder")]
[DefaultOrder(0)]
[DefaultGroup("Disk")]
public IMenuItem OpenDataFolder => MenuItemFactory.CreateCommandMenuItem("File.Open.DataFolder");
[ExportMainMenuItem("File", "Open", "Wallets Folder")]
[DefaultOrder(1)]
[DefaultGroup("Disk")]
public IMenuItem OpenWalletsFolder => MenuItemFactory.CreateCommandMenuItem("File.Open.WalletsFolder");
[ExportMainMenuItem("File", "Open", "Log File")]
[DefaultOrder(2)]
[DefaultGroup("Disk")]
public IMenuItem OpenLogFile => MenuItemFactory.CreateCommandMenuItem("File.Open.LogFile");
[ExportMainMenuItem("File", "Open", "Tor Log File")]
[DefaultOrder(3)]
[DefaultGroup("Disk")]
public IMenuItem OpenTorLogFile => MenuItemFactory.CreateCommandMenuItem("File.Open.TorLogFile");
[ExportMainMenuItem("File", "Open", "Config File")]
[DefaultOrder(4)]
[DefaultGroup("Disk")]
public IMenuItem OpenConfigFile => MenuItemFactory.CreateCommandMenuItem("File.Open.ConfigFile");
#endregion SubMenuItem
}
}
| using AvalonStudio.MainMenu;
using AvalonStudio.Menus;
using System;
using System.Collections.Generic;
using System.Composition;
using System.Text;
namespace WalletWasabi.Gui.Shell.MainMenu
{
internal class FileMainMenuItems
{
private IMenuItemFactory MenuItemFactory { get; }
[ImportingConstructor]
public FileMainMenuItems(IMenuItemFactory menuItemFactory)
{
MenuItemFactory = menuItemFactory;
}
#region MainMenu
[ExportMainMenuItem("File")]
[DefaultOrder(0)]
public IMenuItem File => MenuItemFactory.CreateHeaderMenuItem("File", null);
#endregion MainMenu
#region Group
[ExportMainMenuDefaultGroup("File", "Wallet")]
[DefaultOrder(0)]
public object WalletGroup => null;
[ExportMainMenuDefaultGroup("File", "Disk")]
[DefaultOrder(1)]
public object DiskGroup => null;
[ExportMainMenuDefaultGroup("File", "System")]
[DefaultOrder(2)]
public object SystemGroup => null;
#endregion Group
#region MenuItem
[ExportMainMenuItem("File", "Generate Wallet")]
[DefaultOrder(0)]
[DefaultGroup("Wallet")]
public IMenuItem GenerateWallet => MenuItemFactory.CreateCommandMenuItem("File.GenerateWallet");
[ExportMainMenuItem("File", "Recover Wallet")]
[DefaultOrder(1)]
[DefaultGroup("Wallet")]
public IMenuItem Recover => MenuItemFactory.CreateCommandMenuItem("File.RecoverWallet");
[ExportMainMenuItem("File", "Load Wallet")]
[DefaultOrder(2)]
[DefaultGroup("Wallet")]
public IMenuItem LoadWallet => MenuItemFactory.CreateCommandMenuItem("File.LoadWallet");
[ExportMainMenuItem("File", "Open")]
[DefaultOrder(3)]
public IMenuItem Open => MenuItemFactory.CreateHeaderMenuItem("Open", null);
[ExportMainMenuItem("File", "Exit")]
[DefaultOrder(5)]
[DefaultGroup("System")]
public IMenuItem Exit => MenuItemFactory.CreateCommandMenuItem("File.Exit");
#endregion MenuItem
#region SubMenuItem
[ExportMainMenuItem("File", "Open", "Data Folder")]
[DefaultOrder(0)]
[DefaultGroup("Disk")]
public IMenuItem OpenDataFolder => MenuItemFactory.CreateCommandMenuItem("File.Open.DataFolder");
[ExportMainMenuItem("File", "Open", "Wallets Folder")]
[DefaultOrder(1)]
[DefaultGroup("Disk")]
public IMenuItem OpenWalletsFolder => MenuItemFactory.CreateCommandMenuItem("File.Open.WalletsFolder");
[ExportMainMenuItem("File", "Open", "Log File")]
[DefaultOrder(2)]
[DefaultGroup("Disk")]
public IMenuItem OpenLogFile => MenuItemFactory.CreateCommandMenuItem("File.Open.LogFile");
[ExportMainMenuItem("File", "Open", "Tor Log File")]
[DefaultOrder(3)]
[DefaultGroup("Disk")]
public IMenuItem OpenTorLogFile => MenuItemFactory.CreateCommandMenuItem("File.Open.TorLogFile");
[ExportMainMenuItem("File", "Open", "Config File")]
[DefaultOrder(4)]
[DefaultGroup("Disk")]
public IMenuItem OpenConfigFile => MenuItemFactory.CreateCommandMenuItem("File.Open.ConfigFile");
#endregion SubMenuItem
}
}
| mit | C# |
a381919f396b19aeddf5871a7435367c467e4a95 | Fix compiler warning. | paulyoder/LinqToExcel | src/LinqToExcel.Tests/Company.cs | src/LinqToExcel.Tests/Company.cs | using System;
namespace LinqToExcel.Tests
{
public class Company
{
public string Name { get; set; }
public string CEO { get; set; }
public int? EmployeeCount { get; set; }
public DateTime StartDate { get; set; }
public bool IsActive { get; set; }
}
}
| using System;
namespace LinqToExcel.Tests
{
public class Company
{
public string Name { get; set; }
public string CEO { get; set; }
public int EmployeeCount { get; set; }
public DateTime StartDate { get; set; }
public bool IsActive { get; set; }
}
}
| mit | C# |
4954e9784560627690294d30c859de4acbdfd77f | add stuff for cake | jamesmontemagno/MediaPlugin,jamesmontemagno/MediaPlugin | build.cake | build.cake | #tool nuget:?package=XamarinComponent
#addin nuget:?package=Cake.Android.SdkManager
#addin nuget:?package=Cake.XCode
#addin nuget:?package=Cake.Xamarin
#addin nuget:?package=Cake.Xamarin.Build
#addin nuget:?package=Cake.SemVer
#addin nuget:?package=Cake.FileHelpers
#addin nuget:?package=Cake.MonoApiTools
var TARGET = Argument ("target", Argument ("t", "Default"));
var VERSION = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");
var CONFIG = Argument("configuration", EnvironmentVariable ("CONFIGURATION") ?? "Release");
var SLN = "./src/Media.sln";
var ANDROID_HOME = EnvironmentVariable ("ANDROID_HOME") ?? Argument ("android_home", "");
Task("Libraries").Does(()=>
{
NuGetRestore (SLN);
MSBuild (SLN, c => {
c.Configuration = CONFIG;
c.MSBuildPlatform = Cake.Common.Tools.MSBuild.MSBuildPlatform.x86;
});
});
Task ("AndroidSDK")
.Does (() =>
{
Information ("ANDROID_HOME: {0}", ANDROID_HOME);
var androidSdkSettings = new AndroidSdkManagerToolSettings {
SdkRoot = ANDROID_HOME,
SkipVersionCheck = true
};
try { AcceptLicenses (androidSdkSettings); } catch { }
AndroidSdkManagerInstall (new [] {
"platforms;android-15",
"platforms;android-23",
"platforms;android-25",
"platforms;android-26"
}, androidSdkSettings);
});
Task ("NuGet")
.IsDependentOn("AndroidSDK")
.IsDependentOn ("Libraries")
.Does (() =>
{
if(!DirectoryExists("./Build/nuget/"))
CreateDirectory("./Build/nuget");
NuGetPack ("./nuget/Plugin.nuspec", new NuGetPackSettings {
Version = VERSION,
OutputDirectory = "./Build/nuget/",
BasePath = "./"
});
});
//Build the component, which build samples, nugets, and libraries
Task ("Default").IsDependentOn("NuGet");
Task ("Clean").Does (() =>
{
CleanDirectory ("./component/tools/");
CleanDirectories ("./Build/");
CleanDirectories ("./**/bin");
CleanDirectories ("./**/obj");
});
RunTarget (TARGET);
| var TARGET = Argument ("target", Argument ("t", "Default"));
var VERSION = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");
var CONFIG = Argument("configuration", EnvironmentVariable ("CONFIGURATION") ?? "Release");
var SLN = "./src/Media.sln";
Task("Libraries").Does(()=>
{
NuGetRestore (SLN);
MSBuild (SLN, c => {
c.Configuration = CONFIG;
c.MSBuildPlatform = Cake.Common.Tools.MSBuild.MSBuildPlatform.x86;
});
});
Task ("AndroidSDK")
.Does (() =>
{
Information ("ANDROID_HOME: {0}", ANDROID_HOME);
var androidSdkSettings = new AndroidSdkManagerToolSettings {
SdkRoot = ANDROID_HOME,
SkipVersionCheck = true
};
try { AcceptLicenses (androidSdkSettings); } catch { }
AndroidSdkManagerInstall (new [] {
"platforms;android-15",
"platforms;android-23",
"platforms;android-25",
"platforms;android-26"
}, androidSdkSettings);
});
Task ("NuGet")
.IsDependentOn("AndroidSDK")
.IsDependentOn ("Libraries")
.Does (() =>
{
if(!DirectoryExists("./Build/nuget/"))
CreateDirectory("./Build/nuget");
NuGetPack ("./nuget/Plugin.nuspec", new NuGetPackSettings {
Version = VERSION,
OutputDirectory = "./Build/nuget/",
BasePath = "./"
});
});
//Build the component, which build samples, nugets, and libraries
Task ("Default").IsDependentOn("NuGet");
Task ("Clean").Does (() =>
{
CleanDirectory ("./component/tools/");
CleanDirectories ("./Build/");
CleanDirectories ("./**/bin");
CleanDirectories ("./**/obj");
});
RunTarget (TARGET);
| mit | C# |
4b3d9002914e89569c9b9a72a3a993c7f1ffd75d | Use MSBuild for Build and Pack | thomaslevesque/WeakEvent | build.cake | build.cake | using System.Xml.Linq;
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
var projectName = "WeakEvent";
var solution = $"{projectName}.sln";
var libraryProject = $"./{projectName}/{projectName}.csproj";
var testProject = $"./{projectName}.Tests/{projectName}.Tests.csproj";
var outDir = $"./{projectName}/bin/{configuration}";
Task("Clean")
.Does(() =>
{
CleanDirectory(outDir);
});
Task("Restore")
.Does(() => RunMSBuildTarget(solution, "Restore"));
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() => RunMSBuildTarget(solution, "Build"));
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
DotNetCoreTest(testProject, new DotNetCoreTestSettings { Configuration = configuration });
});
Task("Pack")
.IsDependentOn("Test")
.Does(() => RunMSBuildTarget(libraryProject, "Pack"));
Task("Push")
.IsDependentOn("Pack")
.Does(() =>
{
var doc = XDocument.Load(libraryProject);
string version = doc.Root.Elements("PropertyGroup").Elements("Version").First().Value;
string package = $"{projectName}/bin/{configuration}/{projectName}.{version}.nupkg";
NuGetPush(package, new NuGetPushSettings());
});
Task("Default")
.IsDependentOn("Pack");
void RunMSBuildTarget(string projectOrSolution, string target)
{
MSBuild(projectOrSolution, new MSBuildSettings
{
Targets = { target },
Configuration = configuration
});
}
RunTarget(target);
| using System.Xml.Linq;
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
var projectName = "WeakEvent";
var libraryProject = $"./{projectName}/{projectName}.csproj";
var testProject = $"./{projectName}.Tests/{projectName}.Tests.csproj";
var outDir = $"./{projectName}/bin/{configuration}";
Task("Clean")
.Does(() =>
{
CleanDirectory(outDir);
});
Task("Restore").Does(DotNetCoreRestore);
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
DotNetCoreBuild(".", new DotNetCoreBuildSettings { Configuration = configuration });
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
DotNetCoreTest(testProject, new DotNetCoreTestSettings { Configuration = configuration });
});
Task("Pack")
.IsDependentOn("Test")
.Does(() =>
{
DotNetCorePack(libraryProject, new DotNetCorePackSettings { Configuration = configuration });
});
Task("Push")
.IsDependentOn("Pack")
.Does(() =>
{
var doc = XDocument.Load(libraryProject);
string version = doc.Root.Elements("PropertyGroup").Elements("Version").First().Value;
string package = $"{projectName}/bin/{configuration}/{projectName}.{version}.nupkg";
NuGetPush(package, new NuGetPushSettings());
});
Task("Default")
.IsDependentOn("Pack");
RunTarget(target);
| apache-2.0 | C# |
76dd0ae802a6973619c49d7c535aa7702821b8ce | Update HomeController.cs | Longfld/ASPNETCoreAngular2,Longfld/ASPNETCoreAngular2,Longfld/ASPNETCoreAngular2,Longfld/ASPNETCoreAngular2 | webapp/src/webapp/Controllers/HomeController.cs | webapp/src/webapp/Controllers/HomeController.cs | using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace webapp.Controllers
{
public class HomeController : Controller
{
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
_logger.LogError("HomeController: Helloworld from Index");
return View();
}
private readonly ILogger<HomeController> _logger;
}
}
| using Microsoft.AspNetCore.Mvc;
namespace webapp.Controllers
{
public class HomeController : Controller
{
public HomeController(IHostingEnvironment hostingEnvironment, ILogger<HomeController> logger)
{
_hostingEnvironment = hostingEnvironment;
_logger = logger;
}
public IActionResult Index()
{
_logger.LogError("HomeController: Helloworld from Index");
return View();
}
private readonly IHostingEnvironment _hostingEnvironment;
private readonly ILogger<HomeController> _logger;
}
}
| mit | C# |
1c717613c6b5d0c75e1425f1cd5035dea6eb7bdd | Fix formatting / usings in test scene | ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework | osu.Framework.Tests/Visual/Platform/TestSceneAllowSuspension.cs | osu.Framework.Tests/Visual/Platform/TestSceneAllowSuspension.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.Bindables;
using osu.Framework.Platform;
namespace osu.Framework.Tests.Visual.Platform
{
public class TestSceneAllowSuspension : FrameworkTestScene
{
private Bindable<bool> allowSuspension;
[BackgroundDependencyLoader]
private void load(GameHost host)
{
allowSuspension = host.AllowScreenSuspension.GetBoundCopy();
}
protected override void LoadComplete()
{
base.LoadComplete();
AddToggleStep("Toggle Suspension", b => allowSuspension.Value = b);
}
}
}
| // 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.Bindables;
using osu.Framework.Configuration;
using osu.Framework.Platform;
namespace osu.Framework.Tests.Visual.Platform
{
public class TestSceneAllowSuspension : FrameworkTestScene
{
private Bindable<bool> allowSuspension;
[BackgroundDependencyLoader]
private void load(GameHost host)
{
allowSuspension = host.AllowScreenSuspension.GetBoundCopy();
}
protected override void LoadComplete()
{
base.LoadComplete();
AddToggleStep("Toggle Suspension", b =>
{
allowSuspension.Value = b;
}
);
}
}
}
| mit | C# |
6068daeec8f8050d35e23e092c3d23fada23d7aa | Remove level from paragraph | smoogipooo/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,peppy/osu-framework | osu.Framework/Graphics/Containers/Markdown/MarkdownParagraph.cs | osu.Framework/Graphics/Containers/Markdown/MarkdownParagraph.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using Markdig.Syntax;
namespace osu.Framework.Graphics.Containers.Markdown
{
/// <summary>
/// Visualises a paragraph.
/// </summary>
public class MarkdownParagraph : MarkdownTextFlowContainer
{
public MarkdownParagraph(ParagraphBlock paragraphBlock, int level)
{
AddInlineText(paragraphBlock.Inline);
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using Markdig.Syntax;
namespace osu.Framework.Graphics.Containers.Markdown
{
/// <summary>
/// Visualises a paragraph.
/// </summary>
public class MarkdownParagraph : MarkdownTextFlowContainer
{
public readonly int Level;
public MarkdownParagraph(ParagraphBlock paragraphBlock, int level)
{
Level = level;
AddInlineText(paragraphBlock.Inline);
}
}
}
| mit | C# |
789fe4a7a4f63206f97ce126e366ca71c36c290e | Fix incorrect change to Gtk TextureBrushHandler (doesn't compile in windows) | l8s/Eto,PowerOfCode/Eto,l8s/Eto,PowerOfCode/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,bbqchickenrobot/Eto-1,l8s/Eto | Source/Eto.Platform.Gtk/Drawing/TextureBrushHandler.cs | Source/Eto.Platform.Gtk/Drawing/TextureBrushHandler.cs | using System;
using Eto.Drawing;
namespace Eto.Platform.GtkSharp.Drawing
{
/// <summary>
/// Handler for the <see cref="ITextureBrush"/>
/// </summary>
/// <copyright>(c) 2012 by Curtis Wensley</copyright>
/// <license type="BSD-3">See LICENSE for full terms</license>
public class TextureBrushHandler : BrushHandler, ITextureBrush
{
class TextureBrushObject
{
public Cairo.Matrix Transform { get; set; }
public Gdk.Pixbuf Pixbuf { get; set; }
public float Opacity { get; set; }
public TextureBrushObject ()
{
Opacity = 1.0f;
}
public void Apply (GraphicsHandler graphics)
{
if (!object.ReferenceEquals (Transform, null))
graphics.Control.Transform (Transform);
Gdk.CairoHelper.SetSourcePixbuf (graphics.Control, Pixbuf, 0, 0);
var pattern = graphics.Control.Source as Cairo.SurfacePattern;
if (pattern != null)
pattern.Extend = Cairo.Extend.Repeat;
if (Opacity < 1.0f) {
graphics.Control.Clip ();
graphics.Control.PaintWithAlpha (Opacity);
}
else
graphics.Control.Fill ();
}
}
public IMatrix GetTransform (TextureBrush widget)
{
return ((TextureBrushObject)widget.ControlObject).Transform.ToEto ();
}
public void SetTransform (TextureBrush widget, IMatrix transform)
{
((TextureBrushObject)widget.ControlObject).Transform = transform.ToCairo ();
}
public object Create (Image image, float opacity)
{
return new TextureBrushObject {
Pixbuf = image.ToGdk (),
Opacity = opacity
};
}
public override void Apply (object control, GraphicsHandler graphics)
{
((TextureBrushObject)control).Apply (graphics);
}
public float GetOpacity (TextureBrush widget)
{
return ((TextureBrushObject)widget.ControlObject).Opacity;
}
public void SetOpacity (TextureBrush widget, float opacity)
{
((TextureBrushObject)widget.ControlObject).Opacity = opacity;
}
}
}
| using System;
using Eto.Drawing;
namespace Eto.Platform.GtkSharp.Drawing
{
/// <summary>
/// Handler for the <see cref="ITextureBrush"/>
/// </summary>
/// <copyright>(c) 2012 by Curtis Wensley</copyright>
/// <license type="BSD-3">See LICENSE for full terms</license>
public class TextureBrushHandler : BrushHandler, ITextureBrush
{
class TextureBrushObject
{
public Cairo.Matrix Transform { get; set; }
public Gdk.Pixbuf Pixbuf { get; set; }
public float Opacity { get; set; }
public TextureBrushObject ()
{
Opacity = 1.0f;
}
public void Apply (GraphicsHandler graphics)
{
if (!object.ReferenceEquals (Transform, null))
graphics.Control.Transform (Transform);
Gdk.CairoHelper.SetSourcePixbuf (graphics.Control, Pixbuf, 0, 0);
var pattern = graphics.Control.Source as Cairo.Pattern;
if (pattern != null)
pattern.Extend = Cairo.Extend.Repeat;
if (Opacity < 1.0f) {
graphics.Control.Clip ();
graphics.Control.PaintWithAlpha (Opacity);
}
else
graphics.Control.Fill ();
}
}
public IMatrix GetTransform (TextureBrush widget)
{
return ((TextureBrushObject)widget.ControlObject).Transform.ToEto ();
}
public void SetTransform (TextureBrush widget, IMatrix transform)
{
((TextureBrushObject)widget.ControlObject).Transform = transform.ToCairo ();
}
public object Create (Image image, float opacity)
{
return new TextureBrushObject {
Pixbuf = image.ToGdk (),
Opacity = opacity
};
}
public override void Apply (object control, GraphicsHandler graphics)
{
((TextureBrushObject)control).Apply (graphics);
}
public float GetOpacity (TextureBrush widget)
{
return ((TextureBrushObject)widget.ControlObject).Opacity;
}
public void SetOpacity (TextureBrush widget, float opacity)
{
((TextureBrushObject)widget.ControlObject).Opacity = opacity;
}
}
}
| bsd-3-clause | C# |
23cfd49a5ee0214225f528ce29a2c624a8c0b911 | Set default values for filter model | shunobaka/Interapp,shunobaka/Interapp,shunobaka/Interapp | Source/Services/Interapp.Services.Common/FilterModel.cs | Source/Services/Interapp.Services.Common/FilterModel.cs | namespace Interapp.Services.Common
{
public class FilterModel
{
public FilterModel()
{
this.Page = 1;
this.PageSize = 10;
}
public string OrderBy { get; set; }
public string Order { get; set; }
public int Page { get; set; }
public int PageSize { get; set; }
public string Filter { get; set; }
}
}
| namespace Interapp.Services.Common
{
public class FilterModel
{
public string OrderBy { get; set; }
public string Order { get; set; }
public int Page { get; set; }
public int PageSize { get; set; }
public string Filter { get; set; }
}
}
| mit | C# |
93bd5541512d82004c50e94036195b0306af6f5c | Update PersonMap.cs | NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework | Test/AdventureWorksFunctionalModel/Mapping/PersonMap.cs | Test/AdventureWorksFunctionalModel/Mapping/PersonMap.cs | using System.Data.Entity.ModelConfiguration;
using AW.Types;
namespace AW.Mapping
{
public class PersonMap : EntityTypeConfiguration<Person>
{
public PersonMap()
{
// Primary Key
HasKey(t => t.BusinessEntityID);
Ignore(t => t.Password); //TODO: Why?
Property(t => t.Title)
.HasMaxLength(8);
Property(t => t.FirstName)
.IsRequired()
.HasMaxLength(50);
Property(t => t.MiddleName)
.HasMaxLength(50);
Property(t => t.LastName)
.IsRequired()
.HasMaxLength(50);
Property(t => t.Suffix)
.HasMaxLength(10);
// Table & Column Mappings
ToTable("Person", "Person");
Property(t => t.BusinessEntityID).HasColumnName("BusinessEntityID");
Property(t => t.NameStyle).HasColumnName("NameStyle");
Property(t => t.Title).HasColumnName("Title");
Property(t => t.FirstName).HasColumnName("FirstName");
Property(t => t.MiddleName).HasColumnName("MiddleName");
Property(t => t.LastName).HasColumnName("LastName");
Property(t => t.Suffix).HasColumnName("Suffix");
Property(t => t.EmailPromotion).HasColumnName("EmailPromotion");
Property(t => t.AdditionalContactInfo).HasColumnName("AdditionalContactInfo");
Property(t => t.rowguid).HasColumnName("rowguid");
Property(t => t.ModifiedDate).HasColumnName("ModifiedDate");
HasOptional(t => t.Employee).WithRequired(t => t.PersonDetails);
}
}
}
| using System.Data.Entity.ModelConfiguration;
using AW.Types;
namespace AW.Mapping
{
public class PersonMap : EntityTypeConfiguration<Person>
{
public PersonMap()
{
// Primary Key
HasKey(t => t.BusinessEntityID);
//Ignore(t => t.Password); //TODO: Why?
Property(t => t.Title)
.HasMaxLength(8);
Property(t => t.FirstName)
.IsRequired()
.HasMaxLength(50);
Property(t => t.MiddleName)
.HasMaxLength(50);
Property(t => t.LastName)
.IsRequired()
.HasMaxLength(50);
Property(t => t.Suffix)
.HasMaxLength(10);
// Table & Column Mappings
ToTable("Person", "Person");
Property(t => t.BusinessEntityID).HasColumnName("BusinessEntityID");
Property(t => t.NameStyle).HasColumnName("NameStyle");
Property(t => t.Title).HasColumnName("Title");
Property(t => t.FirstName).HasColumnName("FirstName");
Property(t => t.MiddleName).HasColumnName("MiddleName");
Property(t => t.LastName).HasColumnName("LastName");
Property(t => t.Suffix).HasColumnName("Suffix");
Property(t => t.EmailPromotion).HasColumnName("EmailPromotion");
Property(t => t.AdditionalContactInfo).HasColumnName("AdditionalContactInfo");
Property(t => t.rowguid).HasColumnName("rowguid");
Property(t => t.ModifiedDate).HasColumnName("ModifiedDate");
HasOptional(t => t.Employee).WithRequired(t => t.PersonDetails);
}
}
}
| apache-2.0 | C# |
0ec5c81ef9e7706d69d2edeef16adc5d2c8ef5eb | Add further documentation to Add<T> for adding multiple, disjointed files to address discussion in #152. | BluewireTechnologies/cassette,andrewdavey/cassette,honestegg/cassette,BluewireTechnologies/cassette,damiensawyer/cassette,andrewdavey/cassette,damiensawyer/cassette,andrewdavey/cassette,honestegg/cassette,honestegg/cassette,damiensawyer/cassette | src/Website/Views/Documentation/Configuration_AddFile.cshtml | src/Website/Views/Documentation/Configuration_AddFile.cshtml | @{
ViewBag.Title = "Cassette | Add File(s)";
ViewBag.Description = "How to create a bundle from a single file or multiple, disjointed files.";
}
<h1>Add File</h1>
<p>A bundle can be added using a single file, for example, a .less with additional <span class="code-type">@import</span> statements. Each file set can then be a Cassette bundle.</p>
<p>Here's an example structure:</p>
<pre>Content/
- Libraries/
- primary.less
- reset.less
- variables.less
</pre>
<p>Inside of <code>primary.less</code> could exist an <span class="code-type">@import</span> structure:</p>
<pre><code><span class="tag">@import</span> "reset.less";
<span class="tag">@import</span> "variables.less";</code></pre>
<p>By explicitly specifying a file, Cassette only loads that file and the assets specified by that file.</p>
<pre><code><span class="keyword">public</span> <span class="keyword">class</span> <span class="code-type">CassetteConfiguration</span> : <span class="code-type">ICassetteConfiguration</span>
{
<span class="keyword">public</span> <span class="keyword">void</span> Configure(<span class="code-type">BundleCollection</span> bundles, <span class="code-type">CassetteSettings</span> settings)
{
bundles.Add<<span class="code-type">StylesheetBundle</span>>(<span class="string">"Content/Libraries/primary.less"</span>);
}
}</code></pre>
<h2>Multiple Files</h2>
<p>A bundle can also be created from multiple, disjointed files, such as several single files in multiple directories.</p>
<p>Again, an example structure:</p>
<pre>Content/
- Libraries/
- primary.less
- reset.less
- variables.less
- InHouse/
- site.less
</pre>
<p>The <code>Add<T></code> method contains an overload accepting an <code>IEnumerable<string></code> of file names:</p>
<pre><code><span class="keyword">public</span> <span class="keyword">class</span> <span class="code-type">CassetteConfiguration</span> : <span class="code-type">ICassetteConfiguration</span>
{
<span class="keyword">public</span> <span class="keyword">void</span> Configure(<span class="code-type">BundleCollection</span> bundles, <span class="code-type">CassetteSettings</span> settings)
{
var files = new [] {
<span class="string">"Content/Libraries/primary.less"</span>,
<span class="string">"Content/InHouse/site.less"</span>
};
bundles.Add<<span class="code-type">StylesheetBundle</span>>(<span class="string">"styles"</span>, files);
}
}</code></pre>
<p>In this example, <code class="string">"styles"</code> becomes the referenced bundle alias for both of these files.</p>
<pre><code><span class="code-type">Bundles</span>.Reference(<span class="string">"styles"</span>);</code></pre> | @{
ViewBag.Title = "Cassette | Add File";
ViewBag.Description = "How to create a bundle from a single file.";
}
<h1>Add File</h1>
<p>A bundle can be added using a single file, for example, a .less with additional <span class="code-type">@import</span> statements. Each file set can then be a Cassette bundle.</p>
<p>Here's an example structure:</p>
<pre>Content/
- Libraries/
- primary.less
- reset.less
- variables.less
</pre>
<p>Inside of <code>primary.less</code> could exist an <span class="code-type">@import</span> structure:</p>
<pre><code><span class="tag">@import</span> "reset.less";
<span class="tag">@import</span> "variables.less";</code></pre>
<p>By explicitly specifying a file, Cassette only loads that file and the assets specified by that file.</p>
<pre><code><span class="keyword">public</span> <span class="keyword">class</span> <span class="code-type">CassetteConfiguration</span> : <span class="code-type">ICassetteConfiguration</span>
{
<span class="keyword">public</span> <span class="keyword">void</span> Configure(<span class="code-type">BundleCollection</span> bundles, <span class="code-type">CassetteSettings</span> settings)
{
bundles.Add<<span class="code-type">StylesheetBundle</span>>(<span class="string">"Content/Libraries/primary.less"</span>);
}
}</code></pre> | mit | C# |
e9ff5113cf65379a974717e854d178cf6a4af361 | Add xml doc comment | vbfox/pinvoke,jmelosegui/pinvoke,AArnott/pinvoke | src/Windows.Core/IMAGE_SECTION_HEADER+CharacteristicsType.cs | src/Windows.Core/IMAGE_SECTION_HEADER+CharacteristicsType.cs | // Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
namespace PInvoke
{
using System;
/// <content>
/// Contains the <see cref="CharacteristicsType"/> nested type.
/// </content>
public partial struct IMAGE_SECTION_HEADER
{
/// <summary>
/// Enumerates the values that may be expected in the <see cref="Characteristics"/> field.
/// </summary>
[Flags]
public enum CharacteristicsType
{
// TODO
}
}
}
| // Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
namespace PInvoke
{
using System;
public partial struct IMAGE_SECTION_HEADER
{
[Flags]
public enum CharacteristicsType
{
// TODO
}
}
}
| mit | C# |
946a16307d5d7fd2cdec2f8bee78d12b327cac7f | Bump version numbers to 1.3 | DanTup/TestAdapters,DanTup/TestAdapters | DanTup.TestAdapters/Properties/SharedAssemblyInfo.cs | DanTup.TestAdapters/Properties/SharedAssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Danny Tuppeny Test Adapter Collection")]
[assembly: AssemblyCompany("Danny Tuppeny")]
[assembly: AssemblyCopyright("Copyright Danny Tuppeny © 2014")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.3.*")]
[assembly: AssemblyFileVersion("1.3.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Danny Tuppeny Test Adapter Collection")]
[assembly: AssemblyCompany("Danny Tuppeny")]
[assembly: AssemblyCopyright("Copyright Danny Tuppeny © 2014")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyFileVersion("1.2.0.0")]
| mit | C# |
9a13bd7b098ccadbc162528ee2b2619230cdbe8c | fix version to 4.1.0 | NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity,NIFTYCloud-mbaas/ncmb_unity | ncmb_unity/Assets/NCMB/Script/CommonConstant.cs | ncmb_unity/Assets/NCMB/Script/CommonConstant.cs | /*******
Copyright 2017-2020 FUJITSU CLOUD TECHNOLOGIES LIMITED All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
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.Collections;
namespace NCMB.Internal
{
//通信種別
internal enum ConnectType
{
//GET通信
GET,
//POST通信
POST,
//PUT通信
PUT,
//DELETE通信
DELETE
}
/// <summary>
/// 定数を定義する共通用のクラスです
/// </summary>
internal static class CommonConstant
{
//service
public static readonly string DOMAIN = "mbaas.api.nifcloud.com";//ドメイン
public static readonly string DOMAIN_URL = "https://mbaas.api.nifcloud.com";//ドメインのURL
public static readonly string API_VERSION = "2013-09-01";//APIバージョン
public static readonly string SDK_VERSION = "4.1.0"; //SDKバージョン
//DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください
}
}
| /*******
Copyright 2017-2020 FUJITSU CLOUD TECHNOLOGIES LIMITED All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
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.Collections;
namespace NCMB.Internal
{
//通信種別
internal enum ConnectType
{
//GET通信
GET,
//POST通信
POST,
//PUT通信
PUT,
//DELETE通信
DELETE
}
/// <summary>
/// 定数を定義する共通用のクラスです
/// </summary>
internal static class CommonConstant
{
//service
public static readonly string DOMAIN = "mbaas.api.nifcloud.com";//ドメイン
public static readonly string DOMAIN_URL = "https://mbaas.api.nifcloud.com";//ドメインのURL
public static readonly string API_VERSION = "2013-09-01";//APIバージョン
public static readonly string SDK_VERSION = "4.0.5"; //SDKバージョン
//DEBUG LOG Setting: NCMBDebugにてdefine設定をしてください
}
}
| apache-2.0 | C# |
6656164cc5bbc67b4c70410f8c75680e1b19c386 | Remove unnecessary Pack directive to fix build break (#20681) | krk/coreclr,wtgodbe/coreclr,cshung/coreclr,cshung/coreclr,krk/coreclr,mmitche/coreclr,mmitche/coreclr,poizan42/coreclr,wtgodbe/coreclr,mmitche/coreclr,cshung/coreclr,krk/coreclr,krk/coreclr,poizan42/coreclr,poizan42/coreclr,krk/coreclr,cshung/coreclr,krk/coreclr,mmitche/coreclr,mmitche/coreclr,wtgodbe/coreclr,wtgodbe/coreclr,poizan42/coreclr,cshung/coreclr,wtgodbe/coreclr,mmitche/coreclr,poizan42/coreclr,wtgodbe/coreclr,poizan42/coreclr,cshung/coreclr | src/System.Private.CoreLib/shared/System/Number.NumberBuffer.cs | src/System.Private.CoreLib/shared/System/Number.NumberBuffer.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;
namespace System
{
internal static partial class Number
{
// We need 1 additional byte, per length, for the terminating null
private const int DecimalNumberBufferLength = 50 + 1;
private const int DoubleNumberBufferLength = 768 + 1; // 767 for the longest input + 1 for rounding: 4.9406564584124654E-324
private const int Int32NumberBufferLength = 10 + 1; // 10 for the longest input: 2,147,483,647
private const int Int64NumberBufferLength = 19 + 1; // 19 for the longest input: 9,223,372,036,854,775,807
private const int SingleNumberBufferLength = 113 + 1; // 112 for the longest input + 1 for rounding: 1.40129846E-45
private const int UInt32NumberBufferLength = 10 + 1; // 10 for the longest input: 4,294,967,295
private const int UInt64NumberBufferLength = 20 + 1; // 20 for the longest input: 18,446,744,073,709,551,615
internal unsafe ref struct NumberBuffer
{
public int Precision;
public int Scale;
public bool Sign;
public NumberBufferKind Kind;
public Span<char> Digits;
public NumberBuffer(NumberBufferKind kind, char* pDigits, int digitsLength)
{
Precision = 0;
Scale = 0;
Sign = false;
Kind = kind;
Digits = new Span<char>(pDigits, digitsLength);
}
public char* GetDigitsPointer()
{
// This is safe to do since we are a ref struct
return (char*)(Unsafe.AsPointer(ref Digits[0]));
}
}
internal enum NumberBufferKind : byte
{
Unknown = 0,
Integer = 1,
Decimal = 2,
Double = 3,
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;
namespace System
{
internal static partial class Number
{
// We need 1 additional byte, per length, for the terminating null
private const int DecimalNumberBufferLength = 50 + 1;
private const int DoubleNumberBufferLength = 768 + 1; // 767 for the longest input + 1 for rounding: 4.9406564584124654E-324
private const int Int32NumberBufferLength = 10 + 1; // 10 for the longest input: 2,147,483,647
private const int Int64NumberBufferLength = 19 + 1; // 19 for the longest input: 9,223,372,036,854,775,807
private const int SingleNumberBufferLength = 113 + 1; // 112 for the longest input + 1 for rounding: 1.40129846E-45
private const int UInt32NumberBufferLength = 10 + 1; // 10 for the longest input: 4,294,967,295
private const int UInt64NumberBufferLength = 20 + 1; // 20 for the longest input: 18,446,744,073,709,551,615
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal unsafe ref struct NumberBuffer
{
public int Precision;
public int Scale;
public bool Sign;
public NumberBufferKind Kind;
public Span<char> Digits;
public NumberBuffer(NumberBufferKind kind, char* pDigits, int digitsLength)
{
Precision = 0;
Scale = 0;
Sign = false;
Kind = kind;
Digits = new Span<char>(pDigits, digitsLength);
}
public char* GetDigitsPointer()
{
// This is safe to do since we are a ref struct
return (char*)(Unsafe.AsPointer(ref Digits[0]));
}
}
internal enum NumberBufferKind : byte
{
Unknown = 0,
Integer = 1,
Decimal = 2,
Double = 3,
}
}
}
| mit | C# |
8cfee82b5538d4dda47fe16b4b0ce20d1be4d058 | fix lfg data parsing | Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns | TeraPacketParser/Messages/S_PARTY_MEMBER_INFO.cs | TeraPacketParser/Messages/S_PARTY_MEMBER_INFO.cs | using System;
using System.Collections.Generic;
using TeraDataLite;
namespace TeraPacketParser.Messages
{
public class S_PARTY_MEMBER_INFO : ParsedMessage
{
public uint Id { get; }
public List<GroupMemberData> Members { get; }
public S_PARTY_MEMBER_INFO(TeraMessageReader reader) : base(reader)
{
var count = reader.ReadUInt16();
var offset = reader.ReadUInt16();
reader.Skip(2); // bool isRaid + bool adminInspectionUI
reader.RepositionAt(offset);
Members = new List<GroupMemberData>();
for (var i = 0; i < count; i++)
{
var u = new GroupMemberData();
reader.Skip(2); // curr
var next = reader.ReadUInt16();
var nameOffset = reader.ReadUInt16();
u.PlayerId = reader.ReadUInt32();
if (reader.Factory.ReleaseVersion / 100 >= 108)
u.ServerId = reader.ReadUInt32();
u.Class = (Class)reader.ReadUInt16();
reader.Skip(4); // race + gender
u.Level = Convert.ToUInt32(reader.ReadUInt16());
var worldId = reader.ReadUInt32(); // worldId
u.GuardId = reader.ReadUInt32();
u.SectionId = reader.ReadUInt32();
if (reader.Factory.ReleaseVersion / 100 >= 108)
reader.Skip(4); // dungeonGauntletDifficultyId
u.IsLeader = reader.ReadBoolean();
u.Online = reader.ReadBoolean();
reader.RepositionAt(nameOffset);
u.Name = reader.ReadTeraString();
if (u.IsLeader) Id = u.PlayerId;
Members.Add(u);
if (next != 0) reader.BaseStream.Position = next - 4;
}
}
}
}
| using System;
using System.Collections.Generic;
using TeraDataLite;
namespace TeraPacketParser.Messages
{
public class S_PARTY_MEMBER_INFO : ParsedMessage
{
public uint Id { get; }
public List<GroupMemberData> Members { get; }
public S_PARTY_MEMBER_INFO(TeraMessageReader reader) : base(reader)
{
var count = reader.ReadUInt16();
var offset = reader.ReadUInt16();
reader.Skip(2); // bool isRaid + bool adminInspectionUI
reader.BaseStream.Position = offset - 4;
Members = new List<GroupMemberData>();
for (var i = 0; i < count; i++)
{
var u = new GroupMemberData();
reader.Skip(2);
var next = reader.ReadUInt16();
var nameOffset = reader.ReadUInt16();
u.PlayerId = reader.ReadUInt32();
if (reader.Factory.ReleaseVersion / 100 >= 108) u.ServerId = reader.ReadUInt32();
u.Class = (Class)reader.ReadUInt16();
reader.Skip(4);
u.Level = Convert.ToUInt32(reader.ReadUInt16());
reader.Skip(4); // worldId
u.GuardId = reader.ReadUInt32();
u.SectionId = reader.ReadUInt32();
u.Order = Convert.ToInt32(reader.ReadInt16());
reader.Skip(2);
u.IsLeader = reader.ReadBoolean();
if (u.IsLeader) Id = u.PlayerId;
u.Online = reader.ReadBoolean();
reader.BaseStream.Position = nameOffset - 4;
u.Name = reader.ReadTeraString();
Members.Add(u);
if (next != 0) reader.BaseStream.Position = next - 4;
}
}
}
}
| mit | C# |
f1441d1efc26ee6c233753213831ff01b87a0f41 | Clean up build file | Redth/Cake.FileHelpers,Redth/Cake.FileHelpers | build.cake | build.cake | #tool nuget:?package=NUnit.ConsoleRunner
var sln = "./Cake.FileHelpers.sln";
var nuspec = "./Cake.FileHelpers.nuspec";
var version = Argument ("version", "1.0.0.0");
var target = Argument ("target", "build");
var configuration = Argument("configuration", "Release");
Task ("build").Does (() =>
{
NuGetRestore (sln);
DotNetBuild (sln, c => c.Configuration = configuration);
});
Task ("package").IsDependentOn("build").Does (() =>
{
EnsureDirectoryExists ("./output/");
NuGetPack (nuspec, new NuGetPackSettings {
OutputDirectory = "./output/",
Version = version,
});
});
Task ("clean").Does (() =>
{
CleanDirectories ("./**/bin");
CleanDirectories ("./**/obj");
});
Task("test").IsDependentOn("package").Does(() =>
{
NUnit3("./**/bin/"+ configuration + "/*.Tests.dll");
});
Task ("Default")
.IsDependentOn ("test");
RunTarget (target);
| #tool nuget:?package=NUnit.ConsoleRunner&version=3.6.0
var sln = "./Cake.FileHelpers.sln";
var nuspec = "./Cake.FileHelpers.nuspec";
var version = Argument ("version", "1.0.0.0");
var target = Argument ("target", "lib");
var configuration = Argument("configuration", "Release");
Task ("lib").Does (() =>
{
NuGetRestore (sln);
DotNetBuild (sln, c => c.Configuration = configuration);
});
Task ("nuget").IsDependentOn ("unit-tests").Does (() =>
{
CreateDirectory ("./nupkg/");
NuGetPack (nuspec, new NuGetPackSettings {
Verbosity = NuGetVerbosity.Detailed,
OutputDirectory = "./nupkg/",
Version = version,
// NuGet messes up path on mac, so let's add ./ in front again
BasePath = "././",
});
});
Task ("push").IsDependentOn ("nuget").Does (() =>
{
// Get the newest (by last write time) to publish
var newestNupkg = GetFiles ("nupkg/*.nupkg")
.OrderBy (f => new System.IO.FileInfo (f.FullPath).LastWriteTimeUtc)
.LastOrDefault ();
var apiKey = TransformTextFile ("./.nugetapikey").ToString ();
NuGetPush (newestNupkg, new NuGetPushSettings {
Verbosity = NuGetVerbosity.Detailed,
ApiKey = apiKey
});
});
Task ("clean").Does (() =>
{
CleanDirectories ("./**/bin");
CleanDirectories ("./**/obj");
CleanDirectories ("./**/Components");
CleanDirectories ("./**/tools");
DeleteFiles ("./**/*.apk");
});
Task("unit-tests").IsDependentOn("lib").Does(() =>
{
NUnit3("./**/bin/"+ configuration + "/*.Tests.dll");
});
Task ("Default")
.IsDependentOn ("nuget");
RunTarget (target);
| apache-2.0 | C# |
17b6fcf9b1bc211ecc7aa065509b2b82a5b8fc40 | Remove switch for multiplatform build. | sqeezy/FibonacciHeap,sqeezy/FibonacciHeap | build.cake | build.cake | #tool "nuget:?package=xunit.runner.console"
var target = Argument("target", "Default");
var outputDir = "./bin";
Task("Default")
.IsDependentOn("Xunit")
.Does(() =>
{
});
Task("Xunit")
.IsDependentOn("Build")
.Does(()=>
{
XUnit2("./src/FibonacciHeap.Tests/bin/Release/FibonacciHeap.Tests.dll");
});
Task("Build")
.IsDependentOn("Nuget")
.Does(()=>
{
MSBuild("FibonacciHeap.sln", new MSBuildSettings {
Configuration = "Release"
});
});
Task("Nuget")
.IsDependentOn("Clean")
.Does(()=>
{
NuGetRestore("./");
});
Task("Clean")
.Does(()=>
{
CleanDirectories(outputDir+"/**");
});
RunTarget(target); | #tool "nuget:?package=xunit.runner.console"
var target = Argument("target", "Default");
var outputDir = "./bin";
Task("Default")
.IsDependentOn("Xunit")
.Does(() =>
{
});
Task("Xunit")
.IsDependentOn("Build")
.Does(()=>
{
XUnit2("./src/FibonacciHeap.Tests/bin/Release/FibonacciHeap.Tests.dll");
});
Task("Build")
.IsDependentOn("Nuget")
.Does(()=>
{
if(IsRunningOnUnix())
{
XBuild("FibonacciHeap.sln",new XBuildSettings {
Configuration = "Release"
}.WithProperty("POSIX","True"));
}
else
{
MSBuild("FibonacciHeap.sln", new MSBuildSettings {
Configuration = "Release"
});
}
});
Task("Nuget")
.IsDependentOn("Clean")
.Does(()=>
{
NuGetRestore("./");
});
Task("Clean")
.Does(()=>
{
CleanDirectories(outputDir+"/**");
});
RunTarget(target); | mit | C# |
aac92716f3945387a607db730045b4cf72350747 | Bump build script to nuget 2.14 | foxbot/Discord.Addons.InteractiveCommands,foxbot/Discord.Addons.InteractiveCommands | build.cake | build.cake | #addin nuget:?package=NuGet.Core&version=2.14.0
#addin "Cake.ExtendedNuGet"
var MyGetKey = EnvironmentVariable("MYGET_KEY");
string BuildNumber = EnvironmentVariable("TRAVIS_BUILD_NUMBER");
string Branch = EnvironmentVariable("TRAVIS_BRANCH");
ReleaseNotes Notes = null;
Task("Restore")
.Does(() =>
{
var settings = new DotNetCoreRestoreSettings
{
Sources = new[] { "https://www.myget.org/F/discord-net/api/v2", "https://www.nuget.org/api/v2" }
};
DotNetCoreRestore(settings);
});
Task("ReleaseNotes")
.Does(() =>
{
Notes = ParseReleaseNotes("./ReleaseNotes.md");
Information("Release Version: {0}", Notes.Version);
});
Task("Build")
.IsDependentOn("ReleaseNotes")
.Does(() =>
{
var suffix = BuildNumber != null ? BuildNumber.PadLeft(5,'0') : "";
var settings = new DotNetCorePackSettings
{
Configuration = "Release",
OutputDirectory = "./artifacts/",
EnvironmentVariables = new Dictionary<string, string> {
{ "BuildVersion", Notes.Version.ToString() },
{ "BuildNumber", suffix },
{ "ReleaseNotes", string.Join("\n", Notes.Notes) },
},
};
DotNetCorePack("./src/Discord.Addons.InteractiveCommands/", settings);
DotNetCoreBuild("./src/Example/");
});
Task("Deploy")
.WithCriteria(Branch == "master")
.Does(() =>
{
var settings = new NuGetPushSettings
{
Source = "https://www.myget.org/F/discord-net/api/v2/package",
ApiKey = MyGetKey
};
var packages = GetFiles("./artifacts/*.nupkg");
NuGetPush(packages, settings);
});
Task("Default")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.IsDependentOn("Deploy")
.Does(() =>
{
Information("Build Succeeded");
});
RunTarget("Default"); | #addin nuget:?package=NuGet.Core&version=2.12.0
#addin "Cake.ExtendedNuGet"
var MyGetKey = EnvironmentVariable("MYGET_KEY");
string BuildNumber = EnvironmentVariable("TRAVIS_BUILD_NUMBER");
string Branch = EnvironmentVariable("TRAVIS_BRANCH");
ReleaseNotes Notes = null;
Task("Restore")
.Does(() =>
{
var settings = new DotNetCoreRestoreSettings
{
Sources = new[] { "https://www.myget.org/F/discord-net/api/v2", "https://www.nuget.org/api/v2" }
};
DotNetCoreRestore(settings);
});
Task("ReleaseNotes")
.Does(() =>
{
Notes = ParseReleaseNotes("./ReleaseNotes.md");
Information("Release Version: {0}", Notes.Version);
});
Task("Build")
.IsDependentOn("ReleaseNotes")
.Does(() =>
{
var suffix = BuildNumber != null ? BuildNumber.PadLeft(5,'0') : "";
var settings = new DotNetCorePackSettings
{
Configuration = "Release",
OutputDirectory = "./artifacts/",
EnvironmentVariables = new Dictionary<string, string> {
{ "BuildVersion", Notes.Version.ToString() },
{ "BuildNumber", suffix },
{ "ReleaseNotes", string.Join("\n", Notes.Notes) },
},
};
DotNetCorePack("./src/Discord.Addons.InteractiveCommands/", settings);
DotNetCoreBuild("./src/Example/");
});
Task("Deploy")
.WithCriteria(Branch == "master")
.Does(() =>
{
var settings = new NuGetPushSettings
{
Source = "https://www.myget.org/F/discord-net/api/v2/package",
ApiKey = MyGetKey
};
var packages = GetFiles("./artifacts/*.nupkg");
NuGetPush(packages, settings);
});
Task("Default")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.IsDependentOn("Deploy")
.Does(() =>
{
Information("Build Succeeded");
});
RunTarget("Default"); | isc | C# |
f42d9aaaf5873d1c544402c1470b7504d2106e7b | Use XUnit v2 runner in Cake instead of XUnit v1 | Marc3842h/Titan,Marc3842h/Titan,Marc3842h/Titan | build.cake | build.cake | #tool "nuget:?package=xunit.runner.console"
var config = Argument("configuration", "Release");
var runEnvironment = Argument("runenv", "local");
var buildDir = Directory("./Titan/bin/") + Directory(config);
var testDir = Directory("./TitanTest/bin/") + Directory(config);
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("./Titan.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
if(IsRunningOnWindows())
{
// Use MSBuild
MSBuild("./Titan.sln", settings => settings.SetConfiguration(config));
}
else
{
// Use XBuild
XBuild("./Titan.sln", settings => settings.SetConfiguration(config));
}
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
XUnit2(GetFiles("./TitanTest/bin/" + config + "/Titan*.dll"), new XUnit2Settings()
{
Parallelism = ParallelismOption.All,
OutputDirectory = "./TitanTest/bin/" + config + "/results"
});
});
if(runEnvironment.ToLower() == "ci") {
Task("Default").IsDependentOn("Run-Unit-Tests");
} else {
Task("Default").IsDependentOn("Build");
}
RunTarget("Default");
| #tool "nuget:?package=xunit.runners&version=1.9.2"
var config = Argument("configuration", "Release");
var runEnvironment = Argument("runenv", "local");
var buildDir = Directory("./Titan/bin/") + Directory(config);
var testDir = Directory("./TitanTest/bin/") + Directory(config);
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("./Titan.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
if(IsRunningOnWindows())
{
// Use MSBuild
MSBuild("./Titan.sln", settings => settings.SetConfiguration(config));
}
else
{
// Use XBuild
XBuild("./Titan.sln", settings => settings.SetConfiguration(config));
}
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
XUnit(GetFiles("./TitanTest/bin/" + config + "/TitanTest.dll"), new XUnitSettings()
{
OutputDirectory = "./TitanTest/bin/" + config + "/results"
});
});
if(runEnvironment.ToLower() == "ci") {
Task("Default").IsDependentOn("Run-Unit-Tests");
} else {
Task("Default").IsDependentOn("Build");
}
RunTarget("Default");
| mit | C# |
fc95089ecfa72296611a92d599bce83b1ce6e339 | Add Scott Lang (Ant-Man) | jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox | ZirMed.TrainingSandbox/Views/Home/Contact.cshtml | ZirMed.TrainingSandbox/Views/Home/Contact.cshtml | @{
ViewBag.Title = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
425.555.0100
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
<strong>Pat:</strong> <a href="mailto:patrick.fulton@zirmed.com">patrick.fulton@zirmed.com</a>
<strong>Dustin:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a>
<strong>Nicolas:</strong> <a href="mailto:nick.wolf@zirmed.com">nick.wolf@zirmed.com</a>
<strong>Dustin2:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a>
<strong>Travis:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a>
<strong>Travis2:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a>
<strong>Stephanie:</strong> <a href="mailto:stephanie.craig@zirmed.com">stephanie.craig@zirmed.com</a>
<strong>Bruce Wayne:</strong>
<strong>Larry Briggs:</strong>
<strong>Clark Kent:</strong> <a href="mailto:superman.com">superman.com</a>
<strong>Peter Parker:</strong> <a href="mailto:spider-man.com">spider-man.com</a>
<strong>Oliver Queen:</strong>
<strong>Barry Allen:</strong>
<strong>Bob: </strong>
<strong>Bruce Banner:</strong> <a href="#">Hulk.com</a>
<strong>Wade Winston Wilson:</strong> <a href="#">Deadpool.com</a>
<strong>Diana Prince:</strong> <a href="#">WonderWoman.com</a>
<strong>Scott Lang:</strong> <a href="#">Ant-Man.com</a>
</address> | @{
ViewBag.Title = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
425.555.0100
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
<strong>Pat:</strong> <a href="mailto:patrick.fulton@zirmed.com">patrick.fulton@zirmed.com</a>
<strong>Dustin:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a>
<strong>Nicolas:</strong> <a href="mailto:nick.wolf@zirmed.com">nick.wolf@zirmed.com</a>
<strong>Dustin2:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a>
<strong>Travis:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a>
<strong>Travis2:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a>
<strong>Stephanie:</strong> <a href="mailto:stephanie.craig@zirmed.com">stephanie.craig@zirmed.com</a>
<strong>Bruce Wayne:</strong>
<strong>Larry Briggs:</strong>
<strong>Clark Kent:</strong> <a href="mailto:superman.com">superman.com</a>
<strong>Peter Parker:</strong> <a href="mailto:spider-man.com">spider-man.com</a>
<strong>Oliver Queen:</strong>
<strong>Barry Allen:</strong>
<strong>Bob: </strong>
<strong>Bruce Banner:</strong> <a href="#">Hulk.com</a>
<strong>Wade Winston Wilson:</strong> <a href="#">Deadpool.com</a>
<strong>Diana Prince:</strong> <a href="#">WonderWoman.com</a>
</address> | mit | C# |
b4986a6259f2720b032748733686ce63fcc73172 | 修复获取表达式成员栈的缺陷。 :star: :weary: | Zongsoft/Zongsoft.CoreLibrary | src/Common/ExpressionUtility.cs | src/Common/ExpressionUtility.cs | /*
* Authors:
* 钟峰(Popeye Zhong) <zongsoft@gmail.com>
*
* Copyright (C) 2016 Zongsoft Corporation <http://www.zongsoft.com>
*
* This file is part of Zongsoft.CoreLibrary.
*
* Zongsoft.CoreLibrary is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Zongsoft.CoreLibrary is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Zongsoft.CoreLibrary; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Zongsoft.Common
{
internal static class ExpressionUtility
{
internal static string GetMemberName(Expression expression)
{
return GetMember(expression).Item1;
}
internal static Tuple<string, Type> GetMember(Expression expression)
{
var tuple = ResolveMemberExpression(expression, new Stack<MemberInfo>());
if(tuple == null)
throw new ArgumentException("Invalid member expression.");
switch(tuple.Item2.MemberType)
{
case MemberTypes.Property:
return new Tuple<string, Type>(tuple.Item1, ((PropertyInfo)tuple.Item2).PropertyType);
case MemberTypes.Field:
return new Tuple<string, Type>(tuple.Item1, ((FieldInfo)tuple.Item2).FieldType);
default:
throw new InvalidOperationException("Invalid expression.");
}
}
private static Tuple<string, MemberInfo> ResolveMemberExpression(Expression expression, Stack<MemberInfo> stack)
{
if(expression.NodeType == ExpressionType.Lambda)
return ResolveMemberExpression(((LambdaExpression)expression).Body, stack);
switch(expression.NodeType)
{
case ExpressionType.MemberAccess:
stack.Push(((MemberExpression)expression).Member);
if(((MemberExpression)expression).Expression != null)
return ResolveMemberExpression(((MemberExpression)expression).Expression, stack);
break;
case ExpressionType.Convert:
case ExpressionType.ConvertChecked:
return ResolveMemberExpression(((UnaryExpression)expression).Operand, stack);
}
if(stack == null || stack.Count == 0)
return null;
var path = string.Empty;
var type = typeof(object);
MemberInfo member = null;
while(stack.Count > 0)
{
member = stack.Pop();
if(path.Length > 0)
path += ".";
path += member.Name;
}
return new Tuple<string, MemberInfo>(path, member);
}
}
}
| /*
* Authors:
* 钟峰(Popeye Zhong) <zongsoft@gmail.com>
*
* Copyright (C) 2016 Zongsoft Corporation <http://www.zongsoft.com>
*
* This file is part of Zongsoft.CoreLibrary.
*
* Zongsoft.CoreLibrary is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Zongsoft.CoreLibrary is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Zongsoft.CoreLibrary; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Zongsoft.Common
{
internal static class ExpressionUtility
{
internal static string GetMemberName(Expression expression)
{
return GetMember(expression).Item1;
}
internal static Tuple<string, Type> GetMember(Expression expression)
{
var tuple = ResolveMemberExpression(expression, new Stack<MemberInfo>());
if(tuple == null)
throw new ArgumentException("Invalid member expression.");
switch(tuple.Item2.MemberType)
{
case MemberTypes.Property:
return new Tuple<string, Type>(tuple.Item1, ((PropertyInfo)tuple.Item2).PropertyType);
case MemberTypes.Field:
return new Tuple<string, Type>(tuple.Item1, ((FieldInfo)tuple.Item2).FieldType);
default:
throw new InvalidOperationException("Invalid expression.");
}
}
private static Tuple<string, MemberInfo> ResolveMemberExpression(Expression expression, Stack<MemberInfo> stack)
{
if(expression.NodeType == ExpressionType.Lambda)
return ResolveMemberExpression(((LambdaExpression)expression).Body, stack);
if(expression.NodeType == ExpressionType.MemberAccess)
{
stack.Push(((MemberExpression)expression).Member);
if(((MemberExpression)expression).Expression != null)
return ResolveMemberExpression(((MemberExpression)expression).Expression, stack);
}
if(stack == null || stack.Count == 0)
return null;
var path = string.Empty;
var type = typeof(object);
MemberInfo member = null;
while(stack.Count > 0)
{
member = stack.Pop();
if(path.Length > 0)
path += ".";
path += member.Name;
}
return new Tuple<string, MemberInfo>(path, member);
}
}
}
| lgpl-2.1 | C# |
c7ca8a12e5233a7b766b0fd7e3f2e0e5ca3bac6c | Make MockBehavior enumeration backwards compatible with v4 | Moq/moq | src/Moq/Moq/MockBehavior.cs | src/Moq/Moq/MockBehavior.cs | using System.ComponentModel;
namespace Moq
{
/// <summary>
/// Options to customize the behavior of the mock.
/// </summary>
public enum MockBehavior
{
/// <summary>Obsolete</summary>
[EditorBrowsable(EditorBrowsableState.Never)]
Default = 1,
/// <summary>
/// Will never throw exceptions, returning default
/// values when necessary (null for reference types,
/// zero for value types and empty enumerables and arrays).
/// </summary>
Loose = 1,
/// <summary>
/// Causes the mock to always throw
/// an exception for invocations that don't have a
/// corresponding setup.
/// </summary>
Strict = 0,
}
}
| namespace Moq
{
/// <summary>
/// Options to customize the behavior of the mock.
/// </summary>
public enum MockBehavior
{
/// <summary>
/// Will never throw exceptions, returning default
/// values when necessary (null for reference types,
/// zero for value types and empty enumerables and arrays).
/// </summary>
Loose,
/// <summary>
/// Causes the mock to always throw
/// an exception for invocations that don't have a
/// corresponding setup.
/// </summary>
Strict,
}
}
| apache-2.0 | C# |
e5abb23b0b7eddb14a341f3ca1446ebdcf378b5b | Update ObservableExtensions.cs | keith-hall/Extensions,keith-hall/Extensions | src/ObservableExtensions.cs | src/ObservableExtensions.cs | using System;
using System.Reactive.Linq;
namespace HallLibrary.Extensions
{
/// <summary>
/// Contains extension methods for working with observables.
/// </summary>
public static class ObservableExtensions
{
/// <summary>
/// Returns the current value of an observable with the previous value.
/// </summary>
/// <typeparam name="TSource">The source type.</typeparam>
/// <typeparam name="TOutput">The output type after the <paramref name="projection" /> has been applied.</typeparam>
/// <param name="source">The observable.</param>
/// <param name="projection">The projection to apply.</param>
/// <returns>The current observable value with the previous value.</returns>
public static IObservable<TOutput> WithPrevious<TSource, TOutput>(this IObservable<TSource> source, Func<TSource, TSource, TOutput> projection)
{
return source.Scan(Tuple.Create(default(TSource), default(TSource)),
(previous, current) => Tuple.Create(previous.Item2, current))
.Select(t => projection(t.Item1, t.Item2));
}
}
}
| using System;
using System.Reactive.Linq;
namespace HallLibrary.Extensions
{
/// <summary>
/// Contains extension methods for working with observables.
/// </summary>
public static class ObservableExtensions
{
public static IObservable<TOutput> WithPrevious<TSource, TOutput>(this IObservable<TSource> source, Func<TSource, TSource, TOutput> projection)
{
return source.Scan(Tuple.Create(default(TSource), default(TSource)),
(previous, current) => Tuple.Create(previous.Item2, current))
.Select(t => projection(t.Item1, t.Item2));
}
}
}
| apache-2.0 | C# |
4092b4ad3395e5e5b18b054ff1546be32b2405a7 | Increase toleranceSeconds in SafeWait_Timeout test | atata-framework/atata-webdriverextras,atata-framework/atata-webdriverextras | src/Atata.WebDriverExtras.Tests/SafeWaitTests.cs | src/Atata.WebDriverExtras.Tests/SafeWaitTests.cs | using System;
using System.Threading;
using NUnit.Framework;
namespace Atata.WebDriverExtras.Tests
{
[TestFixture]
[Parallelizable(ParallelScope.None)]
public class SafeWaitTests
{
private SafeWait<object> wait;
[SetUp]
public void SetUp()
{
wait = new SafeWait<object>(new object())
{
Timeout = TimeSpan.FromSeconds(.3),
PollingInterval = TimeSpan.FromSeconds(.05)
};
}
[Test]
public void SafeWait_Success_Immediate()
{
using (StopwatchAsserter.Within(0, .01))
wait.Until(_ =>
{
return true;
});
}
[Test]
public void SafeWait_Timeout()
{
using (StopwatchAsserter.Within(.3, .015))
wait.Until(_ =>
{
return false;
});
}
[Test]
public void SafeWait_PollingInterval()
{
using (StopwatchAsserter.Within(.3, .2))
wait.Until(_ =>
{
Thread.Sleep(TimeSpan.FromSeconds(.1));
return false;
});
}
[Test]
public void SafeWait_PollingInterval_GreaterThanTimeout()
{
wait.PollingInterval = TimeSpan.FromSeconds(1);
using (StopwatchAsserter.Within(.3, .015))
wait.Until(_ =>
{
return false;
});
}
}
}
| using System;
using System.Threading;
using NUnit.Framework;
namespace Atata.WebDriverExtras.Tests
{
[TestFixture]
[Parallelizable(ParallelScope.None)]
public class SafeWaitTests
{
private SafeWait<object> wait;
[SetUp]
public void SetUp()
{
wait = new SafeWait<object>(new object())
{
Timeout = TimeSpan.FromSeconds(.3),
PollingInterval = TimeSpan.FromSeconds(.05)
};
}
[Test]
public void SafeWait_Success_Immediate()
{
using (StopwatchAsserter.Within(0, .01))
wait.Until(_ =>
{
return true;
});
}
[Test]
public void SafeWait_Timeout()
{
using (StopwatchAsserter.Within(.3, .01))
wait.Until(_ =>
{
return false;
});
}
[Test]
public void SafeWait_PollingInterval()
{
using (StopwatchAsserter.Within(.3, .2))
wait.Until(_ =>
{
Thread.Sleep(TimeSpan.FromSeconds(.1));
return false;
});
}
[Test]
public void SafeWait_PollingInterval_GreaterThanTimeout()
{
wait.PollingInterval = TimeSpan.FromSeconds(1);
using (StopwatchAsserter.Within(.3, .015))
wait.Until(_ =>
{
return false;
});
}
}
}
| apache-2.0 | C# |
e4b9b0a3cb320dcbb8f7eb0c726e0352663d1e4c | Add IsDependent and GuardianId to patient profile | dhawalharsora/connectedcare-sdk,SnapMD/connectedcare-sdk | SnapMD.ConnectedCare.ApiModels/PatientAccountInfo.cs | SnapMD.ConnectedCare.ApiModels/PatientAccountInfo.cs | #region Copyright
// Copyright 2016 SnapMD, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
namespace SnapMD.ConnectedCare.ApiModels
{
/// <summary>
/// Represents patient details for administrator patient lists.
/// </summary>
public class PatientAccountInfo
{
public int PatientId { get; set; }
public int? UserId { get; set; }
public string ProfileImagePath { get; set; }
public string FullName { get; set; }
public string Phone { get; set; }
public bool IsAuthorized { get; set; }
public PatientAccountStatus Status { get; set; }
public string IsDependent { get; set; }
public int? GuardianId { get; set; }
public string Email { get; set; }
}
}
| #region Copyright
// Copyright 2016 SnapMD, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
namespace SnapMD.ConnectedCare.ApiModels
{
/// <summary>
/// Represents patient details for administrator patient lists.
/// </summary>
public class PatientAccountInfo
{
public int PatientId { get; set; }
public int? UserId { get; set; }
public string ProfileImagePath { get; set; }
public string FullName { get; set; }
public string Phone { get; set; }
public bool IsAuthorized { get; set; }
public PatientAccountStatus Status { get; set; }
public string Email { get; set; }
}
}
| apache-2.0 | C# |
83192d6b83f9c5d8c921bd9aa23f9b1c253cc57e | Add notifications to FilingSubcategory.cs | kevbite/CompaniesHouse.NET,LiberisLabs/CompaniesHouse.NET | src/CompaniesHouse/Response/FilingSubcategory.cs | src/CompaniesHouse/Response/FilingSubcategory.cs | using System.Runtime.Serialization;
namespace CompaniesHouse.Response
{
public enum FilingSubcategory
{
None = 0,
[EnumMember(Value = "annual-return")]
AnnualReturn,
[EnumMember(Value = "resolution")]
Resolution,
[EnumMember(Value = "change")]
Change,
[EnumMember(Value = "create")]
Create,
[EnumMember(Value = "certificate")]
Certificate,
[EnumMember(Value = "appointments")]
Appointments,
[EnumMember(Value = "satisfy")]
Satisfy,
[EnumMember(Value = "termination")]
Termination,
[EnumMember(Value = "release-cease")]
ReleaseCease,
[EnumMember(Value = "voluntary")]
Voluntary,
[EnumMember(Value = "administration")]
Administration,
[EnumMember(Value = "compulsory")]
Compulsory,
[EnumMember(Value = "court-order")]
CourtOrder,
[EnumMember(Value = "notifications")]
Notifications,
[EnumMember(Value = "other")]
Other
}
}
| using System.Runtime.Serialization;
namespace CompaniesHouse.Response
{
public enum FilingSubcategory
{
None = 0,
[EnumMember(Value = "annual-return")]
AnnualReturn,
[EnumMember(Value = "resolution")]
Resolution,
[EnumMember(Value = "change")]
Change,
[EnumMember(Value = "create")]
Create,
[EnumMember(Value = "certificate")]
Certificate,
[EnumMember(Value = "appointments")]
Appointments,
[EnumMember(Value = "satisfy")]
Satisfy,
[EnumMember(Value = "termination")]
Termination,
[EnumMember(Value = "release-cease")]
ReleaseCease,
[EnumMember(Value = "voluntary")]
Voluntary,
[EnumMember(Value = "administration")]
Administration,
[EnumMember(Value = "compulsory")]
Compulsory,
[EnumMember(Value = "court-order")]
CourtOrder,
[EnumMember(Value = "other")]
Other
}
}
| mit | C# |
9ab99aa3be522a6102d8d874391a8998fa22291d | Increment version | ladimolnar/BitcoinBlockchain | Sources/BitcoinBlockchain/Properties/AssemblyInfo.cs | Sources/BitcoinBlockchain/Properties/AssemblyInfo.cs | //-----------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs">
// Copyright © Ladislau Molnar. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
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("BitcoinBlockchain")]
[assembly: AssemblyDescription("A .NET Class Library that provides parsing functionality over files containing the Bitcoin blockchain.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ladislau Molnar")]
[assembly: AssemblyProduct("BitcoinBlockchain")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(false)]
// 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("4d8ebb2b-d182-4106-8d15-5fb864de6706")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
| //-----------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs">
// Copyright © Ladislau Molnar. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
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("BitcoinBlockchain")]
[assembly: AssemblyDescription("A .NET Class Library that provides parsing functionality over files containing the Bitcoin blockchain.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ladislau Molnar")]
[assembly: AssemblyProduct("BitcoinBlockchain")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(false)]
// 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("4d8ebb2b-d182-4106-8d15-5fb864de6706")]
// 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")]
| apache-2.0 | C# |
17d7a1613c5374cfeac51db0b6e4bbd76ec3919e | Bump minor version | hartez/TodotxtTouch.WindowsPhone | TodotxtTouch.WindowsPhone/Properties/AssemblyInfo.cs | TodotxtTouch.WindowsPhone/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
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("TodotxtTouch.WindowsPhone")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CodeWise LLC")]
[assembly: AssemblyProduct("TodotxtTouch.WindowsPhone")]
[assembly: AssemblyCopyright("Copyright © CodeWise LLC 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4d4e2e27-f10d-4061-a66a-3682c3631a7e")]
// 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.0.0")]
[assembly: AssemblyFileVersion("1.7.0.0")]
[assembly: NeutralResourcesLanguage("en-US")] | using System.Reflection;
using System.Resources;
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("TodotxtTouch.WindowsPhone")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CodeWise LLC")]
[assembly: AssemblyProduct("TodotxtTouch.WindowsPhone")]
[assembly: AssemblyCopyright("Copyright © CodeWise LLC 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4d4e2e27-f10d-4061-a66a-3682c3631a7e")]
// 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.2.0")]
[assembly: AssemblyFileVersion("1.6.2.0")]
[assembly: NeutralResourcesLanguage("en-US")] | mit | C# |
df2ff2afc8986abdf140672422e5b487dc743839 | Change *.ConnectionInformation.json filename | 2gis/Winium.StoreApps,2gis/Winium.StoreApps | Winium/Winium.Mobile.Common/ConnectionInformation.cs | Winium/Winium.Mobile.Common/ConnectionInformation.cs | namespace Winium.Mobile.Common
{
public class ConnectionInformation
{
#region Public Properties
public const string FileName = ".Winium.Mobile.ConnectionInformation.json";
public string RemotePort { get; set; }
public override string ToString()
{
return string.Format("RemotePort: {0}", this.RemotePort);
}
#endregion
}
}
| namespace Winium.Mobile.Common
{
public class ConnectionInformation
{
#region Public Properties
public const string FileName = ".Winium.StoreApps.ConnectionInformation.json";
public string RemotePort { get; set; }
public override string ToString()
{
return string.Format("RemotePort: {0}", this.RemotePort);
}
#endregion
}
}
| mpl-2.0 | C# |
5dac7c0d6f282446b7459db9c8719504ab036966 | Update SpellingLanguages.cs | punker76/Markdown-Edit,mike-ward/Markdown-Edit | src/MarkdownEdit/SpellCheck/SpellingLanguages.cs | src/MarkdownEdit/SpellCheck/SpellingLanguages.cs | using System.ComponentModel;
namespace MarkdownEdit.SpellCheck
{
public enum SpellingLanguages
{
[Description("English (Australia)")] Australian,
[Description("English (Canada)")] Canadian,
[Description("English (United Kingdom)")] UnitedKingdom,
[Description("English (United States)")] UnitedStates,
[Description("German (Germany)")] Germany,
[Description("Spanish (Spain)")] Spain,
[Description("Russian (Russia)")] Russian,
[Description("Danish (Denmark)")] Denmark
[Description("Swedish (Sweden)")] Sweden
}
}
| using System.ComponentModel;
namespace MarkdownEdit.SpellCheck
{
public enum SpellingLanguages
{
[Description("English (Australia)")] Australian,
[Description("English (Canada)")] Canadian,
[Description("English (United Kingdom)")] UnitedKingdom,
[Description("English (United States)")] UnitedStates,
[Description("German (Germany)")] Germany,
[Description("Spanish (Spain)")] Spain,
[Description("Russian (Russia)")] Russian,
[Description("Danish (Denmark)")] Denmark
[Description("Swedish (Sweden)")] Sweden
[Description("Swedish (Finland)")] Finland
}
}
| mit | C# |
2944f728b19cfa37eedaff6563562b8d2e2bd2f7 | 修改 HelloWorld controller 的 Welcome action 回傳 view object. | NemoChenTW/MvcMovie,NemoChenTW/MvcMovie,NemoChenTW/MvcMovie | src/MvcMovie/Controllers/HelloWorldController.cs | src/MvcMovie/Controllers/HelloWorldController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.Extensions.WebEncoders;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace MvcMovie.Controllers
{
public class HelloWorldController : Controller
{
//
// GET: /HelloWorld/
public IActionResult Index()
{
return View();
}
//
// GET: /HelloWorld/Welcome/
public IActionResult Welcome(string name, int numTimes = 1)
{
ViewData["Message"] = "Hello " + name;
ViewData["NumTimes"] = numTimes;
return View();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.Extensions.WebEncoders;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace MvcMovie.Controllers
{
public class HelloWorldController : Controller
{
//
// GET: /HelloWorld/
public IActionResult Index()
{
return View();
}
//
// GET: /HelloWorld/Welcome/
public string Welcome(string name, int ID = 1)
{
return HtmlEncoder.Default.HtmlEncode(
"Hello " + name + ", ID: " + ID);
}
}
}
| apache-2.0 | C# |
60e68d90cfd12e61cd2c7dbc45e0d40c8d14aced | Fix master build (#1770) | Aprogiena/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode | src/Stratis.Bitcoin.Tests/Signals/SignalsTest.cs | src/Stratis.Bitcoin.Tests/Signals/SignalsTest.cs | using Moq;
using NBitcoin;
using Stratis.Bitcoin.Signals;
using Stratis.Bitcoin.Tests.Common;
using Xunit;
namespace Stratis.Bitcoin.Tests.Signals
{
public class SignalsTest
{
private readonly Mock<ISignaler<Block>> blockConnectedSignaler;
private readonly Mock<ISignaler<Block>> blockDisconnectedSignaler;
private readonly Bitcoin.Signals.Signals signals;
private readonly Mock<ISignaler<Transaction>> transactionSignaler;
public SignalsTest()
{
this.blockConnectedSignaler = new Mock<ISignaler<Block>>();
this.blockDisconnectedSignaler = new Mock<ISignaler<Block>>();
this.transactionSignaler = new Mock<ISignaler<Transaction>>();
this.signals = new Bitcoin.Signals.Signals(this.blockConnectedSignaler.Object, this.blockDisconnectedSignaler.Object, this.transactionSignaler.Object);
}
[Fact]
public void SignalBlockBroadcastsToBlockSignaler()
{
Block block = KnownNetworks.StratisMain.CreateBlock();
this.signals.SignalBlockConnected(block);
this.blockConnectedSignaler.Verify(b => b.Broadcast(block), Times.Exactly(1));
}
[Fact]
public void SignalBlockDisconnectedToBlockSignaler()
{
Block block = KnownNetworks.StratisMain.CreateBlock();
this.signals.SignalBlockDisconnected(block);
this.blockDisconnectedSignaler.Verify(b => b.Broadcast(block), Times.Exactly(1));
}
[Fact]
public void SignalTransactionBroadcastsToTransactionSignaler()
{
Transaction transaction = KnownNetworks.StratisMain.CreateTransaction();
this.signals.SignalTransaction(transaction);
this.transactionSignaler.Verify(b => b.Broadcast(transaction), Times.Exactly(1));
}
}
} | using Moq;
using NBitcoin;
using Stratis.Bitcoin.Signals;
using Stratis.Bitcoin.Tests.Common;
using Xunit;
namespace Stratis.Bitcoin.Tests.Signals
{
public class SignalsTest
{
private readonly Mock<ISignaler<Block>> blockConnectedSignaler;
private readonly Mock<ISignaler<Block>> blockDisconnectedSignaler;
private readonly Bitcoin.Signals.Signals signals;
private readonly Mock<ISignaler<Transaction>> transactionSignaler;
public SignalsTest()
{
this.blockConnectedSignaler = new Mock<ISignaler<Block>>();
this.blockDisconnectedSignaler = new Mock<ISignaler<Block>>();
this.transactionSignaler = new Mock<ISignaler<Transaction>>();
this.signals = new Bitcoin.Signals.Signals(this.blockConnectedSignaler.Object, this.blockDisconnectedSignaler.Object, this.transactionSignaler.Object);
}
[Fact]
public void SignalBlockBroadcastsToBlockSignaler()
{
Block block = KnownNetworks.StratisMain.CreateBlock();
this.signals.SignalBlockConnected(block);
this.blockConnectedSignaler.Verify(b => b.Broadcast(block), Times.Exactly(1));
}
[Fact]
public void SignalBlockDisconnectedToBlockSignaler()
{
Block block = Networks.StratisMain.CreateBlock();
this.signals.SignalBlockDisconnected(block);
this.blockDisconnectedSignaler.Verify(b => b.Broadcast(block), Times.Exactly(1));
}
[Fact]
public void SignalTransactionBroadcastsToTransactionSignaler()
{
Transaction transaction = KnownNetworks.StratisMain.CreateTransaction();
this.signals.SignalTransaction(transaction);
this.transactionSignaler.Verify(b => b.Broadcast(transaction), Times.Exactly(1));
}
}
} | mit | C# |
d8d3e9f9cd50fe04d43c75c4a580587ead547e0d | Add support for discountable on line item | richardlawley/stripe.net,stripe/stripe-dotnet | src/Stripe.net/Entities/StripeInvoiceLineItem.cs | src/Stripe.net/Entities/StripeInvoiceLineItem.cs | using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
namespace Stripe
{
public class StripeInvoiceLineItem : StripeEntityWithId
{
[JsonProperty("object")]
public string Object { get; set; }
[JsonProperty("livemode")]
public bool LiveMode { get; set; }
[JsonProperty("amount")]
public int Amount { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
#region Expandable Customer
public string CustomerId { get; set; }
[JsonIgnore]
public StripeCustomer Customer { get; set; }
[JsonProperty("customer")]
internal object InternalCustomer
{
set
{
StringOrObject<StripeCustomer>.Map(value, s => CustomerId = s, o => Customer = o);
}
}
#endregion
[JsonProperty("date")]
[JsonConverter(typeof(StripeDateTimeConverter))]
public DateTime Date { get; set; }
[JsonProperty("discountable")]
public bool Discountable { get; set; }
[JsonProperty("proration")]
public bool Proration { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
#region Expandable Invoice
public string InvoiceId { get; set; }
[JsonIgnore]
public StripeInvoice Invoice { get; set; }
[JsonProperty("invoice")]
internal object InternalInvoice
{
set
{
StringOrObject<StripeInvoice>.Map(value, s => InvoiceId = s, o => Invoice = o);
}
}
#endregion
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
[JsonProperty("plan")]
public StripePlan Plan { get; set; }
[JsonProperty("quantity")]
public int? Quantity { get; set; }
[JsonProperty("subscription")]
public string SubscriptionId { get; set; }
[JsonProperty("period")]
public StripePeriod StripePeriod { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
}
} | using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
namespace Stripe
{
public class StripeInvoiceLineItem : StripeEntityWithId
{
[JsonProperty("object")]
public string Object { get; set; }
[JsonProperty("livemode")]
public bool LiveMode { get; set; }
[JsonProperty("amount")]
public int Amount { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
#region Expandable Customer
public string CustomerId { get; set; }
[JsonIgnore]
public StripeCustomer Customer { get; set; }
[JsonProperty("customer")]
internal object InternalCustomer
{
set
{
StringOrObject<StripeCustomer>.Map(value, s => CustomerId = s, o => Customer = o);
}
}
#endregion
[JsonProperty("date")]
[JsonConverter(typeof(StripeDateTimeConverter))]
public DateTime Date { get; set; }
[JsonProperty("proration")]
public bool Proration { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
#region Expandable Invoice
public string InvoiceId { get; set; }
[JsonIgnore]
public StripeInvoice Invoice { get; set; }
[JsonProperty("invoice")]
internal object InternalInvoice
{
set
{
StringOrObject<StripeInvoice>.Map(value, s => InvoiceId = s, o => Invoice = o);
}
}
#endregion
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
[JsonProperty("plan")]
public StripePlan Plan { get; set; }
[JsonProperty("quantity")]
public int? Quantity { get; set; }
[JsonProperty("subscription")]
public string SubscriptionId { get; set; }
[JsonProperty("period")]
public StripePeriod StripePeriod { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
}
} | apache-2.0 | C# |
58a61dc5f64b8eadce5bf13967be5eb2432865c7 | Fix IcmpDatagramFactory following DataSegment update. Code Coverage 97.42% | bricknerb/Pcap.Net,bricknerb/Pcap.Net,bricknerb/Pcap.Net | PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDatagramFactory.cs | PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDatagramFactory.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using PcapDotNet.Base;
namespace PcapDotNet.Packets.Icmp
{
internal static class IcmpDatagramFactory
{
internal static IcmpDatagram CreateInstance(IcmpMessageType messageType, byte[] buffer, int offset, int length)
{
IcmpDatagram prototype;
if (!_prototypes.TryGetValue(messageType, out prototype))
return new IcmpUnknownDatagram(buffer, offset, length);
return prototype.CreateInstance(buffer, offset, length);
}
private static Dictionary<IcmpMessageType, IcmpDatagram> InitializeComplexOptions()
{
var prototypes =
from type in Assembly.GetExecutingAssembly().GetTypes()
where typeof(IcmpDatagram).IsAssignableFrom(type) &&
GetRegistrationAttribute(type) != null
let constructor =
type.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public, null, new[] {typeof(byte[]), typeof(int), typeof(int)}, null)
select new
{
GetRegistrationAttribute(type).MessageType,
Datagram = (IcmpDatagram)constructor.Invoke(new object[] {new byte[0], 0, 0})
};
return prototypes.ToDictionary(prototype => prototype.MessageType, prototype => prototype.Datagram);
}
private static IcmpDatagramRegistrationAttribute GetRegistrationAttribute(Type type)
{
var registrationAttributes =
from attribute in type.GetCustomAttributes<IcmpDatagramRegistrationAttribute>(false)
select attribute;
if (!registrationAttributes.Any())
return null;
return registrationAttributes.First();
}
private static readonly Dictionary<IcmpMessageType, IcmpDatagram> _prototypes = InitializeComplexOptions();
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using PcapDotNet.Base;
namespace PcapDotNet.Packets.Icmp
{
internal static class IcmpDatagramFactory
{
internal static IcmpDatagram CreateInstance(IcmpMessageType messageType, byte[] buffer, int offset, int length)
{
IcmpDatagram prototype;
if (!_prototypes.TryGetValue(messageType, out prototype))
return new IcmpUnknownDatagram(buffer, offset, length);
return prototype.CreateInstance(buffer, offset, length);
}
private static Dictionary<IcmpMessageType, IcmpDatagram> InitializeComplexOptions()
{
var prototypes =
from type in Assembly.GetExecutingAssembly().GetTypes()
where typeof(IcmpDatagram).IsAssignableFrom(type) &&
GetRegistrationAttribute(type) != null
let constructor =
type.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public, null, new[] {typeof(byte[]), typeof(int), typeof(int)}, null)
select new
{
GetRegistrationAttribute(type).MessageType,
Datagram = (IcmpDatagram)constructor.Invoke(new object[] {null, 0, 0})
};
return prototypes.ToDictionary(prototype => prototype.MessageType, prototype => prototype.Datagram);
}
private static IcmpDatagramRegistrationAttribute GetRegistrationAttribute(Type type)
{
var registrationAttributes =
from attribute in type.GetCustomAttributes<IcmpDatagramRegistrationAttribute>(false)
select attribute;
if (!registrationAttributes.Any())
return null;
return registrationAttributes.First();
}
private static readonly Dictionary<IcmpMessageType, IcmpDatagram> _prototypes = InitializeComplexOptions();
}
} | bsd-3-clause | C# |
76fbcd5780513c5c5f38ffddc61ff506af1e86ef | Fix "open in explorer" occurring twice for windows directories | ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework | osu.Framework/Platform/Windows/WindowsGameHost.cs | osu.Framework/Platform/Windows/WindowsGameHost.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
using System.IO;
using osu.Framework.Platform.Windows.Native;
using osuTK;
namespace osu.Framework.Platform.Windows
{
public class WindowsGameHost : DesktopGameHost
{
private TimePeriod timePeriod;
public override Clipboard GetClipboard() => new WindowsClipboard();
public override string UserStoragePath => Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
public override bool CapsLockEnabled => Console.CapsLock;
internal WindowsGameHost(string gameName, bool bindIPC = false, ToolkitOptions toolkitOptions = default, bool portableInstallation = false, bool useSdl = false)
: base(gameName, bindIPC, toolkitOptions, portableInstallation, useSdl)
{
}
public override void OpenFileExternally(string filename)
{
if (Directory.Exists(filename))
{
Process.Start("explorer.exe", filename);
return;
}
base.OpenFileExternally(filename);
}
protected override void SetupForRun()
{
base.SetupForRun();
// OnActivate / OnDeactivate may not fire, so the initial activity state may be unknown here.
// In order to be certain we have the correct activity state we are querying the Windows API here.
timePeriod = new TimePeriod(1) { Active = true };
}
protected override IWindow CreateWindow() =>
!UseSdl ? (IWindow)new WindowsGameWindow() : new SDLWindow();
protected override void Dispose(bool isDisposing)
{
timePeriod?.Dispose();
base.Dispose(isDisposing);
}
protected override void OnActivated()
{
timePeriod.Active = true;
Execution.SetThreadExecutionState(Execution.ExecutionState.Continuous | Execution.ExecutionState.SystemRequired | Execution.ExecutionState.DisplayRequired);
base.OnActivated();
}
protected override void OnDeactivated()
{
timePeriod.Active = false;
Execution.SetThreadExecutionState(Execution.ExecutionState.Continuous);
base.OnDeactivated();
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
using System.IO;
using osu.Framework.Platform.Windows.Native;
using osuTK;
namespace osu.Framework.Platform.Windows
{
public class WindowsGameHost : DesktopGameHost
{
private TimePeriod timePeriod;
public override Clipboard GetClipboard() => new WindowsClipboard();
public override string UserStoragePath => Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
public override bool CapsLockEnabled => Console.CapsLock;
internal WindowsGameHost(string gameName, bool bindIPC = false, ToolkitOptions toolkitOptions = default, bool portableInstallation = false, bool useSdl = false)
: base(gameName, bindIPC, toolkitOptions, portableInstallation, useSdl)
{
}
public override void OpenFileExternally(string filename)
{
if (Directory.Exists(filename))
Process.Start("explorer.exe", filename);
base.OpenFileExternally(filename);
}
protected override void SetupForRun()
{
base.SetupForRun();
// OnActivate / OnDeactivate may not fire, so the initial activity state may be unknown here.
// In order to be certain we have the correct activity state we are querying the Windows API here.
timePeriod = new TimePeriod(1) { Active = true };
}
protected override IWindow CreateWindow() =>
!UseSdl ? (IWindow)new WindowsGameWindow() : new SDLWindow();
protected override void Dispose(bool isDisposing)
{
timePeriod?.Dispose();
base.Dispose(isDisposing);
}
protected override void OnActivated()
{
timePeriod.Active = true;
Execution.SetThreadExecutionState(Execution.ExecutionState.Continuous | Execution.ExecutionState.SystemRequired | Execution.ExecutionState.DisplayRequired);
base.OnActivated();
}
protected override void OnDeactivated()
{
timePeriod.Active = false;
Execution.SetThreadExecutionState(Execution.ExecutionState.Continuous);
base.OnDeactivated();
}
}
}
| mit | C# |
9938084343b989ef7dada28656c1444412297683 | Make parallax container work with global mouse state (so it ignores bounds checks). | smoogipooo/osu,2yangk23/osu,johnneijzen/osu,default0/osu,2yangk23/osu,Nabile-Rahmani/osu,RedNesto/osu,NeoAdonis/osu,EVAST9919/osu,UselessToucan/osu,ppy/osu,ppy/osu,EVAST9919/osu,nyaamara/osu,peppy/osu,peppy/osu,johnneijzen/osu,Damnae/osu,DrabWeb/osu,Drezi126/osu,peppy/osu,NotKyon/lolisu,UselessToucan/osu,ppy/osu,osu-RP/osu-RP,NeoAdonis/osu,NeoAdonis/osu,tacchinotacchi/osu,ZLima12/osu,theguii/osu,Frontear/osuKyzer,naoey/osu,DrabWeb/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,naoey/osu,peppy/osu-new,naoey/osu,smoogipoo/osu,DrabWeb/osu,ZLima12/osu | osu.Game/Graphics/Containers/ParallaxContainer.cs | osu.Game/Graphics/Containers/ParallaxContainer.cs | using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Input;
using OpenTK;
using osu.Framework;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.Containers
{
class ParallaxContainer : Container
{
public float ParallaxAmount = 0.02f;
public override bool Contains(Vector2 screenSpacePos) => true;
public ParallaxContainer()
{
RelativeSizeAxes = Axes.Both;
AddInternal(content = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
}
private Container content;
private InputManager input;
protected override Container<Drawable> Content => content;
[BackgroundDependencyLoader]
private void load(UserInputManager input)
{
this.input = input;
}
protected override void Update()
{
base.Update();
content.Position = (input.CurrentState.Mouse.Position - DrawSize / 2) * ParallaxAmount;
content.Scale = new Vector2(1 + ParallaxAmount);
}
}
}
| using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Input;
using OpenTK;
using osu.Framework;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.Containers
{
class ParallaxContainer : Container
{
public float ParallaxAmount = 0.02f;
public override bool Contains(Vector2 screenSpacePos) => true;
public ParallaxContainer()
{
RelativeSizeAxes = Axes.Both;
AddInternal(content = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
}
private Container content;
protected override Container<Drawable> Content => content;
protected override bool OnMouseMove(InputState state)
{
content.Position = (state.Mouse.Position - DrawSize / 2) * ParallaxAmount;
return base.OnMouseMove(state);
}
protected override void Update()
{
base.Update();
content.Scale = new Vector2(1 + ParallaxAmount);
}
}
}
| mit | C# |
d432ab7510072781da6b4f1cb7559e127ff67333 | Reorder screen tab control items | NeoAdonis/osu,johnneijzen/osu,DrabWeb/osu,smoogipoo/osu,EVAST9919/osu,smoogipoo/osu,ZLima12/osu,2yangk23/osu,Nabile-Rahmani/osu,naoey/osu,naoey/osu,UselessToucan/osu,peppy/osu,peppy/osu,DrabWeb/osu,naoey/osu,ZLima12/osu,Drezi126/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,EVAST9919/osu,johnneijzen/osu,UselessToucan/osu,ppy/osu,peppy/osu-new,ppy/osu,Frontear/osuKyzer,2yangk23/osu,ppy/osu,DrabWeb/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu | osu.Game/Screens/Edit/Screens/EditorScreenMode.cs | osu.Game/Screens/Edit/Screens/EditorScreenMode.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
namespace osu.Game.Screens.Edit.Screens
{
public enum EditorScreenMode
{
[Description("setup")]
SongSetup,
[Description("compose")]
Compose,
[Description("design")]
Design,
[Description("timing")]
Timing,
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
namespace osu.Game.Screens.Edit.Screens
{
public enum EditorScreenMode
{
[Description("compose")]
Compose,
[Description("design")]
Design,
[Description("timing")]
Timing,
[Description("song")]
SongSetup
}
}
| mit | C# |
f18166e5e8db10fbcaede04cfb3dced21ed0bb59 | Fix properties. | bigfont/2013-128CG-Vendord,bigfont/2013-128CG-Vendord,bigfont/2013-128CG-Vendord,bigfont/2013-128CG-Vendord | Vendord/Vendord.Desktop.WPF.App/ViewModel/ProductViewModel.cs | Vendord/Vendord.Desktop.WPF.App/ViewModel/ProductViewModel.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vendord.Desktop.WPF.App.DataAccess;
using Vendord.Desktop.WPF.App.Model;
namespace Vendord.Desktop.WPF.App.ViewModel
{
public class ProductViewModel : WorkspaceViewModel
{
#region Fields
readonly Product _product;
readonly ProductRepository _productRepository;
bool _isSelected;
#endregion // Fields
#region Constructor
public ProductViewModel(Product product, ProductRepository productRepository)
{
if (product == null)
throw new ArgumentNullException("product");
if (productRepository == null)
throw new ArgumentNullException("productRepository");
_product = product;
_productRepository = productRepository;
}
#endregion // Constructor
#region Product Properties
public long Upc
{
get { return _product.Upc; }
set
{
if (value == _product.Upc)
return;
_product.Upc = value;
base.OnPropertyChanged("Upc");
}
}
public string Name
{
get { return _product.Name; }
set
{
if (value == _product.Name)
return;
_product.Name = value;
base.OnPropertyChanged("Name");
}
}
#endregion // Product Properties
#region Presentation Properties
/// <summary>
/// Gets/sets whether this customer is selected in the UI.
/// </summary>
public bool IsSelected
{
get { return _isSelected; }
set
{
if (value == _isSelected)
return;
_isSelected = value;
base.OnPropertyChanged("IsSelected");
}
}
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vendord.Desktop.WPF.App.DataAccess;
using Vendord.Desktop.WPF.App.Model;
namespace Vendord.Desktop.WPF.App.ViewModel
{
public class ProductViewModel : WorkspaceViewModel
{
#region Fields
readonly Product _product;
readonly ProductRepository _productRepository;
bool _isSelected;
#endregion // Fields
#region Constructor
public ProductViewModel(Product product, ProductRepository productRepository)
{
if (product == null)
throw new ArgumentNullException("product");
if (productRepository == null)
throw new ArgumentNullException("productRepository");
_product = product;
_productRepository = productRepository;
}
#endregion // Constructor
#region Product Properties
public string Upc { get; set; }
public string Name { get; set; }
#endregion // Product Properties
#region Presentation Properties
/// <summary>
/// Gets/sets whether this customer is selected in the UI.
/// </summary>
public bool IsSelected
{
get { return _isSelected; }
set
{
if (value == _isSelected)
return;
_isSelected = value;
base.OnPropertyChanged("IsSelected");
}
}
#endregion
}
}
| mit | C# |
03b61e4a5a5e3338400882776b99be6a221e6679 | Throw exception rather than returning nulls | peppy/osu,UselessToucan/osu,ppy/osu,johnneijzen/osu,UselessToucan/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,2yangk23/osu,EVAST9919/osu,2yangk23/osu,ppy/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,EVAST9919/osu,peppy/osu,johnneijzen/osu,NeoAdonis/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu | osu.Game/Online/API/APIMod.cs | osu.Game/Online/API/APIMod.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using Humanizer;
using Newtonsoft.Json;
using osu.Framework.Bindables;
using osu.Game.Configuration;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Online.API
{
public class APIMod : IMod
{
[JsonProperty("acronym")]
public string Acronym { get; set; }
[JsonProperty("settings")]
public Dictionary<string, object> Settings { get; set; } = new Dictionary<string, object>();
[JsonConstructor]
private APIMod()
{
}
public APIMod(Mod mod)
{
Acronym = mod.Acronym;
foreach (var (_, property) in mod.GetSettingsSourceProperties())
Settings.Add(property.Name.Underscore(), property.GetValue(mod));
}
public Mod ToMod(Ruleset ruleset)
{
Mod resultMod = ruleset.GetAllMods().FirstOrDefault(m => m.Acronym == Acronym);
if (resultMod == null)
throw new InvalidOperationException($"There is no mod in the ruleset ({ruleset.ShortName}) matching the acronym {Acronym}.");
foreach (var (_, property) in resultMod.GetSettingsSourceProperties())
{
if (!Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
continue;
((IBindable)property.GetValue(resultMod)).Parse(settingValue);
}
return resultMod;
}
public bool Equals(IMod other) => Acronym == other?.Acronym;
}
}
| // 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.Collections.Generic;
using System.Linq;
using Humanizer;
using Newtonsoft.Json;
using osu.Framework.Bindables;
using osu.Game.Configuration;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Online.API
{
public class APIMod : IMod
{
[JsonProperty("acronym")]
public string Acronym { get; set; }
[JsonProperty("settings")]
public Dictionary<string, object> Settings { get; set; } = new Dictionary<string, object>();
[JsonConstructor]
private APIMod()
{
}
public APIMod(Mod mod)
{
Acronym = mod.Acronym;
foreach (var (_, property) in mod.GetSettingsSourceProperties())
Settings.Add(property.Name.Underscore(), property.GetValue(mod));
}
public Mod ToMod(Ruleset ruleset)
{
Mod resultMod = ruleset.GetAllMods().FirstOrDefault(m => m.Acronym == Acronym);
if (resultMod == null)
return null; // Todo: Maybe throw exception?
foreach (var (_, property) in resultMod.GetSettingsSourceProperties())
{
if (!Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
continue;
((IBindable)property.GetValue(resultMod)).Parse(settingValue);
}
return resultMod;
}
public bool Equals(IMod other) => Acronym == other?.Acronym;
}
}
| mit | C# |
ae8652253b7271da03489bea6c73226cab0fa7bc | Remove usage of ReactiveUserControl | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/Views/AddWallet/AddedWalletPageView.axaml.cs | WalletWasabi.Fluent/Views/AddWallet/AddedWalletPageView.axaml.cs | using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace WalletWasabi.Fluent.Views.AddWallet
{
public class AddedWalletPageView : UserControl
{
public AddedWalletPageView()
{
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
| using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
using WalletWasabi.Fluent.ViewModels.AddWallet;
namespace WalletWasabi.Fluent.Views.AddWallet
{
public class AddedWalletPageView : ReactiveUserControl<AddedWalletPageViewModel>
{
public AddedWalletPageView()
{
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
| mit | C# |
a6782a7b865a048d3b343e877d39db78f24e4e3f | tweak falling speed more | nicolasgustafsson/AttackLeague | AttackLeague/AttackLeague/AttackLeague/Blocks/FallingBlock.cs | AttackLeague/AttackLeague/AttackLeague/Blocks/FallingBlock.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
using AttackLeague.Utility;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace AttackLeague.AttackLeague
{
class FallingBlock : AbstractColorBlock
{
private const float MyBaseSpeed = 0.15f;
private const float MyAdditionalSpeed = 0.1f;
private bool myCanChain = false;
protected float myYOffset = 0.0f;
public FallingBlock(EBlockColor aColor)
{
myColor = aColor;
}
public FallingBlock(ColorBlock aBlock)
{
myColor = aBlock.GetColor();
myCanChain = aBlock.CanChain;
}
public override void Update(float aGameSpeed)
{
myYOffset -= GetFallingSpeed(aGameSpeed);
}
public bool WillPassTile(float aGameSpeed)
{
return (myYOffset - GetFallingSpeed(aGameSpeed)) < 0.0f;
}
private static float GetFallingSpeed(float aGameSpeed)
{//0.15 + 0.75 * (3.0 - 1.0) * 0.1 = +0.3
return MyBaseSpeed + 0.15f * ((aGameSpeed) * 0.1f); // todo un-hardcode if needed
// return MyBaseSpeed + 0.75f * ((aGameSpeed - 1f) * 0.1f); // todo un-hardcode if needed
}
public void PassTile()
{
myGridArea.Y--;
myYOffset += 1.0f;
}
public override void Draw(SpriteBatch aSpriteBatch, Vector2 aGridOffset, int aGridHeight, float aRaisingOffset)
{
Vector2 position = GetScreenPosition(aGridOffset, aGridHeight, aRaisingOffset);
position.Y -= myYOffset * mySprite.GetSize().Y;
mySprite.SetPosition(position);
mySprite.Draw(aSpriteBatch);
}
public bool CanChain
{
get { return myCanChain; }
set { myCanChain = value; }
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
using AttackLeague.Utility;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace AttackLeague.AttackLeague
{
class FallingBlock : AbstractColorBlock
{
private const float MyBaseSpeed = 0.15f;
private const float MyAdditionalSpeed = 0.1f;
private bool myCanChain = false;
protected float myYOffset = 0.0f;
public FallingBlock(EBlockColor aColor)
{
myColor = aColor;
}
public FallingBlock(ColorBlock aBlock)
{
myColor = aBlock.GetColor();
myCanChain = aBlock.CanChain;
}
public override void Update(float aGameSpeed)
{
myYOffset -= GetFallingSpeed(aGameSpeed);
}
public bool WillPassTile(float aGameSpeed)
{
return (myYOffset - GetFallingSpeed(aGameSpeed)) < 0.0f;
}
private static float GetFallingSpeed(float aGameSpeed)
{
return MyBaseSpeed + 0.75f * ((aGameSpeed -1f) * 0.1f); // todo un-hardcode if needed
}
public void PassTile()
{
myGridArea.Y--;
myYOffset += 1.0f;
}
public override void Draw(SpriteBatch aSpriteBatch, Vector2 aGridOffset, int aGridHeight, float aRaisingOffset)
{
Vector2 position = GetScreenPosition(aGridOffset, aGridHeight, aRaisingOffset);
position.Y -= myYOffset * mySprite.GetSize().Y;
mySprite.SetPosition(position);
mySprite.Draw(aSpriteBatch);
}
public bool CanChain
{
get { return myCanChain; }
set { myCanChain = value; }
}
}
}
| mit | C# |
830a547dcb12aeb25c2b7dc4a6ec1ee48c5a55c6 | fix for GA | autumn009/TanoCSharpSamples | Chap37/StaticAbstractMembers/StaticAbstractMembers/Program.cs | Chap37/StaticAbstractMembers/StaticAbstractMembers/Program.cs | using System;
Sub<B>();
void Sub<T>() where T: IA
{
T.MyMethod();
}
interface IA
{
static abstract void MyMethod();
}
class B : IA
{
public static void MyMethod()
{
Console.WriteLine("Hello, World!");
}
}
| Sub<B>();
void Sub<T>() where T: IA
{
T.MyMethod();
}
interface IA
{
static abstract void MyMethod();
}
class B : IA
{
public static void MyMethod()
{
Console.WriteLine("Hello, World!");
}
}
| mit | C# |
17765afb51c539baa2b48e7eb457c0b8c2babc43 | update header | lianzhao/AsoiafWikiDb,lianzhao/AsoiafWikiDb | AsoiafWikiDb/Views/Shared/_Layout.cshtml | AsoiafWikiDb/Views/Shared/_Layout.cshtml | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Category", "Index", "Category")</li>
<li>@Html.ActionLink("Page", "Index", "Page")</li>
<li>@Html.ActionLink("Admin", "Index", "Admin")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
| mit | C# |
Subsets and Splits