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 |
|---|---|---|---|---|---|---|---|---|
0f4c90fb0c727e5059d610a3fd78d6306063f97f | add version information to home page (see #2822) | IdentityServer/IdentityServer4,IdentityServer/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4 | host/Views/Home/Index.cshtml | host/Views/Home/Index.cshtml | @{
var version = typeof(HomeController).Assembly.GetName().Version.ToString();
}
<div class="welcome-page">
<div class="row page-header">
<div class="col-sm-10">
<h1>
<img class="icon" src="~/icon.jpg">
Welcome to IdentityServer4
<small>(build @version)</small>
</h1>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<p>
IdentityServer publishes a
<a href="~/.well-known/openid-configuration">discovery document</a>
where you can find metadata and links to all the endpoints, key material, etc.
</p>
</div>
<div class="col-sm-8">
<p>
Click <a href="~/grants">here</a> to manage your stored grants.
</p>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<p>
Here are links to the
<a href="https://github.com/identityserver/IdentityServer4">source code repository</a>,
and <a href="https://github.com/identityserver/IdentityServer4.Samples">ready to use samples</a>.
</p>
</div>
</div>
</div>
| <div class="welcome-page">
<div class="row page-header">
<div class="col-sm-10">
<h1>
<img class="icon" src="~/icon.jpg">
Welcome to IdentityServer4
@*<small>(build {version})</small>*@
</h1>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<p>
IdentityServer publishes a
<a href="~/.well-known/openid-configuration">discovery document</a>
where you can find metadata and links to all the endpoints, key material, etc.
</p>
</div>
<div class="col-sm-8">
<p>
Click <a href="~/grants">here</a> to manage your stored grants.
</p>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<p>
Here are links to the
<a href="https://github.com/identityserver/IdentityServer4">source code repository</a>,
and <a href="https://github.com/identityserver/IdentityServer4.Samples">ready to use samples</a>.
</p>
</div>
</div>
</div>
| apache-2.0 | C# |
e84863aa6e4e6cf892314dc22e313699896d4603 | fix Buffer segmentation | acple/ParsecSharp | ParsecSharp/Data/Internal/Buffer.cs | ParsecSharp/Data/Internal/Buffer.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ParsecSharp.Internal
{
public sealed class Buffer<TToken> : IReadOnlyList<TToken>
{
private readonly TToken[] _buffer;
private readonly int _index;
private readonly Lazy<Buffer<TToken>> _next;
public TToken this[int index] => this._buffer[this._index + index];
public int Count { get; }
public Buffer<TToken> Next => this._next.Value;
public Buffer(TToken[] buffer, Func<Buffer<TToken>> next) : this(buffer, 0, buffer.Length, next)
{ }
public Buffer(TToken[] buffer, int index, int length, Func<Buffer<TToken>> next)
{
this._buffer = buffer;
this._index = index;
this.Count = length;
this._next = new Lazy<Buffer<TToken>>(next, false);
}
IEnumerator<TToken> IEnumerable<TToken>.GetEnumerator()
=> new ArraySegment<TToken>(this._buffer, this._index, this.Count).AsEnumerable().GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
=> this._buffer.GetEnumerator();
}
}
| using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ParsecSharp.Internal
{
public sealed class Buffer<TToken> : IReadOnlyList<TToken>
{
private readonly TToken[] _buffer;
private readonly Lazy<Buffer<TToken>> _next;
public TToken this[int index] => this._buffer[index];
public int Count { get; }
public Buffer<TToken> Next => this._next.Value;
public Buffer(TToken[] buffer, Func<Buffer<TToken>> next) : this(buffer, buffer.Length, next)
{ }
public Buffer(TToken[] buffer, int length, Func<Buffer<TToken>> next)
{
this._buffer = buffer;
this.Count = length;
this._next = new Lazy<Buffer<TToken>>(next, false);
}
public IEnumerator<TToken> GetEnumerator()
=> this._buffer.AsEnumerable().GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
=> this._buffer.GetEnumerator();
}
}
| mit | C# |
7792acba260d01a004a660f0039cb0eb5006d295 | Update AssemblyInfo app version | CalebChalmers/KAGTools | KAGTools/Properties/AssemblyInfo.cs | KAGTools/Properties/AssemblyInfo.cs | using System.Reflection;
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("KAG Tools")]
[assembly: AssemblyDescription("A set of useful modding tools for the game King Arthur's Gold.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KAG Tools")]
[assembly: AssemblyCopyright("Copyright © Caleb Chalmers 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
// 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("0.9.1")]
[assembly: AssemblyFileVersion("0.9.1")]
| using System.Reflection;
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("KAG Tools")]
[assembly: AssemblyDescription("A set of useful modding tools for the game King Arthur's Gold.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KAG Tools")]
[assembly: AssemblyCopyright("Copyright © Caleb Chalmers 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
// 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("0.9.0")]
[assembly: AssemblyFileVersion("0.9.0")]
| mit | C# |
1f5b1e0811f281c38b1d3e413fc772aa23736327 | Remove unnecessary usings in TcpKeepAliveSettings | Azure/amqpnetlite,ChugR/amqpnetlite | src/Net/TcpKeepAliveSettings.cs | src/Net/TcpKeepAliveSettings.cs | namespace Amqp
{
public class TcpKeepAliveSettings
{
public ulong KeepAliveTime
{
get;
set;
}
public ulong KeepAliveInterval
{
get;
set;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Amqp
{
public class TcpKeepAliveSettings
{
public ulong KeepAliveTime
{
get;
set;
}
public ulong KeepAliveInterval
{
get;
set;
}
}
}
| apache-2.0 | C# |
2b92a61f591ad8afe38e275cc3f63457027d50cf | update to layer 72 | OpenTl/OpenTl.Schema | src/OpenTl.Schema/SchemaInfo.cs | src/OpenTl.Schema/SchemaInfo.cs | namespace OpenTl.Schema
{
public static class SchemaInfo
{
public static int SchemaVersion { get; } = 72;
}
} | namespace OpenTl.Schema
{
public static class SchemaInfo
{
public static int SchemaVersion { get; } = 70;
}
} | mit | C# |
c1045b0b315498897dea80c12ddda90d34436252 | remove unused code | IUMDPI/IUMediaHelperApps | Packager/Utilities/Hashing/Hasher.cs | Packager/Utilities/Hashing/Hasher.cs | using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
using Packager.Models.FileModels;
using Packager.Models.SettingsModels;
namespace Packager.Utilities.Hashing
{
public class Hasher : IHasher
{
public Hasher(IProgramSettings programSettings)
{
BaseProcessingFolder = programSettings.ProcessingDirectory;
}
private string BaseProcessingFolder { get; }
public async Task<string> Hash(AbstractFile model, CancellationToken cancellationToken)
{
return await Task.Run(() => HashInternal(Path.Combine(BaseProcessingFolder, model.GetFolderName(), model.Filename)), cancellationToken);
}
public async Task<string> Hash(string path,CancellationToken cancellationToken)
{
return await Task.Run(() => HashInternal(path), cancellationToken);
}
public static string Hash(Stream content)
{
using (var md5 = MD5.Create())
{
using (content)
{
var hash = md5.ComputeHash(content);
return hash.Aggregate(string.Empty, (current, b) => current + $"{b:x2}");
}
}
}
private static string HashInternal(string path)
{
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
return Hash(stream);
}
}
}
} | using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
using Packager.Models.FileModels;
using Packager.Models.SettingsModels;
namespace Packager.Utilities.Hashing
{
public class Hasher : IHasher
{
public Hasher(IProgramSettings programSettings)
{
BaseProcessingFolder = programSettings.ProcessingDirectory;
}
/* public Hasher(string baseProcessingFolder)
{
BaseProcessingFolder = baseProcessingFolder;
}*/
private string BaseProcessingFolder { get; }
public async Task<string> Hash(AbstractFile model, CancellationToken cancellationToken)
{
return await Task.Run(() => HashInternal(Path.Combine(BaseProcessingFolder, model.GetFolderName(), model.Filename)), cancellationToken);
}
public async Task<string> Hash(string path,CancellationToken cancellationToken)
{
return await Task.Run(() => HashInternal(path), cancellationToken);
}
public static string Hash(Stream content)
{
using (var md5 = MD5.Create())
{
using (content)
{
var hash = md5.ComputeHash(content);
return hash.Aggregate(string.Empty, (current, b) => current + $"{b:x2}");
}
}
}
private static string HashInternal(string path)
{
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
return Hash(stream);
}
}
}
} | apache-2.0 | C# |
13cd75a778d590f65edd45190a6e91f953731684 | Bump version to 0.34.1-beta | github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity | common/SolutionInfo.cs | common/SolutionInfo.cs | #pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
// this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics
internal const string VersionForAssembly = "0.34.1";
// Actual real version
internal const string Version = "0.34.1-beta";
}
}
| #pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
// this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics
internal const string VersionForAssembly = "0.34.0";
// Actual real version
internal const string Version = "0.34.0-beta";
}
}
| mit | C# |
1ec2bccf2839020730a5ec609465e6bf138f2132 | Bump version to 0.30.10 | github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity | common/SolutionInfo.cs | common/SolutionInfo.cs | #pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
internal const string Version = "0.30.10";
}
}
| #pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
internal const string Version = "0.30.9";
}
}
| mit | C# |
63ea463f5d40a6bd244bb5b47cf2328a8f53e0d7 | Make this internal. It's not supposed to be part of the API | mono/Mono.Nat | Mono.Nat/SemaphoreSlimExtensions.cs | Mono.Nat/SemaphoreSlimExtensions.cs | using System;
using System.Threading;
using System.Threading.Tasks;
namespace Mono.Nat
{
static class SemaphoreSlimExtensions
{
class SemaphoreSlimDisposable : IDisposable
{
SemaphoreSlim Semaphore;
public SemaphoreSlimDisposable (SemaphoreSlim semaphore)
{
Semaphore = semaphore;
}
public void Dispose ()
{
Semaphore?.Release ();
Semaphore = null;
}
}
public static async Task<IDisposable> DisposableWaitAsync (this SemaphoreSlim semaphore)
{
await semaphore.WaitAsync ();
return new SemaphoreSlimDisposable (semaphore);
}
}
}
| using System;
using System.Threading;
using System.Threading.Tasks;
namespace Mono.Nat
{
public static class SemaphoreSlimExtensions
{
class SemaphoreSlimDisposable : IDisposable
{
SemaphoreSlim Semaphore;
public SemaphoreSlimDisposable (SemaphoreSlim semaphore)
{
Semaphore = semaphore;
}
public void Dispose ()
{
Semaphore?.Release ();
Semaphore = null;
}
}
public static async Task<IDisposable> DisposableWaitAsync (this SemaphoreSlim semaphore)
{
await semaphore.WaitAsync ();
return new SemaphoreSlimDisposable (semaphore);
}
}
}
| mit | C# |
54699edefbf79b2e7e1311debddc8d41beeb53b1 | fix startup #2928 | Wox-launcher/Wox,qianlifeng/Wox,qianlifeng/Wox,Wox-launcher/Wox,qianlifeng/Wox | Wox.Infrastructure/Constant.cs | Wox.Infrastructure/Constant.cs | using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using JetBrains.Annotations;
namespace Wox.Infrastructure
{
public static class Constant
{
public const string Wox = "Wox";
public static readonly string WoxExecutable = $"{Wox}.exe";
public const string Plugins = "Plugins";
private static Assembly Assembly = Assembly.GetExecutingAssembly();
public static string ExecutablePath = Path.Combine(Path.GetDirectoryName(Assembly.Location), WoxExecutable);
public static string Version = FileVersionInfo.GetVersionInfo(ExecutablePath).ProductVersion;
public static string ProgramDirectory = Directory.GetParent(ExecutablePath).ToString();
public static string ApplicationDirectory = Directory.GetParent(ProgramDirectory).ToString();
public static string RootDirectory = Directory.GetParent(ApplicationDirectory).ToString();
public static string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
public const string Issue = "https://github.com/Wox-launcher/Wox/issues/new";
public static readonly int ThumbnailSize = 64;
public static string ImagesDirectory = Path.Combine(ProgramDirectory, "Images");
public static string DefaultIcon = Path.Combine(ImagesDirectory, "app.png");
public static string ErrorIcon = Path.Combine(ImagesDirectory, "app_error.png");
public static string PythonPath;
public static string EverythingSDKPath;
}
}
| using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using JetBrains.Annotations;
namespace Wox.Infrastructure
{
public static class Constant
{
public const string Wox = "Wox";
public const string Plugins = "Plugins";
private static Assembly Assembly = Assembly.GetExecutingAssembly();
public static string ExecutablePath = Assembly.Location.NonNull();
public static string Version = FileVersionInfo.GetVersionInfo(ExecutablePath).ProductVersion;
public static string ProgramDirectory = Directory.GetParent(ExecutablePath).ToString();
public static string ApplicationDirectory = Directory.GetParent(ProgramDirectory).ToString();
public static string RootDirectory = Directory.GetParent(ApplicationDirectory).ToString();
public static string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
public const string Issue = "https://github.com/Wox-launcher/Wox/issues/new";
public static readonly int ThumbnailSize = 64;
public static string ImagesDirectory = Path.Combine(ProgramDirectory, "Images");
public static string DefaultIcon = Path.Combine(ImagesDirectory, "app.png");
public static string ErrorIcon = Path.Combine(ImagesDirectory, "app_error.png");
public static string PythonPath;
public static string EverythingSDKPath;
}
}
| mit | C# |
50ae9d782204f3c9a7eee93785203d96308e16c4 | Add supression for generated xaml class | oliver-feng/nuget,rikoe/nuget,rikoe/nuget,mono/nuget,jholovacs/NuGet,dolkensp/node.net,mrward/NuGet.V2,mrward/NuGet.V2,themotleyfool/NuGet,mrward/NuGet.V2,anurse/NuGet,indsoft/NuGet2,chester89/nugetApi,GearedToWar/NuGet2,oliver-feng/nuget,jholovacs/NuGet,pratikkagda/nuget,zskullz/nuget,atheken/nuget,jholovacs/NuGet,chocolatey/nuget-chocolatey,mrward/nuget,chester89/nugetApi,jmezach/NuGet2,jmezach/NuGet2,kumavis/NuGet,antiufo/NuGet2,xoofx/NuGet,zskullz/nuget,antiufo/NuGet2,pratikkagda/nuget,RichiCoder1/nuget-chocolatey,xoofx/NuGet,jmezach/NuGet2,OneGet/nuget,alluran/node.net,mrward/nuget,mono/nuget,indsoft/NuGet2,RichiCoder1/nuget-chocolatey,pratikkagda/nuget,xoofx/NuGet,mrward/NuGet.V2,antiufo/NuGet2,themotleyfool/NuGet,pratikkagda/nuget,mrward/NuGet.V2,rikoe/nuget,GearedToWar/NuGet2,dolkensp/node.net,kumavis/NuGet,indsoft/NuGet2,GearedToWar/NuGet2,alluran/node.net,jmezach/NuGet2,rikoe/nuget,RichiCoder1/nuget-chocolatey,ctaggart/nuget,alluran/node.net,oliver-feng/nuget,chocolatey/nuget-chocolatey,akrisiun/NuGet,OneGet/nuget,alluran/node.net,mrward/nuget,indsoft/NuGet2,jmezach/NuGet2,ctaggart/nuget,mrward/NuGet.V2,GearedToWar/NuGet2,mrward/nuget,jholovacs/NuGet,chocolatey/nuget-chocolatey,antiufo/NuGet2,zskullz/nuget,chocolatey/nuget-chocolatey,chocolatey/nuget-chocolatey,jmezach/NuGet2,mono/nuget,mrward/nuget,mrward/nuget,RichiCoder1/nuget-chocolatey,zskullz/nuget,anurse/NuGet,indsoft/NuGet2,GearedToWar/NuGet2,oliver-feng/nuget,xoofx/NuGet,pratikkagda/nuget,pratikkagda/nuget,dolkensp/node.net,RichiCoder1/nuget-chocolatey,akrisiun/NuGet,indsoft/NuGet2,RichiCoder1/nuget-chocolatey,xoofx/NuGet,atheken/nuget,ctaggart/nuget,oliver-feng/nuget,OneGet/nuget,antiufo/NuGet2,antiufo/NuGet2,mono/nuget,dolkensp/node.net,OneGet/nuget,jholovacs/NuGet,xoofx/NuGet,xero-github/Nuget,themotleyfool/NuGet,oliver-feng/nuget,ctaggart/nuget,GearedToWar/NuGet2,jholovacs/NuGet,chocolatey/nuget-chocolatey | NuPack.Dialog/GlobalSuppressions.cs | NuPack.Dialog/GlobalSuppressions.cs | // 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
// Error List, point to "Suppress Message(s)", and click "In Project
// Suppression File". You do not need to add suppressions to this
// file manually.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "NuPack.Dialog.Providers")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "NuPack.Dialog.ToolsOptionsUI")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "XamlGeneratedNamespace")]
| // 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
// Error List, point to "Suppress Message(s)", and click "In Project
// Suppression File". You do not need to add suppressions to this
// file manually.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "NuPack.Dialog.Providers")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "NuPack.Dialog.ToolsOptionsUI")]
| apache-2.0 | C# |
ca86524c922012b32e7a1420c54b49d96a6df3d6 | Add locking on join/leave operations | peppy/osu-new,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,ppy/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu | osu.Game/Online/RealtimeMultiplayer/MultiplayerRoom.cs | osu.Game/Online/RealtimeMultiplayer/MultiplayerRoom.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;
namespace osu.Game.Online.RealtimeMultiplayer
{
[Serializable]
public class MultiplayerRoom
{
private object writeLock = new object();
public long RoomID { get; set; }
public MultiplayerRoomState State { get; set; }
private List<MultiplayerRoomUser> users = new List<MultiplayerRoomUser>();
public IReadOnlyList<MultiplayerRoomUser> Users
{
get
{
lock (writeLock)
return users.ToArray();
}
}
public MultiplayerRoomUser Join(int userId)
{
var user = new MultiplayerRoomUser(userId);
lock (writeLock) users.Add(user);
return user;
}
public MultiplayerRoomUser Leave(int userId)
{
lock (writeLock)
{
var user = users.Find(u => u.UserID == userId);
if (user == null)
return null;
users.Remove(user);
return user;
}
}
}
}
| // 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;
namespace osu.Game.Online.RealtimeMultiplayer
{
[Serializable]
public class MultiplayerRoom
{
private object writeLock = new object();
public long RoomID { get; set; }
public MultiplayerRoomState State { get; set; }
private List<MultiplayerRoomUser> users = new List<MultiplayerRoomUser>();
public IReadOnlyList<MultiplayerRoomUser> Users
{
get
{
lock (writeLock)
return users.ToArray();
}
}
public void Join(int user)
{
lock (writeLock)
users.Add(new MultiplayerRoomUser(user));
}
public void Leave(int user)
{
lock (writeLock)
users.RemoveAll(u => u.UserID == user);
}
}
}
| mit | C# |
1b33c637951db005cb35b653ebf5422820cbdc8f | Add testing support | Miruken-DotNet/Miruken | Source/Miruken/Callback/Resolving.cs | Source/Miruken/Callback/Resolving.cs | namespace Miruken.Callback
{
using System;
using System.Linq;
using Policy;
public class Resolving : Inquiry, IResolveCallback
{
private readonly object _callback;
private bool _handled;
public Resolving(object key, object callback)
: base(key, true)
{
if (callback == null)
throw new ArgumentNullException(nameof(callback));
_callback = callback;
}
object IResolveCallback.GetResolveCallback()
{
return this;
}
protected override bool IsSatisfied(
object resolution, bool greedy, IHandler composer)
{
if (_handled && !greedy) return true;
return _handled = Handler.Dispatch(
resolution, _callback, ref greedy, composer)
|| _handled;
}
public static object GetDefaultResolvingCallback(object callback)
{
var handlers = CallbackPolicy.GetCallbackHandlers(callback).ToArray();
if (handlers.Length == 0) return callback;
var bundle = new Bundle(false);
/*
.Add(h => h.Handle(callback), handled =>
{
if (handled)
Console.WriteLine($"Handled {callback}");
return handled;
});
*/
foreach (var handler in handlers)
bundle.Add(h => h.Handle(new Resolving(handler, callback)));
return bundle;
}
}
}
| namespace Miruken.Callback
{
using System;
using System.Linq;
using Policy;
public class Resolving : Inquiry, IResolveCallback
{
private readonly object _callback;
private bool _handled;
public Resolving(object key, object callback)
: base(key, true)
{
if (callback == null)
throw new ArgumentNullException(nameof(callback));
_callback = callback;
}
object IResolveCallback.GetResolveCallback()
{
return this;
}
protected override bool IsSatisfied(
object resolution, bool greedy, IHandler composer)
{
if (_handled && !greedy) return true;
return _handled = Handler.Dispatch(
resolution, _callback, ref greedy, composer)
|| _handled;
}
public static object GetDefaultResolvingCallback(object callback)
{
var handlers = CallbackPolicy.GetCallbackHandlers(callback).ToArray();
if (handlers.Length == 0) return callback;
var bundle = new Bundle(false)
.Add(h => h.Handle(callback), handled =>
{
if (handled)
Console.WriteLine($"Handled {callback}");
return handled;
});
foreach (var handler in handlers)
bundle.Add(h => h.Handle(new Resolving(handler, callback)));
return bundle;
}
}
}
| mit | C# |
221a99d886cfe9aaacf6515dcd65c0c0673b90e1 | fix StatusPill not setting text when initially set with NONE | johnneijzen/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu,DrabWeb/osu,peppy/osu,EVAST9919/osu,naoey/osu,EVAST9919/osu,ZLima12/osu,naoey/osu,peppy/osu,UselessToucan/osu,ZLima12/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,DrabWeb/osu,smoogipooo/osu,UselessToucan/osu,johnneijzen/osu,2yangk23/osu,NeoAdonis/osu,DrabWeb/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu-new,ppy/osu,naoey/osu,ppy/osu | osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public class BeatmapSetOnlineStatusPill : CircularContainer
{
private readonly OsuSpriteText statusText;
private BeatmapSetOnlineStatus status;
public BeatmapSetOnlineStatus Status
{
get => status;
set
{
if (value == status) return;
status = value;
statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant();
}
}
public BeatmapSetOnlineStatusPill(float textSize, MarginPadding textPadding)
{
AutoSizeAxes = Axes.Both;
Masking = true;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.5f,
},
statusText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = @"Exo2.0-Bold",
TextSize = textSize,
Padding = textPadding,
},
};
Status = BeatmapSetOnlineStatus.None;
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public class BeatmapSetOnlineStatusPill : CircularContainer
{
private readonly OsuSpriteText statusText;
private BeatmapSetOnlineStatus status = BeatmapSetOnlineStatus.None;
public BeatmapSetOnlineStatus Status
{
get { return status; }
set
{
if (value == status) return;
status = value;
statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant();
}
}
public BeatmapSetOnlineStatusPill(float textSize, MarginPadding textPadding)
{
AutoSizeAxes = Axes.Both;
Masking = true;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.5f,
},
statusText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = @"Exo2.0-Bold",
TextSize = textSize,
Padding = textPadding,
},
};
}
}
}
| mit | C# |
812181190e36ef71da107d299c99e111f18cb909 | Update SelectionLayer.cs | johnneijzen/osu,peppy/osu,2yangk23/osu,naoey/osu,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,Frontear/osuKyzer,ppy/osu,ppy/osu,Nabile-Rahmani/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,johnneijzen/osu,ZLima12/osu,DrabWeb/osu,NeoAdonis/osu,peppy/osu,naoey/osu,peppy/osu-new,2yangk23/osu,ppy/osu,smoogipooo/osu,naoey/osu,DrabWeb/osu,ZLima12/osu,NeoAdonis/osu,DrabWeb/osu,EVAST9919/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu | osu.Game/Rulesets/Edit/Layers/Selection/SelectionLayer.cs | osu.Game/Rulesets/Edit/Layers/Selection/SelectionLayer.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 osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Edit.Layers.Selection
{
public class SelectionLayer : CompositeDrawable
{
public readonly Bindable<SelectionInfo> Selection = new Bindable<SelectionInfo>();
private readonly Playfield playfield;
public SelectionLayer(Playfield playfield)
{
this.playfield = playfield;
RelativeSizeAxes = Axes.Both;
}
private DragSelector selector;
protected override bool OnDragStart(InputState state)
{
// Hide the previous drag box - we won't be working with it any longer
selector?.Hide();
AddInternal(selector = new DragSelector(ToLocalSpace(state.Mouse.NativeState.Position))
{
CapturableObjects = playfield.HitObjects.Objects,
});
Selection.BindTo(selector.Selection);
return true;
}
protected override bool OnDrag(InputState state)
{
selector.DragEndPosition = ToLocalSpace(state.Mouse.NativeState.Position);
selector.BeginCapture();
return true;
}
protected override bool OnDragEnd(InputState state)
{
selector.FinishCapture();
return true;
}
protected override bool OnClick(InputState state)
{
selector?.Hide();
return true;
}
}
}
| // 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;
using System.Collections.Generic;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Edit.Layers.Selection
{
public class SelectionLayer : CompositeDrawable
{
public readonly Bindable<SelectionInfo> Selection = new Bindable<SelectionInfo>();
private readonly Playfield playfield;
public SelectionLayer(Playfield playfield)
{
this.playfield = playfield;
RelativeSizeAxes = Axes.Both;
}
private DragSelector selector;
protected override bool OnDragStart(InputState state)
{
// Hide the previous drag box - we won't be working with it any longer
selector?.Hide();
AddInternal(selector = new DragSelector(ToLocalSpace(state.Mouse.NativeState.Position))
{
CapturableObjects = playfield.HitObjects.Objects,
});
Selection.BindTo(selector.Selection);
return true;
}
protected override bool OnDrag(InputState state)
{
selector.DragEndPosition = ToLocalSpace(state.Mouse.NativeState.Position);
selector.BeginCapture();
return true;
}
protected override bool OnDragEnd(InputState state)
{
selector.FinishCapture();
return true;
}
protected override bool OnClick(InputState state)
{
selector?.Hide();
return true;
}
}
}
| mit | C# |
dc8f796edbff4f36a691edb2d1600dbafc950fe8 | Remove useless App startup. | CaptainHayashi/ironfrost | ironfrost/App.xaml.cs | ironfrost/App.xaml.cs | using System;
using System.Threading.Tasks;
using System.Windows;
namespace ironfrost
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
| using System;
using System.Threading.Tasks;
using System.Windows;
namespace ironfrost
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
}
}
}
| mit | C# |
a67ced29a346e9fd200cfdf17b0da71ef322d889 | Remove sensitive information | qianlifeng/Wox,Wox-launcher/Wox,lances101/Wox,lances101/Wox,Wox-launcher/Wox,qianlifeng/Wox,qianlifeng/Wox | Wox.Core/Properties/AssemblyInfo.cs | Wox.Core/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Wox.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Wox.Core")]
[assembly: AssemblyCopyright("The MIT License (MIT)")]
[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("693aa0e5-741b-4759-b740-fdbb011a3280")]
// 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")]
| 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("Wox.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Oracle Corporation")]
[assembly: AssemblyProduct("Wox.Core")]
[assembly: AssemblyCopyright("Copyright © Oracle Corporation 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("693aa0e5-741b-4759-b740-fdbb011a3280")]
// 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")]
| mit | C# |
2fb524e35cbc1e79f360aac998f5271f0bff456e | Delete unnecessary nullable int. | ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton | src/CK.Glouton.Web/Controllers/StatisticsController.cs | src/CK.Glouton.Web/Controllers/StatisticsController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CK.Glouton.Lucene;
using CK.Glouton.Model.Lucene;
using Microsoft.AspNetCore.Mvc;
namespace CK.Glouton.Web.Controllers
{
[Route("api/stats")]
public class StatisticsController : Controller
{
private readonly ILuceneStatisticsService _luceneStatistics;
public StatisticsController(ILuceneStatisticsService luceneStatistics)
{
_luceneStatistics = luceneStatistics;
}
[HttpGet("log/total/by/appname")]
public Dictionary<string, int> LogPerAppName()
{
return _luceneStatistics.GetLogByAppName();
}
[HttpGet("exception/total/by/appname")]
public Dictionary<string, int> ExceptionPerAppName()
{
return _luceneStatistics.GetExceptionByAppName();
}
[HttpGet("log/total")]
public int AllLogCount() => _luceneStatistics.AllLogCount();
[HttpGet("appname/total")]
public int AppNameCount() => _luceneStatistics.AppNameCount;
[HttpGet("exception/total")]
public int AllException() => _luceneStatistics.AllExceptionCount;
[HttpGet("appnames")]
public IEnumerable<string> AppNames() => _luceneStatistics.GetAppNames;
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CK.Glouton.Lucene;
using CK.Glouton.Model.Lucene;
using Microsoft.AspNetCore.Mvc;
namespace CK.Glouton.Web.Controllers
{
[Route("api/stats")]
public class StatisticsController : Controller
{
private readonly ILuceneStatisticsService _luceneStatistics;
public StatisticsController(ILuceneStatisticsService luceneStatistics)
{
_luceneStatistics = luceneStatistics;
}
[HttpGet("log/total/by/appname")]
public Dictionary<string, int> LogPerAppName()
{
return _luceneStatistics.GetLogByAppName();
}
[HttpGet("exception/total/by/appname")]
public Dictionary<string, int> ExceptionPerAppName()
{
return _luceneStatistics.GetExceptionByAppName();
}
[HttpGet("log/total")]
public int? AllLogCount() => _luceneStatistics.AllLogCount();
[HttpGet("appname/total")]
public int? AppNameCount() => _luceneStatistics.AppNameCount;
[HttpGet("exception/total")]
public int? AllException() => _luceneStatistics.AllExceptionCount;
[HttpGet("appnames")]
public IEnumerable<string> AppNames() => _luceneStatistics.GetAppNames;
}
} | mit | C# |
783b302743fbf3a9922a880eda258a09c49aca44 | Correct exception message. | honestegg/cassette,damiensawyer/cassette,damiensawyer/cassette,honestegg/cassette,BluewireTechnologies/cassette,andrewdavey/cassette,BluewireTechnologies/cassette,andrewdavey/cassette,damiensawyer/cassette,andrewdavey/cassette,honestegg/cassette | src/Cassette.Web/PlaceholderReplacingResponseFilter.cs | src/Cassette.Web/PlaceholderReplacingResponseFilter.cs | using System;
using System.IO;
using System.Text;
using System.Web;
namespace Cassette.Web
{
class PlaceholderReplacingResponseFilter : MemoryStream
{
public PlaceholderReplacingResponseFilter(HttpResponseBase response, IPlaceholderTracker placeholderTracker)
{
this.response = response;
this.placeholderTracker = placeholderTracker;
outputStream = response.Filter;
htmlBuffer = new StringBuilder();
}
readonly Stream outputStream;
readonly HttpResponseBase response;
readonly IPlaceholderTracker placeholderTracker;
readonly StringBuilder htmlBuffer;
bool hasWrittenToOutputStream;
public override void Write(byte[] buffer, int offset, int count)
{
if (HttpRuntime.UsingIntegratedPipeline && response.Headers["Content-Encoding"] != null)
{
throw new InvalidOperationException("Cannot rewrite page output when it has been compressed. Either set <cassette rewriteHtml=\"false\" /> to disable rewriting or set <urlCompression dynamicCompressionBeforeCache=\"false\" /> in Web.config.");
}
BufferOutput(buffer, offset, count);
}
public override void Close()
{
if (!hasWrittenToOutputStream)
{
WriteBufferedOutput();
hasWrittenToOutputStream = true;
}
base.Close();
}
void BufferOutput(byte[] buffer, int offset, int count)
{
var encoding = response.Output.Encoding;
var html = encoding.GetString(buffer, offset, count);
htmlBuffer.Append(html);
}
void WriteBufferedOutput()
{
var encoding = response.Output.Encoding;
var output = placeholderTracker.ReplacePlaceholders(htmlBuffer.ToString());
var outputBytes = encoding.GetBytes(output);
outputStream.Write(outputBytes, 0, outputBytes.Length);
}
}
} | using System;
using System.IO;
using System.Text;
using System.Web;
namespace Cassette.Web
{
class PlaceholderReplacingResponseFilter : MemoryStream
{
public PlaceholderReplacingResponseFilter(HttpResponseBase response, IPlaceholderTracker placeholderTracker)
{
this.response = response;
this.placeholderTracker = placeholderTracker;
outputStream = response.Filter;
htmlBuffer = new StringBuilder();
}
readonly Stream outputStream;
readonly HttpResponseBase response;
readonly IPlaceholderTracker placeholderTracker;
readonly StringBuilder htmlBuffer;
bool hasWrittenToOutputStream;
public override void Write(byte[] buffer, int offset, int count)
{
if (HttpRuntime.UsingIntegratedPipeline && response.Headers["Content-Encoding"] != null)
{
throw new InvalidOperationException("Cannot rewrite page output when it has been compressed. Either set ICassetteApplication.IsHtmlRewritingEnabled to false in the Cassette configuration, or set <urlCompression dynamicCompressionBeforeCache=\"false\" /> in Web.config.");
}
BufferOutput(buffer, offset, count);
}
public override void Close()
{
if (!hasWrittenToOutputStream)
{
WriteBufferedOutput();
hasWrittenToOutputStream = true;
}
base.Close();
}
void BufferOutput(byte[] buffer, int offset, int count)
{
var encoding = response.Output.Encoding;
var html = encoding.GetString(buffer, offset, count);
htmlBuffer.Append(html);
}
void WriteBufferedOutput()
{
var encoding = response.Output.Encoding;
var output = placeholderTracker.ReplacePlaceholders(htmlBuffer.ToString());
var outputBytes = encoding.GetBytes(output);
outputStream.Write(outputBytes, 0, outputBytes.Length);
}
}
} | mit | C# |
2758078fe1d8113b6a3c74de0090c0a2f3f36df3 | Bump version to 0.30.11 | github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity | common/SolutionInfo.cs | common/SolutionInfo.cs | #pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
internal const string Version = "0.30.11";
}
}
| #pragma warning disable 436
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub for Unity")]
[assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)]
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)]
//Required for NSubstitute
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)]
//Required for Unity compilation
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)]
namespace System
{
internal static class AssemblyVersionInformation {
internal const string Version = "0.30.10";
}
}
| mit | C# |
845cf33e4b1791a638594a4ef542090b19af9ce8 | Use Shouldy | ermshiperete/GitVersion,alexhardwicke/GitVersion,RaphHaddad/GitVersion,DanielRose/GitVersion,ermshiperete/GitVersion,alexhardwicke/GitVersion,TomGillen/GitVersion,pascalberger/GitVersion,dpurge/GitVersion,distantcam/GitVersion,Philo/GitVersion,dazinator/GitVersion,MarkZuber/GitVersion,ParticularLabs/GitVersion,ermshiperete/GitVersion,JakeGinnivan/GitVersion,pascalberger/GitVersion,RaphHaddad/GitVersion,distantcam/GitVersion,dazinator/GitVersion,onovotny/GitVersion,ermshiperete/GitVersion,TomGillen/GitVersion,dpurge/GitVersion,DanielRose/GitVersion,asbjornu/GitVersion,onovotny/GitVersion,FireHost/GitVersion,dpurge/GitVersion,pascalberger/GitVersion,FireHost/GitVersion,asbjornu/GitVersion,MarkZuber/GitVersion,openkas/GitVersion,DanielRose/GitVersion,GitTools/GitVersion,JakeGinnivan/GitVersion,GitTools/GitVersion,onovotny/GitVersion,Philo/GitVersion,JakeGinnivan/GitVersion,gep13/GitVersion,openkas/GitVersion,gep13/GitVersion,dpurge/GitVersion,ParticularLabs/GitVersion,JakeGinnivan/GitVersion | src/GitVersionCore.Tests/BuildServers/VsoAgentTests.cs | src/GitVersionCore.Tests/BuildServers/VsoAgentTests.cs | using GitVersion;
using NUnit.Framework;
using Shouldly;
[TestFixture]
public class VsoAgentTests
{
[Test]
public void Develop_branch()
{
var versionBuilder = new VsoAgent();
var vsVersion = versionBuilder.GenerateSetVersionMessage("0.0.0-Unstable4");
// Assert.AreEqual("##vso[task.setvariable variable=GitBuildNumber;]0.0.0-Unstable4", vsVersion);
vsVersion.ShouldBe(null);
}
[Test]
public void EscapeValues()
{
var versionBuilder = new VsoAgent();
var vsVersion = versionBuilder.GenerateSetParameterMessage("Foo", "0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'");
vsVersion[0].ShouldBe("##vso[task.setvariable variable=GitVersion.Foo;]0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'");
}
} | using GitVersion;
using NUnit.Framework;
[TestFixture]
public class VsoAgentTests
{
[Test]
public void Develop_branch()
{
var versionBuilder = new VsoAgent();
var vsVersion = versionBuilder.GenerateSetVersionMessage("0.0.0-Unstable4");
// Assert.AreEqual("##vso[task.setvariable variable=GitBuildNumber;]0.0.0-Unstable4", vsVersion);
Assert.Null(vsVersion);
}
[Test]
public void EscapeValues()
{
var versionBuilder = new VsoAgent();
var vsVersion = versionBuilder.GenerateSetParameterMessage("Foo", "0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'");
Assert.AreEqual("##vso[task.setvariable variable=GitVersion.Foo;]0.8.0-unstable568 Branch:'develop' Sha:'ee69bff1087ebc95c6b43aa2124bd58f5722e0cb'", vsVersion[0]);
}
} | mit | C# |
06c20b7cc2e219cd7e279d9171e0b7465c03ed83 | Update src/FluentNHibernate/MappingModel/EqualityExtensions.cs | hzhgis/ss,lingxyd/fluent-nhibernate,narnau/fluent-nhibernate,hzhgis/ss,lingxyd/fluent-nhibernate,HermanSchoenfeld/fluent-nhibernate,owerkop/fluent-nhibernate,HermanSchoenfeld/fluent-nhibernate,chester89/fluent-nhibernate,oceanho/fluent-nhibernate,owerkop/fluent-nhibernate,bogdan7/nhibernate,narnau/fluent-nhibernate,chester89/fluent-nhibernate,bogdan7/nhibernate,oceanho/fluent-nhibernate,bogdan7/nhibernate,chester89/fluent-nhibernate,hzhgis/ss | src/FluentNHibernate/MappingModel/EqualityExtensions.cs | src/FluentNHibernate/MappingModel/EqualityExtensions.cs | using System.Collections.Generic;
using System.Linq;
namespace FluentNHibernate.MappingModel
{
public static class EqualityExtensions
{
public static bool ContentEquals<TKey, TValue>(this IDictionary<TKey, TValue> left, IDictionary<TKey, TValue> right)
{
if (left.Count != right.Count)
return false;
foreach (var item in left)
{
var leftValue = item.Value;
TValue rightValue;
if (!right.TryGetValue(item.Key, out rightValue))
return false; // Key mismatch
if (!Equals(leftValue, rightValue))
return false; // Value mismatch
}
return true;
}
public static bool ContentEquals<T>(this IEnumerable<T> left, IEnumerable<T> right)
{
if (left.Count() != right.Count())
return false;
var index = 0;
foreach (var item in left)
{
if (!item.Equals(right.ElementAt(index)))
return false;
index++;
}
return true;
}
}
} | using System.Collections.Generic;
using System.Linq;
namespace FluentNHibernate.MappingModel
{
public static class EqualityExtensions
{
public static bool ContentEquals<TKey, TValue>(this IDictionary<TKey, TValue> left, IDictionary<TKey, TValue> right)
{
if (left.Count() != right.Count())
return false;
var index = 0;
foreach (var item in left)
{
if (!item.Equals(right.ElementAt(index)))
return false;
index++;
}
return true;
}
public static bool ContentEquals<T>(this IEnumerable<T> left, IEnumerable<T> right)
{
if (left.Count() != right.Count())
return false;
var index = 0;
foreach (var item in left)
{
if (!item.Equals(right.ElementAt(index)))
return false;
index++;
}
return true;
}
}
} | bsd-3-clause | C# |
469ac7f48d4b432b83136887cc322e63252ed600 | Print information about the exception when the bot fails to log in to the forum. | Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW | src/MitternachtBot/Modules/Forum/Services/ForumService.cs | src/MitternachtBot/Modules/Forum/Services/ForumService.cs | using System;
using System.Threading.Tasks;
using Mitternacht.Services;
using NLog;
namespace Mitternacht.Modules.Forum.Services {
public class ForumService : IMService {
private readonly IBotCredentials _creds;
private readonly Logger _log;
public GommeHDnetForumAPI.Forum Forum { get; private set; }
public bool HasForumInstance => Forum != null;
public bool LoggedIn => Forum?.LoggedIn ?? false;
private Task _loginTask;
public ForumService(IBotCredentials creds) {
_creds = creds;
_log = LogManager.GetCurrentClassLogger();
InitForumInstance();
}
public void InitForumInstance() {
_loginTask?.Dispose();
_loginTask = Task.Run(() => {
try {
Forum = new GommeHDnetForumAPI.Forum(_creds.ForumUsername, _creds.ForumPassword);
_log.Info($"Initialized new Forum instance.");
} catch(Exception e) {
_log.Warn(e, $"Initializing new Forum instance failed: {e}");
}
});
}
}
} | using System;
using System.Threading.Tasks;
using Mitternacht.Services;
using NLog;
namespace Mitternacht.Modules.Forum.Services {
public class ForumService : IMService {
private readonly IBotCredentials _creds;
private readonly Logger _log;
public GommeHDnetForumAPI.Forum Forum { get; private set; }
public bool HasForumInstance => Forum != null;
public bool LoggedIn => Forum?.LoggedIn ?? false;
private Task _loginTask;
public ForumService(IBotCredentials creds) {
_creds = creds;
_log = LogManager.GetCurrentClassLogger();
InitForumInstance();
}
public void InitForumInstance() {
_loginTask?.Dispose();
_loginTask = Task.Run(() => {
try {
Forum = new GommeHDnetForumAPI.Forum(_creds.ForumUsername, _creds.ForumPassword);
_log.Info($"Initialized new Forum instance.");
} catch(Exception e) {
_log.Warn(e, $"Initializing new Forum instance failed.");
}
});
}
}
} | mit | C# |
03b5d4bde86a2b53943b6a270b053e53015e6b9d | improve GetAsync extension method | geeklearningio/gl-dotnet-storage | src/GeekLearning.Storage/IStoreExtensions.cs | src/GeekLearning.Storage/IStoreExtensions.cs | namespace GeekLearning.Storage
{
using GeekLearning.Storage;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
public static class IStoreExtensions
{
public static Task<IFileReference[]> ListAsync(this IStore store, string path, bool recursive = false, bool withMetadata = false)
{
return store.ListAsync(path, recursive: recursive, withMetadata: withMetadata);
}
public static Task<IFileReference[]> ListAsync(this IStore store, string path, string searchPattern, bool recursive = false, bool withMetadata = false)
{
return store.ListAsync(path, searchPattern, recursive: recursive, withMetadata: withMetadata);
}
public static Task DeleteAsync(this IStore store, string path)
{
return store.DeleteAsync(new Internal.PrivateFileReference(path));
}
public static Task<IFileReference> GetAsync(this IStore store, string path, bool withMetadata = false)
{
return store.GetAsync(new Internal.PrivateFileReference(path), withMetadata: withMetadata);
}
public static Task<Stream> ReadAsync(this IStore store, string path)
{
return store.ReadAsync(new Internal.PrivateFileReference(path));
}
public static Task<byte[]> ReadAllBytesAsync(this IStore store, string path)
{
return store.ReadAllBytesAsync(new Internal.PrivateFileReference(path));
}
public static Task<string> ReadAllTextAsync(this IStore store, string path)
{
return store.ReadAllTextAsync(new Internal.PrivateFileReference(path));
}
public static Task<IFileReference> SaveAsync(this IStore store, byte[] data, string path, string contentType)
{
return store.SaveAsync(data, new Internal.PrivateFileReference(path), contentType);
}
public static Task<IFileReference> SaveAsync(this IStore store, Stream data, string path, string contentType)
{
return store.SaveAsync(data, new Internal.PrivateFileReference(path), contentType);
}
}
}
| namespace GeekLearning.Storage
{
using GeekLearning.Storage;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
public static class IStoreExtensions
{
public static Task<IFileReference[]> ListAsync(this IStore store, string path, bool recursive = false, bool withMetadata = false)
{
return store.ListAsync(path, recursive: recursive, withMetadata: withMetadata);
}
public static Task<IFileReference[]> ListAsync(this IStore store, string path, string searchPattern, bool recursive = false, bool withMetadata = false)
{
return store.ListAsync(path, searchPattern, recursive: recursive, withMetadata: withMetadata);
}
public static Task DeleteAsync(this IStore store, string path)
{
return store.DeleteAsync(new Internal.PrivateFileReference(path));
}
public static Task<IFileReference> GetAsync(this IStore store, string path)
{
return store.GetAsync(new Internal.PrivateFileReference(path), withMetadata: false);
}
public static Task<Stream> ReadAsync(this IStore store, string path)
{
return store.ReadAsync(new Internal.PrivateFileReference(path));
}
public static Task<byte[]> ReadAllBytesAsync(this IStore store, string path)
{
return store.ReadAllBytesAsync(new Internal.PrivateFileReference(path));
}
public static Task<string> ReadAllTextAsync(this IStore store, string path)
{
return store.ReadAllTextAsync(new Internal.PrivateFileReference(path));
}
public static Task<IFileReference> SaveAsync(this IStore store, byte[] data, string path, string contentType)
{
return store.SaveAsync(data, new Internal.PrivateFileReference(path), contentType);
}
public static Task<IFileReference> SaveAsync(this IStore store, Stream data, string path, string contentType)
{
return store.SaveAsync(data, new Internal.PrivateFileReference(path), contentType);
}
}
}
| mit | C# |
04cc8f883a26b35a4d26ee90994dd5d73096cf5c | Add error handling for the client | avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors,avinassh/grpc-errors | csharp/Hello/HelloClient/Program.cs | csharp/Hello/HelloClient/Program.cs | using System;
using Grpc.Core;
using Hello;
namespace HelloClient
{
class Program
{
public static void Main(string[] args)
{
Channel channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure);
var client = new HelloService.HelloServiceClient(channel);
// ideally you should check for errors here too
var reply = client.SayHello(new HelloReq { Name = "Euler" });
Console.WriteLine(reply.Result);
try
{
reply = client.SayHelloStrict(new HelloReq { Name = "Leonhard Euler" });
Console.WriteLine(reply.Result);
}
catch (RpcException e)
{
// ouch!
// lets print the gRPC error message
// which is "Length of `Name` cannot be more than 10 characters"
Console.WriteLine(e.Status.Detail);
// lets access the error code, which is `INVALID_ARGUMENT`
Console.WriteLine(e.Status.StatusCode);
// Want its int version for some reason?
// you shouldn't actually do this, but if you need for debugging,
// you can access `e.Status.StatusCode` which will give you `3`
Console.WriteLine((int)e.Status.StatusCode);
// Want to take specific action based on specific error?
if (e.Status.StatusCode == Grpc.Core.StatusCode.InvalidArgument) {
// do your thing
}
}
channel.ShutdownAsync().Wait();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
| using System;
using Grpc.Core;
using Hello;
namespace HelloClient
{
class Program
{
public static void Main(string[] args)
{
Channel channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure);
var client = new HelloService.HelloServiceClient(channel);
String user = "Euler";
var reply = client.SayHello(new HelloReq { Name = user });
Console.WriteLine(reply.Result);
channel.ShutdownAsync().Wait();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
| mit | C# |
8f4ec6f1463ea04942a9afd8510bece33f96c1d5 | Update token (#946) | nkdAgility/vsts-sync-migration | src/MigrationTools/Tests/TestingConstants.cs | src/MigrationTools/Tests/TestingConstants.cs | namespace MigrationTools.Tests
{
public static class TestingConstants
{
public static string AccessToken { get { return AccessTokenRaw.Replace(@"fake", ""); } }
public static readonly string AccessTokenRaw = "4u7zrnz4fsdhiro7x4iefakeomevirytzb3tlzva6nnmvbiv3wyh34dq";
}
} | namespace MigrationTools.Tests
{
public static class TestingConstants
{
public static string AccessToken { get { return AccessTokenRaw.Replace(@"fake", ""); } }
public static readonly string AccessTokenRaw = "ilgcnn2fkz455l5vciz3x34fqyfake3o5hq4myjta3zoas4bfvyaljba";
}
} | mit | C# |
205e67868f662d2b22511323ff18c1c72b9763d0 | Fix flaky test | Abc-Arbitrage/ZeroLog | src/ZeroLog.Tests/Appenders/AppenderTests.cs | src/ZeroLog.Tests/Appenders/AppenderTests.cs | using System;
using System.Threading.Tasks;
using NUnit.Framework;
using ZeroLog.Appenders;
using ZeroLog.Configuration;
using ZeroLog.Formatting;
using ZeroLog.Tests.Support;
namespace ZeroLog.Tests.Appenders;
[TestFixture]
public class AppenderTests
{
private FailingAppender _appender;
private FormattedLogMessage _message;
[SetUp]
public void SetUp()
{
_appender = new FailingAppender();
var logMessage = new LogMessage("Test");
_message = new FormattedLogMessage(logMessage.ToString().Length, ZeroLogConfiguration.Default);
_message.SetMessage(logMessage);
}
[Test]
public void should_append()
{
_appender.Fail = false;
_appender.InternalWriteMessage(_message, ZeroLogConfiguration.Default);
_appender.AppendCount.ShouldEqual(1);
_appender.InternalWriteMessage(_message, ZeroLogConfiguration.Default);
_appender.AppendCount.ShouldEqual(2);
}
[Test]
public void should_not_throw_if_appender_implementation_throws()
{
_appender.Fail = true;
Assert.DoesNotThrow(() => _appender.InternalWriteMessage(_message, ZeroLogConfiguration.Default));
}
[Test]
public void should_disable_appender_if_it_throws()
{
_appender.Fail = true;
_appender.InternalWriteMessage(_message, ZeroLogConfiguration.Default);
_appender.InternalWriteMessage(_message, ZeroLogConfiguration.Default);
_appender.AppendCount.ShouldEqual(1);
}
[Test]
public async Task should_reenable_appender_after_quarantine_delay()
{
_appender.Fail = true;
var config = new ZeroLogConfiguration { AppenderQuarantineDelay = TimeSpan.FromSeconds(1) };
_appender.InternalWriteMessage(_message, config);
_appender.AppendCount.ShouldEqual(1);
_appender.InternalWriteMessage(_message, config);
_appender.AppendCount.ShouldEqual(1);
await Task.Delay(TimeSpan.FromSeconds(2));
_appender.InternalWriteMessage(_message, config);
_appender.AppendCount.ShouldEqual(2);
_appender.InternalWriteMessage(_message, config);
_appender.AppendCount.ShouldEqual(2);
}
private class FailingAppender : Appender
{
public bool Fail { get; set; }
public int AppendCount { get; private set; }
public override void WriteMessage(FormattedLogMessage message)
{
++AppendCount;
if (Fail)
throw new InvalidOperationException();
}
}
}
| using System;
using System.Threading.Tasks;
using NUnit.Framework;
using ZeroLog.Appenders;
using ZeroLog.Configuration;
using ZeroLog.Formatting;
using ZeroLog.Tests.Support;
namespace ZeroLog.Tests.Appenders;
[TestFixture]
public class AppenderTests
{
private FailingAppender _appender;
private FormattedLogMessage _message;
[SetUp]
public void SetUp()
{
_appender = new FailingAppender();
var logMessage = new LogMessage("Test");
_message = new FormattedLogMessage(logMessage.ToString().Length, ZeroLogConfiguration.Default);
_message.SetMessage(logMessage);
}
[Test]
public void should_append()
{
_appender.Fail = false;
_appender.InternalWriteMessage(_message, ZeroLogConfiguration.Default);
_appender.AppendCount.ShouldEqual(1);
_appender.InternalWriteMessage(_message, ZeroLogConfiguration.Default);
_appender.AppendCount.ShouldEqual(2);
}
[Test]
public void should_not_throw_if_appender_implementation_throws()
{
_appender.Fail = true;
Assert.DoesNotThrow(() => _appender.InternalWriteMessage(_message, ZeroLogConfiguration.Default));
}
[Test]
public void should_disable_appender_if_it_throws()
{
_appender.Fail = true;
_appender.InternalWriteMessage(_message, ZeroLogConfiguration.Default);
_appender.InternalWriteMessage(_message, ZeroLogConfiguration.Default);
_appender.AppendCount.ShouldEqual(1);
}
[Test]
public async Task should_reenable_appender_after_quarantine_delay()
{
_appender.Fail = true;
var config = new ZeroLogConfiguration { AppenderQuarantineDelay = TimeSpan.FromSeconds(1) };
_appender.InternalWriteMessage(_message, config);
_appender.AppendCount.ShouldEqual(1);
_appender.InternalWriteMessage(_message, config);
_appender.AppendCount.ShouldEqual(1);
await Task.Delay(TimeSpan.FromSeconds(1));
_appender.InternalWriteMessage(_message, config);
_appender.AppendCount.ShouldEqual(2);
_appender.InternalWriteMessage(_message, config);
_appender.AppendCount.ShouldEqual(2);
}
private class FailingAppender : Appender
{
public bool Fail { get; set; }
public int AppendCount { get; private set; }
public override void WriteMessage(FormattedLogMessage message)
{
++AppendCount;
if (Fail)
throw new InvalidOperationException();
}
}
}
| mit | C# |
802ba10995d6a44d8ae58b16d212ee7b5e0ce976 | Update version to 1.0.0.85 | Ridermansb/wox.skype | Wox.Skype/Properties/AssemblyInfo.cs | Wox.Skype/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("Wox.Skype")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Wox.Skype")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d76ab2b-4fda-486e-9378-ff8f7bddd051")]
// 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.85")]
[assembly: AssemblyFileVersion("1.0.0.85")]
| 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("Wox.Skype")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Wox.Skype")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d76ab2b-4fda-486e-9378-ff8f7bddd051")]
// 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.64")]
[assembly: AssemblyFileVersion("1.0.0.64")]
| mit | C# |
9e1578624d13a59b0e4ffb780ba9c856021ec68b | Correct copy on the home page | Kentico/cloud-boilerplate-net,Kentico/cloud-boilerplate-net,Kentico/cloud-boilerplate-net | src/content/CloudBoilerplateNet/Views/Home/Index.cshtml | src/content/CloudBoilerplateNet/Views/Home/Index.cshtml | @model IEnumerable<Article>
@{
ViewData["Title"] = "Home Page";
}
<div class="header clearfix">
<nav>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="/">Home</a></li>
<li role="presentation"><a href="https://kenticocloud.com/" target="_blank">Kentico Cloud</a></li>
<li role="presentation"><a href="https://app.kenticocloud.com/sign-up" target="_blank">Sign up</a></li>
</ul>
</nav>
<h3 class="text-muted">Kentico Cloud Boilerplate</h3>
</div>
<div class="jumbotron">
<h1>Let's Get Started</h1>
<p class="lead">This boilerplate includes a set of features and best practices to kick off your website development with Kentico Cloud smoothly. Take a look into the code to see how it works.</p>
<p><a class="btn btn-lg btn-success" href="https://github.com/Kentico/cloud-boilerplate-net#quick-start" target="_blank" role="button">Read the Quick Start</a></p>
</div>
<div class="row marketing">
<h2>Articles from the Dancing Goat Sample Site</h2>
</div>
<div class="row marketing">
@*
This MVC helper method ensures that current model is rendered
with suitable view from /Views/Shared/DisplayTemplates
*@
@Html.DisplayForModel()
</div>
| @model IEnumerable<Article>
@{
ViewData["Title"] = "Home Page";
}
<div class="header clearfix">
<nav>
<ul class="nav nav-pills pull-right">
<li role="presentation" class="active"><a href="/">Home</a></li>
<li role="presentation"><a href="https://kenticocloud.com/" target="_blank">Kentico Cloud</a></li>
<li role="presentation"><a href="https://app.kenticocloud.com/sign-up" target="_blank">Sign up</a></li>
</ul>
</nav>
<h3 class="text-muted">Kentico Cloud Boilerplate</h3>
</div>
<div class="jumbotron">
<h1>Let's Get Started</h1>
<p class="lead">This boilerplate includes a set of features and best practices to kick off your website development with Kentico Cloud smoothly. Take a look into the code how this page works.</p>
<p><a class="btn btn-lg btn-success" href="https://github.com/Kentico/cloud-boilerplate-net#quick-start" target="_blank" role="button">Read the Quick Start</a></p>
</div>
<div class="row marketing">
<h2>Articles from the Dancing Goat Sample Site</h2>
</div>
<div class="row marketing">
@*
This MVC helper method ensures that current model is rendered
with suitable view from /Views/Shared/DisplayTemplates
*@
@Html.DisplayForModel()
</div>
| mit | C# |
f55b3faa6e0c4cbebe04e92c28c171b8f897ecab | Decrease allocations in stack serializer | gregsdennis/Manatee.Json,gregsdennis/Manatee.Json | Manatee.Json/Serialization/Internal/AutoRegistration/StackSerializationDelegateProvider.cs | Manatee.Json/Serialization/Internal/AutoRegistration/StackSerializationDelegateProvider.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Manatee.Json.Serialization.Internal.AutoRegistration
{
internal class StackSerializationDelegateProvider : SerializationDelegateProviderBase
{
public override bool CanHandle(Type type)
{
return type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Stack<>);
}
private static JsonValue _Encode<T>(Stack<T> stack, JsonSerializer serializer)
{
var values = new JsonValue[stack.Count];
for (int i = 0; i < values.Length; i++)
{
values[0] = serializer.Serialize(stack.ElementAt(i));
}
return new JsonArray(values);
}
private static Stack<T> _Decode<T>(JsonValue json, JsonSerializer serializer)
{
var array = json.Array;
var values = new T[array.Count];
for (int i = 0; i < values.Length; i++)
{
values[i] = serializer.Deserialize<T>(array[i]);
}
return new Stack<T>(values);
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Manatee.Json.Serialization.Internal.AutoRegistration
{
internal class StackSerializationDelegateProvider : SerializationDelegateProviderBase
{
public override bool CanHandle(Type type)
{
return type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Stack<>);
}
private static JsonValue _Encode<T>(Stack<T> stack, JsonSerializer serializer)
{
var array = new JsonArray();
for (int i = 0; i < stack.Count; i++)
{
array.Add(serializer.Serialize(stack.ElementAt(i)));
}
return array;
}
private static Stack<T> _Decode<T>(JsonValue json, JsonSerializer serializer)
{
var stack = new Stack<T>();
for (int i = 0; i < json.Array.Count; i++)
{
stack.Push(serializer.Deserialize<T>(json.Array[i]));
}
return stack;
}
}
} | mit | C# |
4fda84f3b21bd8772fbf0a33a4dc6085b9fea6a9 | Update SubscriptionOptions.cs | Shuttle/Shuttle.Esb | Shuttle.Esb/Configuration/Options/SubscriptionOptions.cs | Shuttle.Esb/Configuration/Options/SubscriptionOptions.cs | using System.Collections.Generic;
namespace Shuttle.Esb
{
public enum SubscribeType
{
Normal = 0,
Ensure = 1,
Ignore = 2
}
public class SubscriptionOptions
{
public const string SectionName = "Shuttle:Subscription";
public SubscribeType SubscribeType { get; set; } = SubscribeType.Normal;
public string ConnectionStringName { get; set; } = "Subscription";
public List<string> MessageTypes { get; set; } = new List<string>();
}
} | using System.Collections.Generic;
namespace Shuttle.Esb
{
public enum SubscribeType
{
Normal = 0,
Ensure = 1,
Ignore = 2
}
public class SubscriptionOptions
{
public const string SectionName = "Shuttle:Subscription";
public SubscribeType SubscribeType { get; set; }
public string ConnectionStringName { get; set; } = "Subscription";
public List<string> MessageTypes { get; set; } = new List<string>();
}
} | bsd-3-clause | C# |
230948d19d809fc288c6f30ef1f5be7c05cd6de8 | Refactor UInt32Type test. | victorbush/ego.nefsedit | VictorBush.Ego.NefsLib.Tests/DataTypes/UInt32TypeTest.cs | VictorBush.Ego.NefsLib.Tests/DataTypes/UInt32TypeTest.cs | using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using VictorBush.Ego.NefsLib.DataTypes;
namespace VictorBush.Ego.NefsLib.Tests.DataTypes
{
[TestClass]
public class UInt32TypeTest
{
[TestMethod]
public void ToString_CorrectStringReturned()
{
var file = new FileStream(TestHelper.DataTypeTestsFile, FileMode.Open);
var data = new UInt32Type(8);
data.Read(file, 0);
Assert.AreEqual((UInt32)0x15161718, data.Value);
file.Close();
/* Test ToString() */
Assert.AreEqual("15161718", data.ToString());
}
[TestMethod]
public void UInt32Type_Size_4Bytes()
{
/* Verify size is 4 bytes */
var data = new UInt32Type(0);
Assert.AreEqual((UInt32)4, data.Size);
}
[TestMethod]
public void UInt32Type_NegativeOffset()
{
/* Negative offset */
var file = new FileStream(TestHelper.DataTypeTestsFile, FileMode.Open);
var data = new UInt32Type(-8);
data.Read(file, 8);
Assert.AreEqual((UInt32)0x05060708, data.Value);
file.Close();
}
[TestMethod]
public void UInt32Type_NoOffset()
{
/* 0x0 offset */
var file = new FileStream(TestHelper.DataTypeTestsFile, FileMode.Open);
var data = new UInt32Type(0x0);
data.Read(file, 0);
Assert.AreEqual((UInt32)0x05060708, data.Value);
file.Close();
}
[TestMethod]
public void UInt32Type_PositiveOffset()
{
/* Positive offset */
var file = new FileStream(TestHelper.DataTypeTestsFile, FileMode.Open);
var data = new UInt32Type(8);
data.Read(file, 0);
Assert.AreEqual((UInt32)0x15161718, data.Value);
file.Close();
}
}
}
| using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using VictorBush.Ego.NefsLib.DataTypes;
namespace VictorBush.Ego.NefsLib.Tests.DataTypes
{
[TestClass]
public class UInt32TypeTest
{
[TestMethod]
public void TestUInt32Type()
{
FileStream file;
UInt32Type data;
/*
* Verify size is 4 bytes
*/
data = new UInt32Type(0);
Assert.AreEqual(4, data.Size);
/*
* 0x0 offset
*/
file = new FileStream(TestHelper.DataTypeTestsFile, FileMode.Open);
data = new UInt32Type(0x0);
data.Read(file, 0);
Assert.AreEqual((UInt32)0x05060708, data.Value);
file.Close();
/*
* Negative offset
*/
file = new FileStream(TestHelper.DataTypeTestsFile, FileMode.Open);
data = new UInt32Type(-8);
data.Read(file, 8);
Assert.AreEqual((UInt32)0x05060708, data.Value);
file.Close();
/*
* Positive offset
*/
file = new FileStream(TestHelper.DataTypeTestsFile, FileMode.Open);
data = new UInt32Type(8);
data.Read(file, 0);
Assert.AreEqual((UInt32)0x15161718, data.Value);
file.Close();
/* Test ToString() */
Assert.AreEqual("15161718", data.ToString());
}
}
}
| mit | C# |
1dde1ed5f0ab4db413ba28e27f096fc98dd73af6 | Add version to assembly | kipusoep/Archetype,tomfulton/Archetype,kgiszewski/Archetype,kjac/Archetype,tomfulton/Archetype,Nicholas-Westby/Archetype,tomfulton/Archetype,kgiszewski/Archetype,kipusoep/Archetype,imulus/Archetype,imulus/Archetype,kipusoep/Archetype,Nicholas-Westby/Archetype,Nicholas-Westby/Archetype,kgiszewski/Archetype,imulus/Archetype,kjac/Archetype,kjac/Archetype | app/Umbraco/Umbraco.Archetype/Properties/AssemblyInfo.cs | app/Umbraco/Umbraco.Archetype/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Archetype")]
[assembly: AssemblyDescription("Archetype's supporting code library for Umbraco")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Imulus")]
[assembly: AssemblyProduct("Archetype")]
[assembly: AssemblyCopyright("Copyright \xa9 Imulus 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("E37E94F9-C7BA-4B54-B7E1-64419B3DBA0B")]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
[assembly: AssemblyInformationalVersion("0.5.0-alpha")]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Archetype")]
[assembly: AssemblyDescription("Archetype's supporting code library for Umbraco")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Imulus")]
[assembly: AssemblyProduct("Archetype")]
[assembly: AssemblyCopyright("Copyright \xa9 Imulus 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("E37E94F9-C7BA-4B54-B7E1-64419B3DBA0B")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0-alpha")]
| mit | C# |
5b8ed3f7f488d654eae22b1a93e8eb801c365096 | Add comments. | petrborzutzky/ATNET2016,mozdren/ATNET2016,MatusHromulak/ATNET2016 | ServiceBus/SharedLibs/DataContracts/Address.cs | ServiceBus/SharedLibs/DataContracts/Address.cs | using System;
using System.Runtime.Serialization;
namespace SharedLibs.DataContracts
{
/// <summary>
/// General Data Contract for Address
/// </summary>
[DataContract]
public class Address : DTO
{
/// <summary>
/// Adress ID
/// </summary>
[DataMember]
public Guid Id { get; set; }
/// <summary>
/// Postal Code, or ZIP code
/// </summary>
[DataMember]
public string PostCode { get; set; }
/// <summary>
/// Description number of Hause
/// </summary>
[DataMember]
public int HouseNumber { get; set; }
/// <summary>
/// House number extension can have alphabethical chracters
/// usualy contains Oriented numberm of Hause
/// </summary>
[DataMember]
public string HouseNumberExtension { get; set; }
/// <summary>
/// Name of the Street, or town part, if there is no Street
/// </summary>
[DataMember]
public string Street { get; set; }
/// <summary>
/// City
/// </summary>
[DataMember]
public string City { get; set; }
/// <summary>
/// District - e.g. Praha 10
/// </summary>
[DataMember]
public string District { get; set; }
/// <summary>
/// Door Number - this has to be included in some cases so the order reaches its customer
/// </summary>
[DataMember]
public string DoorNumber { get; set; }
}
}
| using System;
using System.Runtime.Serialization;
namespace SharedLibs.DataContracts
{
/// <summary>
/// General Data Contract for Address
/// </summary>
[DataContract]
public class Address : DTO
{
/// <summary>
/// Adress ID
/// </summary>
[DataMember]
public Guid Id { get; set; }
/// <summary>
/// Postal Code
/// </summary>
[DataMember]
public string PostCode { get; set; }
/// <summary>
/// House Number
/// </summary>
[DataMember]
public int HouseNumber { get; set; }
/// <summary>
/// House number extension can have alphabethical chracters
/// </summary>
[DataMember]
public string HouseNumberExtension { get; set; }
/// <summary>
/// Street
/// </summary>
[DataMember]
public string Street { get; set; }
/// <summary>
/// City
/// </summary>
[DataMember]
public string City { get; set; }
/// <summary>
/// District - e.g. Praha 10
/// </summary>
[DataMember]
public string District { get; set; }
/// <summary>
/// Door Number - this has to be included in some cases so the order reaches its customer
/// </summary>
[DataMember]
public string DoorNumber { get; set; }
}
}
| mit | C# |
8242142bb1e9a7d551c5e116b66f32acdbcb6419 | Add mouse event for trackball | sakapon/Samples-2016,sakapon/Samples-2016 | Wpf3DSample/DiceRotationWpf/EventsExtension.cs | Wpf3DSample/DiceRotationWpf/EventsExtension.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Windows;
using System.Windows.Input;
namespace DiceRotationWpf
{
public class EventsExtension<TElement> where TElement : UIElement
{
public TElement Target { get; }
Point MouseDragLastPoint;
public IObservable<DeltaInfo> MouseDragDelta { get; }
public EventsExtension(TElement target)
{
Target = target;
// Replaces events with IObservable objects.
var mouseDown = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseDown)).Select(e => e.EventArgs);
var mouseMove = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseMove)).Select(e => e.EventArgs);
var mouseUp = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseUp)).Select(e => e.EventArgs);
var mouseLeave = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseLeave)).Select(e => e.EventArgs);
var mouseDownEnd = mouseUp.Merge(mouseLeave);
MouseDragDelta = mouseDown
.Select(e => e.GetPosition(Target))
.Do(p => MouseDragLastPoint = p)
.SelectMany(p0 => mouseMove
.TakeUntil(mouseDownEnd)
.Select(e => new DeltaInfo { Start = MouseDragLastPoint, End = e.GetPosition(Target) })
.Do(_ => MouseDragLastPoint = _.End));
}
}
public class EventsExtensionForTrackball<TElement> where TElement : UIElement
{
public TElement Target { get; }
Point MouseDragLastPoint;
public IObservable<DeltaInfo> MouseDragDelta { get; }
public EventsExtensionForTrackball(TElement target)
{
Target = target;
// Replaces events with IObservable objects.
var mouseEnter = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseEnter)).Select(e => e.EventArgs);
var mouseMove = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseMove)).Select(e => e.EventArgs);
var mouseLeave = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseLeave)).Select(e => e.EventArgs);
MouseDragDelta = mouseEnter
.Select(e => e.GetPosition(Target))
.Do(p => MouseDragLastPoint = p)
.SelectMany(p0 => mouseMove
.TakeUntil(mouseLeave)
.Select(e => new DeltaInfo { Start = MouseDragLastPoint, End = e.GetPosition(Target) })
.Do(_ => MouseDragLastPoint = _.End));
}
}
public struct DeltaInfo
{
public Point Start { get; set; }
public Point End { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Windows;
using System.Windows.Input;
namespace DiceRotationWpf
{
public class EventsExtension<TElement> where TElement : UIElement
{
public TElement Target { get; }
Point MouseDragLastPoint;
public IObservable<DeltaInfo> MouseDragDelta { get; }
public EventsExtension(TElement target)
{
Target = target;
// Replaces events with IObservable objects.
var mouseDown = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseDown)).Select(e => e.EventArgs);
var mouseMove = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseMove)).Select(e => e.EventArgs);
var mouseUp = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseUp)).Select(e => e.EventArgs);
var mouseLeave = Observable.FromEventPattern<MouseEventArgs>(Target, nameof(UIElement.MouseLeave)).Select(e => e.EventArgs);
var mouseDownEnd = mouseUp.Merge(mouseLeave);
MouseDragDelta = mouseDown
.Select(e => e.GetPosition(Target))
.Do(p => MouseDragLastPoint = p)
.SelectMany(p0 => mouseMove
.TakeUntil(mouseDownEnd)
.Select(e => new DeltaInfo { Start = MouseDragLastPoint, End = e.GetPosition(Target) })
.Do(_ => MouseDragLastPoint = _.End));
}
}
public struct DeltaInfo
{
public Point Start { get; set; }
public Point End { get; set; }
}
}
| mit | C# |
7819cbd72a4e50f0ea0c166d271952c959c7fd7e | Add InvWeekOfMonth | eleven41/Eleven41.Helpers | Eleven41.Helpers/DateTimeHelper.cs | Eleven41.Helpers/DateTimeHelper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Eleven41.Helpers
{
public static class DateTimeHelper
{
// Our base is the same as the standard unix file base
private static DateTime _base = new DateTime(1970, 1, 1);
public static DateTime FromUnixTime(int dt)
{
return _base.AddSeconds(dt).ToLocalTime();
}
public static int ToUnixTime(DateTime dt)
{
TimeSpan span = dt.ToUniversalTime() - _base;
return Convert.ToInt32(span.TotalSeconds);
}
public static DateTime FromXferTime(long dt)
{
return _base.AddMilliseconds(dt).ToLocalTime();
}
public static long ToXferTime(DateTime dt)
{
TimeSpan span = dt.ToUniversalTime() - _base;
return Convert.ToInt64(span.TotalMilliseconds);
}
public static DateTime CombineDateWithTime(DateTime useTime, DateTime useDate)
{
return useDate.Date + useTime.TimeOfDay;
//return new DateTime(useDate.Year, useDate.Month, useDate.Day, useTime.Hour, useTime.Minute, useTime.Second, useTime.Kind);
}
public static int WeekOfMonth(DateTime d)
{
int remainder;
return Math.DivRem(d.Day - 1, 7, out remainder) + 1;
}
public static int InvWeekOfMonth(DateTime d)
{
// How many days in the month?
int daysInMonth = DateTime.DaysInMonth(d.Year, d.Month);
int invDay = (daysInMonth - d.Day);
int remainder;
return Math.DivRem(invDay, 7, out remainder) + 1;
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Eleven41.Helpers
{
public static class DateTimeHelper
{
// Our base is the same as the standard unix file base
private static DateTime _base = new DateTime(1970, 1, 1);
public static DateTime FromUnixTime(int dt)
{
return _base.AddSeconds(dt).ToLocalTime();
}
public static int ToUnixTime(DateTime dt)
{
TimeSpan span = dt.ToUniversalTime() - _base;
return Convert.ToInt32(span.TotalSeconds);
}
public static DateTime FromXferTime(long dt)
{
return _base.AddMilliseconds(dt).ToLocalTime();
}
public static long ToXferTime(DateTime dt)
{
TimeSpan span = dt.ToUniversalTime() - _base;
return Convert.ToInt64(span.TotalMilliseconds);
}
public static DateTime CombineDateWithTime(DateTime useTime, DateTime useDate)
{
return useDate.Date + useTime.TimeOfDay;
//return new DateTime(useDate.Year, useDate.Month, useDate.Day, useTime.Hour, useTime.Minute, useTime.Second, useTime.Kind);
}
public static int WeekOfMonth(DateTime d)
{
int remainder;
return Math.DivRem(d.Day - 1, 7, out remainder) + 1;
}
}
} | mit | C# |
4cf6db248864972056c79ef88ef4e9741614f184 | remove unused field | cbovar/ConvNetSharp | src/ConvNetSharp.Flow/Ops/Assign.cs | src/ConvNetSharp.Flow/Ops/Assign.cs | using System;
using ConvNetSharp.Volume;
namespace ConvNetSharp.Flow.Ops
{
/// <summary>
/// Assignment: valueOp = op
/// </summary>
/// <typeparam name="T"></typeparam>
public class Assign<T> : Op<T> where T : struct, IEquatable<T>, IFormattable
{
public Assign(Op<T> valueOp, Op<T> op)
{
if (!(valueOp is Variable<T>))
{
throw new ArgumentException("Assigned Op should be a Variable", nameof(valueOp));
}
AddParent(valueOp);
AddParent(op);
}
public override string Representation => "->";
public override void Differentiate()
{
throw new NotImplementedException();
}
public override Volume<T> Evaluate(Session<T> session)
{
if(!this.IsDirty)
{
return base.Evaluate(session);
}
this.IsDirty = false;
this.Result = this.Parents[1].Evaluate(session);
((Variable<T>)this.Parents[0]).SetValue(this.Result);
return base.Evaluate(session);
}
public override string ToString()
{
return $"({this.Parents[0]} <- {this.Parents[1]})";
}
}
} | using System;
using ConvNetSharp.Volume;
namespace ConvNetSharp.Flow.Ops
{
/// <summary>
/// Assignment: valueOp = op
/// </summary>
/// <typeparam name="T"></typeparam>
public class Assign<T> : Op<T> where T : struct, IEquatable<T>, IFormattable
{
private long _lastComputeStep;
public Assign(Op<T> valueOp, Op<T> op)
{
if (!(valueOp is Variable<T>))
{
throw new ArgumentException("Assigned Op should be a Variable", nameof(valueOp));
}
AddParent(valueOp);
AddParent(op);
}
public override string Representation => "->";
public override void Differentiate()
{
throw new NotImplementedException();
}
public override Volume<T> Evaluate(Session<T> session)
{
if(!this.IsDirty)
{
return base.Evaluate(session);
}
this.IsDirty = false;
this.Result = this.Parents[1].Evaluate(session);
((Variable<T>)this.Parents[0]).SetValue(this.Result);
return base.Evaluate(session);
}
public override string ToString()
{
return $"({this.Parents[0]} <- {this.Parents[1]})";
}
}
} | mit | C# |
07c9cf2a4b9133a218323a4817a6e0d6b69e15f1 | Add method to calculate time | MelHarbour/HeadRaceTiming-Site,MelHarbour/HeadRaceTiming-Site,MelHarbour/HeadRaceTiming-Site | HeadRaceTiming-Site/Models/Crew.cs | HeadRaceTiming-Site/Models/Crew.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace HeadRaceTimingSite.Models
{
public class Crew
{
public int CrewId { get; set; }
public string Name { get; set; }
public int StartNumber { get; set; }
public TimeSpan? RunTime(TimingPoint startPoint, TimingPoint finishPoint)
{
Result start = Results.First(r => r.TimingPointId == startPoint.TimingPointId);
Result finish = Results.First(r => r.TimingPointId == finishPoint.TimingPointId);
if (start != null && finish != null)
return finish.TimeOfDay - start.TimeOfDay;
else
return null;
}
public List<Result> Results { get; set; }
public int CompetitionId { get; set; }
public Competition Competition { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace HeadRaceTimingSite.Models
{
public class Crew
{
public int CrewId { get; set; }
public string Name { get; set; }
public int StartNumber { get; set; }
public List<Result> Results { get; set; }
public int CompetitionId { get; set; }
public Competition Competition { get; set; }
}
}
| mit | C# |
444f79040b7a3d074a922d884ab8308127df54b0 | Add Plamen | promusic1974/TestingGitPlamen | HiGitPlamen/HiGitPlamen/Program.cs | HiGitPlamen/HiGitPlamen/Program.cs | using System;
namespace HiGitPlamen
{
class Program
{
static void Main()
{
Console.WriteLine("Git,hello!");
Console.WriteLine("Plamen Git");
}
}
}
| using System;
namespace HiGitPlamen
{
class Program
{
static void Main()
{
Console.WriteLine("Git,hello!");
}
}
}
| mit | C# |
2e3f1a6d81af8898901f470ed869ffa0f30b90c9 | Document Opera 26 problems | freenet/wintray,freenet/wintray | Browsers/Opera.cs | Browsers/Opera.cs | using System;
using System.Diagnostics;
using System.IO;
using Microsoft.Win32;
namespace FreenetTray.Browsers
{
class Opera : IBrowser
{
private readonly string _path;
private readonly bool _isInstalled;
public Opera()
{
/*
* TODO: Opera 26 adds launcher.exe and does not support -newprivatetab. Documentation
* on what it supports in its place, if anything, has not been forthcoming.
*/
// Key present with Opera 21.
var possiblePath = (string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Opera Software", "Last Stable Install Path", null) + "opera.exe";
_isInstalled = File.Exists(possiblePath);
if (_isInstalled)
{
_path = possiblePath;
}
}
public bool Open(Uri target)
{
if (!IsAvailable())
{
return false;
}
// See http://www.opera.com/docs/switches
Process.Start(_path, "-newprivatetab " + target);
return true;
}
public bool IsAvailable()
{
return _isInstalled;
}
}
}
| using System;
using System.Diagnostics;
using System.IO;
using Microsoft.Win32;
namespace FreenetTray.Browsers
{
class Opera : IBrowser
{
private readonly string _path;
private readonly bool _isInstalled;
public Opera()
{
// Key present with Opera 21.
var possiblePath = (string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Opera Software", "Last Stable Install Path", null) + "opera.exe";
_isInstalled = File.Exists(possiblePath);
if (_isInstalled)
{
_path = possiblePath;
}
}
public bool Open(Uri target)
{
if (!IsAvailable())
{
return false;
}
// See http://www.opera.com/docs/switches
Process.Start(_path, "-newprivatetab " + target);
return true;
}
public bool IsAvailable()
{
return _isInstalled;
}
}
}
| mit | C# |
c44d780d768684eef14910ee84812f7991ebf009 | Remove virtual from GetResponse | irii/Bundler,irii/Bundler | Bundler/Bundle.cs | Bundler/Bundle.cs | using System;
using System.Linq;
using Bundler.Infrastructure;
using Bundler.Internals;
namespace Bundler {
public class Bundle : IBundle {
protected readonly IContentTransformer[] ContentTransformers;
public string ContentType { get; }
public string TagFormat { get; }
public IBundleContext Context { get; }
private readonly Container _container;
public Bundle(IBundleContext bundleContext, string contentType, string placeholder, string tagFormat, params IContentTransformer[] transformers) {
Context = bundleContext;
ContentTransformers = transformers?.ToArray() ?? new IContentTransformer[0];
ContentType = contentType;
TagFormat = tagFormat;
_container = new Container(placeholder);
}
protected virtual string ProcessContent(string content) {
return ContentTransformers.Any(t => !t.Process(Context, content, out content)) ? null : content;
}
public bool Include(string virtualFile, string content) {
if (virtualFile == null) throw new ArgumentNullException(nameof(virtualFile));
if (content == null) throw new ArgumentNullException(nameof(content));
if (_container.Exists(virtualFile)) {
return true;
}
var transformedContent = ProcessContent(content);
if (transformedContent == null) {
if (!Context.FallbackOnError) {
return false;
}
transformedContent = content;
}
_container.Append(virtualFile, transformedContent);
return true;
}
public IBundleResponse GetResponse() {
return new BundleResponse(ContentType, _container.Version, _container.LastModification, _container.Content, _container.GetFiles());
}
}
}
| using System;
using System.Linq;
using Bundler.Infrastructure;
using Bundler.Internals;
namespace Bundler {
public class Bundle : IBundle {
protected readonly IContentTransformer[] ContentTransformers;
public string ContentType { get; }
public string TagFormat { get; }
public IBundleContext Context { get; }
private readonly Container _container;
public Bundle(IBundleContext bundleContext, string contentType, string placeholder, string tagFormat, params IContentTransformer[] transformers) {
Context = bundleContext;
ContentTransformers = transformers?.ToArray() ?? new IContentTransformer[0];
ContentType = contentType;
TagFormat = tagFormat;
_container = new Container(placeholder);
}
protected virtual string ProcessContent(string content) {
return ContentTransformers.Any(t => !t.Process(Context, content, out content)) ? null : content;
}
public bool Include(string virtualFile, string content) {
if (virtualFile == null) throw new ArgumentNullException(nameof(virtualFile));
if (content == null) throw new ArgumentNullException(nameof(content));
if (_container.Exists(virtualFile)) {
return true;
}
var transformedContent = ProcessContent(content);
if (transformedContent == null) {
if (!Context.FallbackOnError) {
return false;
}
transformedContent = content;
}
_container.Append(virtualFile, transformedContent);
return true;
}
public virtual IBundleResponse GetResponse() {
return new BundleResponse(ContentType, _container.Version, _container.LastModification, _container.Content, _container.GetFiles());
}
}
}
| mit | C# |
5c64376e58b97aa3ebd95e7d85c8d3cd996dfef0 | Update MapLargeSDKTest.cs | MapLarge/MapLargeSDK,MapLarge/MapLargeSDK,MapLarge/MapLargeSDK,MapLarge/MapLargeSDK | csharp/ConsoleTest/MapLargeSDKTest.cs | csharp/ConsoleTest/MapLargeSDKTest.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using com.maplarge.api;
namespace ConsoleTest {
class MapLargeSDKTest {
static void Main(string[] args) {
//DEFAULT CREDENTIALS
string server = "http://server.maplarge.com/";
string user = "user@ml.com";
string pass = "pw123456";
int token = 123456789;
Dictionary<string, string> paramlist = new Dictionary<string, string>();
//CREATE MAPLARGE CONNECTION WITH USER / PASSWORD
MapLargeConnector mlconnPassword = new MapLargeConnector(server, user, pass);
//CREATE MAPLARGE CONNECTION WITH USER / AUTH TOKEN
MapLargeConnector mlconnToken = new MapLargeConnector(server, user, token);
//CREATE TABLE SYNCHRONOUS (NO WEB CALL)
paramlist.Add("account", "test");
paramlist.Add("tablename", "testJavaSdkTable");
paramlist.Add("fileurl", "http://www.domain.com/testfile.csv");
MapLargeConnector.NO_WEB_CALLS = true;
string response = mlconnPassword.InvokeAPIRequest("CreateTableSynchronous", paramlist);
Console.WriteLine(response);
MapLargeConnector.NO_WEB_CALLS = false;
//RETRIEVE REMOTE USER AUTH TOKEN
response = mlconnPassword.GetRemoteAuthToken(user, pass, "255.255.255.255");
Console.WriteLine(response);
//LIST GROUPS
paramlist.Clear();
paramlist.Add("account", "test");
response = mlconnToken.InvokeAPIRequestPost("ListGroups", paramlist);
Console.WriteLine(response);
//CREATE TABLE WITH FILES SYNCHRONOUS
paramlist.Clear();
paramlist.Add("account", "test");
paramlist.Add("tablename", "PostedTableImport");
response = mlconnToken.InvokeAPIRequestPost("CreateTableWithFilesSynchronous", paramlist,
new string[] { "C:\\Data\\TestFile.csv" });
Console.WriteLine(response);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using com.maplarge.api;
namespace ConsoleTest {
class MapLargeSDKTest {
static void Main(string[] args) {
//DEFAULT CREDENTIALS
string server = "http://leeapi.maplarge.com/";
string user = "***REMOVED***";
string pass = "***REMOVED***";
int token = 123456789;
Dictionary<string, string> paramlist = new Dictionary<string, string>();
//CREATE MAPLARGE CONNECTION WITH USER / PASSWORD
MapLargeConnector mlconnPassword = new MapLargeConnector(server, user, pass);
//CREATE MAPLARGE CONNECTION WITH USER / AUTH TOKEN
MapLargeConnector mlconnToken = new MapLargeConnector(server, user, token);
//CREATE TABLE SYNCHRONOUS (NO WEB CALL)
paramlist.Add("account", "test");
paramlist.Add("tablename", "testJavaSdkTable");
paramlist.Add("fileurl", "http://www.domain.com/testfile.csv");
MapLargeConnector.NO_WEB_CALLS = true;
string response = mlconnPassword.InvokeAPIRequest("CreateTableSynchronous", paramlist);
Console.WriteLine(response);
MapLargeConnector.NO_WEB_CALLS = false;
//RETRIEVE REMOTE USER AUTH TOKEN
response = mlconnPassword.GetRemoteAuthToken(user, pass, "255.255.255.255");
Console.WriteLine(response);
//LIST GROUPS
paramlist.Clear();
paramlist.Add("account", "test");
response = mlconnToken.InvokeAPIRequestPost("ListGroups", paramlist);
Console.WriteLine(response);
//CREATE TABLE WITH FILES SYNCHRONOUS
paramlist.Clear();
paramlist.Add("account", "test");
paramlist.Add("tablename", "PostedTableImport");
response = mlconnToken.InvokeAPIRequestPost("CreateTableWithFilesSynchronous", paramlist,
new string[] { "C:\\Data\\TestFile.csv" });
Console.WriteLine(response);
}
}
}
| mit | C# |
31e4a58d5578b49a34dd62e713c50c04fb46571e | update TableViewRefreshView init frame var | masterrr/mobile,peeedge/mobile,ZhangLeiCharles/mobile,ZhangLeiCharles/mobile,peeedge/mobile,eatskolnikov/mobile,masterrr/mobile,eatskolnikov/mobile,eatskolnikov/mobile | Ross/Views/TableViewRefreshView.cs | Ross/Views/TableViewRefreshView.cs | using System;
using CoreGraphics;
using UIKit;
using Toggl.Ross.Theme;
namespace Toggl.Ross.Views
{
public class TableViewRefreshView : UIRefreshControl
{
const int sideSize = 5;
public TableViewRefreshView ()
{
this.Apply (Style.TableViewHeader);
}
public void AdaptToTableView (UITableView tableView)
{
var tableFrame = tableView.Frame;
tableFrame.Y = -tableFrame.Size.Height;
var view = new UIView (tableFrame);
view.BackgroundColor = BackgroundColor;
tableView.InsertSubviewBelow (view, this);
}
}
}
| using System;
using CoreGraphics;
using UIKit;
using Toggl.Ross.Theme;
namespace Toggl.Ross.Views
{
public class TableViewRefreshView : UIRefreshControl
{
public TableViewRefreshView ()
{
this.Apply (Style.TableViewHeader);
}
public void AdaptToTableView (UITableView tableView)
{
var frame = tableView.Frame;
frame.Y = -frame.Size.Height;
var view = new UIView (frame);
view.BackgroundColor = BackgroundColor;
tableView.InsertSubviewBelow (view, this);
}
}
}
| bsd-3-clause | C# |
e21a5842a30b39ef44c8846120e50dbef4aed48b | Update RandomTiles.cs #15 | UnityCommunity/UnityLibrary | Scripts/2D/Tilemaps/RandomTiles.cs | Scripts/2D/Tilemaps/RandomTiles.cs | // tested with unity version: 2017.2.0b4
// info: Fills tilemap with random tiles
// usage: Attach this script to empty gameobject, assign some tiles, then press play
using UnityEngine;
using UnityEngine.Tilemaps;
namespace UnityLibary
{
public class RandomTiles : MonoBehaviour
{
public int width = 32;
public int height = 32;
public Tile[] tiles;
void Start()
{
RandomTileMap();
}
void RandomTileMap()
{
// validation
if (tiles == null || tiles.Length < 1)
{
Debug.LogError("Tiles not assigned", gameObject);
return;
}
var parent = transform.parent;
if (parent == null)
{
var go = new GameObject("grid");
go.AddComponent<Grid>();
transform.SetParent(go.transform);
} else
{
if (parent.GetComponent<Grid>() == null)
{
parent.gameObject.AddComponent<Grid>();
}
}
TilemapRenderer tr = GetComponent<TilemapRenderer>();
if (tr == null)
{
tr = gameObject.AddComponent<TilemapRenderer>();
}
Tilemap map = GetComponent<Tilemap>();
if (map == null)
{
map = gameObject.AddComponent<Tilemap>();
}
// random map generation
Vector3Int tilePos = Vector3Int.zero;
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
tilePos.x = x;
tilePos.y = y;
map.SetTile(tilePos, tiles[Random.Range(0, tiles.Length)]);
}
}
}
}
}
| // Requires: Unity 5.5.0a1 or later
// Fills tilemap with random tiles
// Usage: Attach this script to Tilemap layer, assign tiles, hit play
using UnityEngine;
public class RandomTiles : MonoBehaviour
{
public Tile[] tiles;
void Start()
{
RandomTileMap();
}
void RandomTileMap()
{
TileMap map = GetComponent<TileMap>();
int sizeX = 32;
int sizeY = 16;
for (int x = 0; x < sizeX; x++)
{
for (int y = 0; y < sizeY; y++)
{
var tilePos = new Vector3Int(x, y, 0);
map.SetTile(tilePos, tiles[Random.Range(0, tiles.Length)]);
}
}
}
}
| mit | C# |
55753c24383912615e028c5384d454dc4d856b52 | Test commit | Trimack93/Inzynierka | WpfApplication1/MainWindow.xaml.cs | WpfApplication1/MainWindow.xaml.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void asdf(object sender, RoutedEventArgs e)
{
var x = sender as Button;
}
}
}
| mit | C# |
d7057af49f2e136b2a5f8246cc32e56d6ebc28e7 | Fix border highlight effects gets the wrong effect node | JeremyAnsel/helix-toolkit,holance/helix-toolkit,chrkon/helix-toolkit,helix-toolkit/helix-toolkit | Source/HelixToolkit.SharpDX.SharedModel/Element3D/PostEffects/PostEffectMeshBorderHighlight.cs | Source/HelixToolkit.SharpDX.SharedModel/Element3D/PostEffects/PostEffectMeshBorderHighlight.cs | #if NETFX_CORE
namespace HelixToolkit.UWP
#else
namespace HelixToolkit.Wpf.SharpDX
#endif
{
using Model.Scene;
/// <summary>
/// Highlight the border of meshes
/// </summary>
public class PostEffectMeshBorderHighlight : PostEffectMeshOutlineBlur
{
protected override SceneNode OnCreateSceneNode()
{
return new NodePostEffectBorderHighlight();
}
}
}
| #if NETFX_CORE
namespace HelixToolkit.UWP
#else
namespace HelixToolkit.Wpf.SharpDX
#endif
{
using Model.Scene;
/// <summary>
/// Highlight the border of meshes
/// </summary>
public class PostEffectMeshBorderHighlight : PostEffectMeshOutlineBlur
{
protected override SceneNode OnCreateSceneNode()
{
return new NodePostEffectMeshOutlineBlur();
}
}
}
| mit | C# |
023e9ceba967cff37b0c2374e250169b2ab729e6 | fix terrible version check typo | quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot | plugin/CactbotOverlay/PluginLoader.cs | plugin/CactbotOverlay/PluginLoader.cs | using System.Windows.Forms;
using RainbowMage.OverlayPlugin;
using Advanced_Combat_Tracker;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
namespace Cactbot
{
public class PluginLoader : IActPluginV1, IOverlayAddonV2
{
private static AssemblyResolver asmResolver;
private static Version kMinOverlayPluginVersion = new Version(0, 13, 0);
public void DeInitPlugin()
{
}
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
{
if (asmResolver == null) {
asmResolver = new AssemblyResolver(new List<string>{GetPluginDirectory()});
}
pluginStatusText.Text = "Ready.";
// We don't need a tab here.
((TabControl)pluginScreenSpace.Parent).TabPages.Remove(pluginScreenSpace);
if (GetOverlayPluginVersion() < kMinOverlayPluginVersion) {
throw new Exception($"Cactbot requires OverlayPlugin {kMinOverlayPluginVersion.ToString()}, " +
$"found {GetOverlayPluginVersion().ToString()}");
}
}
public void Init()
{
Registry.RegisterEventSource<CactbotEventSource>();
}
private string GetPluginDirectory()
{
var plugin = ActGlobals.oFormActMain.ActPlugins.Where(x => x.pluginObj == this).FirstOrDefault();
if (plugin != null)
{
return Path.GetDirectoryName(plugin.pluginFile.FullName);
}
else
{
throw new Exception("Could not find ourselves in the plugin list!");
}
}
private Version GetOverlayPluginVersion() {
return System.Reflection.Assembly.GetAssembly(typeof(IOverlay)).GetName().Version;
}
}
}
| using System.Windows.Forms;
using RainbowMage.OverlayPlugin;
using Advanced_Combat_Tracker;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
namespace Cactbot
{
public class PluginLoader : IActPluginV1, IOverlayAddonV2
{
private static AssemblyResolver asmResolver;
private static Version kMinOverlayPluginVersion = new Version(0, 13, 0);
public void DeInitPlugin()
{
}
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
{
if (asmResolver == null) {
asmResolver = new AssemblyResolver(new List<string>{GetPluginDirectory()});
}
pluginStatusText.Text = "Ready.";
// We don't need a tab here.
((TabControl)pluginScreenSpace.Parent).TabPages.Remove(pluginScreenSpace);
if (GetOverlayPluginVersion() < kMinOverlayPluginVersion) {
throw new Exception($"Cactbot requires OverlayPlugin {GetOverlayPluginVersion().ToString()}, " +
$"found {kMinOverlayPluginVersion.ToString()}");
}
}
public void Init()
{
Registry.RegisterEventSource<CactbotEventSource>();
}
private string GetPluginDirectory()
{
var plugin = ActGlobals.oFormActMain.ActPlugins.Where(x => x.pluginObj == this).FirstOrDefault();
if (plugin != null)
{
return Path.GetDirectoryName(plugin.pluginFile.FullName);
}
else
{
throw new Exception("Could not find ourselves in the plugin list!");
}
}
private Version GetOverlayPluginVersion() {
return System.Reflection.Assembly.GetAssembly(typeof(IOverlay)).GetName().Version;
}
}
}
| apache-2.0 | C# |
2c9e45a77b2eec2a97de7b6e9f06a2d2b5cb5c82 | Increment version number | axomic/openasset-rest-cs | OpenAsset.RestClient.Library/Properties/AssemblyInfo.cs | OpenAsset.RestClient.Library/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("OpenAsset.RestClient.Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Axomic Ltd")]
[assembly: AssemblyProduct("OpenAsset RestClient Library")]
[assembly: AssemblyCopyright("Copyright © Axomic Ltd 2013-2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("137fd3b7-9fa8-4003-a734-bb82cf0e2586")]
// 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")]
| 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("OpenAsset.RestClient.Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Axomic Ltd")]
[assembly: AssemblyProduct("OpenAsset RestClient Library")]
[assembly: AssemblyCopyright("Copyright © Axomic Ltd 2013-2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("137fd3b7-9fa8-4003-a734-bb82cf0e2586")]
// 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")]
| mit | C# |
f8b16595a200ca9535cc9e59d92f856ab794e133 | remove empty method. | indsoft/NuGet2,pratikkagda/nuget,xoofx/NuGet,dolkensp/node.net,themotleyfool/NuGet,alluran/node.net,kumavis/NuGet,rikoe/nuget,jmezach/NuGet2,rikoe/nuget,anurse/NuGet,RichiCoder1/nuget-chocolatey,oliver-feng/nuget,antiufo/NuGet2,RichiCoder1/nuget-chocolatey,alluran/node.net,mono/nuget,GearedToWar/NuGet2,oliver-feng/nuget,jholovacs/NuGet,mono/nuget,dolkensp/node.net,jmezach/NuGet2,ctaggart/nuget,themotleyfool/NuGet,xoofx/NuGet,xoofx/NuGet,jmezach/NuGet2,RichiCoder1/nuget-chocolatey,mrward/nuget,indsoft/NuGet2,kumavis/NuGet,pratikkagda/nuget,mrward/NuGet.V2,alluran/node.net,anurse/NuGet,mrward/NuGet.V2,zskullz/nuget,ctaggart/nuget,OneGet/nuget,oliver-feng/nuget,RichiCoder1/nuget-chocolatey,jholovacs/NuGet,RichiCoder1/nuget-chocolatey,chester89/nugetApi,chester89/nugetApi,pratikkagda/nuget,rikoe/nuget,jholovacs/NuGet,mrward/nuget,zskullz/nuget,oliver-feng/nuget,indsoft/NuGet2,xoofx/NuGet,chocolatey/nuget-chocolatey,pratikkagda/nuget,xoofx/NuGet,dolkensp/node.net,pratikkagda/nuget,akrisiun/NuGet,indsoft/NuGet2,akrisiun/NuGet,chocolatey/nuget-chocolatey,antiufo/NuGet2,mrward/NuGet.V2,mrward/nuget,jholovacs/NuGet,ctaggart/nuget,xoofx/NuGet,chocolatey/nuget-chocolatey,mrward/nuget,atheken/nuget,chocolatey/nuget-chocolatey,oliver-feng/nuget,chocolatey/nuget-chocolatey,rikoe/nuget,jholovacs/NuGet,OneGet/nuget,themotleyfool/NuGet,mrward/nuget,dolkensp/node.net,oliver-feng/nuget,mono/nuget,antiufo/NuGet2,GearedToWar/NuGet2,alluran/node.net,indsoft/NuGet2,antiufo/NuGet2,zskullz/nuget,antiufo/NuGet2,antiufo/NuGet2,GearedToWar/NuGet2,jmezach/NuGet2,chocolatey/nuget-chocolatey,RichiCoder1/nuget-chocolatey,GearedToWar/NuGet2,ctaggart/nuget,mono/nuget,jmezach/NuGet2,OneGet/nuget,GearedToWar/NuGet2,zskullz/nuget,OneGet/nuget,mrward/NuGet.V2,indsoft/NuGet2,jholovacs/NuGet,mrward/NuGet.V2,GearedToWar/NuGet2,mrward/NuGet.V2,pratikkagda/nuget,atheken/nuget,mrward/nuget,jmezach/NuGet2 | test/Core.Test/NullSettingsTest.cs | test/Core.Test/NullSettingsTest.cs | using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Extensions;
namespace NuGet.Test
{
public class NullSettingsTest
{
public static IEnumerable<object[]> WriteOperationsData
{
get
{
var settings = NullSettings.Instance;
yield return new object[] { (Assert.ThrowsDelegate)(() => settings.SetValue("section", "key", "value")), "SetValue" };
yield return new object[] { (Assert.ThrowsDelegate)(() => settings.SetValues("section", new[] { new KeyValuePair<string, string>("key", "value") })), "SetValues" };
yield return new object[] { (Assert.ThrowsDelegate)(() => settings.SetNestedValues("section", "key", new[] { new KeyValuePair<string, string>("key1", "value1") })), "SetNestedValues" };
yield return new object[] { (Assert.ThrowsDelegate)(() => settings.DeleteSection("section")), "DeleteSection" };
yield return new object[] { (Assert.ThrowsDelegate)(() => settings.DeleteValue("section", "key")), "DeleteValue" };
}
}
[Theory]
[PropertyData("WriteOperationsData")]
public void NullSettingsThrowsIfWriteOperationMethodsAreInvoked(Assert.ThrowsDelegate throwsDelegate, string methodName)
{
// Act and Assert
ExceptionAssert.Throws<InvalidOperationException>(throwsDelegate,
String.Format("\"{0}\" cannot be called on a NullSettings. This may be caused on account of insufficient permissions to read or write to \"%AppData%\\NuGet\\NuGet.config\".", methodName));
}
}
}
| using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Extensions;
namespace NuGet.Test
{
public class NullSettingsTest
{
public static IEnumerable<object[]> WriteOperationsData
{
get
{
var settings = NullSettings.Instance;
yield return new object[] { (Assert.ThrowsDelegate)(() => settings.SetValue("section", "key", "value")), "SetValue" };
yield return new object[] { (Assert.ThrowsDelegate)(() => settings.SetValues("section", new[] { new KeyValuePair<string, string>("key", "value") })), "SetValues" };
yield return new object[] { (Assert.ThrowsDelegate)(() => settings.SetNestedValues("section", "key", new[] { new KeyValuePair<string, string>("key1", "value1") })), "SetNestedValues" };
yield return new object[] { (Assert.ThrowsDelegate)(() => settings.DeleteSection("section")), "DeleteSection" };
yield return new object[] { (Assert.ThrowsDelegate)(() => settings.DeleteValue("section", "key")), "DeleteValue" };
}
}
[Theory]
[PropertyData("WriteOperationsData")]
public void NullSettingsThrowsIfWriteOperationMethodsAreInvoked(Assert.ThrowsDelegate throwsDelegate, string methodName)
{
// Act and Assert
ExceptionAssert.Throws<InvalidOperationException>(throwsDelegate,
String.Format("\"{0}\" cannot be called on a NullSettings. This may be caused on account of insufficient permissions to read or write to \"%AppData%\\NuGet\\NuGet.config\".", methodName));
}
private static void AssertThrows(Assert.ThrowsDelegate action, string methodName)
{
}
}
}
| apache-2.0 | C# |
94cc33bee8afc6be56243081b44680c0d11c4419 | Remove garbage test. | bfriesen/Rock.Logging,RockFramework/Rock.Logging | Rock.Logging.IntegrationTests/FileConfigurationTests.cs | Rock.Logging.IntegrationTests/FileConfigurationTests.cs | namespace Rock.Logging.IntegrationTests
{
public class FileConfigurationTests
{
}
} | using System;
using NUnit.Framework;
using System.Configuration;
namespace Rock.Logging.IntegrationTests
{
public class FileConfigurationTests
{
[Test]
public void Foo()
{
var factory = (ILoggerFactory)ConfigurationManager.GetSection("rock.logging");
var logger = factory.Get<Logger>();
logger.Warn(GetLogEntry());
}
private static LogEntry GetLogEntry()
{
Exception exception;
try
{
try
{
throw new Exception();
}
catch (Exception ex)
{
throw new InvalidOperationException("o noes!", ex);
}
}
catch (Exception ex)
{
exception = ex;
}
return new LogEntry("Hello, world!", new { foo = "you <> me", baz = "qux" }, exception, "testing...");
}
}
} | mit | C# |
59541ada664016bc3e0135fa0b63f13779f068dc | Add test for getNextToken() | ilovepi/Compiler,ilovepi/Compiler | compiler/frontend/test/LexerTest.cs | compiler/frontend/test/LexerTest.cs | using NUnit.Framework;
using System;
namespace compiler.frontend.test
{
[TestFixture]
public class LexerTest
{
Lexer lex;
[Test]
//[DeploymentItem("LexerTest1.txt", "targetFolder")]
public void nextTest()
{
lex = new Lexer(TestContext.CurrentContext.TestDirectory + @"\frontend\test\LexerTest1.txt");
// Exact string contents of LExerTest1.txt
string str = "Read some characters";
foreach(char c in str)
{
char b = lex.next();
//Console.WriteLine("Scanner expects '" + c + "', but read '" + b +"'");
Assert.AreEqual(c, b);
}
// make sure we throw an exception for reading past the end of the file
var ex = Assert.Throws<Exception>(() => lex.next());
Assert.That(ex.Message, Is.EqualTo("Error: Lexer cannot read beyond the end of the file"));
}
[Test]
public void getNextTokenTest()
{
Assert.Fail();
}
}
}
| using NUnit.Framework;
using System;
namespace compiler.frontend.test
{
[TestFixture]
public class LexerTest
{
Lexer lex;
[Test]
//[DeploymentItem("LexerTest1.txt", "targetFolder")]
public void TestMethod()
{
lex = new Lexer(TestContext.CurrentContext.TestDirectory + @"\frontend\test\LexerTest1.txt");
// Exact string contents of LExerTest1.txt
string str = "Read some characters";
foreach(char c in str)
{
char b = lex.next();
//Console.WriteLine("Scanner expects '" + c + "', but read '" + b +"'");
Assert.AreEqual(c, b);
}
// make sure we throw an exception for reading past the end of the file
var ex = Assert.Throws<Exception>(() => lex.next());
Assert.That(ex.Message, Is.EqualTo("Error: Lexer cannot read beyond the end of the file"));
}
}
}
| mit | C# |
d6cdd0d1732599ce5597464f3b85cf468a443454 | Update SetFileCheckedOut.cs | kilasuit/PnP-PowerShell,OfficeDev/PnP-PowerShell,iiunknown/PnP-PowerShell | Commands/Files/SetFileCheckedOut.cs | Commands/Files/SetFileCheckedOut.cs | using System.Management.Automation;
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
namespace SharePointPnP.PowerShell.Commands.Files
{
[Cmdlet("Set", "PnPFileCheckedOut")]
[CmdletAlias("Set-SPOFileCheckedOut")]
[CmdletHelp("Checks out a file",
Category = CmdletHelpCategory.Files)]
[CmdletExample(
Code = @"Set-PnPFileCheckedOut -Url /sites/testsite/subsite/Pages/default.aspx",
Remarks = @"Checks out a file supplied with a server relative Url",
SortOrder = 1)]
public class SetFileCheckedOut : SPOWebCmdlet
{
[Parameter(Mandatory = true, Position=0, ValueFromPipeline=true)]
public string Url = string.Empty;
protected override void ExecuteCmdlet()
{
SelectedWeb.CheckOutFile(Url);
}
}
}
| using System.Management.Automation;
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
namespace SharePointPnP.PowerShell.Commands.Files
{
[Cmdlet("Set", "PnPFileCheckedOut")]
[CmdletAlias("Set-SPOFileCheckedOut")]
[CmdletHelp("Checks out a file",
Category = CmdletHelpCategory.Files)]
public class SetFileCheckedOut : SPOWebCmdlet
{
[Parameter(Mandatory = true, Position=0, ValueFromPipeline=true)]
public string Url = string.Empty;
protected override void ExecuteCmdlet()
{
SelectedWeb.CheckOutFile(Url);
}
}
}
| mit | C# |
92bdee84c64c83179a2cb1bcec50a9043595e9ab | teste a | Thiago-Caramelo/patchsearch | Program.cs | Program.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace PatchSearch
{
// teste
class Program
{
static void Main(string[] args)
{
if (args == null || args.Length == 0)
{
return;
}
// obter todos os arquivos da pasta
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory());
foreach (var item in files) //teste
{
using (StreamReader reader = new StreamReader(item))
{
string fileContent = reader.ReadToEnd();
int qt = 0;
foreach (var term in args)
{
if (fileContent.Contains(term))
{
qt++;
}
}
if (qt == args.Length)
{
Console.WriteLine(Path.GetFileName(item));
}
}
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace PatchSearch
{
class Program
{
static void Main(string[] args)
{
if (args == null || args.Length == 0)
{
return;
}
// obter todos os arquivos da pasta
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory());
foreach (var item in files) //teste
{
using (StreamReader reader = new StreamReader(item))
{
string fileContent = reader.ReadToEnd();
int qt = 0;
foreach (var term in args)
{
if (fileContent.Contains(term))
{
qt++;
}
}
if (qt == args.Length)
{
Console.WriteLine(Path.GetFileName(item));
}
}
}
}
}
}
| mit | C# |
2ae59017f186f2186ec647a22e0833a8c57cdcb6 | Improve `CallSiteKind.Inferred` comment | stephentoub/roslyn,jasonmalinowski/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,sharwell/roslyn,heejaechang/roslyn,sharwell/roslyn,ErikSchierboom/roslyn,physhi/roslyn,jmarolf/roslyn,KirillOsenkov/roslyn,AmadeusW/roslyn,genlu/roslyn,tannergooding/roslyn,brettfo/roslyn,diryboy/roslyn,eriawan/roslyn,mgoertz-msft/roslyn,wvdd007/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,dotnet/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,mavasani/roslyn,diryboy/roslyn,panopticoncentral/roslyn,panopticoncentral/roslyn,weltkante/roslyn,KirillOsenkov/roslyn,brettfo/roslyn,stephentoub/roslyn,brettfo/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,tannergooding/roslyn,tmat/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,genlu/roslyn,physhi/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,davkean/roslyn,tmat/roslyn,AlekseyTs/roslyn,jmarolf/roslyn,stephentoub/roslyn,AmadeusW/roslyn,genlu/roslyn,jmarolf/roslyn,panopticoncentral/roslyn,wvdd007/roslyn,aelij/roslyn,mavasani/roslyn,diryboy/roslyn,KevinRansom/roslyn,eriawan/roslyn,mavasani/roslyn,aelij/roslyn,weltkante/roslyn,sharwell/roslyn,dotnet/roslyn,AlekseyTs/roslyn,KevinRansom/roslyn,physhi/roslyn,AmadeusW/roslyn,davkean/roslyn,gafter/roslyn,dotnet/roslyn,davkean/roslyn,tmat/roslyn,gafter/roslyn,gafter/roslyn | src/Features/Core/Portable/ChangeSignature/CallSiteKind.cs | src/Features/Core/Portable/ChangeSignature/CallSiteKind.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.
#nullable enable
namespace Microsoft.CodeAnalysis.ChangeSignature
{
internal enum CallSiteKind
{
/// <summary>
/// Use an explicit value to populate call sites, without forcing
/// the addition of a named argument.
/// </summary>
Value,
/// <summary>
/// Use an explicit value to populate call sites, and convert
/// arguments to named arguments even if not required. Often
/// useful for literal callsite values like "true" or "null".
/// </summary>
ValueWithName,
/// <summary>
/// Indicates whether a "TODO" should be introduced at callsites
/// to cause errors that the user can then go visit and fix up.
/// </summary>
Todo,
/// <summary>
/// When an optional parameter is added, passing an argument for
/// it is not required. This indicates that the corresponding argument
/// should be omitted. This often results in subsequent arguments needing
/// to become named arguments
/// </summary>
Omitted,
/// <summary>
/// Populate each call site with an available variable of a matching types.
/// If no matching variable is found, this falls back to the
/// <see cref="Todo"/> behavior.
/// </summary>
Inferred
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
namespace Microsoft.CodeAnalysis.ChangeSignature
{
internal enum CallSiteKind
{
/// <summary>
/// Use an explicit value to populate call sites, without forcing
/// the addition of a named argument.
/// </summary>
Value,
/// <summary>
/// Use an explicit value to populate call sites, and convert
/// arguments to named arguments even if not required. Often
/// useful for literal callsite values like "true" or "null".
/// </summary>
ValueWithName,
/// <summary>
/// Indicates whether a "TODO" should be introduced at callsites
/// to cause errors that the user can then go visit and fix up.
/// </summary>
Todo,
/// <summary>
/// When an optional parameter is added, passing an argument for
/// it is not required. This indicates that the corresponding argument
/// should be omitted. This often results in subsequent arguments needing
/// to become named arguments
/// </summary>
Omitted,
/// <summary>
/// Populate each call site with available variables of matching types.
/// </summary>
Inferred
}
}
| mit | C# |
ee414bcaee02f9325bc4b3cf6621464ba9bab054 | Fix test bug | yfakariya/msgpack-rpc-cli,yonglehou/msgpack-rpc-cli | test/MsgPack.Rpc.UnitTest/Rpc/RpcTimeoutExceptionTest.cs | test/MsgPack.Rpc.UnitTest/Rpc/RpcTimeoutExceptionTest.cs | #region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010 FUJIWARA, Yusuke
//
// 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 -- License Terms --
using System;
using NUnit.Framework;
namespace MsgPack.Rpc
{
[TestFixture]
public class RpcTimeoutExceptionTest : RpcExceptionTestBase<RpcTimeoutException>
{
protected override RpcError DefaultError
{
get { return RpcError.TimeoutError; }
}
protected override RpcTimeoutException NewRpcException( RpcExceptionTestBase<RpcTimeoutException>.ConstructorKind kind, System.Collections.Generic.IDictionary<string, object> properties )
{
switch ( kind )
{
case ConstructorKind.Serialization:
case ConstructorKind.WithInnerException:
{
return new RpcTimeoutException( ( TimeSpan )( properties[ "ClientTimeout" ] ?? TimeSpan.Zero ), GetMessage( properties ), GetDebugInformation( properties ), GetInnerException( properties ) );
}
default:
{
return new RpcTimeoutException( ( TimeSpan )( properties[ "ClientTimeout" ] ?? TimeSpan.Zero ), GetMessage( properties ), GetDebugInformation( properties ) );
}
}
}
protected override RpcTimeoutException NewRpcException( RpcError rpcError, MessagePackObject unpackedException )
{
return new RpcTimeoutException( unpackedException );
}
protected override System.Collections.Generic.IDictionary<string, object> GetTestArguments()
{
var result = base.GetTestArguments();
result.Add( "ClientTimeout", TimeSpan.FromSeconds( 123 ) );
return result;
}
protected override System.Collections.Generic.IDictionary<string, object> GetTestArgumentsWithAllNullValue()
{
var result = base.GetTestArgumentsWithAllNullValue();
result.Add( "ClientTimeout", null );
return result;
}
protected override System.Collections.Generic.IDictionary<string, object> GetTestArgumentsWithDefaultValue()
{
var result = base.GetTestArgumentsWithDefaultValue();
result.Add( "ClientTimeout", TimeSpan.Zero );
return result;
}
[Test]
public void TestConstructor_TimeSpan_AsIs()
{
var timeout = TimeSpan.FromSeconds( 123 );
var target = new RpcTimeoutException( timeout );
Assert.That( target.ClientTimeout, Is.EqualTo( timeout ) );
Assert.That( target.Message, Is.EqualTo( this.DefaultMessage ) );
Assert.That( target.RpcError, Is.EqualTo( this.DefaultError ) );
Assert.That( target.DebugInformation, Is.Empty );
}
}
}
| #region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010 FUJIWARA, Yusuke
//
// 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 -- License Terms --
using System;
using NUnit.Framework;
namespace MsgPack.Rpc
{
[TestFixture]
public class RpcTimeoutExceptionTest : RpcExceptionTestBase<RpcTimeoutException>
{
protected override RpcError DefaultError
{
get { return RpcError.TimeoutError; }
}
protected override RpcTimeoutException NewRpcException( RpcExceptionTestBase<RpcTimeoutException>.ConstructorKind kind, System.Collections.Generic.IDictionary<string, object> properties )
{
switch ( kind )
{
case ConstructorKind.Serialization:
case ConstructorKind.WithInnerException:
{
return new RpcTimeoutException( ( TimeSpan )( properties[ "Timeout" ] ?? TimeSpan.Zero ), GetMessage( properties ), GetDebugInformation( properties ), GetInnerException( properties ) );
}
default:
{
return new RpcTimeoutException( ( TimeSpan )( properties[ "Timeout" ] ?? TimeSpan.Zero ), GetMessage( properties ), GetDebugInformation( properties ) );
}
}
}
protected override RpcTimeoutException NewRpcException( RpcError rpcError, MessagePackObject unpackedException )
{
return new RpcTimeoutException( unpackedException );
}
protected override System.Collections.Generic.IDictionary<string, object> GetTestArguments()
{
var result = base.GetTestArguments();
result.Add( "Timeout", TimeSpan.FromSeconds( 123 ) );
return result;
}
protected override System.Collections.Generic.IDictionary<string, object> GetTestArgumentsWithAllNullValue()
{
var result = base.GetTestArgumentsWithAllNullValue();
result.Add( "Timeout", null );
return result;
}
protected override System.Collections.Generic.IDictionary<string, object> GetTestArgumentsWithDefaultValue()
{
var result = base.GetTestArgumentsWithDefaultValue();
result.Add( "Timeout", TimeSpan.Zero );
return result;
}
[Test]
public void TestConstructor_TimeSpan_AsIs()
{
var timeout = TimeSpan.FromSeconds( 123 );
var target = new RpcTimeoutException( timeout );
Assert.That( target.ClientTimeout, Is.EqualTo( timeout ) );
Assert.That( target.Message, Is.EqualTo( this.DefaultMessage ) );
Assert.That( target.RpcError, Is.EqualTo( this.DefaultError ) );
Assert.That( target.DebugInformation, Is.Empty );
}
}
}
| apache-2.0 | C# |
dc9192cfbddf4d10249edb105936dc549d7eef27 | Normalize DateTime to microsecond-resolution in unit test | smarkets/IronSmarkets | IronSmarkets.Tests/DateTimeTests.cs | IronSmarkets.Tests/DateTimeTests.cs | // Copyright (c) 2011 Smarkets Limited
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using Xunit;
using IronSmarkets.Data;
namespace IronSmarkets.Tests
{
public sealed class DateTimeTests
{
[Fact]
public void MicrosecondsRoundtrip()
{
var dt = MicrosecondNow();
var dt2 = MicrosecondNow().AddDays(1);
Assert.Equal(dt, SetoMap.FromMicroseconds(SetoMap.ToMicroseconds(dt)));
Assert.NotEqual(dt2, SetoMap.FromMicroseconds(SetoMap.ToMicroseconds(dt)));
Assert.Equal((ulong)9800, SetoMap.ToMicroseconds(SetoMap.FromMicroseconds(9800)));
Assert.Equal((ulong)1, SetoMap.ToMicroseconds(SetoMap.FromMicroseconds(1)));
Assert.NotEqual((ulong)1, SetoMap.ToMicroseconds(SetoMap.FromMicroseconds(2)));
}
/// <summary>
/// Provides a DateTime with microsecond resolution (instead
/// of 100-nanoseconds by default)
/// </summary>
private DateTime MicrosecondNow()
{
var dt = DateTime.UtcNow;
return new DateTime(dt.Ticks - (dt.Ticks % 10));
}
}
}
| // Copyright (c) 2011 Smarkets Limited
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using Xunit;
using IronSmarkets.Data;
namespace IronSmarkets.Tests
{
public sealed class DateTimeTests
{
[Fact]
public void MicrosecondsRoundtrip()
{
var dt = DateTime.UtcNow;
var dt2 = DateTime.UtcNow.AddDays(1);
Assert.Equal(dt, SetoMap.FromMicroseconds(SetoMap.ToMicroseconds(dt)));
Assert.NotEqual(dt2, SetoMap.FromMicroseconds(SetoMap.ToMicroseconds(dt)));
Assert.Equal((ulong)9800, SetoMap.ToMicroseconds(SetoMap.FromMicroseconds(9800)));
Assert.Equal((ulong)1, SetoMap.ToMicroseconds(SetoMap.FromMicroseconds(1)));
Assert.NotEqual((ulong)1, SetoMap.ToMicroseconds(SetoMap.FromMicroseconds(2)));
}
}
}
| mit | C# |
7b69884e9b234c73e671a0179052c5787ee8e999 | Hide the 'reply' button in the manager interface for now. | truRating/Piranha,DH0/Piranha,PiranhaCMS/Piranha,truRating/Piranha,truRating/Piranha,timbrown81/Piranha,PiranhaCMS/Piranha,DH0/Piranha,timbrown81/Piranha,cnascimento/Piranha,PiranhaCMS/Piranha,cnascimento/Piranha,timbrown81/Piranha,DH0/Piranha,cnascimento/Piranha | Piranha/Areas/Manager/Views/Comment/List.cshtml | Piranha/Areas/Manager/Views/Comment/List.cshtml | @model List<Piranha.Entities.Comment>
@{
Layout = "" ;
}
<table class="list">
<tr>
<td><strong>@Piranha.Resources.Global.Title</strong></td>
<td><strong>@Piranha.Resources.Comment.Author</strong></td>
<td><strong>@Piranha.Resources.Global.Status</strong></td>
<td class="date"><strong>@Piranha.Resources.Global.Created</strong></td>
</tr>
@foreach (var comment in Model) {
<tr>
<td><a class="btn-comment-expand" href="#" data-id="@comment.Id">@comment.Title</a></td>
<td><a href="mailto:@comment.Author.Email">@comment.Author.Name</a></td>
<td>@comment.StatusName</td>
<td>@comment.Created.ToString("yyyy-MM-dd")</td>
</tr>
<tr class="comment-detail" style="display:none" id="@comment.Id">
<td colspan="4">
<p>@comment.Body</p>
@if (User.HasAccess("ADMIN_COMMENT")) {
<p class="comment-tools right">
<a href="@Url.Action("edit", "comment", new { @id = comment.Id })" class="btn">@Piranha.Resources.Global.Edit</a>
<a href="#" data-id="@comment.Id" class="btn comment-approve">@Piranha.Resources.Comment.Approve</a>
<a href="#" data-id="@comment.Id" class="btn comment-reject">@Piranha.Resources.Comment.Reject</a>
<a href="#" class="btn comment-reply" style="display:none">@Piranha.Resources.Comment.Reply</a>
<a href="#" data-id="@comment.Id" class="btn comment-delete">@Piranha.Resources.Global.Delete</a>
</p>
}
</td>
</tr>
}
</table>
| @model List<Piranha.Entities.Comment>
@{
Layout = "" ;
}
<table class="list">
<tr>
<td><strong>@Piranha.Resources.Global.Title</strong></td>
<td><strong>@Piranha.Resources.Comment.Author</strong></td>
<td><strong>@Piranha.Resources.Global.Status</strong></td>
<td class="date"><strong>@Piranha.Resources.Global.Created</strong></td>
</tr>
@foreach (var comment in Model) {
<tr>
<td><a class="btn-comment-expand" href="#" data-id="@comment.Id">@comment.Title</a></td>
<td><a href="mailto:@comment.Author.Email">@comment.Author.Name</a></td>
<td>@comment.StatusName</td>
<td>@comment.Created.ToString("yyyy-MM-dd")</td>
</tr>
<tr class="comment-detail" style="display:none" id="@comment.Id">
<td colspan="4">
<p>@comment.Body</p>
@if (User.HasAccess("ADMIN_COMMENT")) {
<p class="comment-tools right">
<a href="@Url.Action("edit", "comment", new { @id = comment.Id })" class="btn">@Piranha.Resources.Global.Edit</a>
<a href="#" data-id="@comment.Id" class="btn comment-approve">@Piranha.Resources.Comment.Approve</a>
<a href="#" data-id="@comment.Id" class="btn comment-reject">@Piranha.Resources.Comment.Reject</a>
<a href="#" class="btn comment-reply">@Piranha.Resources.Comment.Reply</a>
<a href="#" data-id="@comment.Id" class="btn comment-delete">@Piranha.Resources.Global.Delete</a>
</p>
}
</td>
</tr>
}
</table>
| mit | C# |
5b5e755050c649c6aadaf5ad5f61123e36123eb2 | Fix ShopifyPaymentsDispute.NetworkReasonCode typo | clement911/ShopifySharp,nozzlegear/ShopifySharp | ShopifySharp/Entities/ShopifyPaymentsDispute.cs | ShopifySharp/Entities/ShopifyPaymentsDispute.cs | using Newtonsoft.Json;
using System;
namespace ShopifySharp
{
/// <summary>
/// An object representing a Shopify payments dispute.
/// </summary>
public class ShopifyPaymentsDispute : ShopifyObject
{
[JsonProperty("order_id")]
public long? OrderId { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
[JsonProperty("amount")]
public decimal? Amount { get; set; }
[JsonProperty("reason")]
public string Reason { get; set; }
[JsonProperty("network_reason_code")]
public string NetworkReasonCode { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("evidence_due_by")]
public DateTimeOffset? EvidenceDueBy { get; set; }
[JsonProperty("initiated_at")]
public DateTimeOffset? InitiatedAt { get; set; }
[JsonProperty("evidence_sent_on")]
public DateTimeOffset? EvidenceSentOn { get; set; }
[JsonProperty("finalized_on")]
public DateTimeOffset? FinalizedOn { get; set; }
}
}
| using Newtonsoft.Json;
using System;
namespace ShopifySharp
{
/// <summary>
/// An object representing a Shopify payments dispute.
/// </summary>
public class ShopifyPaymentsDispute : ShopifyObject
{
[JsonProperty("order_id")]
public long? OrderId { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
[JsonProperty("amount")]
public decimal? Amount { get; set; }
[JsonProperty("reason")]
public string Reason { get; set; }
[JsonProperty("network_reason_code")]
public string NetworkReasonCcode { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("evidence_due_by")]
public DateTimeOffset? EvidenceDueBy { get; set; }
[JsonProperty("initiated_at")]
public DateTimeOffset? InitiatedAt { get; set; }
[JsonProperty("evidence_sent_on")]
public DateTimeOffset? EvidenceSentOn { get; set; }
[JsonProperty("finalized_on")]
public DateTimeOffset? FinalizedOn { get; set; }
}
}
| mit | C# |
ccbf34725d6148682d7d29bf2b6a3c295d231f2b | Increase the message notification delay slightly. | adamzolotarev/Exceptionless,exceptionless/Exceptionless,exceptionless/Exceptionless,exceptionless/Exceptionless,adamzolotarev/Exceptionless,adamzolotarev/Exceptionless,exceptionless/Exceptionless | Source/Core/Pipeline/080_NotifySignalRAction.cs | Source/Core/Pipeline/080_NotifySignalRAction.cs | #region Copyright 2014 Exceptionless
// 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.
//
// http://www.gnu.org/licenses/agpl-3.0.html
#endregion
using System;
using System.Threading.Tasks;
using CodeSmith.Core.Component;
using Exceptionless.Core.Messaging;
using Exceptionless.Core.Messaging.Models;
using Exceptionless.Core.Plugins.EventProcessor;
namespace Exceptionless.Core.Pipeline {
[Priority(80)]
public class NotifySignalRAction : EventPipelineActionBase {
private readonly IMessagePublisher _publisher;
public NotifySignalRAction(IMessagePublisher publisher) {
_publisher = publisher;
}
protected override bool ContinueOnError {
get { return true; }
}
public override void Process(EventContext ctx) {
Task.Factory.StartNewDelayed(1500, () => _publisher.Publish(new EventOccurrence {
Id = ctx.Event.Id,
OrganizationId = ctx.Event.OrganizationId,
ProjectId = ctx.Event.ProjectId,
StackId = ctx.Event.StackId,
Type = ctx.Event.Type,
IsHidden = ctx.Event.IsHidden,
IsFixed = ctx.Event.IsFixed,
IsNotFound = ctx.Event.IsNotFound(),
IsRegression = ctx.IsRegression
}));
}
}
} | #region Copyright 2014 Exceptionless
// 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.
//
// http://www.gnu.org/licenses/agpl-3.0.html
#endregion
using System;
using System.Threading.Tasks;
using CodeSmith.Core.Component;
using Exceptionless.Core.Messaging;
using Exceptionless.Core.Messaging.Models;
using Exceptionless.Core.Plugins.EventProcessor;
namespace Exceptionless.Core.Pipeline {
[Priority(80)]
public class NotifySignalRAction : EventPipelineActionBase {
private readonly IMessagePublisher _publisher;
public NotifySignalRAction(IMessagePublisher publisher) {
_publisher = publisher;
}
protected override bool ContinueOnError {
get { return true; }
}
public override void Process(EventContext ctx) {
Task.Factory.StartNewDelayed(1000, () => _publisher.Publish(new EventOccurrence {
Id = ctx.Event.Id,
OrganizationId = ctx.Event.OrganizationId,
ProjectId = ctx.Event.ProjectId,
StackId = ctx.Event.StackId,
Type = ctx.Event.Type,
IsHidden = ctx.Event.IsHidden,
IsFixed = ctx.Event.IsFixed,
IsNotFound = ctx.Event.IsNotFound(),
IsRegression = ctx.IsRegression
}));
}
}
} | apache-2.0 | C# |
91ee250f20f13bf911ad89cd00d1f4ddc6288364 | Add comments for XBox360GamepadState enum | mina-asham/XBox360ControllerManager | XBox360ControllerManager/XBox360GamepadState.cs | XBox360ControllerManager/XBox360GamepadState.cs | namespace XBox360ControllerManager
{
/// <summary>
/// Represents the state of the gamepad when <see cref="XBox360.GetGamepad"/> is called
/// </summary>
public enum XBox360GamepadState : ushort
{
/// <summary>
/// Gamepad is currently connected
/// </summary>
Connected = 0x0000,
/// <summary>
/// Gamepad is not currently connected
/// </summary>
NotConnected = 0x048F
}
}
| namespace XBox360ControllerManager
{
public enum XBox360GamepadState : ushort
{
Connected = 0x0000,
NotConnected = 0x048F
}
}
| mit | C# |
fad41fd1fce945133b6085302c4ea5d81dc082e8 | change version to 1.3.1 | jittuu/NSupport | NSupport/Properties/AssemblyInfo.cs | NSupport/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NSupport")]
[assembly: AssemblyDescription("A .Net port of ActiveSupport library of Ruby on Rails. The goal is to extend Base Class Library for Common Usage with human readable syntax.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("jittuu")]
[assembly: AssemblyProduct("NSupport")]
[assembly: AssemblyCopyright("Copyright © Soe Moe 2011")]
[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("3baa7153-2964-4185-94b6-4ed86c131481")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.1.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NSupport")]
[assembly: AssemblyDescription("A .Net port of ActiveSupport library of Ruby on Rails. The goal is to extend Base Class Library for Common Usage with human readable syntax.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("jittuu")]
[assembly: AssemblyProduct("NSupport")]
[assembly: AssemblyCopyright("Copyright © Soe Moe 2011")]
[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("3baa7153-2964-4185-94b6-4ed86c131481")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
| mit | C# |
57b1affe08359891d4f7cc5f2d6281526713824c | Change Spot.Board from generic Board to specific LocalBoard | Curdflappers/UltimateTicTacToe | Assets/Resources/Scripts/Architecture/Spot.cs | Assets/Resources/Scripts/Architecture/Spot.cs | using System;
public class Spot
{
Location loc;
LocalBoard board;
Player owner;
bool enabled;
public Location Loc { get { return loc; } }
public LocalBoard Board {
get { return board; }
set { board = value; }
}
public Player Owner
{
get { return owner; }
set
{
owner = value;
RaiseOwnerChanged(GetArgs());
}
}
public bool Enabled
{
get { return enabled; }
set
{
enabled = value;
RaiseEnabledChanged(GetArgs());
}
}
public event EventHandler<SpotEventArgs> OwnerChanged;
protected virtual void RaiseOwnerChanged(SpotEventArgs e)
{
if (OwnerChanged != null) // if there are some listeners
{
OwnerChanged(this, e); // notify all listeners
}
}
public event EventHandler<SpotEventArgs> EnabledChanged;
protected virtual void RaiseEnabledChanged(SpotEventArgs e)
{
if (EnabledChanged!= null) { EnabledChanged(this, e); }
}
public event EventHandler<SpotEventArgs> Clicked;
protected virtual void RaiseClicked(SpotEventArgs e)
{
if(Clicked != null) { Clicked(this, e); }
}
public Spot(Location loc, LocalBoard board, Player owner, bool enabled)
{
this.loc = loc;
this.board = board;
this.owner = owner;
this.enabled = enabled;
}
/// <summary>
/// When this is told that it has been clicked,
/// it broadcasts a message to any listeners of the Clicked event
/// </summary>
public void HandleOnClicked()
{
RaiseClicked(GetArgs());
}
private SpotEventArgs GetArgs()
{
return new SpotEventArgs();
}
}
| using System;
public class Spot
{
Location loc;
Board board;
Player owner;
bool enabled;
public Location Loc { get { return loc; } }
public Board Board {
get { return board; }
set { board = value; }
}
public Player Owner
{
get { return owner; }
set
{
owner = value;
RaiseOwnerChanged(GetArgs());
}
}
public bool Enabled
{
get { return enabled; }
set
{
enabled = value;
RaiseEnabledChanged(GetArgs());
}
}
public event EventHandler<SpotEventArgs> OwnerChanged;
protected virtual void RaiseOwnerChanged(SpotEventArgs e)
{
if (OwnerChanged != null) // if there are some listeners
{
OwnerChanged(this, e); // notify all listeners
}
}
public event EventHandler<SpotEventArgs> EnabledChanged;
protected virtual void RaiseEnabledChanged(SpotEventArgs e)
{
if (EnabledChanged!= null) { EnabledChanged(this, e); }
}
public event EventHandler<SpotEventArgs> Clicked;
protected virtual void RaiseClicked(SpotEventArgs e)
{
if(Clicked != null) { Clicked(this, e); }
}
public Spot(Location loc, Board board, Player owner, bool enabled)
{
this.loc = loc;
this.board = board;
this.owner = owner;
this.enabled = enabled;
}
/// <summary>
/// When this is told that it has been clicked,
/// it broadcasts a message to any listeners of the Clicked event
/// </summary>
public void HandleOnClicked()
{
RaiseClicked(GetArgs());
}
private SpotEventArgs GetArgs()
{
return new SpotEventArgs();
}
}
| mit | C# |
1e5efe755937a65d71be0ad625eca98a995882d2 | Send game state to client. | Mikuz/Battlezeppelins,Mikuz/Battlezeppelins | Battlezeppelins/Controllers/GameController.cs | Battlezeppelins/Controllers/GameController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Battlezeppelins.Models;
namespace Battlezeppelins.Controllers
{
public class GameController : BaseController
{
public ActionResult Metadata()
{
Game game = Game.GetInstance(base.GetPlayer());
if (game != null)
{
return Json(new {
playing = true,
opponent = game.opponent.name,
gameState = game.gameState.ToString() }, JsonRequestBehavior.AllowGet);
}
else
{
return Json(new { playing = false }, JsonRequestBehavior.AllowGet);
}
}
public ActionResult Surrender()
{
Game game = Game.GetInstance(base.GetPlayer());
if (game != null)
{
game.Surrender();
}
return null;
}
public ActionResult AddZeppelin()
{
Game game = Game.GetInstance(base.GetPlayer());
string typeStr = Request.Form["type"];
ZeppelinType type = (ZeppelinType)Enum.Parse(typeof(ZeppelinType), typeStr, true);
int x = Int32.Parse(Request.Form["x"]);
int y = Int32.Parse(Request.Form["y"]);
bool rotDown = Boolean.Parse(Request.Form["rotDown"]);
Zeppelin zeppelin = new Zeppelin(type, x, y, rotDown);
bool zeppelinAdded = game.AddZeppelin(zeppelin);
return Json(zeppelinAdded, JsonRequestBehavior.AllowGet);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Battlezeppelins.Models;
namespace Battlezeppelins.Controllers
{
public class GameController : BaseController
{
public ActionResult Metadata()
{
Game game = Game.GetInstance(base.GetPlayer());
if (game != null)
{
return Json(new { playing = true, opponent = game.opponent.name }, JsonRequestBehavior.AllowGet);
}
else
{
return Json(new { playing = false }, JsonRequestBehavior.AllowGet);
}
}
public ActionResult Surrender()
{
Game game = Game.GetInstance(base.GetPlayer());
if (game != null)
{
game.Surrender();
}
return null;
}
public ActionResult AddZeppelin()
{
Game game = Game.GetInstance(base.GetPlayer());
string typeStr = Request.Form["type"];
ZeppelinType type = (ZeppelinType)Enum.Parse(typeof(ZeppelinType), typeStr, true);
int x = Int32.Parse(Request.Form["x"]);
int y = Int32.Parse(Request.Form["y"]);
bool rotDown = Boolean.Parse(Request.Form["rotDown"]);
Zeppelin zeppelin = new Zeppelin(type, x, y, rotDown);
bool zeppelinAdded = game.AddZeppelin(zeppelin);
return Json(zeppelinAdded, JsonRequestBehavior.AllowGet);
}
}
}
| apache-2.0 | C# |
57e936e6bda2a9f9f60cc9329ab5ad559679a2bc | Fix formatting in events so it will build | mariotoffia/FluentDocker,mariotoffia/FluentDocker,mariotoffia/FluentDocker,mariotoffia/FluentDocker | Ductus.FluentDocker/Model/HostEvents/Event.cs | Ductus.FluentDocker/Model/HostEvents/Event.cs | namespace Ductus.FluentDocker.Model.HostEvents
{
/// <summary>
/// Base evnet emitte by the docker dameon using e.g. docker events.
/// </summary>
/// <remarks>
/// See docker documentation https://docs.docker.com/engine/reference/commandline/events/
/// </remarks>
public class Event
{
/// <summary>
/// The type of the event.
/// </summary>
public EventType Type { get; set; }
/// <summary>
/// The event action
/// </summary>
public EventAction Action { get; set; }
}
}
| namespace Ductus.FluentDocker.Model.HostEvents
{
/// <summary>
/// Base evnet emitte by the docker dameon using e.g. docker events.
/// </summary>
/// <remarks>
/// See docker documentation https://docs.docker.com/engine/reference/commandline/events/
/// </remarks>
public class Event
{
/// <summary>
/// The type of the event.
/// </summary>
public EventType Type { get; set; }
/// <summary>
/// The event action
/// </summary>
public EventAction Action { get; set; }
}
}
| apache-2.0 | C# |
59ef65ba05dfda9e31ff63eced6435a670f5ac49 | Fix LogicApp Description language | fashaikh/SimpleWAWS,projectkudu/SimpleWAWS,projectkudu/SimpleWAWS,projectkudu/TryAppService,projectkudu/TryAppService,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS,fashaikh/SimpleWAWS,davidebbo/SimpleWAWS,fashaikh/SimpleWAWS,projectkudu/TryAppService,davidebbo/SimpleWAWS,fashaikh/SimpleWAWS,projectkudu/SimpleWAWS,projectkudu/TryAppService,davidebbo/SimpleWAWS | SimpleWAWS/Controllers/TemplatesController.cs | SimpleWAWS/Controllers/TemplatesController.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Hosting;
using System.Web.Http;
using SimpleWAWS.Models;
namespace SimpleWAWS.Controllers
{
public class TemplatesController : ApiController
{
public IEnumerable<BaseTemplate> Get()
{
var list = TemplatesManager.GetTemplates().ToList();
list.ForEach(t => { if (t.AppService == AppService.Logic) t.Description = Resources.Server.Templates_PingSiteDescription; });
list.Add(WebsiteTemplate.EmptySiteTemplate);
return list;
}
}
} | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Hosting;
using System.Web.Http;
using SimpleWAWS.Models;
namespace SimpleWAWS.Controllers
{
public class TemplatesController : ApiController
{
public IEnumerable<BaseTemplate> Get()
{
var list = TemplatesManager.GetTemplates().ToList();
list.Add(WebsiteTemplate.EmptySiteTemplate);
return list;
}
}
} | apache-2.0 | C# |
654e2d69030ccc394636bcad2d3a725b8e991ea0 | fix the response | Inumedia/SlackAPI | SlackAPI/RPCMessages/ChannelInviteResponse.cs | SlackAPI/RPCMessages/ChannelInviteResponse.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlackAPI
{
[RequestPath("channels.invite")]
public class ChannelInviteResponse : Response
{
public Channel channel;
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlackAPI
{
[RequestPath("channels.invite")]
public class ChannelInviteResponse : Response
{
}
}
| mit | C# |
c78f3f94a1412590f5bc4580dd3a3c48016ee46e | Add constructors in ConstIterator | henrikfroehling/RangeIt | Source/Lib/RangeIt/Iterators/ConstIterator.cs | Source/Lib/RangeIt/Iterators/ConstIterator.cs | namespace RangeIt.Iterators
{
using Interfaces;
using System;
using System.Collections;
public sealed class ConstIterator : IConstIterator
{
private ConstIterator() { }
public ConstIterator(ArrayList arrayList)
{
}
public ConstIterator(Queue queue)
{
}
public ConstIterator(Stack stack)
{
}
public ConstIterator(SortedList sortedList)
{
}
public object Current
{
get
{
throw new NotImplementedException();
}
}
public bool Previous()
{
throw new NotImplementedException();
}
public bool Next()
{
throw new NotImplementedException();
}
public IEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
}
}
| namespace RangeIt.Iterators
{
using Interfaces;
using System;
using System.Collections;
public sealed class ConstIterator : IConstIterator
{
public object Current
{
get
{
throw new NotImplementedException();
}
}
public bool Previous()
{
throw new NotImplementedException();
}
public bool Next()
{
throw new NotImplementedException();
}
public IEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
}
}
| mit | C# |
1fb1cf6896a19653dcb1bda2378fbb536e8c093f | Make AbuseFilter class read-only. Might put all HTML form post hacks into a separate package. | CXuesong/WikiClientLibrary | WikiClientLibrary/AbuseFilters/AbuseFilter.cs | WikiClientLibrary/AbuseFilters/AbuseFilter.cs | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using Newtonsoft.Json;
using WikiClientLibrary.Sites;
namespace WikiClientLibrary.AbuseFilters
{
[JsonObject(MemberSerialization.OptIn)]
public sealed class AbuseFilter
{
public static readonly string[] emptyActions = { };
public WikiSite Site { get; }
[JsonProperty]
public int Id { get; private set; }
[JsonProperty]
public string Description { get; set; }
[JsonProperty]
public string Pattern { get; set; }
public IReadOnlyCollection<string> Actions { get; private set; } = emptyActions;
[JsonProperty("actions")]
private string RawActions
{
set
{
Actions = string.IsNullOrEmpty(value)
? emptyActions
: (IReadOnlyCollection<string>)new ReadOnlyCollection<string>(value.Split(','));
}
}
[JsonProperty]
public int Hits { get; private set; }
[JsonProperty]
public string Comments { get; set; }
[JsonProperty]
public string LastEditor { get; private set; }
[JsonProperty]
public DateTime LastEditTime { get; private set; }
[JsonProperty("deleted")]
public bool IsDeleted { get; private set; }
[JsonProperty("private")]
public bool IsPrivate { get; private set; }
[JsonProperty("enabled")]
public bool IsEnabled { get; private set; }
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
namespace WikiClientLibrary.AbuseFilters
{
[JsonObject(MemberSerialization.OptIn)]
public sealed class AbuseFilter
{
private ICollection<string> _Actions;
[JsonProperty]
public int Id { get; private set; }
[JsonProperty]
public string Description { get; set; }
[JsonProperty]
public string Pattern { get; set; }
public ICollection<string> Actions
{
get
{
if (_Actions == null) _Actions = new List<string>();
return _Actions;
}
set { _Actions = value; }
}
[JsonProperty("actions")]
private string RawActions
{
set { _Actions = string.IsNullOrEmpty(value) ? null : new List<string>(value.Split(',')); }
}
[JsonProperty]
public int Hits { get; private set; }
[JsonProperty]
public string Comments { get; set; }
[JsonProperty]
public string LastEditor { get; private set; }
[JsonProperty]
public DateTime LastEditTime { get; private set; }
[JsonProperty("deleted")]
public bool IsDeleted { get; set; }
[JsonProperty("private")]
public bool IsPrivate { get; set; }
[JsonProperty("enabled")]
public bool IsEnabled { get; set; }
}
}
| apache-2.0 | C# |
24dd11986989ef28fd996e73275d14118ba40f80 | verify empty data in unit test before test | nevtum/PortForward | PortForwardApp/Tests/ClientTests.cs | PortForwardApp/Tests/ClientTests.cs | using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PortForward;
using PortForward.Utilities;
namespace PortForwardApp.Tests
{
[TestClass]
public class ClientTests
{
[TestMethod]
public void ShouldEchoRequest()
{
TestData data = new TestData();
Bridge bridge = new Bridge();
Client clientA = new ExampleClient(data, bridge.SocketA);
Client clientB = new EchoClient(bridge.SocketB);
byte[] bytes = ByteStringConverter.GetBytes("Hello!");
Assert.AreNotEqual(bytes, data.Request);
clientA.Push(bytes);
Assert.AreEqual(bytes, data.Request);
Assert.AreEqual(data.Response, data.Request);
Assert.IsNotNull(data.Response);
}
}
public class TestData
{
public byte[] Request { get; set; }
public byte[] Response { get; set; }
}
public class ExampleClient : Client
{
private TestData _data;
public ExampleClient(TestData data, Socket socket)
: base(socket)
{
_data = data;
}
public override void Push(byte[] data)
{
_data.Request = data;
base.Push(data);
}
protected override void HandleResponse(byte[] data)
{
_data.Response = data;
}
}
}
| using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PortForward;
using PortForward.Utilities;
namespace PortForwardApp.Tests
{
[TestClass]
public class ClientTests
{
[TestMethod]
public void ShouldEchoRequest()
{
TestData data = new TestData();
Bridge bridge = new Bridge();
Client clientA = new ExampleClient(data, bridge.SocketA);
Client clientB = new EchoClient(bridge.SocketB);
byte[] bytes = ByteStringConverter.GetBytes("Hello!");
clientA.Push(bytes);
Assert.AreEqual(bytes, data.Request);
Assert.AreEqual(data.Response, data.Request);
Assert.IsNotNull(data.Response);
}
}
public class TestData
{
public byte[] Request { get; set; }
public byte[] Response { get; set; }
}
public class ExampleClient : Client
{
private TestData _data;
public ExampleClient(TestData data, Socket socket)
: base(socket)
{
_data = data;
}
public override void Push(byte[] data)
{
_data.Request = data;
base.Push(data);
}
protected override void HandleResponse(byte[] data)
{
_data.Response = data;
}
}
}
| apache-2.0 | C# |
a8f3fc0f7e474c0913a0d9be3aade1dcd8d7766a | Remove Inject from BlockOtherPlayerLobbyJoinEventPayloadHandler | HelloKitty/Booma.Proxy | src/Booma.Proxy.Client.Unity.Ship/Handlers/Payload/BlockOtherPlayerLobbyJoinEventPayloadHandler.cs | src/Booma.Proxy.Client.Unity.Ship/Handlers/Payload/BlockOtherPlayerLobbyJoinEventPayloadHandler.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using GladNet;
using SceneJect.Common;
namespace Booma.Proxy
{
public sealed class BlockOtherPlayerLobbyJoinEventPayloadHandler : GameMessageHandler<BlockOtherPlayerJoinedLobbyEventPayload>
{
private INetworkPlayerFactory PlayerFactory { get; }
/// <inheritdoc />
public BlockOtherPlayerLobbyJoinEventPayloadHandler([NotNull] INetworkPlayerFactory playerFactory, ILog logger)
: base(logger)
{
PlayerFactory = playerFactory ?? throw new ArgumentNullException(nameof(playerFactory));
}
/// <inheritdoc />
public override Task HandleMessage(IPeerMessageContext<PSOBBGamePacketPayloadClient> context, BlockOtherPlayerJoinedLobbyEventPayload payload)
{
if(Logger.IsInfoEnabled)
Logger.Info($"Player Lobby Join: {payload.ClientId} LeaderId: {payload.LeaderId} EventId: {payload.EventId} Lobby: {payload.LobbyNumber}");
//Create the joined player
//We don't really have a position for them though, it didn't come in this packet
PlayerFactory.CreateEntity(payload.ClientId);
return Task.CompletedTask;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using GladNet;
using SceneJect.Common;
namespace Booma.Proxy
{
[Injectee]
public sealed class BlockOtherPlayerLobbyJoinEventPayloadHandler : GameMessageHandler<BlockOtherPlayerJoinedLobbyEventPayload>
{
[Inject]
private INetworkPlayerFactory PlayerFactory { get; }
/// <inheritdoc />
public BlockOtherPlayerLobbyJoinEventPayloadHandler(ILog logger)
: base(logger)
{
}
/// <inheritdoc />
public override Task HandleMessage(IPeerMessageContext<PSOBBGamePacketPayloadClient> context, BlockOtherPlayerJoinedLobbyEventPayload payload)
{
if(Logger.IsInfoEnabled)
Logger.Info($"Player Lobby Join: {payload.ClientId} LeaderId: {payload.LeaderId} EventId: {payload.EventId} Lobby: {payload.LobbyNumber}");
//Create the joined player
//We don't really have a position for them though, it didn't come in this packet
PlayerFactory.CreateEntity(payload.ClientId);
return Task.CompletedTask;
}
}
}
| agpl-3.0 | C# |
5d68996dc6612cdb7dc252b2e6d8c22267ed36a6 | Update ValuesOut.cs | EricZimmerman/RegistryPlugins | RegistryPlugin.USBSTOR/ValuesOut.cs | RegistryPlugin.USBSTOR/ValuesOut.cs | using System;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.USBSTOR
{
public class ValuesOut : IValueOut
{
public ValuesOut(string manufacturer, string title, string version, string serialNumber, DateTimeOffset? timestamp,
string deviceName, DateTimeOffset? installed, DateTimeOffset? firstinstalled, DateTimeOffset? lastconnected, DateTimeOffset? lastremoved)
{
Manufacturer = manufacturer;
Title = title;
Version = version;
SerialNumber = serialNumber;
Timestamp = timestamp;
DeviceName = deviceName;
Installed = installed;
FirstInstalled = firstinstalled;
LastConnected = lastconnected;
LastRemoved = lastremoved;
}
public DateTimeOffset? Timestamp { get; }
public string Manufacturer { get; }
public string Title { get; }
public string Version { get; }
public string SerialNumber { get; }
public string DeviceName { get; }
public DateTimeOffset? Installed { get; }
public DateTimeOffset? FirstInstalled { get; }
public DateTimeOffset? LastConnected { get; }
public DateTimeOffset? LastRemoved { get; }
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"Manufacturer: {Manufacturer} Title: {Title} Version: {Version} SerialNumber: {SerialNumber}";
public string BatchValueData2 => $"Timestamp: {Timestamp?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
public string BatchValueData3 =>
$"Installed: {Installed?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}" +
$"FirstInstalled: {FirstInstalled?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}" +
$"LastConnected: {LastConnected?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}" +
$"LastRemoved: {LastRemoved?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
}
}
| using System;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.USBSTOR
{
public class ValuesOut : IValueOut
{
public ValuesOut(string manufacturer, string title, string version, string serialNumber, DateTimeOffset? timestamp,
string deviceName, DateTimeOffset? installed, DateTimeOffset? firstinstalled, DateTimeOffset? lastconnected, DateTimeOffset? lastremoved)
{
Manufacturer = manufacturer;
Title = title;
Version = version;
SerialNumber = serialNumber;
Timestamp = timestamp;
DeviceName = deviceName;
Installed = installed;
FirstInstalled = firstinstalled;
LastConnected = lastconnected;
LastRemoved = lastremoved;
}
public DateTimeOffset? Timestamp { get; }
public string Manufacturer { get; }
public string Title { get; }
public string Version { get; }
public string SerialNumber { get; }
public string DeviceName { get; }
public DateTimeOffset? Installed { get; }
public DateTimeOffset? FirstInstalled { get; }
public DateTimeOffset? LastConnected { get; }
public DateTimeOffset? LastRemoved { get; }
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"Manufacture: {Manufacturer} Title: {Title} Version: {Version} SerialNumber: {SerialNumber}";
public string BatchValueData2 => $"Timestamp: {Timestamp?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff} ";
public string BatchValueData3 =>
$"Installed: {Installed?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff} " +
$"FirstInstalled: {FirstInstalled?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff} " +
$"LastConnected: {LastConnected?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff} " +
$"LastRemoved: {LastRemoved?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
}
}
| mit | C# |
3b5a840338fd2d0e30e26a3e2dfc12ff0918d1c1 | Switch to 1.4.5 | Abc-Arbitrage/Zebus,biarne-a/Zebus | src/SharedVersionInfo.cs | src/SharedVersionInfo.cs | using System.Reflection;
[assembly: AssemblyVersion("1.4.5")]
[assembly: AssemblyFileVersion("1.4.5")]
[assembly: AssemblyInformationalVersion("1.4.5")]
| using System.Reflection;
[assembly: AssemblyVersion("1.4.4")]
[assembly: AssemblyFileVersion("1.4.4")]
[assembly: AssemblyInformationalVersion("1.4.4")]
| mit | C# |
bc85e984941593081f1dacf002e4ff08a8eb5fa2 | implement backingfield property support | Pondidum/Stronk,Pondidum/Stronk | src/Stronk/Extensions.cs | src/Stronk/Extensions.cs | using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using Stronk.ValueConversion;
namespace Stronk
{
public static class Extensions
{
public static void FromAppConfig(this object target)
{
var converters = new IValueConverter[]
{
new LambdaValueConverter<Uri>(val => new Uri(val)),
new EnumValueConverter(),
new FallbackValueConverter()
};
var propertySelectors = new IPropertySelector[]
{
new PrivateSetterPropertySelector(),
new BackingFieldPropertySelector(),
};
var properties = propertySelectors
.SelectMany(selector => selector.Select(target.GetType()));
var appSettings = ConfigurationManager.AppSettings;
foreach (var property in properties)
{
var hasSetting = appSettings.AllKeys.Contains(property.Name);
if (hasSetting)
{
var converted = converters
.First(c => c.CanMap(property.Type))
.Map(property.Type, appSettings[property.Name]);
property.Assign(target, converted);
}
}
}
}
public interface IPropertySelector
{
IEnumerable<PropertyDescriptor> Select(Type targetType);
}
public class PrivateSetterPropertySelector : IPropertySelector
{
public IEnumerable<PropertyDescriptor> Select(Type targetType)
{
return targetType
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Where(prop => prop.CanWrite)
.Select(prop => new PropertyDescriptor
{
Name = prop.Name,
Type = prop.PropertyType,
Assign = (target, value) => prop.GetSetMethod(true).Invoke(target, new[] { value })
});
}
}
public class BackingFieldPropertySelector : IPropertySelector
{
public IEnumerable<PropertyDescriptor> Select(Type targetType)
{
var fields = targetType
.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)
.ToArray();
var properties = targetType
.GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (var property in properties)
{
var field = fields.FirstOrDefault(f => f.Name.Equals(property.Name, StringComparison.OrdinalIgnoreCase))
?? fields.FirstOrDefault(f => f.Name.Equals("_" + property.Name, StringComparison.OrdinalIgnoreCase));
if (field != null)
yield return new PropertyDescriptor
{
Name = property.Name,
Type = property.PropertyType,
Assign = (target, value) => field.SetValue(target, value)
};
}
}
}
public class PropertyDescriptor
{
public string Name { get; set; }
public Type Type { get; set; }
public Action<object, object> Assign { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using Stronk.ValueConversion;
namespace Stronk
{
public static class Extensions
{
public static void FromAppConfig(this object target)
{
var converters = new IValueConverter[]
{
new LambdaValueConverter<Uri>(val => new Uri(val)),
new EnumValueConverter(),
new FallbackValueConverter()
};
var propertySelectors = new IPropertySelector[]
{
new PrivateSetterPropertySelector(),
};
var properties = propertySelectors
.SelectMany(selector => selector.Select(target.GetType()));
var appSettings = ConfigurationManager.AppSettings;
foreach (var property in properties)
{
var hasSetting = appSettings.AllKeys.Contains(property.Name);
if (hasSetting)
{
var converted = converters
.First(c => c.CanMap(property.Type))
.Map(property.Type, appSettings[property.Name]);
property.Assign(target, converted);
}
}
}
}
public interface IPropertySelector
{
IEnumerable<PropertyDescriptor> Select(Type target);
}
public class PrivateSetterPropertySelector : IPropertySelector
{
public IEnumerable<PropertyDescriptor> Select(Type target)
{
return target
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Select(prop => new PropertyDescriptor
{
Name = prop.Name,
Type = prop.PropertyType,
Assign = (targetObject, value) => prop.GetSetMethod(true).Invoke(targetObject, new[] { value })
});
}
}
public class PropertyDescriptor
{
public string Name { get; set; }
public Type Type { get; set; }
public Action<object, object> Assign { get; set; }
}
}
| lgpl-2.1 | C# |
edeff3f04f94cf720893dfb76a93ee5cdb848e66 | Fix SimpleLogManager | YevgeniyShunevych/Atata,atata-framework/atata,atata-framework/atata,YevgeniyShunevych/Atata | src/Atata/Logging/SimpleLogManager.cs | src/Atata/Logging/SimpleLogManager.cs | using System;
using System.Linq;
using System.Text;
namespace Atata
{
public class SimpleLogManager : LogManagerBase
{
private Action<string> writeLineAction;
public SimpleLogManager(Action<string> writeLineAction = null, string screenshotsFolderPath = null)
: base(screenshotsFolderPath)
{
this.writeLineAction = writeLineAction ?? (x => Console.WriteLine(x));
}
public override void Info(string message, params object[] args)
{
Log("INFO", message, args);
}
public override void Warn(string message, params object[] args)
{
Log("WARN", message, args);
}
public override void Error(string message, Exception excepton)
{
string completeMessage = string.Join(" ", new[] { message, excepton?.ToString() }.Where(x => x != null));
Log("ERROR", completeMessage);
}
private void Log(string logLevel, string message, params object[] args)
{
StringBuilder builder = new StringBuilder();
builder.
Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffff")).
Append(" ").
Append(logLevel).
Append(" ").
AppendFormat(message, args);
writeLineAction(builder.ToString());
}
}
}
| using System;
using System.Text;
namespace Atata
{
public class SimpleLogManager : LogManagerBase
{
private Action<string> writeLineAction;
public SimpleLogManager(Action<string> writeLineAction = null, string screenshotsFolderPath = null)
: base(screenshotsFolderPath)
{
this.writeLineAction = writeLineAction ?? (x => Console.WriteLine(x));
}
public override void Info(string message, params object[] args)
{
Log("INFO", message, args);
}
public override void Warn(string message, params object[] args)
{
Log("WARN", message, args);
}
public override void Error(string message, Exception excepton)
{
string completeMessage = string.Join(" ", new[] { message, excepton.ToString() });
Log("ERROR", completeMessage);
}
private void Log(string logLevel, string message, params object[] args)
{
StringBuilder builder = new StringBuilder();
builder.
Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffff")).
Append(" ").
Append(logLevel).
Append(" ").
AppendFormat(message, args);
writeLineAction(builder.ToString());
}
}
}
| apache-2.0 | C# |
15bb5cf88fae4b9a36655ee7decda5e69370bb91 | fix bug introduced in dropdownitem the clears :selected psuedo class | SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,akrisiun/Perspex | src/Avalonia.Controls/DropDownItem.cs | src/Avalonia.Controls/DropDownItem.cs | // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
namespace Avalonia.Controls
{
/// <summary>
/// A selectable item in a <see cref="DropDown"/>.
/// </summary>
public class DropDownItem : ContentControl, ISelectable
{
/// <summary>
/// Defines the <see cref="IsSelected"/> property.
/// </summary>
public static readonly StyledProperty<bool> IsSelectedProperty =
AvaloniaProperty.Register<DropDownItem, bool>(nameof(IsSelected));
/// <summary>
/// Initializes static members of the <see cref="DropDownItem"/> class.
/// </summary>
static DropDownItem()
{
FocusableProperty.OverrideDefaultValue<DropDownItem>(true);
}
public DropDownItem()
{
this.GetObservable(DropDownItem.IsFocusedProperty).Subscribe(focused =>
{
PseudoClasses.Set(":selected", focused);
});
}
/// <summary>
/// Gets or sets the selection state of the item.
/// </summary>
public bool IsSelected
{
get { return GetValue(IsSelectedProperty); }
set { SetValue(IsSelectedProperty, value); }
}
}
}
| // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
namespace Avalonia.Controls
{
/// <summary>
/// A selectable item in a <see cref="DropDown"/>.
/// </summary>
public class DropDownItem : ContentControl, ISelectable
{
/// <summary>
/// Defines the <see cref="IsSelected"/> property.
/// </summary>
public static readonly StyledProperty<bool> IsSelectedProperty =
AvaloniaProperty.Register<DropDownItem, bool>(nameof(IsSelected));
/// <summary>
/// Initializes static members of the <see cref="DropDownItem"/> class.
/// </summary>
static DropDownItem()
{
FocusableProperty.OverrideDefaultValue<DropDownItem>(true);
IsFocusedProperty.Changed.Subscribe(x =>
{
var sender = x.Sender as IControl;
if (sender != null)
{
((IPseudoClasses)sender.Classes).Set(":selected", (bool)x.NewValue);
}
});
}
/// <summary>
/// Gets or sets the selection state of the item.
/// </summary>
public bool IsSelected
{
get { return GetValue(IsSelectedProperty); }
set { SetValue(IsSelectedProperty, value); }
}
}
}
| mit | C# |
3f2f8eaf535de487c7ac4fc7032ecf0011b4b771 | Allow strict Fake to permit access to overridden Object methods | thomaslevesque/FakeItEasy,blairconrad/FakeItEasy,blairconrad/FakeItEasy,FakeItEasy/FakeItEasy,FakeItEasy/FakeItEasy,thomaslevesque/FakeItEasy | src/FakeItEasy/Core/StrictFakeRule.cs | src/FakeItEasy/Core/StrictFakeRule.cs | namespace FakeItEasy.Core
{
using System;
using static FakeItEasy.ObjectMembers;
internal class StrictFakeRule : IFakeObjectCallRule
{
private readonly StrictFakeOptions options;
public StrictFakeRule(StrictFakeOptions options)
{
this.options = options;
}
public int? NumberOfTimesToCall => null;
public bool IsApplicableTo(IFakeObjectCall fakeObjectCall)
{
if (fakeObjectCall.Method.HasSameBaseMethodAs(EqualsMethod))
{
return !this.HasOption(StrictFakeOptions.AllowEquals);
}
if (fakeObjectCall.Method.HasSameBaseMethodAs(GetHashCodeMethod))
{
return !this.HasOption(StrictFakeOptions.AllowGetHashCode);
}
if (fakeObjectCall.Method.HasSameBaseMethodAs(ToStringMethod))
{
return !this.HasOption(StrictFakeOptions.AllowToString);
}
if (EventCall.TryGetEventCall(fakeObjectCall, out _))
{
return !this.HasOption(StrictFakeOptions.AllowEvents);
}
return true;
}
public void Apply(IInterceptedFakeObjectCall fakeObjectCall)
{
string message = ExceptionMessages.CallToUnconfiguredMethodOfStrictFake(fakeObjectCall);
if (EventCall.TryGetEventCall(fakeObjectCall, out _))
{
message += Environment.NewLine + ExceptionMessages.HandleEventsOnStrictFakes;
}
throw new ExpectationException(message);
}
private bool HasOption(StrictFakeOptions flag) => (flag & this.options) == flag;
}
}
| namespace FakeItEasy.Core
{
using System;
using static FakeItEasy.ObjectMembers;
internal class StrictFakeRule : IFakeObjectCallRule
{
private readonly StrictFakeOptions options;
public StrictFakeRule(StrictFakeOptions options)
{
this.options = options;
}
public int? NumberOfTimesToCall => null;
public bool IsApplicableTo(IFakeObjectCall fakeObjectCall)
{
if (fakeObjectCall.Method.IsSameMethodAs(EqualsMethod))
{
return !this.HasOption(StrictFakeOptions.AllowEquals);
}
if (fakeObjectCall.Method.IsSameMethodAs(GetHashCodeMethod))
{
return !this.HasOption(StrictFakeOptions.AllowGetHashCode);
}
if (fakeObjectCall.Method.IsSameMethodAs(ToStringMethod))
{
return !this.HasOption(StrictFakeOptions.AllowToString);
}
if (EventCall.TryGetEventCall(fakeObjectCall, out _))
{
return !this.HasOption(StrictFakeOptions.AllowEvents);
}
return true;
}
public void Apply(IInterceptedFakeObjectCall fakeObjectCall)
{
string message = ExceptionMessages.CallToUnconfiguredMethodOfStrictFake(fakeObjectCall);
if (EventCall.TryGetEventCall(fakeObjectCall, out _))
{
message += Environment.NewLine + ExceptionMessages.HandleEventsOnStrictFakes;
}
throw new ExpectationException(message);
}
private bool HasOption(StrictFakeOptions flag) => (flag & this.options) == flag;
}
}
| mit | C# |
160e651c8053d6c8ee24919d663eedc51fcb4916 | Update IQueryCommand.cs | Flepper/flepper,Flepper/flepper | Flepper.QueryBuilder/Commands/Interfaces/IQueryCommand.cs | Flepper.QueryBuilder/Commands/Interfaces/IQueryCommand.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace Flepper.QueryBuilder
{
/// <summary>
/// Query Command Interface
/// </summary>
public interface IQueryCommand
{
/// <summary>
/// Build a query
/// </summary>
/// <returns></returns>
string Build();
/// <summary>
/// Build a query with parameters
/// </summary>
/// <returns></returns>
QueryResult BuildWithParameters();
/// <summary>
/// Map Query to nem Command
/// </summary>
/// <typeparam name="TEnd"></typeparam>
/// <returns></returns>
TEnd To<TEnd>() where TEnd : IQueryCommand;
/// <summary>
/// Map Query to nem Command
/// </summary>
/// <typeparam name="TEnd"></typeparam>
/// <returns></returns>
TEnd To<TEnd>(Func<StringBuilder, IDictionary<string, object>, TEnd> creator);
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace Flepper.QueryBuilder
{
/// <summary>
/// Query Command Interface
/// </summary>
public interface IQueryCommand
{
/// <summary>
/// Build a query
/// </summary>
/// <returns></returns>
string Build();
/// <summary>
/// Build a query
/// </summary>
/// <returns></returns>
QueryResult BuildWithParameters();
/// <summary>
/// Map Query to nem Command
/// </summary>
/// <typeparam name="TEnd"></typeparam>
/// <returns></returns>
TEnd To<TEnd>() where TEnd : IQueryCommand;
/// <summary>
/// Map Query to nem Command
/// </summary>
/// <typeparam name="TEnd"></typeparam>
/// <returns></returns>
TEnd To<TEnd>(Func<StringBuilder, IDictionary<string, object>, TEnd> creator);
}
} | mit | C# |
e8b53c136c872cced760740599a21bfa7a0e2d42 | update package description | jobeland/GeneticAlgorithm | NeuralNetwork.GeneticAlgorithm/Properties/AssemblyInfo.cs | NeuralNetwork.GeneticAlgorithm/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("NeuralNetwork.GeneticAlgorithm")]
[assembly: AssemblyDescription("Genetic algorithm for evolving neural networks")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NeuralNetwork.GeneticAlgorithm")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bb0c5189-7fc1-4d26-8f4d-5e66b1d0217d")]
// 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.0")]
[assembly: AssemblyFileVersion("2.3.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NeuralNetwork.GeneticAlgorithm")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NeuralNetwork.GeneticAlgorithm")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bb0c5189-7fc1-4d26-8f4d-5e66b1d0217d")]
// 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.0")]
[assembly: AssemblyFileVersion("2.3.0.0")]
| mit | C# |
f561243f495be0452151dcc0b155b6e5cdbd3b4a | Set default value to BackgroundColor | Xeeynamo/KingdomHearts | OpenKh.Tools.LayoutViewer/Properties/Settings.Designer.cs | OpenKh.Tools.LayoutViewer/Properties/Settings.Designer.cs | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenKh.Tools.LayoutViewer {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValue("Magenta")]
public global::System.Drawing.Color BackgroundColor {
get {
return ((global::System.Drawing.Color)(this["BackgroundColor"]));
}
set {
this["BackgroundColor"] = value;
}
}
}
}
| //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenKh.Tools.LayoutViewer {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::System.Drawing.Color BackgroundColor {
get {
return ((global::System.Drawing.Color)(this["BackgroundColor"]));
}
set {
this["BackgroundColor"] = value;
}
}
}
}
| mit | C# |
b163475f2932f83921b45f1270927b08448ff775 | bump version | anobleperson/GitVersion,distantcam/GitVersion,distantcam/GitVersion,TomGillen/GitVersion,alexhardwicke/GitVersion,GeertvanHorrik/GitVersion,openkas/GitVersion,dazinator/GitVersion,pascalberger/GitVersion,GitTools/GitVersion,FireHost/GitVersion,Kantis/GitVersion,ermshiperete/GitVersion,Philo/GitVersion,dpurge/GitVersion,dazinator/GitVersion,dpurge/GitVersion,asbjornu/GitVersion,anobleperson/GitVersion,JakeGinnivan/GitVersion,FireHost/GitVersion,onovotny/GitVersion,onovotny/GitVersion,asbjornu/GitVersion,anobleperson/GitVersion,gep13/GitVersion,TomGillen/GitVersion,orjan/GitVersion,ermshiperete/GitVersion,gep13/GitVersion,Philo/GitVersion,openkas/GitVersion,pascalberger/GitVersion,DanielRose/GitVersion,GeertvanHorrik/GitVersion,JakeGinnivan/GitVersion,orjan/GitVersion,ermshiperete/GitVersion,RaphHaddad/GitVersion,dpurge/GitVersion,ermshiperete/GitVersion,JakeGinnivan/GitVersion,pascalberger/GitVersion,JakeGinnivan/GitVersion,MarkZuber/GitVersion,dpurge/GitVersion,DanielRose/GitVersion,DanielRose/GitVersion,onovotny/GitVersion,Kantis/GitVersion,alexhardwicke/GitVersion,MarkZuber/GitVersion,ParticularLabs/GitVersion,RaphHaddad/GitVersion,ParticularLabs/GitVersion,GitTools/GitVersion,Kantis/GitVersion | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("GitFlowVersion")]
[assembly: AssemblyProduct("GitFlowVersion")]
[assembly: AssemblyVersion("0.1.9")]
[assembly: AssemblyFileVersion("0.1.9")]
| using System.Reflection;
[assembly: AssemblyTitle("GitFlowVersion")]
[assembly: AssemblyProduct("GitFlowVersion")]
[assembly: AssemblyVersion("0.1.8")]
[assembly: AssemblyFileVersion("0.1.8")]
| mit | C# |
f5744ebe936e4966718c887b3d1bcc29408713ef | Resolve #182 - Add remaining missing tests for macro substitution | csf-dev/ZPT-Sharp,csf-dev/ZPT-Sharp | Tests/Test.CSF.Zpt/Metal/TestMacroExtensionSubstitutor.cs | Tests/Test.CSF.Zpt/Metal/TestMacroExtensionSubstitutor.cs | using System;
using NUnit.Framework;
using Ploeh.AutoFixture;
using CSF.Zpt.Metal;
using Moq;
using CSF.Zpt.Rendering;
using CSF.Zpt;
using System.Linq;
namespace Test.CSF.Zpt.Metal
{
[TestFixture]
public class TestMacroExtensionSubstitutor
{
#region fields
private IFixture _autoFixture;
private MacroSubstituter _sut;
private Mock<IRenderingContext> _contextOne, _contextTwo;
private Mock<IZptElement> _elementOne, _elementTwo, _elementThree;
private SlotToFill _slotAndFiller;
#endregion
#region setup
[SetUp]
public void Setup()
{
_autoFixture = new Fixture();
_contextOne = new Mock<IRenderingContext>();
_contextTwo = new Mock<IRenderingContext>();
_elementOne = new Mock<IZptElement>();
_elementTwo = new Mock<IZptElement>();
_elementThree = new Mock<IZptElement>();
_contextOne.SetupGet(x => x.Element).Returns(_elementOne.Object);
_contextTwo.SetupGet(x => x.Element).Returns(_elementTwo.Object);
_elementOne.Setup(x => x.ReplaceWith(_elementTwo.Object)).Returns(_elementThree.Object);
_slotAndFiller = new SlotToFill(_contextOne.Object, _contextTwo.Object, _autoFixture.Create<string>());
_sut = new MacroExtensionSubstitutor();
}
#endregion
#region tests
[Test]
public void FillSlot_copies_define_slot_attribute_if_it_is_not_redefined()
{
// Arrange
_elementTwo
.Setup(x => x.SearchChildrenByAttribute(ZptConstants.Metal.Namespace, ZptConstants.Metal.DefineSlotAttribute))
.Returns(Enumerable.Empty<IZptElement>().ToArray());
// Act
_sut.FillSlot(_slotAndFiller);
// Assert
_elementThree.Verify(x => x.SetAttribute(ZptConstants.Metal.Namespace, ZptConstants.Metal.DefineSlotAttribute, _slotAndFiller.Name),
Times.Once());
}
[Test]
public void FillSlot_does_not_copy_define_slot_attribute_if_it_is_redefined()
{
_elementTwo
.Setup(x => x.SearchChildrenByAttribute(ZptConstants.Metal.Namespace, ZptConstants.Metal.DefineSlotAttribute))
.Returns(new [] {
Mock.Of<IZptElement>(x => x.GetAttribute(ZptConstants.Metal.Namespace, ZptConstants.Metal.DefineSlotAttribute).Value == _slotAndFiller.Name),
});
// Act
_sut.FillSlot(_slotAndFiller);
// Assert
_elementThree.Verify(x => x.SetAttribute(ZptConstants.Metal.Namespace, ZptConstants.Metal.DefineSlotAttribute, It.IsAny<string>()),
Times.Never());
}
#endregion
}
}
| using System;
using NUnit.Framework;
namespace Test.CSF.Zpt.Metal
{
[TestFixture]
public class TestMacroExtensionSubstitutor
{
#region tests
[Test]
[Ignore("This test needs to be written - see #182")]
public void FillSlot_copies_define_slot_attribute_if_it_is_not_redefined()
{
// Arrange
// Act
// Assert
}
[Test]
[Ignore("This test needs to be written - see #182")]
public void FillSlot_does_not_copt_define_slot_attribute_if_it_is_redefined()
{
// Arrange
// Act
// Assert
}
#endregion
}
}
| mit | C# |
f1c8aedc44ed0ce66d258cc2bceb38300bb89dc1 | load via Templates for file watcher | mcintyre321/Noodles,mcintyre321/Noodles | Noodles.Example.Web/App_Code/RegisterVirtualPathProvider.cs | Noodles.Example.Web/App_Code/RegisterVirtualPathProvider.cs | namespace Noodles.Example
{
public class RegisterVirtualPathProvider
{
public static void AppInitialize()
{
System.Web.Hosting.HostingEnvironment.RegisterVirtualPathProvider(new EmbeddedResourceVirtualPathProvider.Vpp()
{
{typeof(AspMvc.ActionResultExtension).Assembly, @"..\Noodles.AspMvc.Templates"} ,
{typeof(Mvc.JQuery.Datatables.DataTablesData).Assembly} ,
typeof(FormFactory.Logger).Assembly,
});
}
}
} | namespace Noodles.Example
{
public class RegisterVirtualPathProvider
{
public static void AppInitialize()
{
System.Web.Hosting.HostingEnvironment.RegisterVirtualPathProvider(new EmbeddedResourceVirtualPathProvider.Vpp()
{
{typeof(AspMvc.ActionResultExtension).Assembly, @"..\Noodles.AspMvc"} ,
{typeof(Mvc.JQuery.Datatables.DataTablesData).Assembly} ,
typeof(FormFactory.Logger).Assembly,
});
}
}
} | mit | C# |
53773caca0c3d770291b0b8f2173d57e031c5faa | use new name | sjrawlins/JobSearchScorecard | Droid/MainActivity.cs | Droid/MainActivity.cs | using System;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using JobSearchScorecard;
namespace JobSearchScorecard.Droid
{
[Activity (Label = "JobSearchScorecard.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
global::Xamarin.Forms.Forms.Init (this, bundle);
LoadApplication (new App ());
}
}
}
| using System;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace JobScorecard.Droid
{
[Activity (Label = "JobScorecard.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
global::Xamarin.Forms.Forms.Init (this, bundle);
LoadApplication (new App ());
}
}
}
| bsd-3-clause | C# |
03428f390c0cedf0bfd59510d1e7533451cb31b2 | Add Student support | aloisdg/edx-csharp | edX/Module4/Program.cs | edX/Module4/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Module4
{
class Program
{
struct Student
{
private readonly string _firstName;
private readonly string _lastName;
private readonly int _age;
private readonly DateTime _birthDate;
public Student(string firstName, string lastName, DateTime birthDate)
: this()
{
_firstName = firstName;
_lastName = lastName;
_birthDate = birthDate;
_age = (DateTime.Today.Year - birthDate.Year);
if (birthDate > DateTime.Today.AddYears(-_age)) _age--;
}
public string FirstName
{
get { return _firstName; }
}
public string LastName
{
get { return _lastName; }
}
public int Age
{
get { return _age; }
}
public DateTime BirthDate
{
get { return _birthDate; }
}
public override string ToString()
{
return FirstName + " "
+ LastName + " "
+ Age;
}
}
struct Teacher
{
private readonly string _firstName;
private readonly string _lastName;
private readonly int _age;
private readonly DateTime _birthDate;
public Teacher(string firstName, string lastName, DateTime birthDate)
: this()
{
_firstName = FirstName;
_lastName = LastName;
_birthDate = birthDate;
_age = (DateTime.Today.Year - birthDate.Year);
if (birthDate > DateTime.Today.AddYears(-_age)) _age--;
}
public string FirstName
{
get { return _firstName; }
}
public string LastName
{
get { return _lastName; }
}
public int Age
{
get { return _age; }
}
public DateTime BirthDate
{
get { return _birthDate; }
}
}
struct Prog
{
private readonly string _name;
public string Name
{
get { return _name; }
}
public Prog(string name)
{
_name = name;
}
}
static void Main()
{
var students = new[]
{
new Student("Harry", "Potter", new DateTime(1980, 7, 31)),
new Student("Ron", "Weasley", new DateTime(1980, 3, 1)),
new Student("Hermione", "Granger", new DateTime(1979, 9, 19)),
new Student("Fred", "Weasley", new DateTime(1978, 4, 1)),
new Student("George", "Weasley", new DateTime(1978, 4, 1)),
};
foreach (var student in students)
Console.WriteLine(student.ToString());
var teacher = new Teacher("Remus", "Lupin", new DateTime(1960, 3, 10));
var program = new Prog("edx");
Console.ReadLine();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Module4
{
class Program
{
static void Main(string[] args)
{
}
}
}
| mit | C# |
6fa0448036e44ef677957e8038e1dcb9936a1214 | Update _Footer.cshtml | reactiveui/website,reactiveui/website,reactiveui/website,reactiveui/website | input/_Footer.cshtml | input/_Footer.cshtml | <div class="container bottom-footer">
<div class="col-lg-10 col-sm-10 col-xs-12">
<ul class="list-inline">
<li class="list-inline-item">
<a href="/donate" target="_blank">Donate</a>
</li>
<li class="list-inline-item">
<a href="/sponsorship" target="_blank">Sponsorship</a>
</li>
<li class="list-inline-item">
<a href="/support" target="_blank">Support</a>
</li>
<li class="list-inline-item">
<a href="/stack-overflow" target="_blank">StackOverflow</a>
</li>
<li class="list-inline-item">
<a href="/branding" target="_blank">Branding</a>
</li>
<li>
<a href="/source-code" target="_blank">Source Code</a>
</li>
<li class="list-inline-item">
<a href="/docs" target="_blank">Documentation</a>
</li>
<li class="list-inline-item">
<a href="/changelog" target="_blank">Changelog</a>
</li>
</ul>
</div>
<div class="col-lg-2 col-sm-2 col-xs-12">
<a href="/"><img src="./assets/img/logo.png" width="64" height="64" class="footer-logo" ></a>
</div>
</div>
| <div class="container bottom-footer">
<div class="col-lg-10 col-sm-10 col-xs-12">
<ul class="list-inline">
<li class="list-inline-item">
<a href="/donate" target="_blank">Donate</a>
</li>
<li class="list-inline-item">
<a href="/sponsorship" target="_blank">Sponsorship</a>
</li>
<li class="list-inline-item">
<a href="/support" target="_blank">Support</a>
</li>
<li class="list-inline-item">
<a href="/stack-overflow" target="_blank">StackOverflow</a>
</li>
<li class="list-inline-item">
<a href="/branding" target="_blank">Branding</a>
</li>
<li>
<a href="/source-code" target="_blank">Source Code</a>
</li>
<li class="list-inline-item">
<a href="/docs" target="_blank">Documentation</a>
</li>
<li class="list-inline-item">
<a href="/changelog" target="_blank">Changelog</a>
</li>
</ul>
</div>
<div class="col-lg-2 col-sm-2 col-xs-12">
<a href="/"><img src="./assets/img/logo.png" class="footer-logo" ></a>
</div>
</div>
| mit | C# |
d1fbb5c8bb2e02a701014166ba8dff83f60e2a70 | Fix failed build | ndrmc/cats,ndrmc/cats,ndrmc/cats | Tests/Cats.Tests/ControllersTests/CurrencyControllerTest.cs | Tests/Cats.Tests/ControllersTests/CurrencyControllerTest.cs | using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Cats.Areas.EarlyWarning.Controllers;
using Cats.Areas.Settings.Controllers;
using Cats.Services.EarlyWarning;
using Kendo.Mvc.UI;
using Moq;
using NUnit.Framework;
using Cats.Models;
namespace Cats.Tests.ControllersTests
{ [TestFixture]
public class CurrencyControllerTest
{
private CurrencyController _currencyController;
#region Setup
[SetUp]
public void Init()
{
var currency = new List<Currency>
{
new Currency {CurrencyID =1,Code = "USD",Name = "US Dollar"},
new Currency {CurrencyID =2,Code = "URO",Name = "EURO"}
};
var currencyService = new Mock<ICurrencyService>();
currencyService.Setup(m => m.GetAllCurrency()).Returns(currency);
_currencyController=new CurrencyController(currencyService.Object);
}
[TearDown]
public void Dispose()
{
_currencyController.Dispose();
}
#endregion
#region Tests
[Test]
public void CanShowIndex()
{
var result = _currencyController.Index();
Assert.IsNotNull(result);
}
[Test]
public void CanCreateCurrency()
{
var result = _currencyController.Create();
Assert.IsNotNull(result);
}
[Test]
public void CanReadCUrrency()
{
var currency = new DataSourceRequest();
var result = _currencyController.Currency_Read(currency);
Assert.IsNotNull(result);
Assert.IsInstanceOf<JsonResult>(result);
//Assert.AreEqual(1, (((DataSourceResult)result.Data).Total));
}
[Test]
public void CanDeleteCurrency()
{
var id = 1;
var result = (RedirectToRouteResult)_currencyController.Delete(id);
Assert.IsNotNull(result);
//Assert.IsInstanceOf<ContributionDetail>(result.Model);
}
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Cats.Areas.EarlyWarning.Controllers;
using Cats.Services.EarlyWarning;
using Kendo.Mvc.UI;
using Moq;
using NUnit.Framework;
using Cats.Models;
namespace Cats.Tests.ControllersTests
{ [TestFixture]
public class CurrencyControllerTest
{
private CurrencyController _currencyController;
#region Setup
[SetUp]
public void Init()
{
var currency = new List<Currency>
{
new Currency {CurrencyID =1,Code = "USD",Name = "US Dollar"},
new Currency {CurrencyID =2,Code = "URO",Name = "EURO"}
};
var currencyService = new Mock<ICurrencyService>();
currencyService.Setup(m => m.GetAllCurrency()).Returns(currency);
_currencyController=new CurrencyController(currencyService.Object);
}
[TearDown]
public void Dispose()
{
_currencyController.Dispose();
}
#endregion
#region Tests
[Test]
public void CanShowIndex()
{
var result = _currencyController.Index();
Assert.IsNotNull(result);
}
[Test]
public void CanCreateCurrency()
{
var result = _currencyController.Create();
Assert.IsNotNull(result);
}
[Test]
public void CanReadCUrrency()
{
var currency = new DataSourceRequest();
var result = _currencyController.Currency_Read(currency);
Assert.IsNotNull(result);
Assert.IsInstanceOf<JsonResult>(result);
//Assert.AreEqual(1, (((DataSourceResult)result.Data).Total));
}
[Test]
public void CanDeleteCurrency()
{
var id = 1;
var result = (RedirectToRouteResult)_currencyController.Delete(id);
Assert.IsNotNull(result);
//Assert.IsInstanceOf<ContributionDetail>(result.Model);
}
#endregion
}
}
| apache-2.0 | C# |
653a2cc02ab1b6c97f336865bb226fc94a08d6f9 | fix typo | DelcoigneYves/Xamarin.GoogleAnalytics | build.cake | build.cake | #addin nuget:https://nuget.org/api/v2/?package=Cake.FileHelpers&version=1.0.3.2
#addin nuget:https://nuget.org/api/v2/?package=Cake.Xamarin&version=1.2.3
var TARGET = Argument ("target", Argument ("t", "Default"));
var version = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");
var libraries = new Dictionary<string, string> {
{ "./src/Analytics.sln", "Any" },
};
var samples = new Dictionary<string, string> {
{ "./Sample/Sample.sln", "Win" },
};
var BuildAction = new Action<Dictionary<string, string>> (solutions =>
{
foreach (var sln in solutions)
{
// If the platform is Any build regardless
// If the platform is Win and we are running on windows build
// If the platform is Mac and we are running on Mac, build
if ((sln.Value == "Any")
|| (sln.Value == "Win" && IsRunningOnWindows ())
|| (sln.Value == "Mac" && IsRunningOnUnix ()))
{
// Bit of a hack to use nuget3 to restore packages for project.json
if (IsRunningOnWindows ())
{
Information ("RunningOn: {0}", "Windows");
NuGetRestore (sln.Key, new NuGetRestoreSettings
{
ToolPath = "./tools/nuget3.exe"
});
// Windows Phone / Universal projects require not using the amd64 msbuild
MSBuild (sln.Key, c =>
{
c.Configuration = "Release";
c.MSBuildPlatform = Cake.Common.Tools.MSBuild.MSBuildPlatform.x86;
});
}
else
{
// Mac is easy ;)
NuGetRestore (sln.Key);
DotNetBuild (sln.Key, c => c.Configuration = "Release");
}
}
}
});
Task("Libraries").Does(()=>
{
BuildAction(libraries);
});
Task("Samples")
.IsDependentOn("Libraries")
.Does(()=>
{
BuildAction(samples);
});
Task ("NuGet")
.IsDependentOn ("Samples")
.Does (() =>
{
if(!DirectoryExists("./Build/nuget/"))
CreateDirectory("./Build/nuget");
NuGetPack ("./nuget/Analytics.nuspec", new NuGetPackSettings {
Version = version,
Verbosity = NuGetVerbosity.Detailed,
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);
| #addin nuget:https://nuget.org/api/v2/?package=Cake.FileHelpers&version=1.0.3.2
#addin nuget:https://nuget.org/api/v2/?package=Cake.Xamarin&version=1.2.3
var TARGET = Argument ("target", Argument ("t", "Default"));
var version = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");
var libraries = new Dictionary<string, string> {
{ "./src/Analytics.sln", "Any" },
};
var samples = new Dictionary<string, string> {
{ "./samples/Sample.sln", "Win" },
};
var BuildAction = new Action<Dictionary<string, string>> (solutions =>
{
foreach (var sln in solutions)
{
// If the platform is Any build regardless
// If the platform is Win and we are running on windows build
// If the platform is Mac and we are running on Mac, build
if ((sln.Value == "Any")
|| (sln.Value == "Win" && IsRunningOnWindows ())
|| (sln.Value == "Mac" && IsRunningOnUnix ()))
{
// Bit of a hack to use nuget3 to restore packages for project.json
if (IsRunningOnWindows ())
{
Information ("RunningOn: {0}", "Windows");
NuGetRestore (sln.Key, new NuGetRestoreSettings
{
ToolPath = "./tools/nuget3.exe"
});
// Windows Phone / Universal projects require not using the amd64 msbuild
MSBuild (sln.Key, c =>
{
c.Configuration = "Release";
c.MSBuildPlatform = Cake.Common.Tools.MSBuild.MSBuildPlatform.x86;
});
}
else
{
// Mac is easy ;)
NuGetRestore (sln.Key);
DotNetBuild (sln.Key, c => c.Configuration = "Release");
}
}
}
});
Task("Libraries").Does(()=>
{
BuildAction(libraries);
});
Task("Samples")
.IsDependentOn("Libraries")
.Does(()=>
{
BuildAction(samples);
});
Task ("NuGet")
.IsDependentOn ("Samples")
.Does (() =>
{
if(!DirectoryExists("./Build/nuget/"))
CreateDirectory("./Build/nuget");
NuGetPack ("./nuget/Analytics.nuspec", new NuGetPackSettings {
Version = version,
Verbosity = NuGetVerbosity.Detailed,
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# |
c930f10770f173a62e09f169715a4ea18f06f9bb | Reduce requirements of code coverage due to platform specific behaviors | SceneGate/Yarhl | build.cake | build.cake | #load "nuget:?package=PleOps.Cake&version=0.7.0"
Task("Define-Project")
.Description("Fill specific project information")
.Does<BuildInfo>(info =>
{
info.CoverageTarget = 90; // can't be 100 due to platform-specific code paths
info.AddLibraryProjects("Yarhl");
info.AddLibraryProjects("Yarhl.Media");
info.AddTestProjects("Yarhl.UnitTests");
info.AddTestProjects("Yarhl.IntegrationTests");
info.PreviewNuGetFeed = "https://pkgs.dev.azure.com/SceneGate/SceneGate/_packaging/SceneGate-Preview/nuget/v3/index.json";
});
Task("Prepare-IntegrationTests")
.Description("Prepare the integration tests by copying an example of DLL")
.IsDependeeOf("Test")
.Does<BuildInfo>(info =>
{
// Copy a good and bad plugin to test the assembly load logic
string pluginPath = $"src/Yarhl.Media/bin/{info.Configuration}/net6.0/Yarhl.Media.dll";
string badPluginPath = info.SolutionFile; // this isn't a DLL for sure :D
string outputBasePath = $"src/Yarhl.IntegrationTests/bin/{info.Configuration}";
string testProjectPath = "src/Yarhl.IntegrationTests/Yarhl.IntegrationTests.csproj";
foreach (string framework in GetTargetFrameworks(testProjectPath)) {
string pluginDir = $"{outputBasePath}/{framework}/Plugins";
CreateDirectory(pluginDir);
CopyFile(pluginPath, $"{pluginDir}/Yarhl.Media.dll");
CopyFile(badPluginPath, $"{pluginDir}/MyBadPlugin.dll");
}
});
public IEnumerable<string> GetTargetFrameworks(string projectPath)
{
var projectXml = System.Xml.Linq.XDocument.Load(projectPath).Root;
List<string> frameworks = projectXml.Elements("PropertyGroup")
.Where(x => x.Element("TargetFrameworks") != null)
.SelectMany(x => x.Element("TargetFrameworks").Value.Split(';'))
.ToList();
string singleFramework = projectXml.Elements("PropertyGroup")
.Select(x => x.Element("TargetFramework")?.Value)
.FirstOrDefault();
if (singleFramework != null && !frameworks.Contains(singleFramework)) {
frameworks.Add(singleFramework);
}
return frameworks;
}
Task("Default")
.IsDependentOn("Stage-Artifacts");
string target = Argument("target", "Default");
RunTarget(target);
| #load "nuget:?package=PleOps.Cake&version=0.7.0"
Task("Define-Project")
.Description("Fill specific project information")
.Does<BuildInfo>(info =>
{
info.AddLibraryProjects("Yarhl");
info.AddLibraryProjects("Yarhl.Media");
info.AddTestProjects("Yarhl.UnitTests");
info.AddTestProjects("Yarhl.IntegrationTests");
info.PreviewNuGetFeed = "https://pkgs.dev.azure.com/SceneGate/SceneGate/_packaging/SceneGate-Preview/nuget/v3/index.json";
});
Task("Prepare-IntegrationTests")
.Description("Prepare the integration tests by copying an example of DLL")
.IsDependeeOf("Test")
.Does<BuildInfo>(info =>
{
// Copy a good and bad plugin to test the assembly load logic
string pluginPath = $"src/Yarhl.Media/bin/{info.Configuration}/net6.0/Yarhl.Media.dll";
string badPluginPath = info.SolutionFile; // this isn't a DLL for sure :D
string outputBasePath = $"src/Yarhl.IntegrationTests/bin/{info.Configuration}";
string testProjectPath = "src/Yarhl.IntegrationTests/Yarhl.IntegrationTests.csproj";
foreach (string framework in GetTargetFrameworks(testProjectPath)) {
string pluginDir = $"{outputBasePath}/{framework}/Plugins";
CreateDirectory(pluginDir);
CopyFile(pluginPath, $"{pluginDir}/Yarhl.Media.dll");
CopyFile(badPluginPath, $"{pluginDir}/MyBadPlugin.dll");
}
});
public IEnumerable<string> GetTargetFrameworks(string projectPath)
{
var projectXml = System.Xml.Linq.XDocument.Load(projectPath).Root;
List<string> frameworks = projectXml.Elements("PropertyGroup")
.Where(x => x.Element("TargetFrameworks") != null)
.SelectMany(x => x.Element("TargetFrameworks").Value.Split(';'))
.ToList();
string singleFramework = projectXml.Elements("PropertyGroup")
.Select(x => x.Element("TargetFramework")?.Value)
.FirstOrDefault();
if (singleFramework != null && !frameworks.Contains(singleFramework)) {
frameworks.Add(singleFramework);
}
return frameworks;
}
Task("Default")
.IsDependentOn("Stage-Artifacts");
string target = Argument("target", "Default");
RunTarget(target);
| mit | C# |
7c7f482d413411915be73a50bf05f669ecb80b1e | add description in assemblyinfo | FrankyBoy/idgen.net | idgen.net/Properties/AssemblyInfo.cs | idgen.net/Properties/AssemblyInfo.cs | using System.Resources;
using System.Reflection;
// 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("idgen.net")]
[assembly: AssemblyDescription("generator and validator for spanish NIE/NIF numbers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("idgen.net")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Resources;
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("idgen.net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("idgen.net")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| apache-2.0 | C# |
a80efc0a74d868f0d6e118c36a45e1567ec0f7c2 | Update AssemblyInfo version from 31 to 33 | ITGlobal/CefSharp,jamespearce2006/CefSharp,ruisebastiao/CefSharp,rover886/CefSharp,joshvera/CefSharp,illfang/CefSharp,zhangjingpu/CefSharp,Haraguroicha/CefSharp,battewr/CefSharp,jamespearce2006/CefSharp,AJDev77/CefSharp,jamespearce2006/CefSharp,haozhouxu/CefSharp,illfang/CefSharp,AJDev77/CefSharp,Livit/CefSharp,ITGlobal/CefSharp,VioletLife/CefSharp,VioletLife/CefSharp,Livit/CefSharp,joshvera/CefSharp,wangzheng888520/CefSharp,rlmcneary2/CefSharp,ruisebastiao/CefSharp,jamespearce2006/CefSharp,yoder/CefSharp,rover886/CefSharp,VioletLife/CefSharp,Haraguroicha/CefSharp,wangzheng888520/CefSharp,dga711/CefSharp,battewr/CefSharp,windygu/CefSharp,Haraguroicha/CefSharp,jamespearce2006/CefSharp,VioletLife/CefSharp,joshvera/CefSharp,NumbersInternational/CefSharp,yoder/CefSharp,gregmartinhtc/CefSharp,twxstar/CefSharp,rlmcneary2/CefSharp,gregmartinhtc/CefSharp,ITGlobal/CefSharp,ruisebastiao/CefSharp,rlmcneary2/CefSharp,NumbersInternational/CefSharp,zhangjingpu/CefSharp,zhangjingpu/CefSharp,ITGlobal/CefSharp,twxstar/CefSharp,Livit/CefSharp,haozhouxu/CefSharp,rover886/CefSharp,AJDev77/CefSharp,twxstar/CefSharp,windygu/CefSharp,gregmartinhtc/CefSharp,illfang/CefSharp,Octopus-ITSM/CefSharp,wangzheng888520/CefSharp,joshvera/CefSharp,haozhouxu/CefSharp,yoder/CefSharp,dga711/CefSharp,zhangjingpu/CefSharp,ruisebastiao/CefSharp,illfang/CefSharp,rlmcneary2/CefSharp,wangzheng888520/CefSharp,yoder/CefSharp,rover886/CefSharp,twxstar/CefSharp,dga711/CefSharp,battewr/CefSharp,windygu/CefSharp,Octopus-ITSM/CefSharp,haozhouxu/CefSharp,Haraguroicha/CefSharp,NumbersInternational/CefSharp,windygu/CefSharp,Haraguroicha/CefSharp,AJDev77/CefSharp,Livit/CefSharp,Octopus-ITSM/CefSharp,battewr/CefSharp,Octopus-ITSM/CefSharp,dga711/CefSharp,rover886/CefSharp,gregmartinhtc/CefSharp,NumbersInternational/CefSharp | CefSharp/Properties/AssemblyInfo.cs | CefSharp/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CefSharp;
using System;
[assembly: AssemblyTitle("CefSharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCompany(AssemblyInfo.AssemblyCompany)]
[assembly: AssemblyProduct(AssemblyInfo.AssemblyProduct)]
[assembly: AssemblyCopyright(AssemblyInfo.AssemblyCopyright)]
[assembly: ComVisible(AssemblyInfo.ComVisible)]
[assembly: AssemblyVersion(AssemblyInfo.AssemblyVersion)]
[assembly: AssemblyFileVersion(AssemblyInfo.AssemblyFileVersion)]
[assembly: CLSCompliant(AssemblyInfo.ClsCompliant)]
[assembly: InternalsVisibleTo(AssemblyInfo.CefSharpCoreProject)]
[assembly: InternalsVisibleTo(AssemblyInfo.CefSharpBrowserSubprocessProject)]
[assembly: InternalsVisibleTo(AssemblyInfo.CefSharpWpfProject)]
[assembly: InternalsVisibleTo(AssemblyInfo.CefSharpWinFormsProject)]
[assembly: InternalsVisibleTo(AssemblyInfo.CefSharpTestProject)]
namespace CefSharp
{
public static class AssemblyInfo
{
public const bool ClsCompliant = false;
public const bool ComVisible = false;
public const string AssemblyCompany = "The CefSharp Authors";
public const string AssemblyProduct = "CefSharp";
public const string AssemblyVersion = "33.0.0.0";
public const string AssemblyFileVersion = "33.0.0.0";
public const string AssemblyCopyright = "Copyright © The CefSharp Authors 2010-2014";
public const string CefSharpCoreProject = "CefSharp.Core, PublicKey=" + PublicKey;
public const string CefSharpBrowserSubprocessProject = "CefSharp.BrowserSubprocess, PublicKey=" + PublicKey;
public const string CefSharpWpfProject = "CefSharp.Wpf, PublicKey=" + PublicKey;
public const string CefSharpWinFormsProject = "CefSharp.WinForms, PublicKey=" + PublicKey;
public const string CefSharpTestProject = "CefSharp.Test, PublicKey=" + PublicKey;
// Use "%ProgramFiles%\Microsoft SDKs\Windows\v7.0A\bin\sn.exe" -Tp <assemblyname> to get PublicKey
public const string PublicKey = "0024000004800000940000000602000000240000525341310004000001000100c5ddf5d063ca8e695d4b8b5ad76634f148db9a41badaed8850868b75f916e313f15abb62601d658ce2bed877d73314d5ed202019156c21033983fed80ce994a325b5d4d93b0f63a86a1d7db49800aa5638bb3fd98f4a33cceaf8b8ba1800b7d7bff67b72b90837271491b61c91ef6d667be0521ce171f77e114fc2bbcfd185d3";
}
}
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CefSharp;
using System;
[assembly: AssemblyTitle("CefSharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCompany(AssemblyInfo.AssemblyCompany)]
[assembly: AssemblyProduct(AssemblyInfo.AssemblyProduct)]
[assembly: AssemblyCopyright(AssemblyInfo.AssemblyCopyright)]
[assembly: ComVisible(AssemblyInfo.ComVisible)]
[assembly: AssemblyVersion(AssemblyInfo.AssemblyVersion)]
[assembly: AssemblyFileVersion(AssemblyInfo.AssemblyFileVersion)]
[assembly: CLSCompliant(AssemblyInfo.ClsCompliant)]
[assembly: InternalsVisibleTo(AssemblyInfo.CefSharpCoreProject)]
[assembly: InternalsVisibleTo(AssemblyInfo.CefSharpBrowserSubprocessProject)]
[assembly: InternalsVisibleTo(AssemblyInfo.CefSharpWpfProject)]
[assembly: InternalsVisibleTo(AssemblyInfo.CefSharpWinFormsProject)]
[assembly: InternalsVisibleTo(AssemblyInfo.CefSharpTestProject)]
namespace CefSharp
{
public static class AssemblyInfo
{
public const bool ClsCompliant = false;
public const bool ComVisible = false;
public const string AssemblyCompany = "The CefSharp Authors";
public const string AssemblyProduct = "CefSharp";
public const string AssemblyVersion = "31.0.0.0";
public const string AssemblyFileVersion = "31.0.0.0";
public const string AssemblyCopyright = "Copyright © The CefSharp Authors 2010-2014";
public const string CefSharpCoreProject = "CefSharp.Core, PublicKey=" + PublicKey;
public const string CefSharpBrowserSubprocessProject = "CefSharp.BrowserSubprocess, PublicKey=" + PublicKey;
public const string CefSharpWpfProject = "CefSharp.Wpf, PublicKey=" + PublicKey;
public const string CefSharpWinFormsProject = "CefSharp.WinForms, PublicKey=" + PublicKey;
public const string CefSharpTestProject = "CefSharp.Test, PublicKey=" + PublicKey;
// Use "%ProgramFiles%\Microsoft SDKs\Windows\v7.0A\bin\sn.exe" -Tp <assemblyname> to get PublicKey
public const string PublicKey = "0024000004800000940000000602000000240000525341310004000001000100c5ddf5d063ca8e695d4b8b5ad76634f148db9a41badaed8850868b75f916e313f15abb62601d658ce2bed877d73314d5ed202019156c21033983fed80ce994a325b5d4d93b0f63a86a1d7db49800aa5638bb3fd98f4a33cceaf8b8ba1800b7d7bff67b72b90837271491b61c91ef6d667be0521ce171f77e114fc2bbcfd185d3";
}
}
| bsd-3-clause | C# |
ec47333b52d3a1796d419f31bd59ecbb9eb8a264 | Update DocumentView.cs | Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Core2D.Editor/Views/DocumentView.cs | src/Core2D.Editor/Views/DocumentView.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;
namespace Core2D.Editor.Views
{
/// <summary>
/// Document view.
/// </summary>
public class DocumentView : ViewBase<ProjectEditor>
{
private readonly IServiceProvider _serviceProvider;
private Lazy<ProjectEditor> _context;
/// <inheritdoc/>
public override string Title => "Document";
/// <inheritdoc/>
public override object Context => _context.Value;
/// <summary>
/// Initialize new instance of <see cref="DocumentView"/> class.
/// </summary>
/// <param name="serviceProvider">The service provider.</param>
public DocumentView(IServiceProvider serviceProvider) : base()
{
_serviceProvider = serviceProvider;
_context = serviceProvider.GetServiceLazily<ProjectEditor>();
}
}
}
| // 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;
namespace Core2D.Editor.Views
{
/// <summary>
/// Document view.
/// </summary>
public class DocumentView : ViewBase<ProjectEditor>
{
private readonly IServiceProvider _serviceProvider;
private Lazy<ProjectEditor> _context;
/// <inheritdoc/>
public override string Name => "Document";
/// <inheritdoc/>
public override object Context => _context.Value;
/// <summary>
/// Initialize new instance of <see cref="DocumentView"/> class.
/// </summary>
/// <param name="serviceProvider">The service provider.</param>
public DocumentView(IServiceProvider serviceProvider) : base()
{
_serviceProvider = serviceProvider;
_context = serviceProvider.GetServiceLazily<ProjectEditor>();
}
}
}
| mit | C# |
40eca9566125da5ee6d498445feba9e37e5ef373 | Fix build. | space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content | Content.Client/Chat/ChatFilterUI.cs | Content.Client/Chat/ChatFilterUI.cs | using Robust.Client.Graphics;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Utility;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
using Content.Client.Chat;
namespace Content.Client.Chat
{
public class ChatFilterUI : SS14Window
{
protected override void Initialize()
{
base.Initialize();
Title = "Filter Channels";
var margin = new MarginContainer()
{
MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,
};
margin.SetAnchorAndMarginPreset(LayoutPreset.TopRight);
var vbox = new VBoxContainer();
vbox.SetAnchorAndMarginPreset(LayoutPreset.TopRight);
var descMargin = new MarginContainer()
{
MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsStretchRatio = 2,
};
var hbox = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
};
var vboxInfo = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 3,
};
}
}
}
| using Robust.Client.Graphics;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Utility;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
using Content.Client.Chat;
namespace Content.Client.Chat
{
public class ChatFilterUI : SS14Window
{
protected override void Initialize()
{
base.Initialize();
HideOnClose = true;
Title = "Filter Channels";
Visible = false;
var margin = new MarginContainer()
{
MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,
};
margin.SetAnchorAndMarginPreset(LayoutPreset.TopRight);
var vbox = new VBoxContainer();
vbox.SetAnchorAndMarginPreset(LayoutPreset.TopRight);
var descMargin = new MarginContainer()
{
MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsStretchRatio = 2,
};
var hbox = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
};
var vboxInfo = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 3,
};
}
}
} | mit | C# |
139c2eba32f79fb1f67c04179a74110eeb514d86 | Update test.csx | palladin/MBrace.Core,mbraceproject/MBrace.Core,palladin/MBrace.Core,dsyme/MBrace.Core,dsyme/MBrace.Core,mbraceproject/MBrace.Core | src/MBrace.Thespian/test.csx | src/MBrace.Thespian/test.csx | #r "../../bin/FSharp.Core.dll"
#r "../../bin/FsPickler.dll"
#r "../../bin/Vagabond.dll"
#r "../../bin/Argu.dll"
#r "../../bin/Newtonsoft.Json.dll"
#r "../../bin/MBrace.Core.dll"
#r "../../bin/MBrace.Runtime.dll"
#r "../../bin/MBrace.Thespian.dll"
#r "../../bin/MBrace.Flow.dll"
#r "../../bin/MBrace.Flow.CSharp.dll"
#r "../../bin/Streams.dll"
// before running sample, don't forget to set binding redirects to FSharp.Core in InteractiveHost.exe
using System;
using MBrace.Core;
using MBrace.Library;
using MBrace.Thespian;
using MBrace.Flow.CSharp;
ThespianWorker.LocalExecutable = "../../bin/mbrace.thespian.worker.exe";
var cluster = ThespianCluster.InitOnCurrentMachine(4);
var url = "http://publicdata.landregistry.gov.uk/market-trend-data/price-paid-data/a/pp-2015.csv";
var flow = CloudFlow.OfHTTPFileByLine(url)
.Select(line => line.Split(new[] { ',' }))
.Select(arr => new { TransactionId = arr[0], Price = arr[1], City = arr[12] })
.Where(housePrice => housePrice.City.Contains("LONDON"))
.Take(10)
.ToArray();
var result = cluster.Run(flow);
| #r "../../bin/FSharp.Core.dll"
#r "../../bin/FsPickler.dll"
#r "../../bin/Vagabond.dll"
#r "../../bin/Argu.dll"
#r "../../bin/Newtonsoft.Json.dll"
#r "../../bin/MBrace.Core.dll"
#r "../../bin/MBrace.Runtime.dll"
#r "../../bin/MBrace.Thespian.dll"
#r "../../bin/MBrace.Flow.dll"
#r "../../bin/MBrace.Flow.CSharp.dll"
#r "../../bin/Streams.dll"
// before running sample, don't forget to set binding redirects to FSharp.Core in InteractiveHost.exe
using System;
using MBrace.Core;
using MBrace.Library;
using MBrace.Thespian;
using MBrace.Flow.CSharp;
ThespianWorker.LocalExecutable = "../../bin/mbrace.thespian.worker.exe";
var cluster = ThespianCluster.InitOnCurrentMachine(4);
var flow = CloudFlow.OfArray(new[] { 1, 2, 3 })
.Select(x => x + 1)
.Where(x => x % 2 == 0)
.ToArray();
var result = cluster.Run(flow);
| apache-2.0 | C# |
a5a025de6867edbfb70cf13df58353da4ea044cc | Add proper tests | UselessToucan/osu,ppy/osu,NeoAdonis/osu,ppy/osu,2yangk23/osu,peppy/osu-new,johnneijzen/osu,peppy/osu,peppy/osu,johnneijzen/osu,NeoAdonis/osu,2yangk23/osu,ZLima12/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,EVAST9919/osu,UselessToucan/osu,ZLima12/osu,smoogipoo/osu,smoogipooo/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,EVAST9919/osu | osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs | osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Overlays.Profile.Sections;
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneShowMoreButton : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ShowMoreButton),
};
public TestSceneShowMoreButton()
{
ShowMoreButton button = null;
int fireCount = 0;
Add(button = new ShowMoreButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Action = () =>
{
fireCount++;
// ReSharper disable once AccessToModifiedClosure
// ReSharper disable once PossibleNullReferenceException
Scheduler.AddDelayed(() => button.IsLoading = false, 2000);
}
});
AddStep("click button", () => button.Click());
AddAssert("action fired once", () => fireCount == 1);
AddAssert("is in loading state", () => button.IsLoading);
AddStep("click button", () => button.Click());
AddAssert("action not fired", () => fireCount == 1);
AddAssert("is in loading state", () => button.IsLoading);
AddUntilStep("wait for loaded", () => !button.IsLoading);
AddStep("click button", () => button.Click());
AddAssert("action fired twice", () => fireCount == 2);
AddAssert("is in loading state", () => button.IsLoading);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Overlays.Profile.Sections;
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneShowMoreButton : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ShowMoreButton),
};
public TestSceneShowMoreButton()
{
ShowMoreButton button;
Add(button = new ShowMoreButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Action = () => { }
});
AddStep("switch loading state", () => button.IsLoading = !button.IsLoading);
}
}
}
| mit | C# |
e3f8883713d8bb1479030992fd44d540b3f60f97 | Add debris pickup behavior | zorbathut/luminance | Assets/Script/Notamari.cs | Assets/Script/Notamari.cs | using UnityEngine;
using UnityEngine.Assertions;
using System.Collections;
public class Notamari : MonoBehaviour
{
public Transform m_CameraAnchor;
public float m_MovementForce = 10f;
Rigidbody m_RigidBody;
void Start()
{
Assert.IsNotNull(m_CameraAnchor);
m_RigidBody = GetComponent<Rigidbody>();
Assert.IsNotNull(m_RigidBody);
}
void OnCollisionEnter(Collision collision)
{
Debris debris = collision.gameObject.GetComponent<Debris>();
if (debris)
{
Debug.Log("Collided with debris!");
// Wipe the debris' rigid body so it becomes part of us
Destroy(collision.gameObject.GetComponent<Rigidbody>());
// Make it a child of us
collision.gameObject.transform.SetParent(transform);
// Now it's hard to move around!
// Yay!
// YAY.
}
}
void FixedUpdate()
{
m_RigidBody.AddForce(new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")) * m_MovementForce);
}
void Update()
{
if (m_CameraAnchor)
{
// Move the camera along with the sphere; it's not a child of the sphere so we don't have to muck about with undoing rotations
m_CameraAnchor.transform.position = new Vector3(transform.position.x, 0f, transform.position.z);
}
}
}
| using UnityEngine;
using UnityEngine.Assertions;
using System.Collections;
public class Notamari : MonoBehaviour
{
public Transform m_CameraAnchor;
public float m_MovementForce = 10f;
Rigidbody m_RigidBody;
void Start()
{
Assert.IsNotNull(m_CameraAnchor);
m_RigidBody = GetComponent<Rigidbody>();
Assert.IsNotNull(m_RigidBody);
}
void FixedUpdate()
{
m_RigidBody.AddForce(new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")) * m_MovementForce);
}
void Update()
{
if (m_CameraAnchor)
{
// Move the camera along with the sphere; it's not a child of the sphere so we don't have to muck about with undoing rotations
m_CameraAnchor.transform.position = new Vector3(transform.position.x, 0f, transform.position.z);
}
}
}
| mit | C# |
a50b69ea22a26d7dfa6ba67de3ee18c7cbc2a6ff | Update RyanDavis.cs | beraybentesen/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,MabroukENG/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin,beraybentesen/planetxamarin | src/Firehose.Web/Authors/RyanDavis.cs | src/Firehose.Web/Authors/RyanDavis.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class RyanDavis : IAmAXamarinMVP, IFilterMyBlogPosts
{
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://ryandavis.io/rss/"); }
}
public string FirstName => "Ryan";
public string LastName => "Davis";
public string StateOrRegion => "Brisbane, Australia";
public string EmailAddress => "ryandavis.au@gmail.com";
public string ShortBioOrTagLine => "knows how to 🎉";
public Uri WebSite => new Uri("http://ryandavis.io");
public string TwitterHandle => "rdavis_au";
public string GitHubHandle => string.Empty;
public string GravatarHash => "d351762ec451e252b20ff860dfcded91d351762ec451e252b20ff860dfcded91";
public GeoPosition Position => new GeoPosition(-27.4697710, 153.0251240);
public bool Filter(SyndicationItem item)
=> item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("xamarin"));
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class RyanDavis : IAmAXamarinMVP, IFilterMyBlogPosts
{
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://ryandavis.io/rss/"); }
}
public string FirstName => "Ryan";
public string LastName => "Davis";
public string StateOrRegion => "Brisbane, Australia";
public string EmailAddress => "ryandavis.au@gmail.com";
public string ShortBioOrTagLine => "🎉";
public Uri WebSite => new Uri("http://ryandavis.io");
public string TwitterHandle => "rdavis_au";
public string GitHubHandle => string.Empty;
public string GravatarHash => "d351762ec451e252b20ff860dfcded91d351762ec451e252b20ff860dfcded91";
public GeoPosition Position => new GeoPosition(-27.4697710, 153.0251240);
public bool Filter(SyndicationItem item)
=> item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("xamarin"));
}
} | mit | C# |
338e5284dc991332b88d2ef28dd93b17efe2ed82 | Update #283 - Remove unneed usign statements | Glimpse/Glimpse,sorenhl/Glimpse,codevlabs/Glimpse,codevlabs/Glimpse,Glimpse/Glimpse,dudzon/Glimpse,flcdrg/Glimpse,paynecrl97/Glimpse,rho24/Glimpse,rho24/Glimpse,gabrielweyer/Glimpse,codevlabs/Glimpse,gabrielweyer/Glimpse,SusanaL/Glimpse,sorenhl/Glimpse,sorenhl/Glimpse,elkingtonmcb/Glimpse,paynecrl97/Glimpse,elkingtonmcb/Glimpse,Glimpse/Glimpse,dudzon/Glimpse,dudzon/Glimpse,rho24/Glimpse,elkingtonmcb/Glimpse,paynecrl97/Glimpse,flcdrg/Glimpse,SusanaL/Glimpse,paynecrl97/Glimpse,rho24/Glimpse,gabrielweyer/Glimpse,SusanaL/Glimpse,flcdrg/Glimpse | source/Glimpse.EF/Inspector/EntityFrameworkInspector.cs | source/Glimpse.EF/Inspector/EntityFrameworkInspector.cs | using Glimpse.Core.Extensibility;
using Glimpse.EF.Inspector.Core;
namespace Glimpse.EF.Inspector
{
public class EntityFrameworkInspector : IInspector
{
public void Setup(IInspectorContext context)
{
EntityFrameworkExecutionBlock.Instance.Execute();
}
}
} | using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Config;
using System.Reflection;
using Glimpse.Core.Extensibility;
using Glimpse.EF.AlternateType;
using Glimpse.EF.Inspector.Core;
namespace Glimpse.EF.Inspector
{
public class EntityFrameworkInspector : IInspector
{
public void Setup(IInspectorContext context)
{
EntityFrameworkExecutionBlock.Instance.Execute();
}
}
} | apache-2.0 | C# |
3369df540ddfc46981980fe6dbc308968d0652f3 | Update ClickTabOrPillAttribute trigger | atata-framework/atata-bootstrap,atata-framework/atata-bootstrap | src/Atata.Bootstrap/Triggers/ClickTabOrPillAttribute.cs | src/Atata.Bootstrap/Triggers/ClickTabOrPillAttribute.cs | using System;
using OpenQA.Selenium;
namespace Atata.Bootstrap
{
public class ClickTabOrPillAttribute : TriggerAttribute
{
private bool isInitialized;
private UIComponent navItemComponent;
public ClickTabOrPillAttribute(TriggerEvents on = TriggerEvents.BeforeAccess, TriggerPriority priority = TriggerPriority.Medium)
: base(on, priority)
{
}
private void Init<TOwner>(TriggerContext<TOwner> context)
where TOwner : PageObject<TOwner>
{
var tabPane = context.Component.GetAncestorOrSelf<BSTabPane<TOwner>>() as IUIComponent<TOwner>;
if (tabPane == null)
throw new InvalidOperationException($"Cannot find '{nameof(BSTabPane<TOwner>)}' ancestor.");
string tabPillInnerXPath = $".//a[@href='#{tabPane.Attributes.Id.Value}']";
string pillXPath = UIComponentResolver.GetControlDefinition(typeof(BSPill<TOwner>)).ScopeXPath;
bool isUsingPill = tabPane.Parent.Scope.Exists(By.XPath($".//{pillXPath}[{tabPillInnerXPath}]").SafelyAtOnce());
var findAttribute = new FindByInnerXPathAttribute(tabPillInnerXPath);
navItemComponent = isUsingPill
? (UIComponent)tabPane.Parent.Controls.Create<BSPill<TOwner>>(context.Component.Parent.ComponentName, findAttribute)
: tabPane.Parent.Controls.Create<BSTab<TOwner>>(context.Component.Parent.ComponentName, findAttribute);
isInitialized = true;
}
protected override void Execute<TOwner>(TriggerContext<TOwner> context)
{
if (!isInitialized)
Init(context);
BSNavItem<TOwner> navItem = (BSNavItem<TOwner>)navItemComponent;
if (!navItem.IsActive)
navItem.Click();
}
}
}
| using System;
using OpenQA.Selenium;
namespace Atata.Bootstrap
{
public class ClickTabOrPillAttribute : TriggerAttribute
{
private bool isInitialized;
private UIComponent navItemComponent;
public ClickTabOrPillAttribute(TriggerEvents on = TriggerEvents.BeforeAccess, TriggerPriority priority = TriggerPriority.Medium)
: base(on, priority)
{
}
private void Init<TOwner>(TriggerContext<TOwner> context)
where TOwner : PageObject<TOwner>
{
var tabPane = context.Component.GetAncestorOrSelf<BSTabPane<TOwner>>() as IUIComponent<TOwner>;
if (tabPane == null)
throw new InvalidOperationException($"Cannot find '{nameof(BSTabPane<TOwner>)}' ancestor.");
string tabPillInnerXPath = $".//a[@href='#{tabPane.Attributes.Id.Value}']";
string pillXPath = UIComponentResolver.GetControlDefinition(typeof(BSPill<TOwner>)).ScopeXPath;
bool isUsingPill = tabPane.Parent.Scope.Exists(By.XPath($"{pillXPath}[{tabPillInnerXPath}]").SafelyAtOnce());
var findAttribute = new FindByInnerXPathAttribute(tabPillInnerXPath);
navItemComponent = isUsingPill
? (UIComponent)tabPane.Parent.Controls.Create<BSPill<TOwner>>(context.Component.Parent.ComponentName, findAttribute)
: tabPane.Parent.Controls.Create<BSTab<TOwner>>(context.Component.Parent.ComponentName, findAttribute);
isInitialized = true;
}
protected override void Execute<TOwner>(TriggerContext<TOwner> context)
{
if (!isInitialized)
Init(context);
BSNavItem<TOwner> navItem = (BSNavItem<TOwner>)navItemComponent;
if (!navItem.IsActive)
navItem.Click();
}
}
}
| apache-2.0 | C# |
ee99963aa959cdcc0757468aaf92b455901464ee | Update DrawNode.cs | wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D | src/Core2D/Modules/Renderer/SkiaSharp/Nodes/DrawNode.cs | src/Core2D/Modules/Renderer/SkiaSharp/Nodes/DrawNode.cs | #nullable enable
using Core2D.Model.Renderer.Nodes;
using Core2D.ViewModels.Style;
using SkiaSharp;
namespace Core2D.Modules.Renderer.SkiaSharp.Nodes;
internal abstract class DrawNode : IDrawNode
{
public ShapeStyleViewModel? Style { get; set; }
public bool ScaleThickness { get; set; }
public bool ScaleSize { get; set; }
public SKPaint? Fill { get; set; }
public SKPaint? Stroke { get; set; }
public SKPoint Center { get; set; }
public abstract void UpdateGeometry();
public virtual void UpdateStyle()
{
if (Style?.Fill?.Color is { })
{
Fill = SkiaSharpDrawUtil.ToSKPaintBrush(Style.Fill.Color);
}
if (Style?.Stroke is { })
{
Stroke = SkiaSharpDrawUtil.ToSKPaintPen(Style, Style.Stroke.Thickness);
}
}
public virtual void Draw(object? dc, double zoom)
{
if (dc is not SKCanvas canvas)
{
return;
}
var scale = ScaleSize ? 1.0 / zoom : 1.0;
var translateX = 0.0 - (Center.X * scale) + Center.X;
var translateY = 0.0 - (Center.Y * scale) + Center.Y;
var thickness = Style?.Stroke?.Thickness ?? 1d;
if (ScaleThickness)
{
thickness /= zoom;
}
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (scale != 1.0)
{
thickness /= scale;
}
if (Style?.Stroke is { } && Stroke is { })
{
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (Stroke.StrokeWidth != thickness)
{
Stroke.StrokeWidth = (float)thickness;
}
}
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (scale != 1.0)
{
var count = canvas.Save();
canvas.Translate((float)translateX, (float)translateY);
canvas.Scale((float)scale, (float)scale);
OnDraw(dc, zoom);
canvas.RestoreToCount(count);
}
else
{
OnDraw(dc, zoom);
}
}
public abstract void OnDraw(object? dc, double zoom);
public virtual void Dispose()
{
}
}
| #nullable enable
using Core2D.Model.Renderer.Nodes;
using Core2D.ViewModels.Style;
using SkiaSharp;
namespace Core2D.Modules.Renderer.SkiaSharp.Nodes;
internal abstract class DrawNode : IDrawNode
{
public ShapeStyleViewModel? Style { get; set; }
public bool ScaleThickness { get; set; }
public bool ScaleSize { get; set; }
public SKPaint? Fill { get; set; }
public SKPaint? Stroke { get; set; }
public SKPoint Center { get; set; }
protected DrawNode()
{
}
public abstract void UpdateGeometry();
public virtual void UpdateStyle()
{
if (Style?.Fill?.Color is { })
{
Fill = SkiaSharpDrawUtil.ToSKPaintBrush(Style.Fill.Color);
}
if (Style?.Stroke is { })
{
Stroke = SkiaSharpDrawUtil.ToSKPaintPen(Style, Style.Stroke.Thickness);
}
}
public virtual void Draw(object? dc, double zoom)
{
if (dc is not SKCanvas canvas)
{
return;
}
var scale = ScaleSize ? 1.0 / zoom : 1.0;
var translateX = 0.0 - (Center.X * scale) + Center.X;
var translateY = 0.0 - (Center.Y * scale) + Center.Y;
var thickness = Style.Stroke.Thickness;
if (ScaleThickness)
{
thickness /= zoom;
}
if (scale != 1.0)
{
thickness /= scale;
}
if (Stroke.StrokeWidth != thickness)
{
Stroke.StrokeWidth = (float)thickness;
}
var count = int.MinValue;
if (scale != 1.0)
{
count = canvas.Save();
canvas.Translate((float)translateX, (float)translateY);
canvas.Scale((float)scale, (float)scale);
}
OnDraw(dc, zoom);
if (scale != 1.0)
{
canvas.RestoreToCount(count);
}
}
public abstract void OnDraw(object? dc, double zoom);
public virtual void Dispose()
{
}
}
| mit | C# |
e72add7b6795f0bb49ec2feded4264167bccf024 | remove unused using statement | NHSChoices/location-service,NHSChoices/location-service | src/GoatTrip.RestApi/Services/LocationQueryValidator.cs | src/GoatTrip.RestApi/Services/LocationQueryValidator.cs | namespace GoatTrip.RestApi.Services {
public class LocationQueryValidator
: ILocationQueryValidator {
public bool IsValid(string query) {
if (!IsMinumumLength(query))
return false;
return true;
}
private static bool IsMinumumLength(string query) {
if (string.IsNullOrEmpty(query))
return false;
return query.Length >= 1;
}
}
} | namespace GoatTrip.RestApi.Services {
using Controllers;
public class LocationQueryValidator
: ILocationQueryValidator {
public bool IsValid(string query) {
if (!IsMinumumLength(query))
return false;
return true;
}
private static bool IsMinumumLength(string query) {
if (string.IsNullOrEmpty(query))
return false;
return query.Length >= 1;
}
}
} | apache-2.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.