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 |
---|---|---|---|---|---|---|---|---|
a1f2926cda5893eb787680823ce5141f6b7a2d69
|
Update SyntaxEpsilon.cs
|
b3b00/csly
|
sly/parser/syntax/tree/SyntaxEpsilon.cs
|
sly/parser/syntax/tree/SyntaxEpsilon.cs
|
using sly.lexer;
namespace sly.parser.syntax.tree
{
public class SyntaxEpsilon<IN> : ISyntaxNode<IN> where IN : struct
{
public bool Discarded { get; } = false;
public string Name => "Epsilon";
public bool HasByPassNodes { get; set; } = false;
[ExcludeFromCodeCoverage]
public string Dump(string tab)
{
return $"Epsilon";
}
[ExcludeFromCodeCoverage]
public string ToJson(int index = 0)
{
return $@"""{index}.Epsilon"":""e""";
}
}
}
|
using sly.lexer;
namespace sly.parser.syntax.tree
{
public class SyntaxEpsilon<IN> : ISyntaxNode<IN> where IN : struct
{
public bool Discarded { get; } = false;
public string Name => "Epsilon";
public bool HasByPassNodes { get; set; } = false;
public string Dump(string tab)
{
return $"Epsilon";
}
public string ToJson(int index = 0)
{
return $@"""{index}.Epsilon"":""e""";
}
}
}
|
mit
|
C#
|
585893c60de5fa129a6bdcf170580644a7cfa975
|
Bump version
|
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
|
Android/ExposureNotification/build.cake
|
Android/ExposureNotification/build.cake
|
var TARGET = Argument ("t", Argument ("target", "ci"));
var NUGET_VERSION = "18.0.2-eap.5";
var AAR_URL = "https://github.com/google/exposure-notifications-android/raw/174cf0dab62d0c7c5d2c5d1abe5bef595d0d4942/app/libs/play-services-nearby-18.0.2-eap.aar";
Task ("externals")
.Does (() =>
{
EnsureDirectoryExists ("./externals");
DownloadFile(AAR_URL, "./externals/play-services-nearby-18.0.2-eap.aar");
// Update .csproj nuget versions
XmlPoke("./source/PlayServicesNearby/PlayServicesNearby.csproj", "/Project/PropertyGroup/PackageVersion", NUGET_VERSION);
});
Task("libs")
.IsDependentOn("externals")
.Does(() =>
{
MSBuild("./PlayServicesNearby.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.MaxCpuCount = 0;
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("nuget")
.IsDependentOn("libs")
.Does(() =>
{
MSBuild ("./PlayServicesNearby.sln", c => {
c.Configuration = "Release";
c.MaxCpuCount = 0;
c.Targets.Clear();
c.Targets.Add("Pack");
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("samples")
.IsDependentOn("nuget");
Task("ci")
.IsDependentOn("samples");
Task ("clean")
.Does (() =>
{
if (DirectoryExists ("./externals/"))
DeleteDirectory ("./externals", new DeleteDirectorySettings {
Recursive = true,
Force = true
});
});
RunTarget (TARGET);
|
var TARGET = Argument ("t", Argument ("target", "ci"));
var NUGET_VERSION = "18.0.2-eap.4";
var AAR_URL = "https://github.com/google/exposure-notifications-android/raw/174cf0dab62d0c7c5d2c5d1abe5bef595d0d4942/app/libs/play-services-nearby-18.0.2-eap.aar";
Task ("externals")
.Does (() =>
{
EnsureDirectoryExists ("./externals");
DownloadFile(AAR_URL, "./externals/play-services-nearby-18.0.2-eap.aar");
// Update .csproj nuget versions
XmlPoke("./source/PlayServicesNearby/PlayServicesNearby.csproj", "/Project/PropertyGroup/PackageVersion", NUGET_VERSION);
});
Task("libs")
.IsDependentOn("externals")
.Does(() =>
{
MSBuild("./PlayServicesNearby.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.MaxCpuCount = 0;
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("nuget")
.IsDependentOn("libs")
.Does(() =>
{
MSBuild ("./PlayServicesNearby.sln", c => {
c.Configuration = "Release";
c.MaxCpuCount = 0;
c.Targets.Clear();
c.Targets.Add("Pack");
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("samples")
.IsDependentOn("nuget");
Task("ci")
.IsDependentOn("samples");
Task ("clean")
.Does (() =>
{
if (DirectoryExists ("./externals/"))
DeleteDirectory ("./externals", new DeleteDirectorySettings {
Recursive = true,
Force = true
});
});
RunTarget (TARGET);
|
mit
|
C#
|
9f7c6adb5849777f77de6ba48c129bf8b53fd130
|
Fix test failures due to logger pollution
|
peppy/osu-new,UselessToucan/osu,peppy/osu,ppy/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu
|
osu.Game/Tests/CleanRunHeadlessGameHost.cs
|
osu.Game/Tests/CleanRunHeadlessGameHost.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.Runtime.CompilerServices;
using osu.Framework.Platform;
namespace osu.Game.Tests
{
/// <summary>
/// A headless host which cleans up before running (removing any remnants from a previous execution).
/// </summary>
public class CleanRunHeadlessGameHost : HeadlessGameHost
{
/// <summary>
/// Create a new instance.
/// </summary>
/// <param name="gameSuffix">An optional suffix which will isolate this host from others called from the same method source.</param>
/// <param name="bindIPC">Whether to bind IPC channels.</param>
/// <param name="realtime">Whether the host should be forced to run in realtime, rather than accelerated test time.</param>
/// <param name="callingMethodName">The name of the calling method, used for test file isolation and clean-up.</param>
public CleanRunHeadlessGameHost(string gameSuffix = @"", bool bindIPC = false, bool realtime = true, [CallerMemberName] string callingMethodName = @"")
: base(callingMethodName + gameSuffix, bindIPC, realtime)
{
}
protected override void SetupForRun()
{
Storage.DeleteDirectory(string.Empty);
// base call needs to be run *after* storage is emptied, as it updates the (static) logger's storage and may start writing
// log entries from another source if a unit test host is shared over multiple tests, causing a file access denied exception.
base.SetupForRun();
}
}
}
|
// 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.Runtime.CompilerServices;
using osu.Framework.Platform;
namespace osu.Game.Tests
{
/// <summary>
/// A headless host which cleans up before running (removing any remnants from a previous execution).
/// </summary>
public class CleanRunHeadlessGameHost : HeadlessGameHost
{
/// <summary>
/// Create a new instance.
/// </summary>
/// <param name="gameSuffix">An optional suffix which will isolate this host from others called from the same method source.</param>
/// <param name="bindIPC">Whether to bind IPC channels.</param>
/// <param name="realtime">Whether the host should be forced to run in realtime, rather than accelerated test time.</param>
/// <param name="callingMethodName">The name of the calling method, used for test file isolation and clean-up.</param>
public CleanRunHeadlessGameHost(string gameSuffix = @"", bool bindIPC = false, bool realtime = true, [CallerMemberName] string callingMethodName = @"")
: base(callingMethodName + gameSuffix, bindIPC, realtime)
{
}
protected override void SetupForRun()
{
base.SetupForRun();
Storage.DeleteDirectory(string.Empty);
}
}
}
|
mit
|
C#
|
0d330630ad1e957607df097e2bd2e6eeef5e4088
|
Remove superfluous call to ToImmutableArray
|
terrajobst/apiporter
|
src/ApiPorter.Patterns/PatternSearch.cs
|
src/ApiPorter.Patterns/PatternSearch.cs
|
using System;
using System.Collections.Immutable;
namespace ApiPorter.Patterns
{
public sealed partial class PatternSearch
{
private PatternSearch(string text, ImmutableArray<PatternVariable> variables)
{
Text = text;
Variables = variables;
}
public static PatternSearch Create(string text, ImmutableArray<PatternVariable> variables)
{
if (text == null)
throw new ArgumentNullException(nameof(text));
return new PatternSearch(text, variables);
}
public static PatternSearch Create(string text, params PatternVariable[] variables)
{
if (text == null)
throw new ArgumentNullException(nameof(text));
var variableArray = variables == null
? ImmutableArray<PatternVariable>.Empty
: variables.ToImmutableArray();
return Create(text, variableArray);
}
public string Text { get; }
public ImmutableArray<PatternVariable> Variables { get; set; }
}
}
|
using System;
using System.Collections.Immutable;
namespace ApiPorter.Patterns
{
public sealed partial class PatternSearch
{
private PatternSearch(string text, ImmutableArray<PatternVariable> variables)
{
Text = text;
Variables = variables;
}
public static PatternSearch Create(string text, ImmutableArray<PatternVariable> variables)
{
if (text == null)
throw new ArgumentNullException(nameof(text));
return new PatternSearch(text, variables.ToImmutableArray());
}
public static PatternSearch Create(string text, params PatternVariable[] variables)
{
if (text == null)
throw new ArgumentNullException(nameof(text));
var variableArray = variables == null
? ImmutableArray<PatternVariable>.Empty
: variables.ToImmutableArray();
return Create(text, variableArray);
}
public string Text { get; }
public ImmutableArray<PatternVariable> Variables { get; set; }
}
}
|
mit
|
C#
|
89fe8b09f63d953b036db80f23f9808996217dee
|
Handle inconclusive results in teamcity versions less than 6
|
refractalize/bounce,socialdotcom/bounce,refractalize/bounce,sreal/bounce,sreal/bounce,socialdotcom/bounce,socialdotcom/bounce,sreal/bounce,socialdotcom/bounce,refractalize/bounce
|
Bounce.Framework/TeamCityNUnitLogger.cs
|
Bounce.Framework/TeamCityNUnitLogger.cs
|
using System;
using System.IO;
using System.Text.RegularExpressions;
namespace Bounce.Framework {
public class TeamCityNUnitLogger : ICommandLog {
private readonly TextWriter Output;
private readonly ICommandLog Log;
private readonly TeamCityFormatter TeamCityFormatter;
private readonly Regex SummaryRegex;
private readonly bool InconclusiveTestCountRequired;
public TeamCityNUnitLogger(string args, TextWriter output, ICommandLog log) {
Output = output;
Log = log;
CommandArgumentsForLogging = args;
TeamCityFormatter = new TeamCityFormatter();
SummaryRegex = new Regex(@"Tests run: (\d.*), Errors: (\d.*), Failures: (\d.*), Inconclusive: (\d.*), Time: (\d.*) seconds");
InconclusiveTestCountRequired = DetermineIfInconclusiveTestCountRequired();
}
public void CommandOutput(string output)
{
OutputInconclusiveTestCount(output);
Log.CommandOutput(output);
}
public void CommandError(string error) {
Log.CommandError(error);
}
public void CommandComplete(int exitCode) {
var resultsPath = Path.GetFullPath("TestResult.xml");
Output.WriteLine(TeamCityFormatter.FormatTeamCityMessageWithFields("importData", "type", "nunit", "path", resultsPath));
Log.CommandComplete(exitCode);
}
public string CommandArgumentsForLogging { get; private set; }
private static bool DetermineIfInconclusiveTestCountRequired()
{
var version = Environment.GetEnvironmentVariable("TEAMCITY_VERSION");
if (version == null) return false;
var regex = new Regex(@"([0-9].*)\.([0-9].*)\.([0-9].*) \(build \d.*\)");
var match = regex.Match(version);
if (match.Success)
{
return (int.Parse(match.Groups[1].Value) < 6);
}
return true;
}
private void OutputInconclusiveTestCount(string output)
{
if (!InconclusiveTestCountRequired) return;
if (output == null) return;
var match = SummaryRegex.Match(output);
if (match.Success && int.Parse(match.Groups[4].Value) > 0)
{
Output.WriteLine(TeamCityFormatter.FormatTeamCityMessageWithFields("buildStatus", "text",
"{build.status.text}, inconclusive: " + match.Groups[4].Value));
}
}
}
}
|
using System;
using System.IO;
namespace Bounce.Framework {
public class TeamCityNUnitLogger : ICommandLog {
private readonly TextWriter Output;
private readonly ICommandLog Log;
private TeamCityFormatter TeamCityFormatter;
public TeamCityNUnitLogger(string args, TextWriter output, ICommandLog log) {
Output = output;
Log = log;
CommandArgumentsForLogging = args;
TeamCityFormatter = new TeamCityFormatter();
}
public void CommandOutput(string output) {
Log.CommandOutput(output);
}
public void CommandError(string error) {
Log.CommandError(error);
}
public void CommandComplete(int exitCode) {
var resultsPath = Path.GetFullPath("TestResult.xml");
Output.WriteLine(TeamCityFormatter.FormatTeamCityMessageWithFields("importData", "type", "nunit", "path", resultsPath));
Log.CommandComplete(exitCode);
}
public string CommandArgumentsForLogging { get; private set; }
}
}
|
bsd-2-clause
|
C#
|
fac0e04989cd61e16775d837750e9e4cd8ad2ffb
|
Fix invalid scissor rectangle
|
zwcloud/ImGui,zwcloud/ImGui,zwcloud/ImGui
|
src/ImGui/Rendering/GeometryRenderer.cs
|
src/ImGui/Rendering/GeometryRenderer.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace ImGui.Rendering.Composition
{
internal abstract class GeometryRenderer : RecordReader
{
protected Stack<Rect> ClipRectStack { get; } = new Stack<Rect>(new[] { Rect.Big });
public void PushClipRect(Rect rect)
{
if (rect.IsEmpty || rect.IsZero)
{
throw new ArgumentOutOfRangeException(nameof(rect), "Invalid Clip Rect: empty or zero-sized");
}
//pushed rect should be clipped by current clip rect
if (ClipRectStack.TryPeek(out var currentRect))
{
rect = Rect.Intersect(rect, currentRect);
//no intersection
if (rect.IsEmpty)
{
rect = Rect.Zero;
}
}
ClipRectStack.Push(rect);
}
public void PopClipRect()
{
if (ClipRectStack.Count <= 1)
{
throw new InvalidOperationException("Push/Pop doesn't match.");
}
ClipRectStack.Pop();
}
public abstract override void PushClip(Geometry clipGeometry);
public abstract override void Pop();
}
}
|
using System;
using System.Collections.Generic;
namespace ImGui.Rendering.Composition
{
internal abstract class GeometryRenderer : RecordReader
{
protected Stack<Rect> ClipRectStack { get; } = new Stack<Rect>(new[] { Rect.Big });
public void PushClipRect(Rect rect)
{
if (rect.IsEmpty || rect.IsZero)
{
throw new ArgumentOutOfRangeException(nameof(rect), "Invalid Clip Rect: empty or zero-sized");
}
//pushed rect should be clipped by current clip rect
if (ClipRectStack.TryPeek(out var currentRect))
{
rect = Rect.Intersect(rect, currentRect);
}
ClipRectStack.Push(rect);
}
public void PopClipRect()
{
if (ClipRectStack.Count <= 1)
{
throw new InvalidOperationException("Push/Pop doesn't match.");
}
ClipRectStack.Pop();
}
public abstract override void PushClip(Geometry clipGeometry);
public abstract override void Pop();
}
}
|
agpl-3.0
|
C#
|
01be25f9fa3d0cf46c31b92655f3cf7c20b1785a
|
Update AssemblyInfo.cs
|
NConsole/NConsole
|
src/NConsole/Properties/AssemblyInfo.cs
|
src/NConsole/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("NConsole")]
[assembly: AssemblyDescription("NConsole is a .NET library to parse command line arguments and execute commands.")]
[assembly: AssemblyCompany("Rico Suter")]
[assembly: AssemblyProduct("NConsole")]
[assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: InternalsVisibleTo("NConsole.Tests")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("NConsole")]
[assembly: AssemblyDescription("NConsole is a .NET library to parse command line arguments and execute commands.")]
[assembly: AssemblyCompany("Rico Suter")]
[assembly: AssemblyProduct("NConsole")]
[assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")]
[assembly: AssemblyVersion("0.1.*")]
[assembly: InternalsVisibleTo("NConsole.Tests")]
|
mit
|
C#
|
b48f484b8d693a58abf651eec6ea547e24f3cb77
|
load config
|
ucdavis/Namster,ucdavis/Namster,ucdavis/Namster
|
src/Namster.Jobs.ElasticSync/Program.cs
|
src/Namster.Jobs.ElasticSync/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Namster.Jobs.ElasticSync
{
public class Program
{
private static IConfigurationRoot _configuration;
private static IServiceProvider _serviceProvider;
public static void Main(string[] args)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddUserSecrets()
.AddEnvironmentVariables();
_configuration = builder.Build();
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
var uploader = _serviceProvider.GetService<NamSearchUploader>();
uploader.Run();
}
private static void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IConfiguration>(_configuration);
services.AddTransient<NamSearchUploader, NamSearchUploader>();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Namster.Jobs.ElasticSync
{
public class Program
{
private static IConfigurationRoot _configuration;
private static IServiceProvider _serviceProvider;
public static void Main(string[] args)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddUserSecrets()
.AddEnvironmentVariables();
_configuration = builder.Build();
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
var uploader = _serviceProvider.GetService<NamSearchUploader>();
uploader.Run();
}
private static void ConfigureServices(IServiceCollection services)
{
//services.AddSingleton<IConfiguration>(Configuration);
services.AddTransient<NamSearchUploader, NamSearchUploader>();
}
}
}
|
mit
|
C#
|
64d4e807c3fca4c0471e7019aae8884eff829c55
|
Add the search for user api to the Site.
|
AlexGhiondea/SmugMug.NET
|
src/SmugMugModel.v2/Types/SiteEntity.cs
|
src/SmugMugModel.v2/Types/SiteEntity.cs
|
// Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using SmugMug.v2.Authentication;
using System.Threading.Tasks;
namespace SmugMug.v2.Types
{
public class SiteEntity : SmugMugEntity
{
public SiteEntity(OAuthToken token)
{
_oauthToken = token;
}
public async Task<UserEntity> GetAuthenticatedUserAsync()
{
// !authuser
string requestUri = string.Format("{0}!authuser", SmugMug.v2.Constants.Addresses.SmugMugApi);
return await RetrieveEntityAsync<UserEntity>(requestUri);
}
public async Task<UserEntity[]> SearchForUser(string query)
{
// api/v2/user!search?q=
string requestUri = string.Format("{0}/user!search?q={1}", SmugMug.v2.Constants.Addresses.SmugMugApi, query);
return await RetrieveEntityArrayAsync<UserEntity>(requestUri);
}
}
}
|
// Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using SmugMug.v2.Authentication;
using System.Threading.Tasks;
namespace SmugMug.v2.Types
{
public class SiteEntity : SmugMugEntity
{
public SiteEntity(OAuthToken token)
{
_oauthToken = token;
}
public async Task<UserEntity> GetAuthenticatedUserAsync()
{
// /album/(*)!applyalbumtemplate
string requestUri = string.Format("{0}!authuser", SmugMug.v2.Constants.Addresses.SmugMugApi);
return await RetrieveEntityAsync<UserEntity>(requestUri);
}
}
}
|
mit
|
C#
|
e20aadd3dd1c50b020a0ef59ae2594a7b1e5ec63
|
Revert "islr-17: test"
|
StockSharp/StockSharp
|
Algo/Storages/DefaultCredentialsProvider.cs
|
Algo/Storages/DefaultCredentialsProvider.cs
|
namespace StockSharp.Algo.Storages
{
using System;
using System.IO;
using Ecng.Common;
using Ecng.ComponentModel;
using Ecng.Serialization;
using StockSharp.Configuration;
using StockSharp.Logging;
/// <summary>
/// Default implementation of <see cref="ICredentialsProvider"/>.
/// </summary>
public class DefaultCredentialsProvider : ICredentialsProvider
{
private readonly string _credentialsFile = $"credentials{Paths.DefaultSettingsExt}";
bool ICredentialsProvider.TryLoad(out ServerCredentials credentials)
{
var file = Path.Combine(Paths.CompanyPath, _credentialsFile);
if (!File.Exists(file) && !File.Exists(file.MakeLegacy()))
{
credentials = null;
return false;
}
credentials = new ServerCredentials();
try
{
credentials.LoadIfNotNull(file.DeserializeWithMigration<SettingsStorage>());
}
catch (Exception ex)
{
ex.LogError();
return false;
}
return !credentials.Password.IsEmpty() || !credentials.Token.IsEmpty();
}
void ICredentialsProvider.Save(ServerCredentials credentials)
{
if (credentials is null)
throw new ArgumentNullException(nameof(credentials));
var clone = credentials;
if (!credentials.AutoLogon)
clone.Password = null;
Directory.CreateDirectory(Paths.CompanyPath);
var file = Path.Combine(Paths.CompanyPath, _credentialsFile);
clone.Save().Serialize(file);
}
}
}
|
namespace StockSharp.Algo.Storages
{
using System;
using System.IO;
using Ecng.Common;
using Ecng.ComponentModel;
using Ecng.Serialization;
using StockSharp.Configuration;
using StockSharp.Logging;
/// <summary>
/// Default implementation of <see cref="ICredentialsProvider"/>.
/// </summary>
public class DefaultCredentialsProvider : ICredentialsProvider
{
private static readonly string _credentialsFile = $"credentials{Paths.DefaultSettingsExt}";
private ServerCredentials _credentials;
// ReSharper disable InconsistentlySynchronizedField
private bool IsValid => _credentials != null && (!_credentials.Password.IsEmpty() || !_credentials.Token.IsEmpty());
// ReSharper restore InconsistentlySynchronizedField
bool ICredentialsProvider.TryLoad(out ServerCredentials credentials)
{
lock (this)
{
if(_credentials != null)
{
credentials = _credentials.Clone();
return IsValid;
}
var file = Path.Combine(Paths.CompanyPath, _credentialsFile);
credentials = null;
try
{
if (File.Exists(file) || File.Exists(file.MakeLegacy()))
{
credentials = new ServerCredentials();
credentials.LoadIfNotNull(file.DeserializeWithMigration<SettingsStorage>());
_credentials = credentials.Clone();
}
}
catch (Exception ex)
{
ex.LogError();
}
return IsValid;
}
}
void ICredentialsProvider.Save(ServerCredentials credentials)
{
if (credentials is null)
throw new ArgumentNullException(nameof(credentials));
lock (this)
{
var clone = credentials.Clone();
if (!clone.AutoLogon)
clone.Password = null;
Directory.CreateDirectory(Paths.CompanyPath);
var file = Path.Combine(Paths.CompanyPath, _credentialsFile);
clone.Save().Serialize(file);
_credentials = clone;
}
}
}
}
|
apache-2.0
|
C#
|
d7322c8ebd1c4139eb05bed63d7c936f3305cb67
|
Change "Note" default size / minimum size
|
danielchalmers/DesktopWidgets
|
DesktopWidgets/Widgets/Note/Settings.cs
|
DesktopWidgets/Widgets/Note/Settings.cs
|
using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;
namespace DesktopWidgets.Widgets.Note
{
public class Settings : WidgetSettingsBase
{
public Settings()
{
Style.MinWidth = 160;
Style.MinHeight = 132;
}
[DisplayName("Saved Text")]
public string Text { get; set; }
[Category("Style")]
[DisplayName("Read Only")]
public bool ReadOnly { get; set; }
}
}
|
using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;
namespace DesktopWidgets.Widgets.Note
{
public class Settings : WidgetSettingsBase
{
public Settings()
{
Style.Width = 160;
Style.Height = 132;
}
[DisplayName("Saved Text")]
public string Text { get; set; }
[Category("Style")]
[DisplayName("Read Only")]
public bool ReadOnly { get; set; }
}
}
|
apache-2.0
|
C#
|
2e06a0ec0011ed6cc29ed0818df3d5acb2de241d
|
Handle exceptions during authentication
|
k-t/SharpHaven
|
MonoHaven.Client/Network/AsyncAuthClient.cs
|
MonoHaven.Client/Network/AsyncAuthClient.cs
|
using System;
using System.Threading.Tasks;
namespace MonoHaven.Network
{
public class AsyncAuthClient
{
private readonly string host;
private readonly int port;
private readonly CallbackDispatcher dispatcher;
public AsyncAuthClient(string host, int port, CallbackDispatcher dispatcher)
{
this.host = host;
this.port = port;
this.dispatcher = dispatcher;
}
public event EventHandler<AuthProgressEventArgs> ProgressChanged;
public event EventHandler<AuthResultEventArgs> Completed;
public void Authenticate(string userName, string password)
{
Task.Factory.StartNew(() => {
AuthClient authClient = null;
try
{
authClient = new AuthClient(host, port);
byte[] cookie;
ChangeProgress("Authenticating...");
authClient.Connect();
authClient.BindUser(userName);
if (authClient.TryPassword(password, out cookie))
{
ChangeProgress("Connecting...");
Complete(cookie);
}
else
Complete("Username or password incorrect");
}
catch (Exception e)
{
Complete(e.Message);
}
finally
{
if (authClient != null)
authClient.Dispose();
}
});
}
private void Complete(byte[] cookie)
{
Complete(new AuthResultEventArgs(cookie));
}
private void Complete(string error)
{
Complete(new AuthResultEventArgs(error));
}
private void Complete(AuthResultEventArgs args)
{
dispatcher.Dispatch(Completed, this, args);
}
private void ChangeProgress(string statusText)
{
var args = new AuthProgressEventArgs(statusText);
dispatcher.Dispatch(ProgressChanged, this, args);
}
}
}
|
using System;
using System.Threading.Tasks;
namespace MonoHaven.Network
{
public class AsyncAuthClient
{
private readonly string host;
private readonly int port;
private readonly CallbackDispatcher dispatcher;
public AsyncAuthClient(string host, int port, CallbackDispatcher dispatcher)
{
this.host = host;
this.port = port;
this.dispatcher = dispatcher;
}
public event EventHandler<AuthProgressEventArgs> ProgressChanged;
public event EventHandler<AuthResultEventArgs> Completed;
public void Authenticate(string userName, string password)
{
Task.Factory.StartNew(() => {
using (var authClient = new AuthClient(host, port))
{
byte[] cookie;
ChangeProgress("Connecting...");
authClient.Connect();
ChangeProgress("Authenticating...");
authClient.BindUser(userName);
if (authClient.TryPassword(password, out cookie))
Complete(cookie);
else
Complete("Username or password incorrect");
}
});
}
private void Complete(byte[] cookie)
{
Complete(new AuthResultEventArgs(cookie));
}
private void Complete(string error)
{
Complete(new AuthResultEventArgs(error));
}
private void Complete(AuthResultEventArgs args)
{
dispatcher.Dispatch(Completed, this, args);
}
private void ChangeProgress(string statusText)
{
var args = new AuthProgressEventArgs(statusText);
dispatcher.Dispatch(ProgressChanged, this, args);
}
}
}
|
mit
|
C#
|
0b78f719b25e3074f892db31b0193ffe680348df
|
Update VisitProbe.cs
|
predictive-technology-laboratory/sensus,predictive-technology-laboratory/sensus,predictive-technology-laboratory/sensus,predictive-technology-laboratory/sensus,predictive-technology-laboratory/sensus,predictive-technology-laboratory/sensus
|
Sensus.Shared/Probes/Location/VisitProbe.cs
|
Sensus.Shared/Probes/Location/VisitProbe.cs
|
// Copyright 2014 The Rector & Visitors of the University of Virginia
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Syncfusion.SfChart.XForms;
using System;
namespace Sensus.Probes.Location
{
/// <summary>
/// Collects keystroke information as <see cref="VisitDatum"/>
/// </summary>
public abstract class VisitProbe : ListeningProbe
{
protected override bool DefaultKeepDeviceAwake
{
get
{
return false;
}
}
public override Type DatumType
{
get
{
return typeof(VisitDatum);
}
}
public override string DisplayName
{
get
{
return "GPS Location Visits";
}
}
protected override string DeviceAwakeWarning
{
get
{
return "";
}
}
protected override string DeviceAsleepWarning
{
get
{
return "";
}
}
protected override ChartDataPoint GetChartDataPointFromDatum(Datum datum)
{
throw new NotImplementedException();
}
protected override ChartAxis GetChartPrimaryAxis()
{
throw new NotImplementedException();
}
protected override RangeAxisBase GetChartSecondaryAxis()
{
throw new NotImplementedException();
}
protected override ChartSeries GetChartSeries()
{
throw new NotImplementedException();
}
}
}
|
// Copyright 2014 The Rector & Visitors of the University of Virginia
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Syncfusion.SfChart.XForms;
using System;
namespace Sensus.Probes.Location
{
/// <summary>
/// Collects keystroke information as <see cref="VisitDatum"/>
/// </summary>
public abstract class VisitProbe : ListeningProbe
{
protected override bool DefaultKeepDeviceAwake
{
get
{
return false;
}
}
public override Type DatumType
{
get
{
return typeof(VisitDatum);
}
}
public override string DisplayName
{
get
{
return "Visits";
}
}
protected override string DeviceAwakeWarning
{
get
{
return "";
}
}
protected override string DeviceAsleepWarning
{
get
{
return "";
}
}
protected override ChartDataPoint GetChartDataPointFromDatum(Datum datum)
{
throw new NotImplementedException();
}
protected override ChartAxis GetChartPrimaryAxis()
{
throw new NotImplementedException();
}
protected override RangeAxisBase GetChartSecondaryAxis()
{
throw new NotImplementedException();
}
protected override ChartSeries GetChartSeries()
{
throw new NotImplementedException();
}
}
}
|
apache-2.0
|
C#
|
5705cf448f7fe77903f6671078f44d2a36ef12fb
|
Add PointLoadProperty to NodeProperty for remembering point load at node
|
ReiiYuki/KU-Structure
|
Assets/Scripts/Beam/NodeProperty.cs
|
Assets/Scripts/Beam/NodeProperty.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NodeProperty : MonoBehaviour {
public int number;
public float m, dy;
public PointLoadProperty pointLoad;
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NodeProperty : MonoBehaviour {
public int number;
public float m, dy;
}
|
mit
|
C#
|
aad51f2cb06b33521f525b885dc993ebc87168a6
|
Move method up.
|
fffej/BobTheBuilder,alastairs/BobTheBuilder
|
BobTheBuilder/DynamicBuilderBase.cs
|
BobTheBuilder/DynamicBuilderBase.cs
|
using System;
using System.Dynamic;
namespace BobTheBuilder
{
public abstract class DynamicBuilderBase<T> : DynamicObject, IDynamicBuilder<T> where T : class
{
protected internal readonly IArgumentStore argumentStore;
protected DynamicBuilderBase(IArgumentStore argumentStore)
{
if (argumentStore == null)
{
throw new ArgumentNullException("argumentStore");
}
this.argumentStore = argumentStore;
}
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
{
return InvokeBuilderMethod(binder, args, out result);
}
public abstract bool InvokeBuilderMethod(InvokeMemberBinder binder, object[] args, out object result);
public T Build()
{
var instance = CreateInstanceOfType();
PopulatePublicSettableProperties(instance);
return instance;
}
private static T CreateInstanceOfType()
{
var instance = Activator.CreateInstance<T>();
return instance;
}
private void PopulatePublicSettableProperties(T instance)
{
var knownMembers = argumentStore.GetAllStoredMembers();
foreach (var member in knownMembers)
{
var property = typeof (T).GetProperty(member.Name);
property.SetValue(instance, member.Value);
}
}
public static implicit operator T(DynamicBuilderBase<T> builder)
{
return builder.Build();
}
}
}
|
using System;
using System.Dynamic;
namespace BobTheBuilder
{
public abstract class DynamicBuilderBase<T> : DynamicObject, IDynamicBuilder<T> where T : class
{
protected internal readonly IArgumentStore argumentStore;
protected DynamicBuilderBase(IArgumentStore argumentStore)
{
if (argumentStore == null)
{
throw new ArgumentNullException("argumentStore");
}
this.argumentStore = argumentStore;
}
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
{
return InvokeBuilderMethod(binder, args, out result);
}
public abstract bool InvokeBuilderMethod(InvokeMemberBinder binder, object[] args, out object result);
public T Build()
{
var instance = CreateInstanceOfType();
PopulatePublicSettableProperties(instance);
return instance;
}
private void PopulatePublicSettableProperties(T instance)
{
var knownMembers = argumentStore.GetAllStoredMembers();
foreach (var member in knownMembers)
{
var property = typeof (T).GetProperty(member.Name);
property.SetValue(instance, member.Value);
}
}
private static T CreateInstanceOfType()
{
var instance = Activator.CreateInstance<T>();
return instance;
}
public static implicit operator T(DynamicBuilderBase<T> builder)
{
return builder.Build();
}
}
}
|
apache-2.0
|
C#
|
5151a36c22dab3aae0d8a81c73f5f8f700637f0b
|
fix "private", remove underscores from variable name
|
Shaddix/FormsPlayer,Shaddix/FormsPlayer
|
src/FormsPlayer/App.cs
|
src/FormsPlayer/App.cs
|
using System;
using System.ComponentModel;
using System.IO;
using System.Xml;
using System.Reflection;
using Xamarin.Forms;
namespace Xamarin.Forms.Player
{
/// <summary>
/// Main player app, to be used from the main entry point for your
/// Xamarin.Forms application.
/// </summary>
public class App : Application
{
AppController controller;
/// <summary>
/// Initializes the application.
/// </summary>
public App ()
{
controller = new AppController(this);
}
/// <summary>
/// Starts the app.
/// </summary>
protected override void OnStart ()
{
controller.OnStart();
}
/// <summary>
/// Sleeps the app.
/// </summary>
protected override void OnSleep ()
{
controller.OnSleep();
}
/// <summary>
/// Resumes the app.
/// </summary>
protected override void OnResume ()
{
controller.OnResume();
}
}
}
|
using System;
using System.ComponentModel;
using System.IO;
using System.Xml;
using System.Reflection;
using Xamarin.Forms;
namespace Xamarin.Forms.Player
{
/// <summary>
/// Main player app, to be used from the main entry point for your
/// Xamarin.Forms application.
/// </summary>
public class App : Application
{
private AppController _controller;
/// <summary>
/// Initializes the application.
/// </summary>
public App ()
{
_controller = new AppController(this);
}
/// <summary>
/// Starts the app.
/// </summary>
protected override void OnStart ()
{
_controller.OnStart();
}
/// <summary>
/// Sleeps the app.
/// </summary>
protected override void OnSleep ()
{
_controller.OnSleep();
}
/// <summary>
/// Resumes the app.
/// </summary>
protected override void OnResume ()
{
_controller.OnResume();
}
}
}
|
mit
|
C#
|
76e92d1bd2764e38802ebacc23b4965c041524b3
|
Fix the repositories having each others names
|
jakeclawson/Pinta,Fenex/Pinta,PintaProject/Pinta,PintaProject/Pinta,Mailaender/Pinta,Mailaender/Pinta,Fenex/Pinta,jakeclawson/Pinta,PintaProject/Pinta
|
Pinta/AddinSetupService.cs
|
Pinta/AddinSetupService.cs
|
//
// AddinSetupService.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
//
// 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 Mono.Addins;
using Mono.Addins.Setup;
using Pinta.Core;
using Mono.Unix;
namespace Pinta
{
public class AddinSetupService: SetupService
{
internal AddinSetupService (AddinRegistry r): base (r)
{
}
public bool AreRepositoriesRegistered ()
{
string url = GetPlatformRepositoryUrl ();
return Repositories.ContainsRepository (url);
}
public void RegisterRepositories (bool enable)
{
RegisterRepository (GetPlatformRepositoryUrl (),
Catalog.GetString ("Pinta Community Addins - Platform specific"),
enable);
RegisterRepository (GetAllRepositoryUrl (),
Catalog.GetString ("Pinta Community Addins - Cross-Platform"),
enable);
}
private void RegisterRepository(string url, string name, bool enable)
{
if (!Repositories.ContainsRepository (url)) {
var rep = Repositories.RegisterRepository (null, url, false);
rep.Name = name;
// Although repositories are enabled by default, we should always call this method to ensure
// that the repository name from the previous line ends up being saved to disk.
Repositories.SetRepositoryEnabled (url, enable);
}
}
private static string GetPlatformRepositoryUrl ()
{
string platform;
if (SystemManager.GetOperatingSystem () == OS.Windows)
platform = "Windows";
else
if (SystemManager.GetOperatingSystem () == OS.Mac)
platform = "Mac";
else
platform = "Linux";
return "http://pintaproject.github.io/Pinta-Community-Addins/repository/" + platform + "/main.mrep";
}
private static string GetAllRepositoryUrl ()
{
return "http://pintaproject.github.io/Pinta-Community-Addins/repository/All/main.mrep";
}
}
}
|
//
// AddinSetupService.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
//
// 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 Mono.Addins;
using Mono.Addins.Setup;
using Pinta.Core;
using Mono.Unix;
namespace Pinta
{
public class AddinSetupService: SetupService
{
internal AddinSetupService (AddinRegistry r): base (r)
{
}
public bool AreRepositoriesRegistered ()
{
string url = GetPlatformRepositoryUrl ();
return Repositories.ContainsRepository (url);
}
public void RegisterRepositories (bool enable)
{
RegisterRepository (GetPlatformRepositoryUrl (),
Catalog.GetString ("Pinta Community Addins - Cross-Platform"),
enable);
RegisterRepository (GetAllRepositoryUrl (),
Catalog.GetString ("Pinta Community Addins - Platform specific"),
enable);
}
private void RegisterRepository(string url, string name, bool enable)
{
if (!Repositories.ContainsRepository (url)) {
var rep = Repositories.RegisterRepository (null, url, false);
rep.Name = name;
// Although repositories are enabled by default, we should always call this method to ensure
// that the repository name from the previous line ends up being saved to disk.
Repositories.SetRepositoryEnabled (url, enable);
}
}
private static string GetPlatformRepositoryUrl ()
{
string platform;
if (SystemManager.GetOperatingSystem () == OS.Windows)
platform = "Windows";
else
if (SystemManager.GetOperatingSystem () == OS.Mac)
platform = "Mac";
else
platform = "Linux";
return "http://pintaproject.github.io/Pinta-Community-Addins/repository/" + platform + "/main.mrep";
}
private static string GetAllRepositoryUrl ()
{
return "http://pintaproject.github.io/Pinta-Community-Addins/repository/All/main.mrep";
}
}
}
|
mit
|
C#
|
e6665bc0f5467a4f7a45994a16ff97e3c880ba31
|
Update AssemblyInfo.cs in preparation for NuGet package deploy.
|
ItzWarty/ItzWarty.Proxies.Api,the-dargon-project/ItzWarty.Proxies.Api
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("libwarty.proxies-api")]
[assembly: AssemblyDescription("Interfaces for abstracting common static invocations.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ItzWarty")]
[assembly: AssemblyProduct("proxies-api")]
[assembly: AssemblyCopyright("Copyright © ItzWarty 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("e76746d1-7fc0-4b89-951d-3a5390c11582")]
// 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("common-proxies")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("common-proxies")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e76746d1-7fc0-4b89-951d-3a5390c11582")]
// 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")]
|
bsd-2-clause
|
C#
|
89ea189f994174698cb4d4d7dcc920cfd0bffcae
|
Bump version
|
o11c/WebMConverter,Yuisbean/WebMConverter,nixxquality/WebMConverter
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.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("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.0")]
|
mit
|
C#
|
1384674052b5608e76a37ac98828bac0dc630c4d
|
Add missing ConfigIO tests
|
fwinkelbauer/Bumpy
|
Source/Bumpy.Tests/Config/ConfigIOTests.cs
|
Source/Bumpy.Tests/Config/ConfigIOTests.cs
|
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Bumpy.Config;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Bumpy.Tests.Config
{
[TestClass]
public class ConfigIOTests
{
[TestMethod]
public void ReadConfigFile_ParseDefaultConfig()
{
// We also make sure that the default "new" template is valid
var entries = ReadConfig(ConfigIO.NewConfigFile()).Queries.ToList();
Assert.AreEqual(3, entries.Count);
Assert.AreEqual("AssemblyInfo.cs", entries[0].Glob);
Assert.AreEqual("assembly", entries[0].Profile);
Assert.AreEqual("*.nuspec", entries[1].Glob);
Assert.AreEqual("nuspec", entries[1].Profile);
Assert.AreEqual("*.csproj", entries[2].Glob);
Assert.AreEqual("nuspec", entries[2].Profile);
}
[TestMethod]
public void ReadConfigFile_ParseCompleteEntry()
{
string configText = @"
[AssemblyInfo.cs | my_profile]
regex = some regex
encoding = utf-8
[*.rc]
encoding = 1200
";
var entries = ReadConfig(configText).Queries.ToList();
Assert.AreEqual(2, entries.Count);
Assert.AreEqual("AssemblyInfo.cs", entries[0].Glob);
Assert.AreEqual("my_profile", entries[0].Profile);
Assert.AreEqual("Unicode (UTF-8)", entries[0].Encoding.EncodingName);
Assert.AreEqual("some regex", entries[0].Regex);
Assert.AreEqual(1200, entries[1].Encoding.CodePage);
}
[TestMethod]
public void ReadConfigFile_InvalidSyntax()
{
string configText = @"
[AssemblyInfo.cs | my_profile]
regex
";
Assert.ThrowsException<ConfigException>(() => ReadConfig(configText));
}
[TestMethod]
public void ReadConfigFile_UnrecognizedElement()
{
string configText = @"
[AssemblyInfo.cs | my_profile]
unknown_key = some value
";
Assert.ThrowsException<ConfigException>(() => ReadConfig(configText));
}
private BumpyConfig ReadConfig(string configText)
{
return ConfigIO.ReadConfigFile(GetLines(configText));
}
private IEnumerable<string> GetLines(string configText)
{
using (var stream = new StringReader(configText))
{
string line;
while ((line = stream.ReadLine()) != null)
{
yield return line;
}
}
}
}
}
|
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Bumpy.Config;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Bumpy.Tests.Config
{
[TestClass]
public class ConfigIOTests
{
[TestMethod]
public void ReadConfigFile_CanDeserializeConfig()
{
var entries = ConfigIO.ReadConfigFile(GetLines()).Queries.ToList();
Assert.AreEqual(3, entries.Count);
Assert.AreEqual("AssemblyInfo.cs", entries[0].Glob);
Assert.AreEqual("assembly", entries[0].Profile);
Assert.AreEqual("*.nuspec", entries[1].Glob);
Assert.AreEqual("nuspec", entries[1].Profile);
Assert.AreEqual("*.csproj", entries[2].Glob);
Assert.AreEqual("nuspec", entries[2].Profile);
}
private IEnumerable<string> GetLines()
{
// We also make sure that the default "new" template is valid
using (var stream = new StringReader(ConfigIO.NewConfigFile()))
{
string line;
while ((line = stream.ReadLine()) != null)
{
yield return line;
}
}
}
}
}
|
mit
|
C#
|
e926cec386ca369d5de34f57d5423a4d2a298a8d
|
Remove unused using
|
JamieMagee/GovUK-Pulse,JamieMagee/GovUK-Pulse,JamieMagee/GovUK-Pulse
|
SslScanner/Program.cs
|
SslScanner/Program.cs
|
using System;
using System.Collections.Generic;
using Microsoft.WindowsAzure.Storage;
using Newtonsoft.Json;
namespace SslScanner
{
internal static class Program
{
private static void Main()
{
const string readFile =
@"https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/465282/gov.uk_domains_as_of_01Oct_2015.csv";
var domains = GetDomains(readFile);
var scores = GetScores(domains);
UpdateDatabase(scores);
}
private static HashSet<string> GetDomains(string readFile)
{
return new DomainScanner(readFile).Run();
}
private static IEnumerable<GovDomain> GetScores(HashSet<string> domains)
{
return new SslLabsScanner(domains).Run();
}
private static void UpdateDatabase(IEnumerable<GovDomain> scores)
{
var storageAccount = CloudStorageAccount.Parse(
Environment.GetEnvironmentVariable("Data:ConnectionString"));
var blobClient = storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference("scans");
container.CreateIfNotExists();
var blob = container.GetBlockBlobReference("latest.json");
blob.UploadText(JsonConvert.SerializeObject(scores));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Configuration;
using Microsoft.WindowsAzure.Storage;
using Newtonsoft.Json;
namespace SslScanner
{
internal static class Program
{
private static void Main()
{
const string readFile =
@"https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/465282/gov.uk_domains_as_of_01Oct_2015.csv";
var domains = GetDomains(readFile);
var scores = GetScores(domains);
UpdateDatabase(scores);
}
private static HashSet<string> GetDomains(string readFile)
{
return new DomainScanner(readFile).Run();
}
private static IEnumerable<GovDomain> GetScores(HashSet<string> domains)
{
return new SslLabsScanner(domains).Run();
}
private static void UpdateDatabase(IEnumerable<GovDomain> scores)
{
var storageAccount = CloudStorageAccount.Parse(
Environment.GetEnvironmentVariable("Data:ConnectionString"));
var blobClient = storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference("scans");
container.CreateIfNotExists();
var blob = container.GetBlockBlobReference("latest.json");
blob.UploadText(JsonConvert.SerializeObject(scores));
}
}
}
|
mit
|
C#
|
8a488c353bf28e368a1706e90964bb905b314736
|
Allow only one instance of application
|
akorb/SteamShutdown
|
SteamShutdown/Program.cs
|
SteamShutdown/Program.cs
|
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
namespace SteamShutdown
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
string appProcessName = Path.GetFileNameWithoutExtension(Application.ExecutablePath);
Process[] RunningProcesses = Process.GetProcessesByName(appProcessName);
if (RunningProcesses.Length > 1) return;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var applicationContext = new CustomApplicationContext();
Application.Run(applicationContext);
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "SteamShutdown_Log.txt");
File.WriteAllText(path, e.ExceptionObject.ToString());
MessageBox.Show("Please send me the log file on GitHub or via E-Mail (Andreas.D.Korb@gmail.com)" + Environment.NewLine + path, "An Error occured");
}
}
}
|
using System;
using System.IO;
using System.Windows.Forms;
namespace SteamShutdown
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var applicationContext = new CustomApplicationContext();
Application.Run(applicationContext);
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "SteamShutdown_Log.txt");
File.WriteAllText(path, e.ExceptionObject.ToString());
MessageBox.Show("Please send me the log file on GitHub or via E-Mail (Andreas.D.Korb@gmail.com)" + Environment.NewLine + path, "An Error occured");
}
}
}
|
mit
|
C#
|
4b51eb4932c6d000ec9e73daedcf13317a193ef5
|
add DebugID tag
|
Alexx999/SwfSharp
|
SwfSharp/Tags/TagType.cs
|
SwfSharp/Tags/TagType.cs
|
namespace SwfSharp.Tags
{
public enum TagType
{
End = 0,
ShowFrame = 1,
DefineShape = 2,
PlaceObject = 4,
RemoveObject = 5,
DefineBits = 6,
DefineButton = 7,
JPEGTables = 8,
SetBackgroundColor = 9,
DefineFont = 10,
DefineText = 11,
DoAction = 12,
DefineFontInfo = 13,
DefineSound = 14,
StartSound = 15,
DefineButtonSound = 17,
SoundStreamHead = 18,
SoundStreamBlock = 19,
DefineBitsLossless = 20,
DefineBitsJPEG2 = 21,
DefineShape2 = 22,
DefineButtonCxform = 23,
Protect = 24,
PlaceObject2 = 26,
RemoveObject2 = 28,
DefineShape3 = 32,
DefineText2 = 33,
DefineButton2 = 34,
DefineBitsJPEG3 = 35,
DefineBitsLossless2 = 36,
DefineEditText = 37,
DefineSprite = 39,
ProductInfo = 41,
FrameLabel = 43,
SoundStreamHead2 = 45,
DefineMorphShape = 46,
DefineFont2 = 48,
ExportAssets = 56,
ImportAssets = 57,
EnableDebugger = 58,
DoInitAction = 59,
DefineVideoStream = 60,
VideoFrame = 61,
DefineFontInfo2 = 62,
DebugID = 63,
EnableDebugger2 = 64,
ScriptLimits = 65,
SetTabIndex = 66,
FileAttributes = 69,
PlaceObject3 = 70,
ImportAssets2 = 71,
DefineFontAlignZones = 73,
CSMTextSetting = 74,
DefineFont3 = 75,
SymbolClass = 76,
Metadata = 77,
DefineScalingGrid = 78,
DoABC = 82,
DefineShape4 = 83,
DefineMorphShape2 = 84,
DefineSceneAndFrameLabelData = 86,
DefineBinaryData = 87,
DefineFontName = 88,
StartSound2 = 89,
DefineBitsJPEG4 = 90,
DefineFont4 = 91,
EnableTelemetry = 93,
}
}
|
namespace SwfSharp.Tags
{
public enum TagType
{
End = 0,
ShowFrame = 1,
DefineShape = 2,
PlaceObject = 4,
RemoveObject = 5,
DefineBits = 6,
DefineButton = 7,
JPEGTables = 8,
SetBackgroundColor = 9,
DefineFont = 10,
DefineText = 11,
DoAction = 12,
DefineFontInfo = 13,
DefineSound = 14,
StartSound = 15,
DefineButtonSound = 17,
SoundStreamHead = 18,
SoundStreamBlock = 19,
DefineBitsLossless = 20,
DefineBitsJPEG2 = 21,
DefineShape2 = 22,
DefineButtonCxform = 23,
Protect = 24,
PlaceObject2 = 26,
RemoveObject2 = 28,
DefineShape3 = 32,
DefineText2 = 33,
DefineButton2 = 34,
DefineBitsJPEG3 = 35,
DefineBitsLossless2 = 36,
DefineEditText = 37,
DefineSprite = 39,
ProductInfo = 41,
FrameLabel = 43,
SoundStreamHead2 = 45,
DefineMorphShape = 46,
DefineFont2 = 48,
ExportAssets = 56,
ImportAssets = 57,
EnableDebugger = 58,
DoInitAction = 59,
DefineVideoStream = 60,
VideoFrame = 61,
DefineFontInfo2 = 62,
EnableDebugger2 = 64,
ScriptLimits = 65,
SetTabIndex = 66,
FileAttributes = 69,
PlaceObject3 = 70,
ImportAssets2 = 71,
DefineFontAlignZones = 73,
CSMTextSetting = 74,
DefineFont3 = 75,
SymbolClass = 76,
Metadata = 77,
DefineScalingGrid = 78,
DoABC = 82,
DefineShape4 = 83,
DefineMorphShape2 = 84,
DefineSceneAndFrameLabelData = 86,
DefineBinaryData = 87,
DefineFontName = 88,
StartSound2 = 89,
DefineBitsJPEG4 = 90,
DefineFont4 = 91,
EnableTelemetry = 93,
}
}
|
mit
|
C#
|
a06b4d90f7202b3f49817783143633cde8135cab
|
Fix NPCTalk message decoding.
|
DeathCradle/Terraria-s-Dedicated-Server-Mod,DeathCradle/Terraria-s-Dedicated-Server-Mod,DeathCradle/Terraria-s-Dedicated-Server-Mod,DeathCradle/Terraria-s-Dedicated-Server-Mod
|
Terraria_Server/Messages/NPCTalkMessage.cs
|
Terraria_Server/Messages/NPCTalkMessage.cs
|
using System;
namespace Terraria_Server.Messages
{
public class NPCTalkMessage : IMessage
{
public Packet GetPacket()
{
return Packet.NPC_TALK;
}
public void Process(int start, int length, int num, int whoAmI, byte[] readBuffer, byte bufferData)
{
int playerIndex = whoAmI;
int talkNPC = (int)BitConverter.ToInt16(readBuffer, num + 1);
Main.players[playerIndex].talkNPC = talkNPC;
NetMessage.SendData(40, -1, whoAmI, "", playerIndex);
}
}
}
|
using System;
namespace Terraria_Server.Messages
{
public class NPCTalkMessage : IMessage
{
public Packet GetPacket()
{
return Packet.NPC_TALK;
}
public void Process(int start, int length, int num, int whoAmI, byte[] readBuffer, byte bufferData)
{
int playerIndex = playerIndex = whoAmI;
int talkNPC = (int)BitConverter.ToInt16(readBuffer, num);
num += 2;
Main.players[playerIndex].talkNPC = talkNPC;
NetMessage.SendData(40, -1, whoAmI, "", playerIndex);
}
}
}
|
mit
|
C#
|
7da000fb99175164b49beed1221baa43bdd117ce
|
Fix test again
|
corstijank/blog-dotnet-jenkins,corstijank/blog-dotnet-jenkins
|
TodoApi.Test/Models/TodoRepositoryTests.cs
|
TodoApi.Test/Models/TodoRepositoryTests.cs
|
using Xunit;
namespace TodoApi.Models
{
public class TodoRepositoryTests
{
private ITodoRepository _repository;
public TodoRepositoryTests()
{
_repository = new TodoRepository();
}
[Fact]
public void CanFindANewlyAddedTodoItem()
{
//Given
_repository.Add(new TodoItem {TodoItemID="abc", Name = "Some Random Todo", IsComplete = false });
//When
TodoItem foundItem = _repository.Find("abc");
//Then
Assert.NotNull(foundItem);
}
}
}
|
using Xunit;
namespace TodoApi.Models
{
public class TodoRepositoryTests
{
private ITodoRepository _repository;
public TodoRepositoryTests()
{
_repository = new TodoRepository();
}
[Fact]
public void CanFindANewlyAddedTodoItem()
{
//Given
_repository.Add(new TodoItem {Key="abc", Name = "Some Random Todo", IsComplete = false });
//When
TodoItem foundItem = _repository.Find("abc");
//Then
Assert.NotNull(foundItem);
}
}
}
|
apache-2.0
|
C#
|
7e5f70d3e8429455c77cde0486e7df633cd06ec6
|
Swap arguments order
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi/Backend/Models/FilterModel.cs
|
WalletWasabi/Backend/Models/FilterModel.cs
|
using NBitcoin;
using NBitcoin.DataEncoders;
using System;
using System.Text;
using WalletWasabi.Blockchain.Blocks;
using WalletWasabi.Helpers;
namespace WalletWasabi.Backend.Models
{
public class FilterModel
{
public FilterModel(SmartHeader header, GolombRiceFilter filter)
{
Header = Guard.NotNull(nameof(header), header);
Filter = Guard.NotNull(nameof(filter), filter);
}
public SmartHeader Header { get; }
public GolombRiceFilter Filter { get; }
// https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
// The parameter k MUST be set to the first 16 bytes of the hash of the block for which the filter
// is constructed.This ensures the key is deterministic while still varying from block to block.
public byte[] FilterKey => Header.BlockHash.ToBytes()[..16];
public static FilterModel FromLine(string line)
{
Guard.NotNullOrEmptyOrWhitespace(nameof(line), line);
string[] parts = line.Split(':');
if (parts.Length < 5)
{
throw new ArgumentException(line, nameof(line));
}
var blockHeight = uint.Parse(parts[0]);
var blockHash = uint256.Parse(parts[1]);
var filterData = Encoders.Hex.DecodeData(parts[2]);
GolombRiceFilter filter = new GolombRiceFilter(filterData, 20, 1 << 20);
var prevBlockHash = uint256.Parse(parts[3]);
var blockTime = DateTimeOffset.FromUnixTimeSeconds(long.Parse(parts[4]));
return new FilterModel(new SmartHeader(blockHash, prevBlockHash, blockHeight, blockTime), filter);
}
public string ToLine()
{
var builder = new StringBuilder();
builder.Append(Header.Height);
builder.Append(":");
builder.Append(Header.BlockHash);
builder.Append(":");
builder.Append(Filter);
builder.Append(":");
builder.Append(Header.PrevHash);
builder.Append(":");
builder.Append(Header.BlockTime.ToUnixTimeSeconds());
return builder.ToString();
}
}
}
|
using NBitcoin;
using NBitcoin.DataEncoders;
using System;
using System.Text;
using WalletWasabi.Blockchain.Blocks;
using WalletWasabi.Helpers;
namespace WalletWasabi.Backend.Models
{
public class FilterModel
{
public FilterModel(SmartHeader header, GolombRiceFilter filter)
{
Header = Guard.NotNull(nameof(header), header);
Filter = Guard.NotNull(nameof(filter), filter);
}
public SmartHeader Header { get; }
public GolombRiceFilter Filter { get; }
// https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
// The parameter k MUST be set to the first 16 bytes of the hash of the block for which the filter
// is constructed.This ensures the key is deterministic while still varying from block to block.
public byte[] FilterKey => Header.BlockHash.ToBytes()[..16];
public static FilterModel FromLine(string line)
{
Guard.NotNullOrEmptyOrWhitespace(nameof(line), line);
string[] parts = line.Split(':');
if (parts.Length < 5)
{
throw new ArgumentException(nameof(line), line);
}
var blockHeight = uint.Parse(parts[0]);
var blockHash = uint256.Parse(parts[1]);
var filterData = Encoders.Hex.DecodeData(parts[2]);
GolombRiceFilter filter = new GolombRiceFilter(filterData, 20, 1 << 20);
var prevBlockHash = uint256.Parse(parts[3]);
var blockTime = DateTimeOffset.FromUnixTimeSeconds(long.Parse(parts[4]));
return new FilterModel(new SmartHeader(blockHash, prevBlockHash, blockHeight, blockTime), filter);
}
public string ToLine()
{
var builder = new StringBuilder();
builder.Append(Header.Height);
builder.Append(":");
builder.Append(Header.BlockHash);
builder.Append(":");
builder.Append(Filter);
builder.Append(":");
builder.Append(Header.PrevHash);
builder.Append(":");
builder.Append(Header.BlockTime.ToUnixTimeSeconds());
return builder.ToString();
}
}
}
|
mit
|
C#
|
a8c692187ec9e05778495a99bd94b4aba1159c2a
|
Allow InitialFocusIndex to be specified for Window.
|
eylvisaker/AgateLib
|
AgateLib/UserInterface/Widgets/Window.cs
|
AgateLib/UserInterface/Widgets/Window.cs
|
//
// Copyright (c) 2006-2018 Erik Ylvisaker
//
// 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 System.Collections.Generic;
using System.Linq;
using System.Text;
using AgateLib.Mathematics.Geometry;
using AgateLib.UserInterface.Layout;
using Microsoft.Xna.Framework;
namespace AgateLib.UserInterface
{
/// <summary>
/// Widget that contains other widgets in a layout.
/// </summary>
public class Window : Widget<WindowProps>
{
public Window(WindowProps props) : base(props)
{
}
public override IRenderable Render() => new FlexBox(new FlexBoxProps
{
AllowNavigate = Props.AllowNavigate,
StyleTypeId = "window",
Children = Props.Children.ToList(),
OnCancel = Props.OnCancel,
Enabled = Props.Enabled,
InitialFocusIndex = Props.InitialFocusIndex,
}.CopyFromWidgetProps(Props));
}
public class WindowProps : WidgetProps
{
public bool AllowNavigate { get; set; } = true;
public IList<IRenderable> Children { get; set; } = new List<IRenderable>();
public UserInterfaceEventHandler OnCancel { get; set; }
public bool Enabled { get; set; } = true;
public int InitialFocusIndex { get; set; }
}
}
|
//
// Copyright (c) 2006-2018 Erik Ylvisaker
//
// 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 System.Collections.Generic;
using System.Linq;
using System.Text;
using AgateLib.Mathematics.Geometry;
using AgateLib.UserInterface.Layout;
using Microsoft.Xna.Framework;
namespace AgateLib.UserInterface
{
/// <summary>
/// Widget that contains other widgets in a layout.
/// </summary>
public class Window : Widget<WindowProps>
{
public Window(WindowProps props) : base(props)
{
}
public override IRenderable Render() => new FlexBox(new FlexBoxProps
{
AllowNavigate = Props.AllowNavigate,
StyleTypeId = "window",
Children = Props.Children.ToList(),
OnCancel = Props.OnCancel,
Enabled = Props.Enabled,
}.CopyFromWidgetProps(Props));
}
public class WindowProps : WidgetProps
{
public bool AllowNavigate { get; set; } = true;
public IList<IRenderable> Children { get; set; } = new List<IRenderable>();
public UserInterfaceEventHandler OnCancel { get; set; }
public bool Enabled { get; set; } = true;
}
}
|
mit
|
C#
|
e07cf3b018af42ee869ef219e73f0ff306e150a4
|
Fix "Options" window "OK"/"Cancel" button error
|
danielchalmers/DesktopWidgets
|
DesktopWidgets/Windows/Options.xaml.cs
|
DesktopWidgets/Windows/Options.xaml.cs
|
#region
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Navigation;
using DesktopWidgets.OptionsPages;
using DesktopWidgets.Properties;
#endregion
namespace DesktopWidgets.Windows
{
/// <summary>
/// Interaction logic for Options.xaml
/// </summary>
public partial class Options : Window
{
private readonly List<Page> _pages;
public Options()
{
InitializeComponent();
_pages = new List<Page>();
LoadPages();
Settings.Default.Save();
}
private void LoadPages()
{
_pages.Add(new General());
if (Settings.Default.EnableAdvancedMode)
_pages.Add(new Advanced());
_pages.Add(new About());
for (var i = 0; i < _pages.Count; i++)
NavBar.Items.Add(new ListBoxItem
{
Content = _pages[i].Title,
Tag = i
});
}
private void btnOK_Click(object sender, RoutedEventArgs e)
{
foreach (var be in _pages.SelectMany(BindingOperations.GetSourceUpdatingBindings))
be.UpdateSource();
Settings.Default.Save();
Close();
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
Settings.Default.Reload();
Close();
}
private void frame_LoadCompleted(object sender, NavigationEventArgs e)
{
var content = OptionsFrame.Content as FrameworkElement;
if (content == null)
return;
content.Style = (Style) FindResource("OptionsStyle");
}
private void NavBar_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
OptionsFrame.Navigate(_pages[NavBar.SelectedIndex]);
}
}
}
|
#region
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Navigation;
using DesktopWidgets.OptionsPages;
using DesktopWidgets.Properties;
#endregion
namespace DesktopWidgets.Windows
{
/// <summary>
/// Interaction logic for Options.xaml
/// </summary>
public partial class Options : Window
{
private readonly List<Page> _pages;
public Options()
{
InitializeComponent();
_pages = new List<Page>();
LoadPages();
Settings.Default.Save();
}
private void LoadPages()
{
_pages.Add(new General());
if (Settings.Default.EnableAdvancedMode)
_pages.Add(new Advanced());
_pages.Add(new About());
for (var i = 0; i < _pages.Count; i++)
NavBar.Items.Add(new ListBoxItem
{
Content = _pages[i].Title,
Tag = i
});
}
private void btnOK_Click(object sender, RoutedEventArgs e)
{
foreach (var be in _pages.SelectMany(BindingOperations.GetSourceUpdatingBindings))
be.UpdateSource();
Settings.Default.Save();
DialogResult = true;
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
Settings.Default.Reload();
DialogResult = true;
}
private void frame_LoadCompleted(object sender, NavigationEventArgs e)
{
var content = OptionsFrame.Content as FrameworkElement;
if (content == null)
return;
content.Style = (Style) FindResource("OptionsStyle");
}
private void NavBar_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
OptionsFrame.Navigate(_pages[NavBar.SelectedIndex]);
}
}
}
|
apache-2.0
|
C#
|
423b75fad31455b1aeb80d51c30107871f62b211
|
Make CouchRepository constructor public
|
tekbird/LoveSeat
|
LoveSeat.Repository/CouchRepository.cs
|
LoveSeat.Repository/CouchRepository.cs
|
using System;
using LoveSeat.Repository;
namespace LoveSeat.Repositories
{
public class CouchRepository<T> : IRepository<T> where T : IBaseObject
{
protected readonly CouchDatabase db = null;
public CouchRepository(CouchDatabase db)
{
this.db = db;
}
public virtual void Save(T item)
{
if (item.Id == Guid.Empty)
item.Id = Guid.NewGuid();
var doc = new Document<T>(item);
db.SaveDocument(doc);
}
public virtual T Find(Guid id)
{
return db.GetDocument<T>(id.ToString());
}
/// <summary>
/// Repository methods don't have the business validation. Use the service methods to enforce.
/// </summary>
/// <param name="obj"></param>
public virtual void Delete(T obj)
{
db.DeleteDocument(obj.Id.ToString(), obj.Rev);
}
}
}
|
using System;
using LoveSeat.Repository;
namespace LoveSeat.Repositories
{
public class CouchRepository<T> : IRepository<T> where T : IBaseObject
{
protected readonly CouchDatabase db = null;
protected CouchRepository(CouchDatabase db)
{
this.db = db;
}
public virtual void Save(T item)
{
if (item.Id == Guid.Empty)
item.Id = Guid.NewGuid();
var doc = new Document<T>(item);
db.SaveDocument(doc);
}
public virtual T Find(Guid id)
{
return db.GetDocument<T>(id.ToString());
}
/// <summary>
/// Repository methods don't have the business validation. Use the service methods to enforce.
/// </summary>
/// <param name="obj"></param>
public virtual void Delete(T obj)
{
db.DeleteDocument(obj.Id.ToString(), obj.Rev);
}
}
}
|
mit
|
C#
|
9c9bfff6ff305fc2fbea4770c89d0052a4d5ccc4
|
Allow topics to schedule at multiple times of day
|
bwatts/Totem,bwatts/Totem
|
Source/Totem/Runtime/Timeline/Topic.cs
|
Source/Totem/Runtime/Timeline/Topic.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Totem.Runtime.Map.Timeline;
namespace Totem.Runtime.Timeline
{
/// <summary>
/// A timeline presence that makes decisions
/// </summary>
public abstract class Topic : Flow
{
[Transient] public new TopicType Type => (TopicType) base.Type;
[Transient] protected new TopicWhenCall WhenCall => (TopicWhenCall) base.WhenCall;
protected void Then(Event e)
{
ExpectCallingWhen();
WhenCall.Append(e);
}
protected void ThenSchedule(Event e, DateTime whenOccurs)
{
Message.Traits.When.Set(e, whenOccurs);
Then(new EventScheduled(e));
}
protected void ThenSchedule(Event e, TimeSpan timeOfDay)
{
ThenSchedule(e, GetWhenOccursNext(timeOfDay));
}
protected void ThenSchedule(Event e, IEnumerable<TimeSpan> timesOfDay)
{
ThenSchedule(e, timesOfDay.Select(timeOfDay => GetWhenOccursNext(timeOfDay)).Min());
}
protected void ThenSchedule(Event e, params TimeSpan[] timesOfDay)
{
ThenSchedule(e, timesOfDay as IEnumerable<TimeSpan>);
}
private DateTime GetWhenOccursNext(TimeSpan timeOfDay)
{
// The time of day is relative to the timezone of the principal
var now = Clock.Now.ToLocalTime();
var today = now.Date;
var whenToday = today + timeOfDay;
var whenOccurs = whenToday > now
? whenToday
: today.AddDays(1) + timeOfDay;
return whenOccurs.ToUniversalTime();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Totem.Runtime.Map.Timeline;
namespace Totem.Runtime.Timeline
{
/// <summary>
/// A timeline presence that makes decisions
/// </summary>
public abstract class Topic : Flow
{
[Transient] public new TopicType Type => (TopicType) base.Type;
[Transient] protected new TopicWhenCall WhenCall => (TopicWhenCall) base.WhenCall;
protected void Then(Event e)
{
ExpectCallingWhen();
WhenCall.Append(e);
}
protected void Then(IEnumerable<Event> events)
{
ExpectCallingWhen();
foreach(var e in events)
{
WhenCall.Append(e);
}
}
protected void Then(params Event[] events)
{
Then(events as IEnumerable<Event>);
}
protected void ThenAt(DateTime whenOccurs, Event e)
{
Message.Traits.When.Set(e, whenOccurs);
Then(new EventScheduled(e));
}
protected void ThenAt(DateTime whenOccurs, IEnumerable<Event> events)
{
ThenAt(whenOccurs, events.ToArray());
}
protected void ThenAt(DateTime whenOccurs, params Event[] events)
{
foreach(var e in events)
{
Message.Traits.When.Set(e, whenOccurs);
}
Then(events);
}
protected void ThenAt(TimeSpan timeOfDay, Event e)
{
ThenAt(GetWhenOccursNext(timeOfDay), e);
}
protected void ThenAt(TimeSpan timeOfDay, IEnumerable<Event> events)
{
ThenAt(GetWhenOccursNext(timeOfDay), events);
}
protected void ThenAt(TimeSpan timeOfDay, params Event[] events)
{
ThenAt(GetWhenOccursNext(timeOfDay), events);
}
private DateTime GetWhenOccursNext(TimeSpan timeOfDay)
{
// The time of day is relative to the timezone of the principal
var now = Clock.Now.ToLocalTime();
var today = now.Date;
var whenToday = today + timeOfDay;
var whenOccurs = whenToday > now
? whenToday
: today.AddDays(1) + timeOfDay;
return whenOccurs.ToUniversalTime();
}
}
}
|
mit
|
C#
|
ec2c2781456c7da601f383d48af8ca707363438b
|
Use ticks instead of milliseconds for time calculation
|
feliwir/openSage,feliwir/openSage
|
src/OpenSage.Game/GameTimer.cs
|
src/OpenSage.Game/GameTimer.cs
|
using System;
using System.Diagnostics;
namespace OpenSage
{
public sealed class GameTimer : IDisposable
{
private readonly Stopwatch _stopwatch;
private long _startTime;
private long _lastUpdate;
public GameTime CurrentGameTime { get; private set; }
public GameTimer()
{
_stopwatch = new Stopwatch();
}
private long GetTimeNow() => _stopwatch.ElapsedTicks;
public void Start()
{
_stopwatch.Start();
Reset();
}
public void Update()
{
var now = GetTimeNow();
var deltaTime = now - _lastUpdate;
_lastUpdate = now;
CurrentGameTime = new GameTime(
TimeSpan.FromTicks(now - _startTime),
TimeSpan.FromTicks(deltaTime));
}
public void Reset()
{
_lastUpdate = GetTimeNow();
_startTime = _lastUpdate;
}
public void Dispose()
{
_stopwatch.Stop();
}
}
public readonly struct GameTime
{
public readonly TimeSpan TotalGameTime;
public readonly TimeSpan ElapsedGameTime;
public GameTime(in TimeSpan totalGameTime, in TimeSpan elapsedGameTime)
{
TotalGameTime = totalGameTime;
ElapsedGameTime = elapsedGameTime;
}
}
}
|
using System;
using System.Diagnostics;
namespace OpenSage
{
public sealed class GameTimer : IDisposable
{
private readonly Stopwatch _stopwatch;
private double _startTime;
private double _lastUpdate;
public GameTime CurrentGameTime { get; private set; }
public GameTimer()
{
_stopwatch = new Stopwatch();
}
private double GetTimeNow() => _stopwatch.ElapsedMilliseconds;
public void Start()
{
_stopwatch.Start();
Reset();
}
public void Update()
{
var now = GetTimeNow();
var deltaTime = now - _lastUpdate;
_lastUpdate = now;
CurrentGameTime = new GameTime(
TimeSpan.FromMilliseconds(now - _startTime),
TimeSpan.FromMilliseconds(deltaTime));
}
public void Reset()
{
_lastUpdate = GetTimeNow();
_startTime = _lastUpdate;
}
public void Dispose()
{
_stopwatch.Stop();
}
}
public readonly struct GameTime
{
public readonly TimeSpan TotalGameTime;
public readonly TimeSpan ElapsedGameTime;
public GameTime(in TimeSpan totalGameTime, in TimeSpan elapsedGameTime)
{
TotalGameTime = totalGameTime;
ElapsedGameTime = elapsedGameTime;
}
}
}
|
mit
|
C#
|
fd4218ae0ef0badf9864714d6f268a3fab4b7883
|
Add comment for desc.
|
mattgwagner/Cash-Flow-Projection,mattgwagner/Cash-Flow-Projection,mattgwagner/Cash-Flow-Projection,mattgwagner/Cash-Flow-Projection
|
src/Cash-Flow-Projection/Models/Entry.cs
|
src/Cash-Flow-Projection/Models/Entry.cs
|
using System;
using System.ComponentModel.DataAnnotations;
namespace Cash_Flow_Projection.Models
{
public class Entry
{
/// <summary>
/// A unique identifer generated for the entry
/// </summary>
public String id { get; set; } = Guid.NewGuid().ToString();
/// <summary>
/// Date the entry occurred
/// </summary>
[DataType(DataType.Date)]
public DateTime Date { get; set; } = DateTime.Today;
/// <summary>
/// A short, visible description of the transaction
/// </summary>
public String Description { get; set; }
/// <summary>
/// The amount of the transaction, negative represents cash expenditures, positive represents income.
///
/// If the entry is a balance snapshot, this represents the balance at this point in time.
/// </summary>
[DataType(DataType.Currency)]
public Decimal Amount { get; set; }
/// <summary>
/// If true, this entry denotes the snapshot cash balance at the given datetime
/// </summary>
public Boolean IsBalance { get; set; }
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
namespace Cash_Flow_Projection.Models
{
public class Entry
{
/// <summary>
/// A unique identifer generated for the entry
/// </summary>
public String id { get; set; } = Guid.NewGuid().ToString();
/// <summary>
/// Date the entry occurred
/// </summary>
[DataType(DataType.Date)]
public DateTime Date { get; set; } = DateTime.Today;
public String Description { get; set; }
/// <summary>
/// The amount of the transaction, negative represents cash expenditures, positive represents income.
///
/// If the entry is a balance snapshot, this represents the balance at this point in time.
/// </summary>
[DataType(DataType.Currency)]
public Decimal Amount { get; set; }
/// <summary>
/// If true, this entry denotes the snapshot cash balance at the given datetime
/// </summary>
public Boolean IsBalance { get; set; }
}
}
|
mit
|
C#
|
4720b9ee3decbb081f34c6ead716bf7d5102d6b5
|
Simplify the goto test
|
jonathanvdc/ecsc
|
tests/cs/goto/Goto.cs
|
tests/cs/goto/Goto.cs
|
// This test was adapted from a code sample from the C# language reference:
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/goto
using System;
public static class Program
{
public static void Main()
{
int x = 200;
int count = 0;
string[] array = new string[x];
// Initialize the array:
for (int i = 0; i < x; i++)
array[i] = (++count).ToString();
// Input a string:
string myNumber = "49";
// Search:
for (int i = 0; i < x; i++)
{
if (array[i].Equals(myNumber))
{
goto Found;
}
}
Console.WriteLine("The number " + myNumber + " was not found.");
goto Finish;
Found:
Console.WriteLine("The number " + myNumber + " is found.");
Finish:
Console.WriteLine("End of search.");
}
}
|
// This test was adapted from a code sample from the C# language reference:
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/goto
using System;
public static class Program
{
public static void Main()
{
int x = 200, y = 4;
int count = 0;
string[] array = new string[x * y];
// Initialize the array:
for (int i = 0; i < x; i++)
for (int j = 0; j < y; j++)
array[i * y + j] = (++count).ToString();
// Input a string:
string myNumber = "49";
// Search:
for (int i = 0; i < x; i++)
{
for (int j = 0; j < y; j++)
{
if (array[i * y + j].Equals(myNumber))
{
goto Found;
}
}
}
Console.WriteLine("The number " + myNumber + " was not found.");
goto Finish;
Found:
Console.WriteLine("The number " + myNumber + " is found.");
Finish:
Console.WriteLine("End of search.");
}
}
|
mit
|
C#
|
4cc1bc28da9c90b3ff830c1c9320db225042c26a
|
Switch to text area
|
mattgwagner/alert-roster
|
alert-roster.web/Views/Home/New.cshtml
|
alert-roster.web/Views/Home/New.cshtml
|
@model alert_roster.web.Models.Message
@{
ViewBag.Title = "Create New Message";
}
<h2>@ViewBag.Title</h2>
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@using (Html.BeginForm("New", "Home", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Message</h4>
<hr />
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(model => model.Content, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextAreaFor(model => model.Content)
@Html.ValidationMessageFor(model => model.Content)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
|
@model alert_roster.web.Models.Message
@{
ViewBag.Title = "Create New Message";
}
<h2>@ViewBag.Title</h2>
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@using (Html.BeginForm("New", "Home", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Message</h4>
<hr />
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(model => model.Content, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Content)
@Html.ValidationMessageFor(model => model.Content)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
|
mit
|
C#
|
c9a943c75d4ba8f9b429fd261fc410c8dfe75b78
|
添加对物理文件路由判断!
|
XujinquanGitHub/SipmleMvc,XujinquanGitHub/SipmleMvc
|
src/SipmleMvc.Routing/RouteDictionary.cs
|
src/SipmleMvc.Routing/RouteDictionary.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace SipmleMvc.Routing
{
public class RouteDictionary : Dictionary<string, Route>
{
/// <summary>
/// 对现有文件应用路由
/// </summary>
public bool RouteExistingFiles { get; set; }
public RouteData GetRouteData(HttpContext context)
{
//不应该路由时,查看文件是否存在,如果存在返回Null
if (!RouteExistingFiles)
{
var flag = this.IsRouteToExistingFile(context);
if (flag)
{
return null;
}
}
foreach (var route in this.Values)
{
RouteData routeData = route.GetRouteData(context);
if (routeData != null)
{
return routeData;
}
}
return null;
}
/// <summary>
/// 访问的路径是否存在文件
/// </summary>
/// <param name="httpContext"></param>
/// <returns></returns>
private bool IsRouteToExistingFile(HttpContext httpContext)
{
string appRelativeCurrentExecutionFilePath = httpContext.Request.AppRelativeCurrentExecutionFilePath;
if (appRelativeCurrentExecutionFilePath == "~/" || !File.Exists(httpContext.Server.MapPath(appRelativeCurrentExecutionFilePath)))
{
return false;
}
return true;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace SipmleMvc.Routing
{
public class RouteDictionary : Dictionary<string, Route>
{
public RouteData GetRouteData(HttpContext context)
{
foreach (var route in this.Values)
{
RouteData routeData = route.GetRouteData(context);
if (routeData != null)
{
return routeData;
}
}
return null;
}
}
}
|
mit
|
C#
|
70585a279dc3be236f617ebb70b20407a76cdeaa
|
Comment out unused variables for now
|
EVAST9919/osu,johnneijzen/osu,NeoAdonis/osu,ZLima12/osu,Damnae/osu,peppy/osu,smoogipoo/osu,ppy/osu,ZLima12/osu,DrabWeb/osu,Nabile-Rahmani/osu,NeoAdonis/osu,naoey/osu,2yangk23/osu,2yangk23/osu,smoogipoo/osu,johnneijzen/osu,ppy/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,UselessToucan/osu,DrabWeb/osu,naoey/osu,peppy/osu-new,Drezi126/osu,smoogipoo/osu,EVAST9919/osu,NeoAdonis/osu,ppy/osu,DrabWeb/osu,peppy/osu,Frontear/osuKyzer,UselessToucan/osu,naoey/osu
|
osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs
|
osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.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.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using System.Collections.Generic;
using System;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.UI;
namespace osu.Game.Rulesets.Catch.Beatmaps
{
internal class CatchBeatmapConverter : BeatmapConverter<CatchBaseHit>
{
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };
protected override IEnumerable<CatchBaseHit> ConvertHitObject(HitObject obj, Beatmap beatmap)
{
/*var distanceData = obj as IHasDistance;
var repeatsData = obj as IHasRepeats;
var endTimeData = obj as IHasEndTime;
var curveData = obj as IHasCurve;*/
yield return new Fruit
{
StartTime = obj.StartTime,
Position = ((IHasXPosition)obj).X / OsuPlayfield.BASE_SIZE.X
};
}
}
}
|
// 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.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using System.Collections.Generic;
using System;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.UI;
namespace osu.Game.Rulesets.Catch.Beatmaps
{
internal class CatchBeatmapConverter : BeatmapConverter<CatchBaseHit>
{
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };
protected override IEnumerable<CatchBaseHit> ConvertHitObject(HitObject obj, Beatmap beatmap)
{
var distanceData = obj as IHasDistance;
var repeatsData = obj as IHasRepeats;
var endTimeData = obj as IHasEndTime;
var curveData = obj as IHasCurve;
yield return new Fruit
{
StartTime = obj.StartTime,
Position = ((IHasXPosition)obj).X / OsuPlayfield.BASE_SIZE.X
};
}
}
}
|
mit
|
C#
|
3a269ecd71ff7816decd62cc743cd5c039638e82
|
Update to non-obsolete API
|
ErikEJ/EntityFramework7.SqlServerCompact,ErikEJ/EntityFramework.SqlServerCompact
|
src/Provider40/Scaffolding/Internal/SqlCeCodeGenerator.cs
|
src/Provider40/Scaffolding/Internal/SqlCeCodeGenerator.cs
|
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Scaffolding;
namespace EFCore.SqlCe.Scaffolding.Internal
{
public class SqlCeCodeGenerator : ProviderCodeGenerator
{
public SqlCeCodeGenerator([NotNull] ProviderCodeGeneratorDependencies dependencies)
: base(dependencies)
{
}
/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
public override MethodCallCodeFragment GenerateUseProvider(
string connectionString,
MethodCallCodeFragment providerOptions)
=> new MethodCallCodeFragment(
nameof(SqlCeDbContextOptionsExtensions.UseSqlCe),
providerOptions == null
? new object[] { connectionString }
: new object[] { connectionString, new NestedClosureCodeFragment("x", providerOptions) });
}
}
|
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Scaffolding;
namespace EFCore.SqlCe.Scaffolding.Internal
{
public class SqlCeCodeGenerator : ProviderCodeGenerator
{
public SqlCeCodeGenerator([NotNull] ProviderCodeGeneratorDependencies dependencies)
: base(dependencies)
{
}
public override MethodCallCodeFragment GenerateUseProvider(string connectionString)
=> new MethodCallCodeFragment(nameof(SqlCeDbContextOptionsExtensions.UseSqlCe), connectionString);
}
}
|
apache-2.0
|
C#
|
6c78f9488a8fcaa10692cee480aa0deaf9328815
|
Update copyright to 2019
|
Azure/azure-storage-net-data-movement
|
tools/AssemblyInfo/SharedAssemblyInfo.cs
|
tools/AssemblyInfo/SharedAssemblyInfo.cs
|
//------------------------------------------------------------------------------
// <copyright file="SharedAssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation
// </copyright>
// <summary>
// Assembly global configuration.
// </summary>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("0.9.1.0")]
[assembly: AssemblyFileVersion("0.9.1.0")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure Storage")]
[assembly: AssemblyCopyright("Copyright © 2019 Microsoft Corp.")]
[assembly: AssemblyTrademark("Microsoft ® is a registered trademark of Microsoft Corporation.")]
[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)]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: CLSCompliant(false)]
|
//------------------------------------------------------------------------------
// <copyright file="SharedAssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation
// </copyright>
// <summary>
// Assembly global configuration.
// </summary>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("0.9.1.0")]
[assembly: AssemblyFileVersion("0.9.1.0")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure Storage")]
[assembly: AssemblyCopyright("Copyright © 2018 Microsoft Corp.")]
[assembly: AssemblyTrademark("Microsoft ® is a registered trademark of Microsoft Corporation.")]
[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)]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: CLSCompliant(false)]
|
mit
|
C#
|
f48df96725e6946a141ba67a6fe1fd2f951fb8f7
|
Add metadata loading to abstract report class
|
Kentico/KInspector,ChristopherJennings/KInspector,ChristopherJennings/KInspector,Kentico/KInspector,Kentico/KInspector,ChristopherJennings/KInspector,Kentico/KInspector,ChristopherJennings/KInspector
|
KenticoInspector.Core/AbstractReport.cs
|
KenticoInspector.Core/AbstractReport.cs
|
using KenticoInspector.Core.Models;
using KenticoInspector.Core.Services.Interfaces;
using System;
using System.Collections.Generic;
namespace KenticoInspector.Core
{
public abstract class AbstractReport<T> : IReport, IWithMetadata<T> where T : new()
{
protected readonly IReportMetadataService reportMetadataService;
public AbstractReport(IReportMetadataService reportMetadataService)
{
this.reportMetadataService = reportMetadataService;
}
public string Codename => GetCodename(this.GetType());
public static string GetCodename(Type reportType) {
return GetDirectParentNamespace(reportType);
}
public abstract IList<Version> CompatibleVersions { get; }
public virtual IList<Version> IncompatibleVersions => new List<Version>();
public abstract IList<string> Tags { get; }
public ReportMetadata<T> Metadata => reportMetadataService.GetReportMetadata<T>(Codename);
public abstract ReportResults GetResults();
private static string GetDirectParentNamespace(Type reportType)
{
var fullNameSpace = reportType.Namespace;
var indexAfterLastPeriod = fullNameSpace.LastIndexOf('.') + 1;
return fullNameSpace.Substring(indexAfterLastPeriod, fullNameSpace.Length - indexAfterLastPeriod);
}
}
}
|
using KenticoInspector.Core.Models;
using System;
using System.Collections.Generic;
namespace KenticoInspector.Core
{
public abstract class AbstractReport<T> : IReport, IWithMetadata<T> where T : new()
{
public string Codename => GetCodename(this.GetType());
public static string GetCodename(Type reportType) {
return GetDirectParentNamespace(reportType);
}
public abstract IList<Version> CompatibleVersions { get; }
public virtual IList<Version> IncompatibleVersions => new List<Version>();
public abstract IList<string> Tags { get; }
public abstract ReportMetadata<T> Metadata { get; }
public abstract ReportResults GetResults();
private static string GetDirectParentNamespace(Type reportType)
{
var fullNameSpace = reportType.Namespace;
var indexAfterLastPeriod = fullNameSpace.LastIndexOf('.') + 1;
return fullNameSpace.Substring(indexAfterLastPeriod, fullNameSpace.Length - indexAfterLastPeriod);
}
}
}
|
mit
|
C#
|
e03f765270018cece9af64c1ad86f6a6db6ae832
|
add unobtrusive to bundle
|
ojraqueno/vstemplates,ojraqueno/vstemplates,ojraqueno/vstemplates
|
MVC5_R/MVC5_R/App_Start/BundleConfig.cs
|
MVC5_R/MVC5_R/App_Start/BundleConfig.cs
|
using MVC5_R.Infrastructure.Bundling;
using System.Web.Optimization;
namespace MVC5_R
{
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
AddCoreBundles(bundles);
}
private static void AddCoreBundles(BundleCollection bundles)
{
bundles.AddStyleBundle("~/stylebundles/core",
"~/bower_components/bootstrap/dist/css/bootstrap.css",
"~/Content/site.css");
bundles.AddScriptBundle("~/scriptbundles/core",
"~/bower_components/jquery/dist/jquery.min.js",
"~/bower_components/jquery-validation/dist/jquery.validate.min.js",
"~/bower_components/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js",
"~/bower_components/bootstrap/dist/js/bootstrap.js");
}
}
}
|
using MVC5_R.Infrastructure.Bundling;
using System.Web.Optimization;
namespace MVC5_R
{
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
AddCoreBundles(bundles);
}
private static void AddCoreBundles(BundleCollection bundles)
{
bundles.AddStyleBundle("~/stylebundles/core",
"~/bower_components/bootstrap/dist/css/bootstrap.css",
"~/Content/site.css");
bundles.AddScriptBundle("~/scriptbundles/core",
"~/bower_components/jquery/dist/jquery.min.js",
"~/bower_components/jquery-validation/dist/jquery.validate.min.js",
"~/bower_components/bootstrap/dist/js/bootstrap.js");
}
}
}
|
mit
|
C#
|
99f1ae9fe748b2b279ac40b2919b0b40fc10e484
|
Update Documentation
|
David-Desmaisons/Neutronium,NeutroniumCore/Neutronium,NeutroniumCore/Neutronium,David-Desmaisons/Neutronium,David-Desmaisons/Neutronium,NeutroniumCore/Neutronium
|
Neutronium.Core/Utils/CJsonConverter.cs
|
Neutronium.Core/Utils/CJsonConverter.cs
|
using Neutronium.Core.Binding;
using Neutronium.Core.Binding.GlueBuilder;
using Neutronium.Core.Extension;
using Neutronium.Core.Infra.VM;
using Neutronium.Core.Log;
namespace Neutronium.Core.Utils
{
/// <summary>
/// Helper class to export C# object into cjson format (circular json).
/// This format is compatible with neutronium-vue client: https://github.com/NeutroniumCore/neutronium-vue
/// using the neutronium-vm-loader: https://github.com/NeutroniumCore/neutronium-vm-loader
/// </summary>
public class CJsonConverter
{
private readonly CSharpToJavascriptConverter _Converter;
/// <summary>
/// Instanciate a new CJsonConverter
/// </summary>
public CJsonConverter()
{
var cache = new SessionCacher();
var factory = new GlueFactory(null, cache, null, null);
_Converter = new CSharpToJavascriptConverter(cache, factory, new NullLogger());
}
/// <summary>
/// raw conversion to cjson format
/// </summary>
/// <param name="object">object to be serialiazed</param>
/// <returns>cjson string value</returns>
public string ToCjson(object @object)
{
var glue = _Converter.Map(@object);
return glue.AsCircularJson();
}
/// <summary>
/// Conversion to cjson format compatible with a data context root Vm
/// Can be used as an entry for neutronium-vm-loader https://github.com/NeutroniumCore/neutronium-vm-loader
/// </summary>
/// <param name="object">object to be serialiazed</param>
/// <returns>cjson string value</returns>
public string ToRootVmCjson(object @object)
{
var context = new DataContextViewModel(@object);
var glue = _Converter.Map(context);
return glue.AsCircularVersionedJson();
}
}
}
|
using Neutronium.Core.Binding;
using Neutronium.Core.Binding.GlueBuilder;
using Neutronium.Core.Extension;
using Neutronium.Core.Infra.VM;
using Neutronium.Core.Log;
namespace Neutronium.Core.Utils
{
/// <summary>
/// Helper class to export C# object into cjson format (circular json).
/// This format is compatible with neutronium-vue client: https://github.com/NeutroniumCore/neutronium-vue
/// using the neutronium-vm-loader: https://github.com/NeutroniumCore/neutronium-vm-loader
/// </summary>
public class CJsonConverter
{
private readonly CSharpToJavascriptConverter _Converter;
/// <summary>
/// Instanciate a new CJsonConverter
/// </summary>
public CJsonConverter()
{
var cache = new SessionCacher();
var factory = new GlueFactory(null, cache, null, null);
_Converter = new CSharpToJavascriptConverter(cache, factory, new NullLogger());
}
/// <summary>
/// raw conversion to cjson format
/// </summary>
/// <param name="object">object to be serialiazed</param>
/// <returns>cjson string value</returns>
public string ToCjson(object @object)
{
var glue = _Converter.Map(@object);
return glue.AsCircularJson();
}
/// <summary>
/// Conversion to cjson format compatible with a data context root Vm
/// Can be used as entry for neutronium-vm-loader https://github.com/NeutroniumCore/neutronium-vm-loader
/// </summary>
/// <param name="object">object to be serialiazed</param>
/// <returns>cjson string value</returns>
public string ToRootVmCjson(object @object)
{
var context = new DataContextViewModel(@object);
var glue = _Converter.Map(context);
return glue.AsCircularVersionedJson();
}
}
}
|
mit
|
C#
|
9718e476c7e4ea6eadc2547b4143243bd2f16b52
|
Add license header
|
johnneijzen/osu,UselessToucan/osu,DrabWeb/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,2yangk23/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,DrabWeb/osu,ZLima12/osu,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,naoey/osu,peppy/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,naoey/osu,DrabWeb/osu,naoey/osu,ZLima12/osu
|
osu.Game/Rulesets/Mods/IMod.cs
|
osu.Game/Rulesets/Mods/IMod.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Rulesets.Mods
{
public interface IMod
{
/// <summary>
/// The shortened name of this mod.
/// </summary>
string Acronym { get; }
}
}
|
namespace osu.Game.Rulesets.Mods
{
public interface IMod
{
/// <summary>
/// The shortened name of this mod.
/// </summary>
string Acronym { get; }
}
}
|
mit
|
C#
|
f2518e948005faab2097fd9b4497cc4230184f80
|
throw if cancelled
|
jchannon/Nancy.Demo.Async,jchannon/Nancy.Demo.Async
|
Nancy.Demo.Async/Modules/IndexModule.cs
|
Nancy.Demo.Async/Modules/IndexModule.cs
|
namespace Nancy.Demo.Async.Modules
{
using System.Net.Http;
using ServiceStack.Text;
using System.Threading.Tasks;
using System.Threading;
public class IndexModule : NancyModule
{
public IndexModule()
{
Get["/"] = parameters => View["Index"];
Post["/", true] = async (x, ct) =>
{
var link = await GetQrCode(ct);
var model = new { QrPath = link };
return View["Index", model];
};
}
private async Task<string> GetQrCode(CancellationToken ct)
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-Mashape-Authorization", "oEzDRdFudTpsuLtmgewrIGcuj08tK7PI");
var response = await client.GetAsync(
"https://mutationevent-qr-code-generator.p.mashape.com/generate.php?content=http://www.nancyfx.org&type=url", ct);
var stringContent = await response.Content.ReadAsStringAsync();
ct.ThrowIfCancellationRequested();
dynamic model = JsonObject.Parse(stringContent);
return model["image_url"];
}
}
}
|
namespace Nancy.Demo.Async.Modules
{
using System.Net.Http;
using ServiceStack.Text;
using System.Threading.Tasks;
using System.Threading;
public class IndexModule : NancyModule
{
public IndexModule()
{
Get["/"] = parameters => View["Index"];
Post["/", true] = async (x, ct) =>
{
var link = await GetQrCode(ct);
var model = new { QrPath = link };
return View["Index", model];
};
}
private async Task<string> GetQrCode(CancellationToken ct)
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-Mashape-Authorization", "oEzDRdFudTpsuLtmgewrIGcuj08tK7PI");
var response = await client.GetAsync(
"https://mutationevent-qr-code-generator.p.mashape.com/generate.php?content=http://www.nancyfx.org&type=url", ct);
var stringContent = await response.Content.ReadAsStringAsync();
dynamic model = JsonObject.Parse(stringContent);
return model["image_url"];
}
}
}
|
mit
|
C#
|
9407bcd32c9209ec81815d33b3ca2b4850127de9
|
Bump to v2.0.3
|
clement911/ShopifySharp,addsb/ShopifySharp,nozzlegear/ShopifySharp,Yitzchok/ShopifySharp
|
ShopifySharp/Properties/AssemblyInfo.cs
|
ShopifySharp/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("ShopifySharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShopifySharp")]
[assembly: AssemblyCopyright("Copyright © Nozzlegear Software 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("833ec12b-956d-427b-a598-2f12b84589ef")]
// 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.0.3.0")]
[assembly: AssemblyFileVersion("2.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("ShopifySharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShopifySharp")]
[assembly: AssemblyCopyright("Copyright © Nozzlegear Software 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("833ec12b-956d-427b-a598-2f12b84589ef")]
// 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.0.2.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
|
mit
|
C#
|
b1a6eaae8cd7140455580c5094fe3e32089b3114
|
Add progress example to command line program
|
christophediericx/ArduinoSketchUploader
|
Source/ArduinoSketchUploader/Program.cs
|
Source/ArduinoSketchUploader/Program.cs
|
using System;
using ArduinoUploader;
using NLog;
namespace ArduinoSketchUploader
{
/// <summary>
/// The ArduinoSketchUploader can upload a compiled (Intel) HEX file directly to an attached Arduino.
/// </summary>
internal class Program
{
private static readonly Logger logger = LogManager.GetLogger("ArduinoSketchUploader");
private enum StatusCodes
{
Success,
ArduinoUploaderException,
GeneralRuntimeException
}
private static void Main(string[] args)
{
var commandLineOptions = new CommandLineOptions();
if (!CommandLine.Parser.Default.ParseArguments(args, commandLineOptions)) return;
var options = new ArduinoSketchUploaderOptions
{
PortName = commandLineOptions.PortName,
FileName = commandLineOptions.FileName,
ArduinoModel = commandLineOptions.ArduinoModel
};
var progress = new Progress<double>(p => logger.Info("{0:F1}%", p * 100));
var uploader = new ArduinoUploader.ArduinoSketchUploader(options, progress);
try
{
uploader.UploadSketch();
Environment.Exit((int)StatusCodes.Success);
}
catch (ArduinoUploaderException)
{
Environment.Exit((int)StatusCodes.ArduinoUploaderException);
}
catch (Exception ex)
{
UploaderLogger.LogError(string.Format("Unexpected exception: {0}!", ex.Message), ex);
Environment.Exit((int)StatusCodes.GeneralRuntimeException);
}
}
}
}
|
using System;
using ArduinoUploader;
namespace ArduinoSketchUploader
{
/// <summary>
/// The ArduinoSketchUploader can upload a compiled (Intel) HEX file directly to an attached Arduino.
/// </summary>
internal class Program
{
private enum StatusCodes
{
Success,
ArduinoUploaderException,
GeneralRuntimeException
}
private static void Main(string[] args)
{
var commandLineOptions = new CommandLineOptions();
if (!CommandLine.Parser.Default.ParseArguments(args, commandLineOptions)) return;
var options = new ArduinoSketchUploaderOptions
{
PortName = commandLineOptions.PortName,
FileName = commandLineOptions.FileName,
ArduinoModel = commandLineOptions.ArduinoModel
};
var uploader = new ArduinoUploader.ArduinoSketchUploader(options);
try
{
uploader.UploadSketch();
Environment.Exit((int)StatusCodes.Success);
}
catch (ArduinoUploaderException)
{
Environment.Exit((int)StatusCodes.ArduinoUploaderException);
}
catch (Exception ex)
{
UploaderLogger.LogError(string.Format("Unexpected exception: {0}!", ex.Message), ex);
Environment.Exit((int)StatusCodes.GeneralRuntimeException);
}
}
}
}
|
mit
|
C#
|
ad9dfcf04e2ca3af8218357e441c21e342d85a58
|
Add more user friendly message. Fixes #68
|
OrleansContrib/Orleankka,yevhen/Orleankka,mhertis/Orleankka,pkese/Orleankka,mhertis/Orleankka,yevhen/Orleankka,llytvynenko/Orleankka,AntyaDev/Orleankka,AntyaDev/Orleankka,pkese/Orleankka,llytvynenko/Orleankka,OrleansContrib/Orleankka
|
Source/Orleankka/Core/ActorActivator.cs
|
Source/Orleankka/Core/ActorActivator.cs
|
using System;
namespace Orleankka.Core
{
public interface IActorActivator
{
void Init(object properties);
Actor Activate(Type type, string id, IActorRuntime runtime);
}
public abstract class ActorActivator<TProperties> : IActorActivator
{
void IActorActivator.Init(object properties)
{
Init((TProperties) properties);
}
public abstract void Init(TProperties properties);
public abstract Actor Activate(Type type, string id, IActorRuntime runtime);
}
public abstract class ActorActivator : ActorActivator<object>
{
public override void Init(object properties) {}
}
class DefaultActorActivator : ActorActivator
{
public override Actor Activate(Type type, string id, IActorRuntime runtime)
{
try
{
return (Actor) Activator.CreateInstance(type, nonPublic: true);
}
catch (MissingMethodException e)
{
throw new InvalidOperationException(
$"No parameterless constructor defined for {type} type");
}
}
}
static class ActorActivatorExntensions
{
public static Actor Activate(this IActorActivator activator, ActorPath path, IActorRuntime runtime)
{
var type = ActorType.Registered(path.Code);
return activator.Activate(type.Implementation, path.Id, runtime);
}
}
}
|
using System;
namespace Orleankka.Core
{
public interface IActorActivator
{
void Init(object properties);
Actor Activate(Type type, string id, IActorRuntime runtime);
}
public abstract class ActorActivator<TProperties> : IActorActivator
{
void IActorActivator.Init(object properties)
{
Init((TProperties) properties);
}
public abstract void Init(TProperties properties);
public abstract Actor Activate(Type type, string id, IActorRuntime runtime);
}
public abstract class ActorActivator : ActorActivator<object>
{
public override void Init(object properties) {}
}
class DefaultActorActivator : ActorActivator
{
public override Actor Activate(Type type, string id, IActorRuntime runtime)
{
return (Actor) Activator.CreateInstance(type, nonPublic: true);
}
}
static class ActorActivatorExntensions
{
public static Actor Activate(this IActorActivator activator, ActorPath path, IActorRuntime runtime)
{
var type = ActorType.Registered(path.Code);
return activator.Activate(type.Implementation, path.Id, runtime);
}
}
}
|
apache-2.0
|
C#
|
1cb5a464e964efa5816d8afac54ceb2bd5a6180a
|
Bump version
|
criteo/RabbitMQHare
|
RabbitMQHare/Properties/AssemblyInfo.cs
|
RabbitMQHare/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("RabbitMQHare")]
[assembly: AssemblyDescription("Simple wrapper around rabbit official client")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Criteo")]
[assembly: AssemblyProduct("RabbitMQHare")]
[assembly: AssemblyCopyright("Copyright © Criteo 2013")]
[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("058763b1-7003-4abe-86f7-e7f58334b2c7")]
// 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(Info.Version)]
[assembly: AssemblyFileVersion(Info.Version)]
[assembly: AssemblyInformationalVersion(Info.Version)]
public static class Info
{
public const string Version = "4.2.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("RabbitMQHare")]
[assembly: AssemblyDescription("Simple wrapper around rabbit official client")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Criteo")]
[assembly: AssemblyProduct("RabbitMQHare")]
[assembly: AssemblyCopyright("Copyright © Criteo 2013")]
[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("058763b1-7003-4abe-86f7-e7f58334b2c7")]
// 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(Info.Version)]
[assembly: AssemblyFileVersion(Info.Version)]
[assembly: AssemblyInformationalVersion(Info.Version)]
public static class Info
{
public const string Version = "4.1.0";
}
|
apache-2.0
|
C#
|
9dd7098f1d3a1f3adcd606709819376e2bc7dde9
|
index of
|
lianzhao/netfx
|
src/LianZhao.NetFx/Linq/Enumerable.IndexOf.cs
|
src/LianZhao.NetFx/Linq/Enumerable.IndexOf.cs
|
using System.Collections.Generic;
namespace LianZhao.Linq
{
public static partial class Enumerable
{
public static int IndexOf<T>(this IEnumerable<T> source, T item, IEqualityComparer<T> comparer = null)
{
if (comparer == null)
{
var list = source as IList<T>;
if (list != null)
{
return list.IndexOf(item);
}
comparer = EqualityComparer<T>.Default;
}
using (var itor = source.GetEnumerator())
{
var i = 0;
while (itor.MoveNext())
{
if (comparer.Equals(itor.Current, item))
{
return i;
}
i++;
}
}
return -1;
}
}
}
|
using System.Collections.Generic;
namespace LianZhao.Linq
{
public static partial class Enumerable
{
public static int IndexOf<T>(this IEnumerable<T> source, T item, IEqualityComparer<T> comparer = null)
{
comparer = comparer ?? EqualityComparer<T>.Default;
using (var itor = source.GetEnumerator())
{
var i = 0;
while (itor.MoveNext())
{
if (comparer.Equals(itor.Current, item))
{
return i;
}
i++;
}
}
return -1;
}
}
}
|
mit
|
C#
|
fc28e6e254409100f29ab07fd0ef87ebd20af814
|
Update "App"
|
DRFP/Personal-Library
|
_Build/PersonalLibrary/Base/App.xaml.cs
|
_Build/PersonalLibrary/Base/App.xaml.cs
|
using System.IO;
using System.Windows;
using static Library.Configuration;
using static Library.SQLiteManager;
namespace Base {
public partial class App : Application {
public App() { Configure(); }
private async void Configure() {
if (!File.Exists(DatabaseName)) await CreateDatabase();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace Base {
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application {
}
}
|
mit
|
C#
|
590462eb007f957d83ae1d8cc610a885d6c32ae1
|
Update OpeningTabDelimitedFiles.cs
|
aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/CSharp/Files/Handling/OpeningTabDelimitedFiles.cs
|
Examples/CSharp/Files/Handling/OpeningTabDelimitedFiles.cs
|
using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.Files.Handling
{
public class OpeningFiles
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Opening Tab Delimited Files
//Instantiate LoadOptions specified by the LoadFormat.
LoadOptions loadOptions5 = new LoadOptions(LoadFormat.TabDelimited);
//Create a Workbook object and opening the file from its path
Workbook wbTabDelimited = new Workbook(dataDir + "Book1TabDelimited.txt", loadOptions5);
Console.WriteLine("Tab delimited file opened successfully!");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.Files.Handling
{
public class OpeningFiles
{
public static void Main(string[] args)
{
//Exstart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Opening Tab Delimited Files
//Instantiate LoadOptions specified by the LoadFormat.
LoadOptions loadOptions5 = new LoadOptions(LoadFormat.TabDelimited);
//Create a Workbook object and opening the file from its path
Workbook wbTabDelimited = new Workbook(dataDir + "Book1TabDelimited.txt", loadOptions5);
Console.WriteLine("Tab delimited file opened successfully!");
//ExEnd:1
}
}
}
|
mit
|
C#
|
9c07a8705b69e595882d655e45fc81755f47487c
|
fix test
|
qianlifeng/Wox,qianlifeng/Wox,Wox-launcher/Wox,Wox-launcher/Wox,qianlifeng/Wox
|
Wox.Test/PluginProgramTest.cs
|
Wox.Test/PluginProgramTest.cs
|
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Wox.Core.Configuration;
using Wox.Core.Plugin;
using Wox.Image;
using Wox.Infrastructure;
using Wox.Infrastructure.UserSettings;
using Wox.Plugin;
using Wox.ViewModel;
namespace Wox.Test
{
[TestFixture]
class PluginProgramTest
{
private Plugin.Program.Main plugin;
[OneTimeSetUp]
public void Setup()
{
Settings.Initialize();
Portable portable = new Portable();
SettingWindowViewModel settingsVm = new SettingWindowViewModel(portable);
StringMatcher stringMatcher = new StringMatcher();
StringMatcher.Instance = stringMatcher;
stringMatcher.UserSettingSearchPrecision = Settings.Instance.QuerySearchPrecision;
PluginManager.LoadPlugins(Settings.Instance.PluginSettings);
MainViewModel mainVm = new MainViewModel(false);
PublicAPIInstance api = new PublicAPIInstance(settingsVm, mainVm);
plugin = new Plugin.Program.Main();
plugin.InitSync(new PluginInitContext()
{
API = api,
});
}
[TestCase("powershell", "PowerShell")]
[TestCase("note", "Notepad")]
[TestCase("computer", "computer")]
public void Win32Test(string QueryText, string ResultTitle)
{
Query query = QueryBuilder.Build(QueryText.Trim(), new Dictionary<string, PluginPair>());
Result result = plugin.Query(query).OrderByDescending(r => r.Score).First();
Assert.IsTrue(result.Title.StartsWith(ResultTitle));
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Wox.Core.Configuration;
using Wox.Core.Plugin;
using Wox.Image;
using Wox.Infrastructure;
using Wox.Infrastructure.UserSettings;
using Wox.Plugin;
using Wox.ViewModel;
namespace Wox.Test
{
[TestFixture]
class PluginProgramTest
{
private Plugin.Program.Main plugin;
[OneTimeSetUp]
public void Setup()
{
Settings.Initialize();
Portable portable = new Portable();
SettingWindowViewModel settingsVm = new SettingWindowViewModel(portable);
StringMatcher stringMatcher = new StringMatcher();
StringMatcher.Instance = stringMatcher;
stringMatcher.UserSettingSearchPrecision = Settings.Instance.QuerySearchPrecision;
PluginManager.LoadPlugins(Settings.Instance.PluginSettings);
MainViewModel mainVm = new MainViewModel(false);
PublicAPIInstance api = new PublicAPIInstance(settingsVm, mainVm);
plugin = new Plugin.Program.Main();
plugin.InitSync(new PluginInitContext()
{
API = api,
});
}
[TestCase("powershell", "PowerShell")]
[TestCase("note", "Notepad")]
[TestCase("this pc", "This PC")]
public void Win32Test(string QueryText, string ResultTitle)
{
Query query = QueryBuilder.Build(QueryText.Trim(), new Dictionary<string, PluginPair>());
Result result = plugin.Query(query).OrderByDescending(r => r.Score).First();
Assert.IsTrue(result.Title.StartsWith(ResultTitle));
}
}
}
|
mit
|
C#
|
c7f686922da3c8e7eeff012a08e3788d3a198d34
|
Fix namespace for CommandInterpreterTest.cs
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Tests/UnitTests/GUI/CommandInterpreterTest.cs
|
WalletWasabi.Tests/UnitTests/GUI/CommandInterpreterTest.cs
|
using Mono.Options;
using System.IO;
using WalletWasabi.Gui.CommandLine;
using Xunit;
namespace WalletWasabi.Tests.UnitTests.GUI
{
public class CommandInterpreterTest
{
[Fact]
public async void CommandInterpreterShowsHelpAsync()
{
var textWriter = new StringWriter();
var c = new CommandInterpreter(textWriter);
await c.ExecuteCommandsAsync(new string[] { "wassabee", "--help" }, new Command("mixer"), new Command("findpassword"));
Assert.Equal(
@"Usage: wassabee [OPTIONS]+
Launches Wasabi Wallet.
-h, --help Displays help page and exit.
-v, --version Displays Wasabi version and exit.
Available commands are:
mixer
findpassword
",
textWriter.ToString());
}
}
}
|
using Mono.Options;
using System.IO;
using WalletWasabi.Gui.CommandLine;
using Xunit;
namespace WalletWasabi.Tests.UnitTests
{
public class CommandInterpreterTest
{
[Fact]
public async void CommandInterpreterShowsHelpAsync()
{
var textWriter = new StringWriter();
var c = new CommandInterpreter(textWriter);
await c.ExecuteCommandsAsync(new string[] { "wassabee", "--help" }, new Command("mixer"), new Command("findpassword"));
Assert.Equal(
@"Usage: wassabee [OPTIONS]+
Launches Wasabi Wallet.
-h, --help Displays help page and exit.
-v, --version Displays Wasabi version and exit.
Available commands are:
mixer
findpassword
",
textWriter.ToString());
}
}
}
|
mit
|
C#
|
44ac3ef4c391fff22cf3ccd30dfcc88d26a6585e
|
Add ObjC flag to LinkWith file
|
MarcBruins/FSCalendar-Xamarin-iOS
|
FSCalendar/LinkWith.cs
|
FSCalendar/LinkWith.cs
|
using ObjCRuntime;
[assembly: LinkWith("libFSCalendar.a", LinkTarget.i386 | LinkTarget.x86_64 | LinkTarget.Arm64 | LinkTarget.ArmV7 | LinkTarget.Simulator, SmartLink = true, ForceLoad = true, Frameworks = "NotificationCenter UIKit Foundation CoreGraphics", LinkerFlags = "-ObjC")]
|
using ObjCRuntime;
[assembly: LinkWith("libFSCalendar.a", LinkTarget.i386 | LinkTarget.x86_64 | LinkTarget.Arm64 | LinkTarget.ArmV7 | LinkTarget.Simulator, SmartLink = true, ForceLoad = true, Frameworks = "NotificationCenter UIKit Foundation CoreGraphics")]
|
mit
|
C#
|
634967d08c4e625d3d5c1e119bfb6cafb922e2e7
|
Add Dequeue<T>(int count) for dequeue specified items in Queue<T> by count when enumberate
|
witoong623/TirkxDownloader,witoong623/TirkxDownloader
|
Framework/Extension.cs
|
Framework/Extension.cs
|
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
namespace TirkxDownloader.Framework
{
public static class Extension
{
public static async Task<HttpWebResponse> GetResponseAsync(this HttpWebRequest request, CancellationToken ct)
{
using (ct.Register(() => request.Abort(), useSynchronizationContext: false))
{
try
{
var response = await request.GetResponseAsync();
ct.ThrowIfCancellationRequested();
return (HttpWebResponse)response;
}
catch (WebException webEx)
{
if (ct.IsCancellationRequested)
{
throw new OperationCanceledException(webEx.Message, webEx, ct);
}
throw;
}
}
}
public static T[] Dequeue<T>(this Queue<T> queue, int count)
{
T[] list = new T[count];
for (int i = 0; i < count; i++)
{
list[i] = queue.Dequeue();
}
return list;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
namespace TirkxDownloader.Framework
{
public static class Extension
{
public static async Task<HttpWebResponse> GetResponseAsync(this HttpWebRequest request, CancellationToken ct)
{
using (ct.Register(() => request.Abort(), useSynchronizationContext: false))
{
try
{
var response = await request.GetResponseAsync();
ct.ThrowIfCancellationRequested();
return (HttpWebResponse)response;
}
catch (WebException webEx)
{
if (ct.IsCancellationRequested)
{
throw new OperationCanceledException(webEx.Message, webEx, ct);
}
throw;
}
}
}
}
}
|
mit
|
C#
|
b333c4e66da543e27283eb251006d0b5028e2997
|
remove prevention of resetting the prototype and expose HasOwnProperty to support HyperJS
|
quameleon/hypercore,heupel/hypercore
|
HyperCore/HyperHypo.cs
|
HyperCore/HyperHypo.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TonyHeupel.HyperCore
{
public class HyperHypo : HyperDynamo
{
public HyperHypo() : this(null) { }
public HyperHypo(HyperHypo prototype)
{
this.MemberProvider = new HyperDictionary();
Prototype = prototype;
}
private HyperHypo _prototype = null;
public HyperHypo Prototype
{
get { return _prototype; }
set
{
_prototype = value;
if (_prototype == null) return;
//Use InheritsFrom so we don't create some crazy all-encompassing graph of things
this.MemberProvider.InheritsFrom(_prototype.MemberProvider);
}
}
public new HyperDictionary MemberProvider
{
get { return base.MemberProvider as HyperDictionary; }
set { base.MemberProvider = value; }
}
public virtual bool HasOwnProperty(string name)
{
return this.MemberProvider.HasOwnProperty(name);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TonyHeupel.HyperCore
{
public class HyperHypo : HyperDynamo
{
public HyperHypo() : this(null) { }
public HyperHypo(HyperHypo prototype)
{
this.MemberProvider = new HyperDictionary();
Prototype = prototype;
}
private HyperHypo _prototype = null;
public HyperHypo Prototype
{
get { return _prototype; }
set
{
if (_prototype != null && (value == null || value != _prototype))
{
throw new NotImplementedException("We do not yet support resetting the prototype");
}
_prototype = value;
if (_prototype == null) return;
//Use InheritsFrom so we don't create some crazy all-encompassing graph of things
this.MemberProvider.InheritsFrom(_prototype.MemberProvider);
}
}
public new HyperDictionary MemberProvider
{
get { return base.MemberProvider as HyperDictionary; }
set { base.MemberProvider = value; }
}
}
}
|
mit
|
C#
|
27dda6209fd5ce60683067344e47939df68959f8
|
update sample values
|
thewizster/hanc,thewizster/hanc
|
AspNetAPI/Controllers/ValuesController.cs
|
AspNetAPI/Controllers/ValuesController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Webextant.Security.Cryptography;
using Microsoft.Extensions.Options;
namespace Hanc.AspNetAPI.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
private readonly SecretOptions _optionsAccessor;
public ValuesController(IOptions<SecretOptions> optionsAccessor)
{
_optionsAccessor = optionsAccessor.Value;
}
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
Mac mac = new Mac(_optionsAccessor.MacSecret);
var token = mac.GenerateToken("Hello World!");
return new string[] { "Hello", "World", token };
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Webextant.Security.Cryptography;
using Microsoft.Extensions.Options;
namespace Hanc.AspNetAPI.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
private readonly SecretOptions _optionsAccessor;
public ValuesController(IOptions<SecretOptions> optionsAccessor)
{
_optionsAccessor = optionsAccessor.Value;
}
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
Mac mac = new Mac(_optionsAccessor.MacSecret);
var token = mac.GenerateToken("Hello World!");
return new string[] { "value1", "value2", token, _optionsAccessor.MacSecret };
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
|
mit
|
C#
|
13fdcbe1bbc9292443c530c6e5b5a94bd1b8f962
|
Add Single Query Filter
|
masoud-bahrami/Chakad.Pipeline4Monolith
|
Chakad/Pipeline/Core/Query/ChakadQuery.cs
|
Chakad/Pipeline/Core/Query/ChakadQuery.cs
|
using Chakad.Pipeline.Core.Internal;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Chakad.Pipeline.Core.Query
{
public interface IChakadQuery<TOut> : IBusinessQuery<TOut>
{
string SearchText { get; set; }
ICollection<SortInfo> OrderBy { get; set; }
Page Page { get; set; }
Filter[] Filters { get; set; }
Sort[] Sorts { get; set; }
string[] Groups { get; set; }
}
public class ChakadQuery<TOut> : IChakadQuery<TOut>
{
public ChakadQuery()
{
CorrelationId = CorrelationIdConstants.Query;
Page = new Page
{
Skip = 0,
Take = ushort.MaxValue
};
OrderBy = new Collection<SortInfo>();
}
#region IListQuery<TOut> Members
public string SearchText { get; set; }
public ICollection<SortInfo> OrderBy { get; set; }
public Filter[] Filters { get; set; }
public Sort[] Sorts { get; set; }
public string[] Groups { get; set; }
public Page Page { get; set; }
public string CorrelationId { get; set; }
#endregion
}
#region ~ Sort Info ~
public class SortInfo
{
public string Field { get; set; }
public bool Descending { get; set; }
public int Order { get; set; }
}
#endregion
public class Page
{
public ushort Skip { get; set; }
public ushort Take { get; set; }
}
public class Sort
{
public string Dir { get; set; }
public string Field { get; set; }
}
public class Filter
{
public class FilterVM
{
public string Field { get; set; }
public string Operator { get; set; }
public string Value { get; set; }
}
public FilterVM[] Filters { get; set; }
public string Logic { get; set; }
public string Field { get; set; }
public string Operator { get; set; }
public string Value { get; set; }
public bool HasMultipleCriteria
{
get
{
return Filters != null && Filters.Length > 0;
}
}
}
}
|
using Chakad.Pipeline.Core.Internal;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Chakad.Pipeline.Core.Query
{
public interface IChakadQuery<TOut> : IBusinessQuery<TOut>
{
string SearchText { get; set; }
ICollection<SortInfo> OrderBy { get; set; }
Page Page { get; set; }
Filter[] Filters { get; set; }
Sort[] Sorts { get; set; }
string[] Groups { get; set; }
}
public class ChakadQuery<TOut> : IChakadQuery<TOut>
{
public ChakadQuery()
{
CorrelationId = CorrelationIdConstants.Query;
Page = new Page
{
Skip = 0,
Take = ushort.MaxValue
};
OrderBy = new Collection<SortInfo>();
}
#region IListQuery<TOut> Members
public string SearchText { get; set; }
public ICollection<SortInfo> OrderBy { get; set; }
public Filter[] Filters { get; set; }
public Sort[] Sorts { get; set; }
public string[] Groups { get; set; }
public Page Page { get; set; }
public string CorrelationId { get; set; }
#endregion
}
#region ~ Sort Info ~
public class SortInfo
{
public string Field { get; set; }
public bool Descending { get; set; }
public int Order { get; set; }
}
#endregion
public class Page
{
public ushort Skip { get; set; }
public ushort Take { get; set; }
}
public class Sort
{
public string Dir { get; set; }
public string Field { get; set; }
}
public class Filter
{
public class FilterVM
{
public string Field { get; set; }
public string Operator { get; set; }
public string Value { get; set; }
}
public FilterVM[] Filters { get; set; }
public string Logic { get; set; }
}
}
|
apache-2.0
|
C#
|
ee0f55b0efec5a7d6c5018a9111dbfcb5da871b1
|
Fix HidesHair (#12219)
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
|
Content.Server/Clothing/ClothingSystem.cs
|
Content.Server/Clothing/ClothingSystem.cs
|
using Content.Server.Humanoid;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Humanoid;
using Content.Shared.Inventory.Events;
using Content.Shared.Tag;
namespace Content.Server.Clothing;
public sealed class ServerClothingSystem : ClothingSystem
{
[Dependency] private readonly HumanoidSystem _humanoidSystem = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
protected override void OnGotEquipped(EntityUid uid, ClothingComponent component, GotEquippedEvent args)
{
base.OnGotEquipped(uid, component, args);
// why the fuck is humanoid visuals server-only???
if (args.Slot == "head"
&& _tagSystem.HasTag(args.Equipment, "HidesHair"))
{
_humanoidSystem.ToggleHiddenLayer(args.Equipee, HumanoidVisualLayers.Hair);
}
}
protected override void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args)
{
base.OnGotUnequipped(uid, component, args);
// why the fuck is humanoid visuals server-only???
if (args.Slot == "head"
&& _tagSystem.HasTag(args.Equipment, "HidesHair"))
{
_humanoidSystem.ToggleHiddenLayer(args.Equipee, HumanoidVisualLayers.Hair);
}
}
}
|
using Content.Server.Humanoid;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Humanoid;
using Content.Shared.Inventory.Events;
using Content.Shared.Tag;
namespace Content.Server.Clothing;
public sealed class ServerClothingSystem : ClothingSystem
{
[Dependency] private readonly HumanoidSystem _humanoidSystem = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
protected override void OnGotEquipped(EntityUid uid, ClothingComponent component, GotEquippedEvent args)
{
base.OnGotEquipped(uid, component, args);
// why the fuck is humanoid visuals server-only???
if (args.Slot == "head"
&& _tagSystem.HasTag(args.Equipment, "HidesHair"))
{
_humanoidSystem.SetLayersVisibility(args.Equipee,
HumanoidVisualLayersExtension.Sublayers(HumanoidVisualLayers.Head), false);
}
}
protected override void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args)
{
base.OnGotUnequipped(uid, component, args);
// why the fuck is humanoid visuals server-only???
if (args.Slot == "head"
&& _tagSystem.HasTag(args.Equipment, "HidesHair"))
{
_humanoidSystem.SetLayersVisibility(args.Equipee,
HumanoidVisualLayersExtension.Sublayers(HumanoidVisualLayers.Head), true);
}
}
}
|
mit
|
C#
|
71d99f8e09765df21d424a7fd9feae2bd087396c
|
Improve documentation of ConditionalClickWidget behavior
|
mmoening/MatterControl,MatterHackers/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,mmoening/MatterControl,tellingmachine/MatterControl,tellingmachine/MatterControl,larsbrubaker/MatterControl,MatterHackers/MatterControl,larsbrubaker/MatterControl,rytz/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,rytz/MatterControl,larsbrubaker/MatterControl,ddpruitt/MatterControl,mmoening/MatterControl,MatterHackers/MatterControl,CodeMangler/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,CodeMangler/MatterControl,ddpruitt/MatterControl,rytz/MatterControl,ddpruitt/MatterControl,jlewin/MatterControl,jlewin/MatterControl,CodeMangler/MatterControl
|
ControlElements/ConditionalClickWidget.cs
|
ControlElements/ConditionalClickWidget.cs
|
using System;
namespace MatterHackers.MatterControl
{
public class ConditionalClickWidget : ClickWidget
{
private Func<bool> enabledCallback;
public ConditionalClickWidget(Func<bool> enabledCallback)
{
this.enabledCallback = enabledCallback;
}
// The ConditionalClickWidget provides a mechanism that allows the Enable property to be bound
// to a Delegate that resolves the value. This is a readonly value supplied via the constructor
// and should not be assigned after construction
public override bool Enabled
{
get
{
return this.enabledCallback();
}
set
{
Console.WriteLine("Attempted to set readonly Enabled property on ConditionalClickWidget");
#if DEBUG
throw new InvalidOperationException("Cannot set Enabled on ConditionalClickWidget");
#endif
}
}
}
}
|
using System;
namespace MatterHackers.MatterControl
{
public class ConditionalClickWidget : ClickWidget
{
private Func<bool> enabledCallback;
public ConditionalClickWidget(Func<bool> enabledCallback)
{
this.enabledCallback = enabledCallback;
}
public override bool Enabled
{
get
{
return this.enabledCallback();
}
set
{
throw new InvalidOperationException("Cannot set Enabled on ConditionalClickWidget");
}
}
}
}
|
bsd-2-clause
|
C#
|
3209b987c879a9373ad3ed3fb4c3a0406a01ff8c
|
Fix UIAccessFlags
|
MYOB-Technology/AccountRight_Live_API_.Net_SDK
|
MYOB.API.SDK/SDK/Contracts/CompanyFile.cs
|
MYOB.API.SDK/SDK/Contracts/CompanyFile.cs
|
using System;
using System.Runtime.Serialization;
namespace MYOB.AccountRight.SDK.Contracts
{
/// <summary>
/// CompanyFile
/// </summary>
public class CompanyFile
{
/// <summary>
/// The CompanyFile Identifier
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// CompanyFile Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// CompanyFile Library full path (including file name).
/// </summary>
public string LibraryPath { get; set; }
/// <summary>
/// Account Right Live product version compatible with this CompanyFile
/// </summary>
public string ProductVersion { get; set; }
/// <summary>
/// Account Right Live product level of the CompanyFile
/// </summary>
public ProductLevel ProductLevel { get; set; }
/// <summary>
/// Uri of the resource
/// </summary>
public Uri Uri { get; set; }
/// <summary>
/// Launcher Id can be used to open Online Company files from command line
/// </summary>
public Guid? LauncherId { get; set; }
/// <summary>
/// Serial Number of Company file
/// </summary>
public string SerialNumber { get; set; }
/// <summary>
/// Country code.
/// </summary>
public String Country { get; set; }
/// <summary>
/// UIAccessFlags
/// </summary>
public int UIAccessFlags { get; set; }
/// <summary>
/// Subscription Details of Company file
/// </summary>
public Subscription Subscription { get; set; }
}
}
|
using System;
using System.Runtime.Serialization;
namespace MYOB.AccountRight.SDK.Contracts
{
/// <summary>
/// CompanyFile
/// </summary>
public class CompanyFile
{
/// <summary>
/// The CompanyFile Identifier
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// CompanyFile Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// CompanyFile Library full path (including file name).
/// </summary>
public string LibraryPath { get; set; }
/// <summary>
/// Account Right Live product version compatible with this CompanyFile
/// </summary>
public string ProductVersion { get; set; }
/// <summary>
/// Account Right Live product level of the CompanyFile
/// </summary>
public ProductLevel ProductLevel { get; set; }
/// <summary>
/// Uri of the resource
/// </summary>
public Uri Uri { get; set; }
/// <summary>
/// Launcher Id can be used to open Online Company files from command line
/// </summary>
public Guid? LauncherId { get; set; }
/// <summary>
/// Serial Number of Company file
/// </summary>
public string SerialNumber { get; set; }
/// <summary>
/// Country code.
/// </summary>
public String Country { get; set; }
/// <summary>
/// Subscription Details of Company file
/// </summary>
public Subscription Subscription { get; set; }
}
}
|
mit
|
C#
|
e1908f7ae7a0403d41eb4c68e23e68384cb79325
|
Fix names
|
alfhenrik/octokit.net,shana/octokit.net,hahmed/octokit.net,dampir/octokit.net,kolbasov/octokit.net,naveensrinivasan/octokit.net,forki/octokit.net,gdziadkiewicz/octokit.net,brramos/octokit.net,SmithAndr/octokit.net,chunkychode/octokit.net,thedillonb/octokit.net,eriawan/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,rlugojr/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,devkhan/octokit.net,devkhan/octokit.net,M-Zuber/octokit.net,darrelmiller/octokit.net,ivandrofly/octokit.net,gabrielweyer/octokit.net,daukantas/octokit.net,mminns/octokit.net,michaKFromParis/octokit.net,Sarmad93/octokit.net,nsnnnnrn/octokit.net,khellang/octokit.net,thedillonb/octokit.net,takumikub/octokit.net,shiftkey/octokit.net,editor-tools/octokit.net,nsrnnnnn/octokit.net,SamTheDev/octokit.net,fffej/octokit.net,bslliw/octokit.net,ivandrofly/octokit.net,hitesh97/octokit.net,SamTheDev/octokit.net,chunkychode/octokit.net,ChrisMissal/octokit.net,octokit-net-test-org/octokit.net,kdolan/octokit.net,rlugojr/octokit.net,Red-Folder/octokit.net,octokit-net-test-org/octokit.net,octokit/octokit.net,shana/octokit.net,dampir/octokit.net,SLdragon1989/octokit.net,TattsGroup/octokit.net,TattsGroup/octokit.net,gdziadkiewicz/octokit.net,cH40z-Lord/octokit.net,octokit-net-test/octokit.net,Sarmad93/octokit.net,magoswiat/octokit.net,eriawan/octokit.net,mminns/octokit.net,hahmed/octokit.net,shiftkey-tester/octokit.net,octokit/octokit.net,geek0r/octokit.net,khellang/octokit.net,shiftkey/octokit.net,editor-tools/octokit.net,shiftkey-tester/octokit.net,SmithAndr/octokit.net,adamralph/octokit.net,gabrielweyer/octokit.net,alfhenrik/octokit.net,M-Zuber/octokit.net,fake-organization/octokit.net,dlsteuer/octokit.net
|
Octokit.Tests/Clients/FeedsClientTests.cs
|
Octokit.Tests/Clients/FeedsClientTests.cs
|
using System;
using System.Threading.Tasks;
using NSubstitute;
using Octokit.Tests.Helpers;
using Xunit;
namespace Octokit.Tests.Clients
{
/// <summary>
/// Client tests mostly just need to make sure they call the IApiConnection with the correct
/// relative Uri. No need to fake up the response. All *those* tests are in ApiConnectionTests.cs.
/// </summary>
public class FeedsClientTests
{
public class TheConstructor
{
[Fact]
public void EnsuresNonNullArguments()
{
Assert.Throws<ArgumentNullException>(() => new FeedsClient(null));
}
}
public class TheGetFeedsMethod
{
[Fact]
public void RequestsCorrectUrl()
{
var connection = Substitute.For<IApiConnection>();
var feedsClient = new FeedsClient(connection);
feedsClient.GetFeeds();
connection.Received().Get<Feed>(Arg.Is<Uri>(u => u.ToString() == "feeds"), null);
}
}
}
}
|
using System;
using System.Threading.Tasks;
using NSubstitute;
using Octokit.Tests.Helpers;
using Xunit;
namespace Octokit.Tests.Clients
{
/// <summary>
/// Client tests mostly just need to make sure they call the IApiConnection with the correct
/// relative Uri. No need to fake up the response. All *those* tests are in ApiConnectionTests.cs.
/// </summary>
public class FeedsClientTests
{
public class TheConstructor
{
[Fact]
public void EnsuresNonNullArguments()
{
Assert.Throws<ArgumentNullException>(() => new FeedsClient(null));
}
}
public class TheGetFeedsMethod
{
[Fact]
public void RequestsCorrectUrl()
{
var client = Substitute.For<IApiConnection>();
var orgsClient = new FeedsClient(client);
orgsClient.GetFeeds();
client.Received().Get<Feed>(Arg.Is<Uri>(u => u.ToString() == "feeds"), null);
}
}
}
}
|
mit
|
C#
|
ad402db44122aaee7fb390995c614fa623f70d1f
|
Update author
|
markantill/PropertyCopier
|
PropertyCopier/Properties/AssemblyInfo.cs
|
PropertyCopier/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("PropertyCopier")]
[assembly: AssemblyDescription("Copy object properties")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mark Antill")]
[assembly: AssemblyProduct("PropertyCopier")]
[assembly: AssemblyCopyright("Copyright © Mark Antill 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("86058e92-ee75-411b-b822-38c08d49437b")]
// 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")]
[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("PropertyCopier")]
[assembly: AssemblyDescription("Copy object properties")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PropertyCopier")]
[assembly: AssemblyCopyright("Copyright © Mark Antill 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("86058e92-ee75-411b-b822-38c08d49437b")]
// 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")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
f4d27ec52337c5886ab1d6d20a60107cbb9cc00f
|
Add subresource integrity for jQuery library
|
gitattributes/gitattributes.io,gitattributes/gitattributes.io,gitattributes/gitattributes.io
|
src/Views/Shared/_Layout.cshtml
|
src/Views/Shared/_Layout.cshtml
|
@using Microsoft.Extensions.Options
@inject IOptions<AppSettings> AppSettings
@inject Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration TelemetryConfiguration
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@AppSettings.Value.SiteTitle - @ViewBag.Title</title>
<link rel="stylesheet" type="text/css" href="~/lib/selectize/css/selectize.css">
<link rel="stylesheet" type="text/css" href="~/lib/bootswatch-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="~/css/site.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js" integrity="sha384-R4/ztc4ZlRqWjqIuvf6RX5yb/v90qNGx6fS48N0tRxiGkqveZETq72KgDVJCp2TC" crossorigin="anonymous"></script>
<script type="text/javascript" src="~/lib/bootswatch-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="~/lib/selectize/js/selectize.js"></script>
<environment names="prod">
@Html.ApplicationInsightsJavaScript(TelemetryConfiguration)
</environment>
</head>
<body>
<div class="container body-content">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">.gitattributes</a>
</div>
</div>
</nav>
<blockquote>
<p>Create <span class="text-info">.gitattributes</span> file for your project.</p>
</blockquote>
@RenderBody()
</div>
</body>
</html>
|
@using Microsoft.Extensions.Options
@inject IOptions<AppSettings> AppSettings
@inject Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration TelemetryConfiguration
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@AppSettings.Value.SiteTitle - @ViewBag.Title</title>
<link rel="stylesheet" type="text/css" href="~/lib/selectize/css/selectize.css">
<link rel="stylesheet" type="text/css" href="~/lib/bootswatch-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="~/css/site.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="~/lib/bootswatch-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="~/lib/selectize/js/selectize.js"></script>
<environment names="prod">
@Html.ApplicationInsightsJavaScript(TelemetryConfiguration)
</environment>
</head>
<body>
<div class="container body-content">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">.gitattributes</a>
</div>
</div>
</nav>
<blockquote>
<p>Create <span class="text-info">.gitattributes</span> file for your project.</p>
</blockquote>
@RenderBody()
</div>
</body>
</html>
|
mit
|
C#
|
490eab1442c4c84c7edf12313e59a39276adc63a
|
Make non-nullable fields nullable
|
SICU-Stress-Measurement-System/frontend-cs
|
StressMeasurementSystem/Models/Patient.cs
|
StressMeasurementSystem/Models/Patient.cs
|
using System.Collections.Generic;
using System.Net.Mail;
namespace StressMeasurementSystem.Models
{
public class Patient
{
#region Structs
public struct Name
{
public string Prefix { get; set; }
public string First { get; set; }
public string Middle { get; set; }
public string Last { get; set; }
public string Suffix { get; set; }
}
public struct Organization
{
public string Company { get; set; }
public string JobTitle { get; set; }
}
public struct PhoneNumber
{
public enum Type { Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other }
public string Number { get; set; }
public Type T { get; set; }
}
public struct Email
{
public enum Type { Home, Work, Other }
public MailAddress Address { get; set; }
public Type T { get; set; }
}
#endregion
#region Fields
private Name? _name;
private uint? _age;
private Organization? _organization;
private List<PhoneNumber> _phoneNumbers;
private List<Email> _emails;
#endregion
#region Constructors
public Patient(Name name, uint age, Organization organization,
List<PhoneNumber> phoneNumbers, List<Email> emails)
{
_name = name;
_age = age;
_organization = organization;
_phoneNumbers = phoneNumbers;
_emails = emails;
}
#endregion
}
}
|
using System.Collections.Generic;
using System.Net.Mail;
namespace StressMeasurementSystem.Models
{
public class Patient
{
#region Structs
public struct Name
{
public string Prefix { get; set; }
public string First { get; set; }
public string Middle { get; set; }
public string Last { get; set; }
public string Suffix { get; set; }
}
public struct Organization
{
public string Company { get; set; }
public string JobTitle { get; set; }
}
public struct PhoneNumber
{
public enum Type { Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other }
public string Number { get; set; }
public Type T { get; set; }
}
public struct Email
{
public enum Type { Home, Work, Other }
public MailAddress Address { get; set; }
public Type T { get; set; }
}
#endregion
#region Fields
private Name _name;
private uint _age;
private Organization _organization;
private List<PhoneNumber> _phoneNumbers;
private List<Email> _emails;
#endregion
#region Constructors
public Patient(Name name, uint age, Organization organization,
List<PhoneNumber> phoneNumbers, List<Email> emails)
{
_name = name;
_age = age;
_organization = organization;
_phoneNumbers = phoneNumbers;
_emails = emails;
}
#endregion
}
}
|
apache-2.0
|
C#
|
2439bc17bacba2a7a96571d93d6c33be506caedd
|
Update IMongoRepository.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/Mongo/IMongoRepository.cs
|
TIKSN.Core/Data/Mongo/IMongoRepository.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.Mongo
{
public interface IMongoRepository<TDocument, TIdentity> : IRepository<TDocument>,
IQueryRepository<TDocument, TIdentity>,
IStreamRepository<TDocument> where TDocument : IEntity<TIdentity> where TIdentity : IEquatable<TIdentity>
{
Task AddOrUpdateAsync(TDocument entity, CancellationToken cancellationToken);
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.Mongo
{
public interface IMongoRepository<TDocument, TIdentity> : IRepository<TDocument>, IQueryRepository<TDocument, TIdentity>, IStreamRepository<TDocument> where TDocument : IEntity<TIdentity> where TIdentity : IEquatable<TIdentity>
{
Task AddOrUpdateAsync(TDocument entity, CancellationToken cancellationToken);
}
}
|
mit
|
C#
|
87f361d1004046f647c80aee5d1bba4fcf886e22
|
Fix building ios tests
|
realm/realm-dotnet,Shaddix/realm-dotnet,realm/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet,realm/realm-dotnet,Shaddix/realm-dotnet
|
Tests/IntegrationTests.XamarinIOS/Main.cs
|
Tests/IntegrationTests.XamarinIOS/Main.cs
|
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using Foundation;
using UIKit;
namespace IntegrationTests.XamarinIOS
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
if (NSProcessInfo.ProcessInfo.Arguments.Any("--headless".Equals)) {
using (var output = File.OpenWrite(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "TestResults.iOS.xml")))
{
IntegrationTests.Shared.TestRunner.Run("iOS", output);
}
return;
}
// if you want to use a different Application Delegate class from "UnitTestAppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "UnitTestAppDelegate");
}
}
}
|
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using Foundation;
using UIKit;
namespace IntegrationTests.XamarinIOS
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
if (NSProcessInfo.ProcessInfo.Arguments.Any("--headless".Equals))) {
using (var output = File.OpenWrite(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "TestResults.iOS.xml")))
{
IntegrationTests.Shared.TestRunner.Run("iOS", output);
}
return;
}
// if you want to use a different Application Delegate class from "UnitTestAppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "UnitTestAppDelegate");
}
}
}
|
apache-2.0
|
C#
|
498baf77870f272ed199238084ba1c5d72469ecd
|
Make internals visible to Moq
|
xen2/il-repack,timotei/il-repack,emanuelvarga/il-repack,RomainHautefeuille/il-repack,SiliconStudio/il-repack,mzboray/il-repack,lovewitty/il-repack,ermshiperete/il-repack,MainMa/il-repack,gluck/il-repack,huoxudong125/il-repack,devitalio/il-repack,AColmant/il-repack
|
ILRepack/Properties/AssemblyInfo.cs
|
ILRepack/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("ILRepack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ILRepack")]
[assembly: AssemblyCopyright("Copyright © Francois Valdy 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("b140d8b2-68f8-4324-965b-5c047c3745ab")]
// 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.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: InternalsVisibleTo("ILRepack.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ILRepack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ILRepack")]
[assembly: AssemblyCopyright("Copyright © Francois Valdy 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("b140d8b2-68f8-4324-965b-5c047c3745ab")]
// 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.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly:InternalsVisibleTo("ILRepack.Tests")]
|
apache-2.0
|
C#
|
af93ca66aaa8389474bb0398862414b24562d160
|
add comment 2
|
toannvqo/dnn_publish
|
Components/ProductController.cs
|
Components/ProductController.cs
|
using DotNetNuke.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Christoc.Modules.DNNModule1.Components
{
public class ProductController
{
public Product GetProduct(int productId)
{
Product p;
using (IDataContext ctx = DataContext.Instance())
{
// comment
//comment afasffsdfasdf
Console.WriteLine("hello world");
var rep = ctx.GetRepository<Product>();
p = rep.GetById(productId);
}
return p;
}
public IEnumerable<Product> getAll()
{
IEnumerable<Product> p;
using (IDataContext ctx = DataContext.Instance())
{
var rep = ctx.GetRepository<Product>();
p = rep.Get();
}
return p;
}
public void CreateProduct(Product p)
{
using (IDataContext ctx = DataContext.Instance())
{
var rep = ctx.GetRepository<Product>();
rep.Insert(p);
}
}
public void DeleteProduct(int productId)
{
var p = GetProduct(productId);
DeleteProduct(p);
}
public void DeleteProduct(Product p)
{
using (IDataContext ctx = DataContext.Instance())
{
var rep = ctx.GetRepository<Product>();
rep.Delete(p);
}
}
public void UpdateProduct(Product p)
{
using (IDataContext ctx = DataContext.Instance())
{
var rep = ctx.GetRepository<Product>();
rep.Update(p);
}
}
}
}
|
using DotNetNuke.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Christoc.Modules.DNNModule1.Components
{
public class ProductController
{
public Product GetProduct(int productId)
{
Product p;
using (IDataContext ctx = DataContext.Instance())
{
// comment
Console.WriteLine("hello world");
var rep = ctx.GetRepository<Product>();
p = rep.GetById(productId);
}
return p;
}
public IEnumerable<Product> getAll()
{
IEnumerable<Product> p;
using (IDataContext ctx = DataContext.Instance())
{
var rep = ctx.GetRepository<Product>();
p = rep.Get();
}
return p;
}
public void CreateProduct(Product p)
{
using (IDataContext ctx = DataContext.Instance())
{
var rep = ctx.GetRepository<Product>();
rep.Insert(p);
}
}
public void DeleteProduct(int productId)
{
var p = GetProduct(productId);
DeleteProduct(p);
}
public void DeleteProduct(Product p)
{
using (IDataContext ctx = DataContext.Instance())
{
var rep = ctx.GetRepository<Product>();
rep.Delete(p);
}
}
public void UpdateProduct(Product p)
{
using (IDataContext ctx = DataContext.Instance())
{
var rep = ctx.GetRepository<Product>();
rep.Update(p);
}
}
}
}
|
mit
|
C#
|
099085b085992d50ce39fb620eafcda12ed2a455
|
Update InsertionSort.cs
|
BBoldenow/Introduction-to-Algorithms,BBoldenow/Algorithms,BBoldenow/Algorithms,BBoldenow/Introduction-to-Algorithms,BBoldenow/Introduction-to-Algorithms,BBoldenow/Algorithms
|
Insertion-Sort/InsertionSort.cs
|
Insertion-Sort/InsertionSort.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Algorithms
{
class InsertionSort
{
public static void InsertSort(ref List<int> arr)
{
for (int i = 0; i < arr.Count; ++i)
{
int current = arr[i];
for(int pos = i; pos > 0 && arr[pos] < arr[pos - 1]; --pos)
{
arr[pos] = arr[pos - 1];
arr[pos - 1] = current;
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Algorithms
{
class InsertionSort
{
public static void InsertSort(ref List<int> arr)
{
for (int i = 0; i < arr.Count; ++i)
{
int current = arr[i];
int pos = i;
while (pos > 0 && current < arr[pos - 1])
{
arr[pos] = arr[pos - 1];
arr[pos - 1] = current;
--pos;
}
}
}
}
}
|
mit
|
C#
|
35ac1d356f7b6c14182373a71aa50bc4244a3c61
|
Fix callsite
|
NLog/NLog.Owin.Logging,pysco68/Pysco68.Owin.Logging.NLogAdapter
|
NLog.Owin.Logging/Extensions.cs
|
NLog.Owin.Logging/Extensions.cs
|
namespace NLog.Owin.Logging
{
using global::Owin;
using Microsoft.Owin.Logging;
using NLog;
using System;
using System.Diagnostics;
/// <summary>
/// Extension class
/// </summary>
public static class NlogFactoryExtensions
{
/// <summary>
/// Set the logger factory for this app builder to NLogFactory
/// </summary>
/// <param name="app"></param>
public static void UseNLog(this IAppBuilder app)
{
InitSetup();
app.SetLoggerFactory(new NLogFactory());
}
/// <summary>
/// Set the logger factory for this app builder to NLogFactory
/// </summary>
/// <param name="app"></param>
/// <param name="getLogLevel"></param>
public static void UseNLog(this IAppBuilder app, Func<TraceEventType, LogLevel> getLogLevel)
{
InitSetup();
app.SetLoggerFactory(new NLogFactory(getLogLevel));
}
private static void InitSetup()
{
LogManager.AddHiddenAssembly(typeof(NLogFactory).Assembly);//NLog.Owin.Logging
LogManager.AddHiddenAssembly(typeof(LoggerExtensions).Assembly);//Microsoft.Owin.Logging
}
}
}
|
namespace NLog.Owin.Logging
{
using global::Owin;
using Microsoft.Owin.Logging;
using NLog;
using System;
using System.Diagnostics;
/// <summary>
/// Extension class
/// </summary>
public static class NlogFactoryExtensions
{
/// <summary>
/// Set the logger factory for this app builder to NLogFactory
/// </summary>
/// <param name="app"></param>
public static void UseNLog(this IAppBuilder app)
{
app.SetLoggerFactory(new NLogFactory());
}
/// <summary>
/// Set the logger factory for this app builder to NLogFactory
/// </summary>
/// <param name="app"></param>
/// <param name="getLogLevel"></param>
public static void UseNLog(this IAppBuilder app, Func<TraceEventType, LogLevel> getLogLevel)
{
app.SetLoggerFactory(new NLogFactory(getLogLevel));
}
}
}
|
mit
|
C#
|
b88029f33e9754e317d4e502df0d764e4802c011
|
Add spacer line for readability
|
EamonNerbonne/ValueUtils,EamonNerbonne/ValueUtils,EamonNerbonne/ValueUtils
|
ValueUtilsTest/GetAllFieldTheory.cs
|
ValueUtilsTest/GetAllFieldTheory.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using ValueUtils;
using Xunit;
namespace ValueUtilsTest
{
public class GetAllFieldTheory
{
[Fact]
public void SampleStructHasFourFields()
{
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleStruct)).Select(f=>f.Name)
.SequenceEqual(new[] { "value", "shortvalue", "hmm", "last" }));
}
[Fact]
public void SampleClassHasFiveFields()
{
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleClass)).Select(f=>f.FieldType)
.SequenceEqual(new[] { typeof(SampleEnum), typeof(int?), typeof(CustomStruct), typeof(CustomStruct?), typeof(string) }));
}
[Fact]
public void SampleSubClassHasBaseFieldsThenOwnFields()
{
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleSubClassWithFields)).Take(5)
.SequenceEqual(ReflectionHelper.GetAllFields(typeof(SampleClass))));
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleSubClassWithFields)).Select(f => f.Name).Skip(5)
.SequenceEqual(new[] { "SubClassField" }));
}
[Fact]
public void FieldsIncludeBaseProtectedFieldsExactlyOnce()
{
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleSubWithProtectedInherited)).Select(f => f.Name)
.SequenceEqual(new[] { "SomeValue" }));
}
[Fact]
public void FieldsIncludeBasePrivateFieldsExactlyOnce()
{
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleSubWithPrivateInherited)).Select(f => f.Name)
.SequenceEqual(new[] { "SomeValue" }));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using ValueUtils;
using Xunit;
namespace ValueUtilsTest
{
public class GetAllFieldTheory
{
[Fact]
public void SampleStructHasFourFields()
{
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleStruct)).Select(f=>f.Name)
.SequenceEqual(new[] { "value", "shortvalue", "hmm", "last" }));
}
[Fact]
public void SampleClassHasFiveFields()
{
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleClass)).Select(f=>f.FieldType)
.SequenceEqual(new[] { typeof(SampleEnum), typeof(int?), typeof(CustomStruct), typeof(CustomStruct?), typeof(string) }));
}
[Fact]
public void SampleSubClassHasBaseFieldsThenOwnFields()
{
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleSubClassWithFields)).Take(5)
.SequenceEqual(ReflectionHelper.GetAllFields(typeof(SampleClass))));
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleSubClassWithFields)).Select(f => f.Name).Skip(5)
.SequenceEqual(new[] { "SubClassField" }));
}
[Fact]
public void FieldsIncludeBaseProtectedFieldsExactlyOnce()
{
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleSubWithProtectedInherited)).Select(f => f.Name)
.SequenceEqual(new[] { "SomeValue" }));
}
[Fact]
public void FieldsIncludeBasePrivateFieldsExactlyOnce()
{
PAssert.That(() => ReflectionHelper.GetAllFields(typeof(SampleSubWithPrivateInherited)).Select(f => f.Name)
.SequenceEqual(new[] { "SomeValue" }));
}
}
}
|
apache-2.0
|
C#
|
aaf2fbe251ea4efa70b87bf398d8d1f32f708ab8
|
Change LogEventData.Properties to IDictionary
|
vostok/core
|
Vostok.Core/Logging/LogEventData.cs
|
Vostok.Core/Logging/LogEventData.cs
|
using System;
using System.Collections.Generic;
namespace Vostok.Logging
{
public sealed class LogEventData
{
public DateTimeOffset Timestamp { get; set; }
public string LogLevel { get; set; }
public string MessageTemplate { get; set; }
public string Exception { get; set; }
public IDictionary<string, string> Properties { get; set; }
}
}
|
using System;
using System.Collections.Generic;
namespace Vostok.Logging
{
public sealed class LogEventData
{
public DateTimeOffset Timestamp { get; set; }
public string LogLevel { get; set; }
public string MessageTemplate { get; set; }
public string Exception { get; set; }
public IReadOnlyDictionary<string, string> Properties { get; set; }
}
}
|
mit
|
C#
|
733326b329a42ec38b416c27aab0d40855280860
|
Revert accidental removal of interface methods
|
Wox-launcher/Wox,Wox-launcher/Wox,qianlifeng/Wox,qianlifeng/Wox,qianlifeng/Wox
|
Wox.Core/Configuration/IPortable.cs
|
Wox.Core/Configuration/IPortable.cs
|
namespace Wox.Core.Configuration
{
public interface IPortable
{
void EnablePortableMode();
void DisablePortableMode();
void RemoveShortcuts();
void RemoveUninstallerEntry();
void CreateShortcuts();
void CreateUninstallerEntry();
void MoveUserDataFolder(string fromLocation, string toLocation);
void VerifyUserDataAfterMove(string fromLocation, string toLocation);
bool CanUpdatePortability();
}
}
|
namespace Wox.Core.Configuration
{
public interface IPortable
{
void RemoveShortcuts();
void RemoveUninstallerEntry();
void CreateShortcuts();
void CreateUninstallerEntry();
void MoveUserDataFolder(string fromLocation, string toLocation);
void VerifyUserDataAfterMove(string fromLocation, string toLocation);
bool CanUpdatePortability();
}
}
|
mit
|
C#
|
924e02243b64fe8d654e069927b0e813dd1ea1c4
|
Bump to v0.10.0
|
danielwertheim/mynatsclient,danielwertheim/mynatsclient
|
buildconfig.cake
|
buildconfig.cake
|
public class BuildConfig
{
private const string Version = "0.10.0";
private const bool IsPreRelease = false;
public readonly string SrcDir = "./src/";
public readonly string OutDir = "./build/";
public string Target { get; private set; }
public string SemVer { get; private set; }
public string BuildProfile { get; private set; }
public bool IsTeamCityBuild { get; private set; }
public static BuildConfig Create(
ICakeContext context,
BuildSystem buildSystem)
{
if (context == null)
throw new ArgumentNullException("context");
var target = context.Argument("target", "Default");
var buildRevision = context.Argument("buildrevision", "0");
return new BuildConfig
{
Target = target,
SemVer = Version + (IsPreRelease ? "-b" + buildRevision : string.Empty),
BuildProfile = context.Argument("configuration", "Release"),
IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity
};
}
}
|
public class BuildConfig
{
private const string Version = "0.9.2";
private const bool IsPreRelease = false;
public readonly string SrcDir = "./src/";
public readonly string OutDir = "./build/";
public string Target { get; private set; }
public string SemVer { get; private set; }
public string BuildProfile { get; private set; }
public bool IsTeamCityBuild { get; private set; }
public static BuildConfig Create(
ICakeContext context,
BuildSystem buildSystem)
{
if (context == null)
throw new ArgumentNullException("context");
var target = context.Argument("target", "Default");
var buildRevision = context.Argument("buildrevision", "0");
return new BuildConfig
{
Target = target,
SemVer = Version + (IsPreRelease ? "-b" + buildRevision : string.Empty),
BuildProfile = context.Argument("configuration", "Release"),
IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity
};
}
}
|
mit
|
C#
|
dafcc5520aa5b0cd4021fe8d1ffc49fc5364a158
|
Bump to v0.7.0
|
danielwertheim/mynatsclient,danielwertheim/mynatsclient
|
buildconfig.cake
|
buildconfig.cake
|
public class BuildConfig
{
private const string Version = "0.7.0";
private const bool IsPreRelease = false;
public readonly string SrcDir = "./src/";
public readonly string OutDir = "./build/";
public string Target { get; private set; }
public string SemVer { get; private set; }
public string BuildProfile { get; private set; }
public bool IsTeamCityBuild { get; private set; }
public static BuildConfig Create(
ICakeContext context,
BuildSystem buildSystem)
{
if (context == null)
throw new ArgumentNullException("context");
var target = context.Argument("target", "Default");
var buildRevision = context.Argument("buildrevision", "0");
return new BuildConfig
{
Target = target,
SemVer = Version + (IsPreRelease ? "-b" + buildRevision : string.Empty),
BuildProfile = context.Argument("configuration", "Release"),
IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity
};
}
}
|
public class BuildConfig
{
private const string Version = "0.6.0";
private const bool IsPreRelease = false;
public readonly string SrcDir = "./src/";
public readonly string OutDir = "./build/";
public string Target { get; private set; }
public string SemVer { get; private set; }
public string BuildProfile { get; private set; }
public bool IsTeamCityBuild { get; private set; }
public static BuildConfig Create(
ICakeContext context,
BuildSystem buildSystem)
{
if (context == null)
throw new ArgumentNullException("context");
var target = context.Argument("target", "Default");
var buildRevision = context.Argument("buildrevision", "0");
return new BuildConfig
{
Target = target,
SemVer = Version + (IsPreRelease ? "-b" + buildRevision : string.Empty),
BuildProfile = context.Argument("configuration", "Release"),
IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity
};
}
}
|
mit
|
C#
|
d6e2addf8e6900c628e77806844c5f9681e224ce
|
Add DataBar
|
MonoCross/MonoCross,MonoCross/MonoCross,MonoCross/MonoCross
|
Utilities/Scanning/Symbology.cs
|
Utilities/Scanning/Symbology.cs
|
namespace MonoCross.Utilities.Barcode
{
// enumaration of 1 Dimensional barcode symbologies
public enum Symbology
{
UNKNOWN, // for scanners that don't report the scanned barcode output type
UPCA, // redlaser?, linea-pro, koamtec 300i
UPCE, // redlaser, linea-pro, koamtec 300i
EAN8, // redlaser, linea-pro, koamtec 300i
EAN13, // redlaser, linea-pro, koamtec 300i
EAN128, // redlaser, linea-pro, koamtec 300i
Code11, // koamtec 300i
Code32, // koamtec 300i
Code39, // redlaser, linea-pro, koamtec 300i
Code93, // redlaser (android only)
Code128, // redlaser, linea-pro, koamtec 300i
Codabar, // linea-pro, koamtec 300i
I2of5, // linea-pro, koamtec 300i
Sticky, // redlaser (no idea what this is but redlaser supports it)
// others supported by koamtec 300i
// GS1-128 (UCC/EAN128), MSI, Plessey, PosiCode, GS1 DataBar (Omni/Limited/Expanded), S2of5IA, S2of5ID, TLC39, Telepen, Trioptic
DataMatrix, // EMDK 2D barcode
DataBar, // EMDK 2D barcode
PDF417, // EMDK 2D barcode
QRCode, // EMDK 2D barcode
}
}
|
namespace MonoCross.Utilities.Barcode
{
// enumaration of 1 Dimensional barcode symbologies
public enum Symbology
{
UNKNOWN, // for scanners that don't report the scanned barcode output type
UPCA, // redlaser?, linea-pro, koamtec 300i
UPCE, // redlaser, linea-pro, koamtec 300i
EAN8, // redlaser, linea-pro, koamtec 300i
EAN13, // redlaser, linea-pro, koamtec 300i
EAN128, // redlaser, linea-pro, koamtec 300i
Code11, // koamtec 300i
Code32, // koamtec 300i
Code39, // redlaser, linea-pro, koamtec 300i
Code93, // redlaser (android only)
Code128, // redlaser, linea-pro, koamtec 300i
Codabar, // linea-pro, koamtec 300i
I2of5, // linea-pro, koamtec 300i
Sticky, // redlaser (no idea what this is but redlaser supports it)
// others supported by koamtec 300i
// GS1-128 (UCC/EAN128), MSI, Plessey, PosiCode, GS1 DataBar (Omni/Limited/Expanded), S2of5IA, S2of5ID, TLC39, Telepen, Trioptic
DataMatrix, // EMDK 2D barcode
PDF417, // EMDK 2D barcode
QRCode, // EMDK 2D barcode
}
}
|
mit
|
C#
|
d0e1d8dbd57c43864eaa9bcdc94276c20f73775f
|
Update TextChangedEventArgs.cs
|
hwthomas/xwt,lytico/xwt,cra0zy/xwt,antmicro/xwt,TheBrainTech/xwt,hamekoz/xwt,mono/xwt
|
Xwt/Xwt/TextChangedEventArgs.cs
|
Xwt/Xwt/TextChangedEventArgs.cs
|
//
// TextChangedEventArgs.cs
//
// Author:
// Marius Ungureanu <maungu@microsoft.com>
//
// Copyright (c) 2017 Microsoft Corporation
//
// 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;
namespace Xwt
{
public class TextChangedEventArgs : WidgetEventArgs
{
public string NewText { get; }
public TextChangedEventArgs(string newText)
{
NewText = newText;
}
}
}
|
//
// TextChangedEventArgs.cs
//
// Author:
// therzok <>
//
// Copyright (c) 2017 ${CopyrightHolder}
//
// 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;
namespace Xwt
{
public class TextChangedEventArgs : WidgetEventArgs
{
public string NewText { get; }
public TextChangedEventArgs(string newText)
{
NewText = newText;
}
}
}
|
mit
|
C#
|
b43af4de745fd7a2ed271260de620848d77171e8
|
Write tests for RollbarPerson
|
Valetude/Valetude.Rollbar
|
Rollbar.Net.Test/RollbarPersonFixture.cs
|
Rollbar.Net.Test/RollbarPersonFixture.cs
|
using Newtonsoft.Json;
using Xunit;
namespace Rollbar.Test {
public class RollbarPersonFixture {
[Fact]
public void Person_id_rendered_correctly() {
var rp = new RollbarPerson("person_id");
Assert.Equal("{\"id\":\"person_id\"}", JsonConvert.SerializeObject(rp));
}
[Fact]
public void Person_username_rendered_correctly() {
var rp = new RollbarPerson("person_id") {
UserName = "chris_pfohl",
};
Assert.Equal("{\"id\":\"person_id\",\"username\":\"chris_pfohl\"}", JsonConvert.SerializeObject(rp));
}
[Fact]
public void Person_email_rendered_correctly() {
var rp = new RollbarPerson("person_id") {
Email = "chris@valetude.com",
};
Assert.Equal("{\"id\":\"person_id\",\"email\":\"chris@valetude.com\"}", JsonConvert.SerializeObject(rp));
}
}
}
|
namespace Rollbar.Test {
public class RollbarPersonFixture {
}
}
|
mit
|
C#
|
693a4ff474ea957bd1d8bc4276b3d75616904278
|
Add change handling for effects section
|
ppy/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu
|
osu.Game/Screens/Edit/Timing/EffectSection.cs
|
osu.Game/Screens/Edit/Timing/EffectSection.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Screens.Edit.Timing
{
internal class EffectSection : Section<EffectControlPoint>
{
private LabelledSwitchButton kiai;
private LabelledSwitchButton omitBarLine;
[BackgroundDependencyLoader]
private void load()
{
Flow.AddRange(new[]
{
kiai = new LabelledSwitchButton { Label = "Kiai Time" },
omitBarLine = new LabelledSwitchButton { Label = "Skip Bar Line" },
});
}
protected override void OnControlPointChanged(ValueChangedEvent<EffectControlPoint> point)
{
if (point.NewValue != null)
{
kiai.Current = point.NewValue.KiaiModeBindable;
kiai.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
omitBarLine.Current = point.NewValue.OmitFirstBarLineBindable;
omitBarLine.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
}
}
protected override EffectControlPoint CreatePoint()
{
var reference = Beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(SelectedGroup.Value.Time);
return new EffectControlPoint
{
KiaiMode = reference.KiaiMode,
OmitFirstBarLine = reference.OmitFirstBarLine
};
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Screens.Edit.Timing
{
internal class EffectSection : Section<EffectControlPoint>
{
private LabelledSwitchButton kiai;
private LabelledSwitchButton omitBarLine;
[BackgroundDependencyLoader]
private void load()
{
Flow.AddRange(new[]
{
kiai = new LabelledSwitchButton { Label = "Kiai Time" },
omitBarLine = new LabelledSwitchButton { Label = "Skip Bar Line" },
});
}
protected override void OnControlPointChanged(ValueChangedEvent<EffectControlPoint> point)
{
if (point.NewValue != null)
{
kiai.Current = point.NewValue.KiaiModeBindable;
omitBarLine.Current = point.NewValue.OmitFirstBarLineBindable;
}
}
protected override EffectControlPoint CreatePoint()
{
var reference = Beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(SelectedGroup.Value.Time);
return new EffectControlPoint
{
KiaiMode = reference.KiaiMode,
OmitFirstBarLine = reference.OmitFirstBarLine
};
}
}
}
|
mit
|
C#
|
e03770972143d0579d397722e0f35526604eee32
|
Bump version to 3.0.1
|
Brightspace/D2L.Security.OAuth2
|
D2L.Security.OAuth2.WebApi/Properties/AssemblyInfo.cs
|
D2L.Security.OAuth2.WebApi/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Nuget: Title
[assembly: AssemblyTitle( "D2L Security For Web API" )]
// Nuget: Description
[assembly: AssemblyDescription( "A library that implements Web API components for authenticating D2L services." )]
// Nuget: Author
[assembly: AssemblyCompany( "Desire2Learn" )]
// Nuget: Owners
[assembly: AssemblyProduct( "Brightspace" )]
// Nuget: Version
[assembly: AssemblyInformationalVersion( "3.0.1.0" )]
[assembly: AssemblyVersion( "3.0.1.0" )]
[assembly: AssemblyFileVersion( "3.0.1.0" )]
[assembly: AssemblyCopyright( "Copyright © Desire2Learn" )]
[assembly: InternalsVisibleTo( "D2L.Security.OAuth2.WebApi.UnitTests" )]
|
using System.Reflection;
using System.Runtime.CompilerServices;
// Nuget: Title
[assembly: AssemblyTitle( "D2L Security For Web API" )]
// Nuget: Description
[assembly: AssemblyDescription( "A library that implements Web API components for authenticating D2L services." )]
// Nuget: Author
[assembly: AssemblyCompany( "Desire2Learn" )]
// Nuget: Owners
[assembly: AssemblyProduct( "Brightspace" )]
// Nuget: Version
[assembly: AssemblyInformationalVersion( "3.0.0.0" )]
[assembly: AssemblyVersion( "3.0.0.0" )]
[assembly: AssemblyFileVersion( "3.0.0.0" )]
[assembly: AssemblyCopyright( "Copyright © Desire2Learn" )]
[assembly: InternalsVisibleTo( "D2L.Security.OAuth2.WebApi.UnitTests" )]
|
apache-2.0
|
C#
|
30ac73af67e42633511ccda1c73b5f4a6c267f6a
|
Reduce border significance
|
jlewin/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,jlewin/MatterControl,jlewin/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,mmoening/MatterControl
|
MatterControlLib/PartPreviewWindow/ItemColorButton.cs
|
MatterControlLib/PartPreviewWindow/ItemColorButton.cs
|
/*
Copyright (c) 2018, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Linq;
using MatterHackers.Agg;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.UI;
using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class ItemColorButton : PopupButton
{
private ColorButton colorButton;
public ItemColorButton(InteractiveScene scene, ThemeConfig theme)
{
this.ToolTipText = "Color".Localize();
this.DynamicPopupContent = () =>
{
return new ColorSwatchSelector(scene, theme, buttonSize: 16, buttonSpacing: new BorderDouble(1, 1, 0, 0), colorNotifier: (newColor) => colorButton.BackgroundColor = newColor)
{
Padding = theme.DefaultContainerPadding,
BackgroundColor = this.HoverColor
};
};
var scaledButtonSize = 14 * GuiWidget.DeviceScale;
colorButton = new ColorButton(scene.SelectedItem?.Color ?? theme.SlightShade)
{
Width = scaledButtonSize,
Height = scaledButtonSize,
HAnchor = HAnchor.Center,
VAnchor = VAnchor.Center,
DisabledColor = theme.MinimalShade,
Border = new BorderDouble(1),
BorderColor = theme.GetBorderColor(75)
};
this.AddChild(colorButton);
}
public override void OnLoad(EventArgs args)
{
var firstBackgroundColor = this.Parents<GuiWidget>().Where(p => p.BackgroundColor.Alpha0To1 == 1).FirstOrDefault()?.BackgroundColor;
if (firstBackgroundColor != null)
{
// Resolve alpha
this.HoverColor = new BlenderRGBA().Blend(firstBackgroundColor.Value, this.HoverColor);
}
base.OnLoad(args);
}
public Color Color
{
get => colorButton.BackgroundColor;
set => colorButton.BackgroundColor = value;
}
}
}
|
/*
Copyright (c) 2018, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Linq;
using MatterHackers.Agg;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.UI;
using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class ItemColorButton : PopupButton
{
private ColorButton colorButton;
public ItemColorButton(InteractiveScene scene, ThemeConfig theme)
{
this.ToolTipText = "Color".Localize();
this.DynamicPopupContent = () =>
{
return new ColorSwatchSelector(scene, theme, buttonSize: 16, buttonSpacing: new BorderDouble(1, 1, 0, 0), colorNotifier: (newColor) => colorButton.BackgroundColor = newColor)
{
Padding = theme.DefaultContainerPadding,
BackgroundColor = this.HoverColor
};
};
var scaledButtonSize = 14 * GuiWidget.DeviceScale;
colorButton = new ColorButton(scene.SelectedItem?.Color ?? theme.SlightShade)
{
Width = scaledButtonSize,
Height = scaledButtonSize,
HAnchor = HAnchor.Center,
VAnchor = VAnchor.Center,
DisabledColor = theme.MinimalShade,
Border = new BorderDouble(1),
BorderColor = theme.GetBorderColor(200)
};
this.AddChild(colorButton);
}
public override void OnLoad(EventArgs args)
{
var firstBackgroundColor = this.Parents<GuiWidget>().Where(p => p.BackgroundColor.Alpha0To1 == 1).FirstOrDefault()?.BackgroundColor;
if (firstBackgroundColor != null)
{
// Resolve alpha
this.HoverColor = new BlenderRGBA().Blend(firstBackgroundColor.Value, this.HoverColor);
}
base.OnLoad(args);
}
public Color Color
{
get => colorButton.BackgroundColor;
set => colorButton.BackgroundColor = value;
}
}
}
|
bsd-2-clause
|
C#
|
92a574ca0dcfb6c9b511ec9e33cd7e32de10ba80
|
Refactor some usings
|
Branimir123/PhotoLife,Branimir123/PhotoLife,Branimir123/PhotoLife
|
PhotoLife/PhotoLife.Web/Controllers/HomeController.cs
|
PhotoLife/PhotoLife.Web/Controllers/HomeController.cs
|
using System.Web.Mvc;
namespace PhotoLife.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace PhotoLife.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
}
|
mit
|
C#
|
06ccae0c667e2c8b667005429f835f8ca1ec6c8e
|
Bump package version
|
kjac/FormEditor,kjac/FormEditor,kjac/FormEditor
|
Source/Solution/FormEditor/Properties/AssemblyInfo.cs
|
Source/Solution/FormEditor/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("FormEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Kenn Jacobsen")]
[assembly: AssemblyProduct("FormEditor")]
[assembly: AssemblyCopyright("Copyright © Kenn Jacobsen 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("39b39b20-7b79-4259-9f04-4c005534b053")]
// 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("0.13.3.1")]
[assembly: AssemblyFileVersion("0.13.3.1")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FormEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Kenn Jacobsen")]
[assembly: AssemblyProduct("FormEditor")]
[assembly: AssemblyCopyright("Copyright © Kenn Jacobsen 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("39b39b20-7b79-4259-9f04-4c005534b053")]
// 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("0.13.2.1")]
[assembly: AssemblyFileVersion("0.13.2.1")]
|
mit
|
C#
|
4b903be3fb1bc3bbd02464773fc7e865e7b576c7
|
Update BaseCommand.cs
|
easymorph/server-cmd
|
src/BusinessLogic/Commands/BaseCommand.cs
|
src/BusinessLogic/Commands/BaseCommand.cs
|
using Morph.Server.Sdk.Client;
using Morph.Server.Sdk.Model;
using MorphCmd.Interfaces;
using MorphCmd.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace MorphCmd.BusinessLogic.Commands
{
internal abstract class BaseCommand
{
protected readonly IOutputEndpoint _output;
protected readonly IInputEndpoint _input;
protected readonly IMorphServerApiClient _apiClient;
protected readonly CancellationTokenSource _cancellationTokenSource;
public BaseCommand(IOutputEndpoint output, IInputEndpoint input, IMorphServerApiClient apiClient)
{
_output = output;
_input = input;
_apiClient = apiClient;
_cancellationTokenSource = new CancellationTokenSource();
}
protected void RequireParam(Guid? value)
{
}
protected async Task<ApiSession> OpenSession(Parameters parameters)
{
// for simplification we just check that the user has pass any password
// in more complex logic, you should call GetSpacesListAsync to retrieve a spaces list and check the isPublic property or the space
// isPublic means that you need to open an anon session, otherwise - open a real session
if (string.IsNullOrWhiteSpace(parameters.Password))
{
var apiSession = ApiSession.Anonymous(parameters.SpaceName);
return apiSession;
}
else
{
var apiSession = await _apiClient.OpenSessionAsync(parameters.SpaceName, parameters.Password, _cancellationTokenSource.Token);
return apiSession;
}
}
}
}
|
using Morph.Server.Sdk.Client;
using Morph.Server.Sdk.Model;
using MorphCmd.Interfaces;
using MorphCmd.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace MorphCmd.BusinessLogic.Commands
{
internal abstract class BaseCommand
{
protected readonly IOutputEndpoint _output;
protected readonly IInputEndpoint _input;
protected readonly IMorphServerApiClient _apiClient;
protected readonly CancellationTokenSource _cancellationTokenSource;
public BaseCommand(IOutputEndpoint output, IInputEndpoint input, IMorphServerApiClient apiClient)
{
_output = output;
_input = input;
_apiClient = apiClient;
_cancellationTokenSource = new CancellationTokenSource();
}
protected void RequireParam(Guid? value)
{
}
protected async Task<ApiSession> OpenSession(Parameters parameters)
{
// for simplification we just check that user pass any password
// in more complex logic, call GetSpacesListAsync to and check isPublic property
// isPublic - means you need to open anon session, otherwise - open real session
if (string.IsNullOrWhiteSpace(parameters.Password))
{
var apiSession = ApiSession.Anonymous(parameters.SpaceName);
return apiSession;
}
else
{
var apiSession = await _apiClient.OpenSessionAsync(parameters.SpaceName, parameters.Password, _cancellationTokenSource.Token);
return apiSession;
}
}
}
}
|
mit
|
C#
|
d8218b088f4a7c00ae42f552266215571686eee7
|
Use canned document service by default.
|
kentcb/WorkoutWotch
|
Src/WorkoutWotch.UI.Android/AndroidCompositionRoot.cs
|
Src/WorkoutWotch.UI.Android/AndroidCompositionRoot.cs
|
namespace WorkoutWotch.UI.Android
{
using Services.ExerciseDocument;
using WorkoutWotch.Services.Contracts.Audio;
using WorkoutWotch.Services.Contracts.ExerciseDocument;
using WorkoutWotch.Services.Contracts.Speech;
using WorkoutWotch.Services.Android.Audio;
using WorkoutWotch.Services.Android.Speech;
using Services.Android.ExerciseDocument;
public sealed class AndroidCompositionRoot : CompositionRoot
{
private readonly MainActivity mainActivity;
public AndroidCompositionRoot(MainActivity mainActivity)
{
this.mainActivity = mainActivity;
}
protected override IAudioService CreateAudioService() =>
new AudioService();
protected override IExerciseDocumentService CreateExerciseDocumentService() =>
// just used canned data - useful for getting you up and running quickly
new CannedExerciseDocumentService();
// comment the above lines and uncomment this line if you want to use an iCloud-based document service
//new GoogleDriveExerciseDocumentService(
// this.loggerService.Value,
// this.mainActivity);
protected override ISpeechService CreateSpeechService() =>
new SpeechService();
}
}
|
namespace WorkoutWotch.UI.Android
{
using Services.ExerciseDocument;
using WorkoutWotch.Services.Contracts.Audio;
using WorkoutWotch.Services.Contracts.ExerciseDocument;
using WorkoutWotch.Services.Contracts.Speech;
using WorkoutWotch.Services.Android.Audio;
using WorkoutWotch.Services.Android.Speech;
using Services.Android.ExerciseDocument;
public sealed class AndroidCompositionRoot : CompositionRoot
{
private readonly MainActivity mainActivity;
public AndroidCompositionRoot(MainActivity mainActivity)
{
this.mainActivity = mainActivity;
}
protected override IAudioService CreateAudioService() =>
new AudioService();
protected override IExerciseDocumentService CreateExerciseDocumentService() =>
// just used canned data - useful for getting you up and running quickly
//new CannedExerciseDocumentService();
// comment the above lines and uncomment this line if you want to use an iCloud-based document service
new GoogleDriveExerciseDocumentService(
this.loggerService.Value,
this.mainActivity);
protected override ISpeechService CreateSpeechService() =>
new SpeechService();
}
}
|
mit
|
C#
|
84378aaf049c9b38b3cf56be686d98c7e3d4c9b4
|
Update CompositeCrossCurrencyConverter.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Finance/CompositeCrossCurrencyConverter.cs
|
TIKSN.Core/Finance/CompositeCrossCurrencyConverter.cs
|
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Finance
{
public class CompositeCrossCurrencyConverter : CompositeCurrencyConverter
{
public CompositeCrossCurrencyConverter(ICurrencyConversionCompositionStrategy compositionStrategy)
: base(compositionStrategy)
{
}
public override async Task<Money> ConvertCurrencyAsync(Money baseMoney, CurrencyInfo counterCurrency,
DateTimeOffset asOn, CancellationToken cancellationToken) =>
await this.compositionStrategy.ConvertCurrencyAsync(baseMoney, this.converters, counterCurrency, asOn,
cancellationToken).ConfigureAwait(false);
public override async Task<IEnumerable<CurrencyPair>> GetCurrencyPairsAsync(DateTimeOffset asOn,
CancellationToken cancellationToken)
{
var pairs = new HashSet<CurrencyPair>();
foreach (var converter in this.converters)
{
var currentPairs = await converter.GetCurrencyPairsAsync(asOn, cancellationToken).ConfigureAwait(false);
foreach (var currentPair in currentPairs)
{
_ = pairs.Add(currentPair);
}
}
return pairs;
}
public override async Task<decimal> GetExchangeRateAsync(CurrencyPair pair, DateTimeOffset asOn,
CancellationToken cancellationToken) =>
await this.compositionStrategy.GetExchangeRateAsync(this.converters, pair, asOn, cancellationToken).ConfigureAwait(false);
}
}
|
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Finance
{
public class CompositeCrossCurrencyConverter : CompositeCurrencyConverter
{
public CompositeCrossCurrencyConverter(ICurrencyConversionCompositionStrategy compositionStrategy)
: base(compositionStrategy)
{
}
public override async Task<Money> ConvertCurrencyAsync(Money baseMoney, CurrencyInfo counterCurrency,
DateTimeOffset asOn, CancellationToken cancellationToken) =>
await this.compositionStrategy.ConvertCurrencyAsync(baseMoney, this.converters, counterCurrency, asOn,
cancellationToken);
public override async Task<IEnumerable<CurrencyPair>> GetCurrencyPairsAsync(DateTimeOffset asOn,
CancellationToken cancellationToken)
{
var pairs = new HashSet<CurrencyPair>();
foreach (var converter in this.converters)
{
var currentPairs = await converter.GetCurrencyPairsAsync(asOn, cancellationToken);
foreach (var currentPair in currentPairs)
{
pairs.Add(currentPair);
}
}
return pairs;
}
public override async Task<decimal> GetExchangeRateAsync(CurrencyPair pair, DateTimeOffset asOn,
CancellationToken cancellationToken) =>
await this.compositionStrategy.GetExchangeRateAsync(this.converters, pair, asOn, cancellationToken);
}
}
|
mit
|
C#
|
b5bc552f14cd885f09cfca0d697c8bd8b925ccf6
|
remove sessions again
|
Drawaes/Leto
|
src/Leto.Windows/WindowsSecurePipeListener.cs
|
src/Leto.Windows/WindowsSecurePipeListener.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using Leto.Certificates;
using Leto.ConnectionStates.SecretSchedules;
using Leto.Handshake.Extensions;
using System.Threading.Tasks;
using System.IO.Pipelines;
using Leto.Sessions;
namespace Leto.Windows
{
public sealed class WindowsSecurePipeListener : SecurePipeListener
{
private WindowsCryptoProvider _cryptoProvider;
private ISessionProvider _sessionProvider;
public WindowsSecurePipeListener(ICertificate certificate, PipeFactory pipeFactory = null)
:base(certificate, pipeFactory)
{
//_sessionProvider = new Sessions.EphemeralSessionProvider();
_cryptoProvider = new WindowsCryptoProvider();
}
public override ICryptoProvider CryptoProvider => _cryptoProvider;
public override ISessionProvider SessionProvider => _sessionProvider;
protected override void Dispose(bool disposing)
{
_sessionProvider?.Dispose();
_cryptoProvider.Dispose();
base.Dispose(disposing);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using Leto.Certificates;
using Leto.ConnectionStates.SecretSchedules;
using Leto.Handshake.Extensions;
using System.Threading.Tasks;
using System.IO.Pipelines;
using Leto.Sessions;
namespace Leto.Windows
{
public sealed class WindowsSecurePipeListener : SecurePipeListener
{
private WindowsCryptoProvider _cryptoProvider;
private ISessionProvider _sessionProvider;
public WindowsSecurePipeListener(ICertificate certificate, PipeFactory pipeFactory = null)
:base(certificate, pipeFactory)
{
_sessionProvider = new Sessions.EphemeralSessionProvider();
_cryptoProvider = new WindowsCryptoProvider();
}
public override ICryptoProvider CryptoProvider => _cryptoProvider;
public override ISessionProvider SessionProvider => _sessionProvider;
protected override void Dispose(bool disposing)
{
_sessionProvider?.Dispose();
_cryptoProvider.Dispose();
base.Dispose(disposing);
}
}
}
|
mit
|
C#
|
d840e223d9a048e2cec711b30f57fb376220917d
|
set version to 0.0.0.0, it will be versioned through appveyor
|
angrifel/mdlgen,angrifel/genmdl
|
src/ModelGenerator/Properties/AssemblyInfo.cs
|
src/ModelGenerator/Properties/AssemblyInfo.cs
|
// This file is part of mdlgen - A Source code generator for model definitions.
// Copyright (c) angrifel
// 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.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("mdlgen")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("mdlgen")]
[assembly: AssemblyCopyright("Copyright © angrifel")]
[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("639941ae-ecdf-41dd-baab-02c020922e8b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0.0")]
|
// This file is part of mdlgen - A Source code generator for model definitions.
// Copyright (c) angrifel
// 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.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("mdlgen")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("mdlgen")]
[assembly: AssemblyCopyright("Copyright © angrifel")]
[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("639941ae-ecdf-41dd-baab-02c020922e8b")]
// 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#
|
a991391afa716ec2daaff1ce7c0d4d39bbded918
|
add northwoods to assembly info
|
northwoodspd/UIA.Extensions,northwoodspd/UIA.Extensions
|
src/UIA.Fluent/Properties/AssemblyInfo.cs
|
src/UIA.Fluent/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("UIA.Fluent")]
[assembly: AssemblyDescription("Fluent .NET library to expose controls to Automation")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Northwoods Consulting Partners")]
[assembly: AssemblyProduct("UIA.Fluent")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("ae10cb98-b115-42f8-9a9b-2e572c767ccf")]
// 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.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("UIA.Fluent")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UIA.Fluent")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("ae10cb98-b115-42f8-9a9b-2e572c767ccf")]
// 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#
|
a474038c38a20f048d1b7b52612d0d455f04b928
|
use sqlId as returned sql
|
sdcb/sdmap
|
sdmap/test/sdmap.ext.test/SmokeTest.cs
|
sdmap/test/sdmap.ext.test/SmokeTest.cs
|
using sdmap.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
namespace sdmap.ext.test
{
public class SmokeTest
{
private class SimpleSqlEmiter : ISqlEmiter
{
public string EmitSql(string sqlId, object queryObject)
{
return sqlId;
}
}
[Fact]
public void SqlEmiterTest()
{
SdmapExtensions.SetSqlEmiter(new SimpleSqlEmiter());
var actual = SdmapExtensions.EmitSql("test", null);
Assert.Equal("test", actual);
}
[Fact]
public void WatchSmoke()
{
Directory.CreateDirectory("sqls");
var tempFile = @"sqls\test.sdmap";
File.WriteAllText(tempFile, "sql Hello{Hello}");
SdmapExtensions.SetSqlDirectoryAndWatch(@".\sqls");
try
{
File.WriteAllText(tempFile, "sql Hello{Hello2}");
Thread.Sleep(30);
var text = SdmapExtensions.EmitSql("Hello", null);
Assert.Equal("Hello2", text);
}
finally
{
File.Delete(tempFile);
Directory.Delete("sqls");
}
}
}
}
|
using sdmap.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
namespace sdmap.ext.test
{
public class SmokeTest
{
private class SimpleSqlEmiter : ISqlEmiter
{
public string EmitSql(string sqlId, object queryObject)
{
return "Simple";
}
}
[Fact]
public void SqlEmiterTest()
{
SdmapExtensions.SetSqlEmiter(new SimpleSqlEmiter());
var actual = SdmapExtensions.EmitSql("test", null);
Assert.Equal("Simple", actual);
}
[Fact]
public void WatchSmoke()
{
Directory.CreateDirectory("sqls");
var tempFile = @"sqls\test.sdmap";
File.WriteAllText(tempFile, "sql Hello{Hello}");
SdmapExtensions.SetSqlDirectoryAndWatch(@".\sqls");
try
{
File.WriteAllText(tempFile, "sql Hello{Hello2}");
Thread.Sleep(30);
var text = SdmapExtensions.EmitSql("Hello", null);
Assert.Equal("Hello2", text);
}
finally
{
File.Delete(tempFile);
Directory.Delete("sqls");
}
}
}
}
|
mit
|
C#
|
07fbb4392cd57a8ba771d2e5c3279a15d5ffbeae
|
remove IsDirectory, closes #104
|
richardschneider/net-ipfs-core
|
src/IFileSystemLink.cs
|
src/IFileSystemLink.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Ipfs
{
/// <summary>
/// A link to another file system node in IPFS.
/// </summary>
public interface IFileSystemLink : IMerkleLink
{
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Ipfs
{
/// <summary>
/// A link to another file system node in IPFS.
/// </summary>
public interface IFileSystemLink : IMerkleLink
{
/// <summary>
/// Determines if the link is a directory (folder).
/// </summary>
/// <value>
/// <b>true</b> if the link is a directory; Otherwise <b>false</b>,
/// the link is some type of a file.
/// </value>
bool IsDirectory { get; }
}
}
|
mit
|
C#
|
e49f618c3f0e829f0f70397e74e816e4099e39b5
|
Move TokenEnvironmentVariable to constant string
|
appharbor/appharbor-cli
|
src/AppHarbor/Commands/LoginCommand.cs
|
src/AppHarbor/Commands/LoginCommand.cs
|
using System;
namespace AppHarbor.Commands
{
public class LoginCommand : ICommand
{
private const string TokenEnvironmentVariable = "AppHarborToken";
private readonly AccessTokenFetcher _accessTokenFetcher;
private readonly EnvironmentVariableConfiguration _environmentVariableConfiguration;
public LoginCommand(AccessTokenFetcher accessTokenFetcher, EnvironmentVariableConfiguration environmentVariableConfiguration)
{
_accessTokenFetcher = accessTokenFetcher;
_environmentVariableConfiguration = environmentVariableConfiguration;
}
public void Execute(string[] arguments)
{
if (_environmentVariableConfiguration.Get(TokenEnvironmentVariable, EnvironmentVariableTarget.User) != null)
{
throw new CommandException("You're already logged in");
}
Console.WriteLine("Username:");
var username = Console.ReadLine();
Console.WriteLine("Password:");
var password = Console.ReadLine();
}
}
}
|
using System;
namespace AppHarbor.Commands
{
public class LoginCommand : ICommand
{
private readonly AccessTokenFetcher _accessTokenFetcher;
private readonly EnvironmentVariableConfiguration _environmentVariableConfiguration;
public LoginCommand(AccessTokenFetcher accessTokenFetcher, EnvironmentVariableConfiguration environmentVariableConfiguration)
{
_accessTokenFetcher = accessTokenFetcher;
_environmentVariableConfiguration = environmentVariableConfiguration;
}
public void Execute(string[] arguments)
{
if (_environmentVariableConfiguration.Get("AppHarborToken", EnvironmentVariableTarget.User) != null)
{
throw new CommandException("You're already logged in");
}
Console.WriteLine("Username:");
var username = Console.ReadLine();
Console.WriteLine("Password:");
var password = Console.ReadLine();
}
}
}
|
mit
|
C#
|
4488abbfbce1e840c36d507766997737a9db602c
|
Add FindNextFile test
|
fearthecowboy/pinvoke,vbfox/pinvoke,AArnott/pinvoke,jmelosegui/pinvoke
|
src/PInvoke.Kernel32.Tests/Kernel32.cs
|
src/PInvoke.Kernel32.Tests/Kernel32.cs
|
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
using System;
using System.IO;
using PInvoke;
using Xunit;
using static PInvoke.Kernel32;
public class Kernel32
{
[Fact]
public void FindFirstFile_NoMatches()
{
WIN32_FIND_DATA data;
using (var handle = FindFirstFile("foodoesnotexist", out data))
{
Assert.True(handle.IsInvalid);
}
}
[Fact]
public void FindFirstFile_FindNextFile()
{
string testPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
try
{
Directory.CreateDirectory(testPath);
string aTxt = Path.Combine(testPath, "a.txt");
File.WriteAllText(aTxt, string.Empty);
File.SetAttributes(aTxt, FileAttributes.Archive);
var bTxt = Path.Combine(testPath, "b.txt");
File.WriteAllText(bTxt, string.Empty);
File.SetAttributes(bTxt, FileAttributes.Normal);
WIN32_FIND_DATA data;
using (var handle = FindFirstFile(Path.Combine(testPath, "*.txt"), out data))
{
Assert.False(handle.IsInvalid);
Assert.Equal("a.txt", data.cFileName);
Assert.Equal(FileAttribute.Archive, data.dwFileAttributes);
Assert.True(FindNextFile(handle, out data));
Assert.Equal("b.txt", data.cFileName);
Assert.Equal(FileAttribute.Normal, data.dwFileAttributes);
Assert.False(FindNextFile(handle, out data));
}
}
finally
{
Directory.Delete(testPath, true);
}
}
}
|
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
using System;
using PInvoke;
using Xunit;
using static PInvoke.Kernel32;
public class Kernel32
{
[Fact]
public void FindFiles()
{
WIN32_FIND_DATA data;
using (var handle = FindFirstFile("foodoesnotexist", out data))
{
Assert.True(handle.IsInvalid);
}
}
}
|
mit
|
C#
|
e09ceb751f0f3f5304ef735e7911d5ba30266f02
|
add UseSoapEndpoint overloads to allow type to be specified at runtime
|
DigDes/SoapCore
|
src/SoapCore/SoapEndpointExtensions.cs
|
src/SoapCore/SoapEndpointExtensions.cs
|
using System;
using System.ServiceModel.Channels;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace SoapCore
{
public static class SoapEndpointExtensions
{
public static IApplicationBuilder UseSoapEndpoint<T>(this IApplicationBuilder builder, string path, MessageEncoder encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null)
{
return builder.UseSoapEndpoint(typeof(T), path, encoder, serializer, caseInsensitivePath, soapModelBounder);
}
public static IApplicationBuilder UseSoapEndpoint(this IApplicationBuilder builder, Type type, string path, MessageEncoder encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null)
{
if (soapModelBounder == null)
{
return builder.UseMiddleware<SoapEndpointMiddleware>(type, path, encoder, serializer, caseInsensitivePath);
}
return builder.UseMiddleware<SoapEndpointMiddleware>(type, path, encoder, serializer, caseInsensitivePath, soapModelBounder);
}
public static IApplicationBuilder UseSoapEndpoint<T>(this IApplicationBuilder builder, string path, Binding binding, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null)
{
return builder.UseSoapEndpoint(typeof(T), path, binding, serializer, caseInsensitivePath, soapModelBounder);
}
public static IApplicationBuilder UseSoapEndpoint(this IApplicationBuilder builder, Type type, string path, Binding binding, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null)
{
var element = binding.CreateBindingElements().Find<MessageEncodingBindingElement>();
var factory = element.CreateMessageEncoderFactory();
var encoder = factory.Encoder;
return builder.UseSoapEndpoint(type, path, encoder, serializer, caseInsensitivePath, soapModelBounder);
}
public static IServiceCollection AddSoapExceptionTransformer(this IServiceCollection serviceCollection, Func<Exception, string> transformer)
{
serviceCollection.TryAddSingleton(new ExceptionTransformer(transformer));
return serviceCollection;
}
public static IServiceCollection AddSoapMessageInspector(this IServiceCollection serviceCollection, IMessageInspector messageInspector)
{
serviceCollection.TryAddSingleton(messageInspector);
return serviceCollection;
}
public static IServiceCollection AddSoapMessageInspector(this IServiceCollection serviceCollection, IMessageInspector2 messageInspector)
{
serviceCollection.TryAddSingleton(messageInspector);
return serviceCollection;
}
public static IServiceCollection AddSoapMessageFilter(this IServiceCollection serviceCollection, IMessageFilter messageFilter)
{
serviceCollection.TryAddSingleton(messageFilter);
return serviceCollection;
}
public static IServiceCollection AddSoapWsSecurityFilter(this IServiceCollection serviceCollection, string username, string password)
{
serviceCollection.AddSoapMessageFilter(new WsMessageFilter(username, password));
return serviceCollection;
}
public static IServiceCollection AddSoapModelBindingFilter(this IServiceCollection serviceCollection, IModelBindingFilter modelBindingFilter)
{
serviceCollection.TryAddSingleton(modelBindingFilter);
return serviceCollection;
}
public static IServiceCollection AddSoapServiceOperationTuner(this IServiceCollection serviceCollection, IServiceOperationTuner serviceOperationTuner)
{
serviceCollection.TryAddSingleton(serviceOperationTuner);
return serviceCollection;
}
}
}
|
using System;
using System.ServiceModel.Channels;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace SoapCore
{
public static class SoapEndpointExtensions
{
public static IApplicationBuilder UseSoapEndpoint<T>(this IApplicationBuilder builder, string path, MessageEncoder encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null)
{
if (soapModelBounder == null)
{
return builder.UseMiddleware<SoapEndpointMiddleware>(typeof(T), path, encoder, serializer, caseInsensitivePath);
}
return builder.UseMiddleware<SoapEndpointMiddleware>(typeof(T), path, encoder, serializer, caseInsensitivePath, soapModelBounder);
}
public static IApplicationBuilder UseSoapEndpoint<T>(this IApplicationBuilder builder, string path, Binding binding, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null)
{
var element = binding.CreateBindingElements().Find<MessageEncodingBindingElement>();
var factory = element.CreateMessageEncoderFactory();
var encoder = factory.Encoder;
return builder.UseSoapEndpoint<T>(path, encoder, serializer, caseInsensitivePath, soapModelBounder);
}
public static IServiceCollection AddSoapExceptionTransformer(this IServiceCollection serviceCollection, Func<Exception, string> transformer)
{
serviceCollection.TryAddSingleton(new ExceptionTransformer(transformer));
return serviceCollection;
}
public static IServiceCollection AddSoapMessageInspector(this IServiceCollection serviceCollection, IMessageInspector messageInspector)
{
serviceCollection.TryAddSingleton(messageInspector);
return serviceCollection;
}
public static IServiceCollection AddSoapMessageFilter(this IServiceCollection serviceCollection, IMessageFilter messageFilter)
{
serviceCollection.TryAddSingleton(messageFilter);
return serviceCollection;
}
public static IServiceCollection AddSoapWsSecurityFilter(this IServiceCollection serviceCollection, string username, string password)
{
serviceCollection.AddSoapMessageFilter(new WsMessageFilter(username, password));
return serviceCollection;
}
public static IServiceCollection AddSoapModelBindingFilter(this IServiceCollection serviceCollection, IModelBindingFilter modelBindingFilter)
{
serviceCollection.TryAddSingleton(modelBindingFilter);
return serviceCollection;
}
public static IServiceCollection AddSoapServiceOperationTuner(this IServiceCollection serviceCollection, IServiceOperationTuner serviceOperationTuner)
{
serviceCollection.TryAddSingleton(serviceOperationTuner);
return serviceCollection;
}
}
}
|
mit
|
C#
|
2e0d5e59beb602affd5c738135e514ec6663ceb3
|
test method with param
|
andrewdavey/witness,andrewdavey/witness,andrewdavey/witness
|
src/Witness.Tests/DotnetContextTest.cs
|
src/Witness.Tests/DotnetContextTest.cs
|
using System;
using System.Linq;
using System.Text;
using Xunit;
namespace Witness.Tests
{
public class ExecutingAuthenticateHeader : ExecutableHeadersTest
{
public ExecutingAuthenticateHeader()
{
HeaderSet("x-witness-onauthenticate");
}
[Fact]
public void HeaderIsExecuted()
{
headers.ExecuteOnAuthenticate();
Assert.True(executed);
}
}
public class ExecutingBeginRequestHeader : ExecutableHeadersTest
{
public ExecutingBeginRequestHeader()
{
HeaderSet("x-witness-beginrequest");
}
[Fact]
public void HeaderIsExecuted()
{
headers.ExecuteBeginRequest();
Assert.True(executed);
}
}
public class ExecutingEndRequestHeader : ExecutableHeadersTest
{
public ExecutingEndRequestHeader()
{
HeaderSet("x-witness-endrequest");
}
[Fact]
public void HeaderIsExecuted()
{
headers.ExecuteEndRequest();
Assert.True(executed);
}
}
public class CallingAMethodFromJavascript
{
static bool called;
DotNetContext context;
public CallingAMethodFromJavascript()
{
context = new DotNetContext()
.Add("callingAMethod", () => called = true);
}
[Fact]
public void IsCalled()
{
context.Run("callingAMethod()");
Assert.True(called);
}
}
public class CallingAParametisedMethodFromJavascript
{
static string result;
DotNetContext context;
public CallingAParametisedMethodFromJavascript()
{
context = new DotNetContext()
.Add("callingAMethod", () => result = "called");
}
[Fact]
public void IsCalled()
{
context.Run("callingAMethod('called')");
Assert.Equal(result,"called");
}
}
}
|
using System;
using System.Linq;
using System.Text;
using Xunit;
namespace Witness.Tests
{
public class ExecutingAuthenticateHeader : ExecutableHeadersTest
{
public ExecutingAuthenticateHeader()
{
HeaderSet("x-witness-onauthenticate");
}
[Fact]
public void HeaderIsExecuted()
{
headers.ExecuteOnAuthenticate();
Assert.True(executed);
}
}
public class ExecutingBeginRequestHeader : ExecutableHeadersTest
{
public ExecutingBeginRequestHeader()
{
HeaderSet("x-witness-beginrequest");
}
[Fact]
public void HeaderIsExecuted()
{
headers.ExecuteBeginRequest();
Assert.True(executed);
}
}
public class ExecutingEndRequestHeader : ExecutableHeadersTest
{
public ExecutingEndRequestHeader()
{
HeaderSet("x-witness-endrequest");
}
[Fact]
public void HeaderIsExecuted()
{
headers.ExecuteEndRequest();
Assert.True(executed);
}
}
public class CallingAMethodFromJavascript
{
static bool called;
DotNetContext context;
public CallingAMethodFromJavascript()
{
context = new DotNetContext()
.Add("callingAMethod", () => called = true);
}
[Fact]
public void IsCalled()
{
context.Run("callingAMethod()");
Assert.True(called);
}
}
}
|
bsd-2-clause
|
C#
|
8a0e1416372adc0c923d95364d9393d473e2185c
|
Fix error in build
|
jadarnel27/nunit,Suremaker/nunit,akoeplinger/nunit,OmicronPersei/nunit,danielmarbach/nunit,jadarnel27/nunit,akoeplinger/nunit,elbaloo/nunit,Therzok/nunit,passaro/nunit,agray/nunit,jhamm/nunit,mjedrzejek/nunit,Green-Bug/nunit,michal-franc/nunit,zmaruo/nunit,michal-franc/nunit,dicko2/nunit,JustinRChou/nunit,michal-franc/nunit,passaro/nunit,ChrisMaddock/nunit,acco32/nunit,Therzok/nunit,jeremymeng/nunit,akoeplinger/nunit,NarohLoyahl/nunit,mikkelbu/nunit,ChrisMaddock/nunit,NarohLoyahl/nunit,appel1/nunit,appel1/nunit,mikkelbu/nunit,agray/nunit,ArsenShnurkov/nunit,pcalin/nunit,pflugs30/nunit,ArsenShnurkov/nunit,ggeurts/nunit,jeremymeng/nunit,dicko2/nunit,zmaruo/nunit,pflugs30/nunit,nunit/nunit,jhamm/nunit,nivanov1984/nunit,Therzok/nunit,JohanO/nunit,NarohLoyahl/nunit,Green-Bug/nunit,acco32/nunit,agray/nunit,danielmarbach/nunit,modulexcite/nunit,Green-Bug/nunit,modulexcite/nunit,pcalin/nunit,NikolayPianikov/nunit,NikolayPianikov/nunit,acco32/nunit,jnm2/nunit,JustinRChou/nunit,Suremaker/nunit,jnm2/nunit,elbaloo/nunit,ArsenShnurkov/nunit,OmicronPersei/nunit,cPetru/nunit-params,zmaruo/nunit,nivanov1984/nunit,cPetru/nunit-params,JohanO/nunit,mjedrzejek/nunit,danielmarbach/nunit,dicko2/nunit,pcalin/nunit,modulexcite/nunit,elbaloo/nunit,passaro/nunit,ggeurts/nunit,jhamm/nunit,nunit/nunit,JohanO/nunit,jeremymeng/nunit
|
src/direct-runner/TestEventListener.cs
|
src/direct-runner/TestEventListener.cs
|
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// 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 System.IO;
using NUnit.Framework.Api;
namespace NUnit.DirectRunner
{
class TestEventListener : MarshalByRefObject, ITestListener
{
CommandLineOptions options;
TextWriter outWriter;
int level = 0;
string prefix = "";
public TestEventListener(CommandLineOptions options, TextWriter outWriter)
{
this.options = options;
this.outWriter = outWriter;
}
#region ITestListener Members
public void TestStarted(ITest test)
{
level++;
prefix = new string('>', level);
if(options.Labels)
outWriter.WriteLine("{0} {1}", prefix, test.Name);
}
public void TestFinished(ITestResult result)
{
level--;
prefix = new string('>', level);
}
public void TestOutput(TestOutput testOutput)
{
outWriter.Write(testOutput.Text);
}
#endregion
}
}
|
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// 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 System.IO;
using NUnit.Framework.Api;
namespace NUnit.AdhocTestRunner
{
class TestEventListener : MarshalByRefObject, ITestListener
{
CommandLineOptions options;
TextWriter outWriter;
int level = 0;
string prefix = "";
public TestEventListener(CommandLineOptions options, TextWriter outWriter)
{
this.options = options;
this.outWriter = outWriter;
}
#region ITestListener Members
public void TestStarted(ITest test)
{
level++;
prefix = new string('>', level);
if(options.Labels)
outWriter.WriteLine("{0} {1}", prefix, test.Name);
}
public void TestFinished(ITestResult result)
{
level--;
prefix = new string('>', level);
}
public void TestOutput(TestOutput testOutput)
{
outWriter.Write(testOutput.Text);
}
#endregion
}
}
|
mit
|
C#
|
cac6410763ddd6dde3cd5a52a539d2563f6f6e79
|
Add a reference to System.Linq to the script template.
|
Damnae/storybrew
|
editor/Resources/scripttemplate.csx
|
editor/Resources/scripttemplate.csx
|
using OpenTK;
using OpenTK.Graphics;
using StorybrewCommon.Mapset;
using StorybrewCommon.Scripting;
using StorybrewCommon.Storyboarding;
using StorybrewCommon.Storyboarding.Util;
using StorybrewCommon.Subtitles;
using StorybrewCommon.Util;
using System;
using System.Collections.Generic;
using System.Linq;
namespace StorybrewScripts
{
public class %CLASSNAME% : StoryboardObjectGenerator
{
public override void Generate()
{
}
}
}
|
using OpenTK;
using OpenTK.Graphics;
using StorybrewCommon.Mapset;
using StorybrewCommon.Scripting;
using StorybrewCommon.Storyboarding;
using StorybrewCommon.Storyboarding.Util;
using StorybrewCommon.Subtitles;
using StorybrewCommon.Util;
using System;
using System.Collections.Generic;
namespace StorybrewScripts
{
public class %CLASSNAME% : StoryboardObjectGenerator
{
public override void Generate()
{
}
}
}
|
mit
|
C#
|
9c7b0f240a7faa6b77e70eb1aa8bb5ab8010b4ef
|
Add more tests to TestSuite
|
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
|
src/Arkivverket.Arkade.Test/Core/TestSuiteTest.cs
|
src/Arkivverket.Arkade.Test/Core/TestSuiteTest.cs
|
using Arkivverket.Arkade.Core;
using Arkivverket.Arkade.Tests;
using FluentAssertions;
using Xunit;
namespace Arkivverket.Arkade.Test.Core
{
public class TestSuiteTest
{
private readonly TestResult _testResultWithError = new TestResult(ResultType.Error, new Location(""), "feil");
private readonly TestResult _testResultWithSuccess = new TestResult(ResultType.Success, new Location(""), "feil");
[Fact]
public void FindNumberOfErrorsShouldReturnOneError()
{
var testSuite = new TestSuite();
var testRun = new TestRun("test with error", TestType.Content);
testRun.Add(new TestResult(ResultType.Error, null, "feil"));
testSuite.AddTestRun(testRun);
testSuite.FindNumberOfErrors().Should().Be(1);
}
[Fact]
public void FindNumberOfErrorsShouldReturnTwoErrors()
{
TestSuite testSuite = CreateTestSuite(_testResultWithError, _testResultWithError, _testResultWithSuccess);
testSuite.FindNumberOfErrors().Should().Be(2);
}
[Fact]
public void FindNumberOfErrorsShouldZeroErrorsWhenNoTestResults()
{
TestSuite testSuite = CreateTestSuite(null);
testSuite.FindNumberOfErrors().Should().Be(0);
}
[Fact]
public void FindNumberOfErrorsShouldZeroErrorsWhenOnlySuccessResults()
{
TestSuite testSuite = CreateTestSuite(_testResultWithSuccess, _testResultWithSuccess);
testSuite.FindNumberOfErrors().Should().Be(0);
}
private static TestSuite CreateTestSuite(params TestResult[] testResults)
{
var testSuite = new TestSuite();
var testRun = new TestRun("test with error", TestType.Content);
if (testResults != null)
{
foreach (var testResult in testResults)
{
testRun.Add(testResult);
}
}
testSuite.AddTestRun(testRun);
return testSuite;
}
}
}
|
using Arkivverket.Arkade.Core;
using Arkivverket.Arkade.Tests;
using FluentAssertions;
using Xunit;
namespace Arkivverket.Arkade.Test.Core
{
public class TestSuiteTest
{
[Fact]
public void ShouldReturnOneError()
{
var testSuite = new TestSuite();
var testRun = new TestRun("test with error", TestType.Content);
testRun.Add(new TestResult(ResultType.Error, new Location(""), "feil"));
testSuite.AddTestRun(testRun);
testSuite.FindNumberOfErrors().Should().Be(1);
}
}
}
|
agpl-3.0
|
C#
|
e69ec91c072c7f4edac21eb944307a1999c8c485
|
Add xmldoc for `CurrentRotation`
|
peppy/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu
|
osu.Game/Rulesets/Mods/ModBarrelRoll.cs
|
osu.Game/Rulesets/Mods/ModBarrelRoll.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModBarrelRoll<TObject> : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset<TObject>
where TObject : HitObject
{
/// <summary>
/// The current angle of rotation being applied by this mod.
/// Generally should be used to apply inverse rotation to elements which should not be rotated.
/// </summary>
protected float CurrentRotation { get; private set; }
[SettingSource("Roll speed", "Rotations per minute")]
public BindableNumber<double> SpinSpeed { get; } = new BindableDouble(0.5)
{
MinValue = 0.02,
MaxValue = 12,
Precision = 0.01,
};
[SettingSource("Direction", "The direction of rotation")]
public Bindable<RotationDirection> Direction { get; } = new Bindable<RotationDirection>(RotationDirection.Clockwise);
public override string Name => "Barrel Roll";
public override string Acronym => "BR";
public override string Description => "The whole playfield is on a wheel!";
public override double ScoreMultiplier => 1;
public override string SettingDescription => $"{SpinSpeed.Value} rpm {Direction.Value.GetDescription().ToLowerInvariant()}";
public void Update(Playfield playfield)
{
playfield.Rotation = CurrentRotation = (Direction.Value == RotationDirection.Counterclockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
}
public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset)
{
// scale the playfield to allow all hitobjects to stay within the visible region.
var playfieldSize = drawableRuleset.Playfield.DrawSize;
var minSide = MathF.Min(playfieldSize.X, playfieldSize.Y);
var maxSide = MathF.Max(playfieldSize.X, playfieldSize.Y);
drawableRuleset.Playfield.Scale = new Vector2(minSide / maxSide);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;
using osuTK;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModBarrelRoll<TObject> : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset<TObject>
where TObject : HitObject
{
protected float CurrentRotation { get; private set; }
[SettingSource("Roll speed", "Rotations per minute")]
public BindableNumber<double> SpinSpeed { get; } = new BindableDouble(0.5)
{
MinValue = 0.02,
MaxValue = 12,
Precision = 0.01,
};
[SettingSource("Direction", "The direction of rotation")]
public Bindable<RotationDirection> Direction { get; } = new Bindable<RotationDirection>(RotationDirection.Clockwise);
public override string Name => "Barrel Roll";
public override string Acronym => "BR";
public override string Description => "The whole playfield is on a wheel!";
public override double ScoreMultiplier => 1;
public override string SettingDescription => $"{SpinSpeed.Value} rpm {Direction.Value.GetDescription().ToLowerInvariant()}";
public void Update(Playfield playfield)
{
playfield.Rotation = CurrentRotation = (Direction.Value == RotationDirection.Counterclockwise ? -1 : 1) * 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
}
public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset)
{
// scale the playfield to allow all hitobjects to stay within the visible region.
var playfieldSize = drawableRuleset.Playfield.DrawSize;
var minSide = MathF.Min(playfieldSize.X, playfieldSize.Y);
var maxSide = MathF.Max(playfieldSize.X, playfieldSize.Y);
drawableRuleset.Playfield.Scale = new Vector2(minSide / maxSide);
}
}
}
|
mit
|
C#
|
39efa2d173de774cf130dded0bf4f5febdbb4666
|
Fix possible cross-thread config cache access
|
EVAST9919/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,2yangk23/osu,smoogipooo/osu,ZLima12/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,ZLima12/osu,peppy/osu,EVAST9919/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu-new,johnneijzen/osu,ppy/osu,peppy/osu,smoogipoo/osu,ppy/osu
|
osu.Game/Rulesets/RulesetConfigCache.cs
|
osu.Game/Rulesets/RulesetConfigCache.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.Concurrent;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Configuration;
namespace osu.Game.Rulesets
{
/// <summary>
/// A cache that provides a single <see cref="IRulesetConfigManager"/> per-ruleset.
/// This is done to support referring to and updating ruleset configs from multiple locations in the absence of inter-config bindings.
/// </summary>
public class RulesetConfigCache : Component
{
private readonly ConcurrentDictionary<int, IRulesetConfigManager> configCache = new ConcurrentDictionary<int, IRulesetConfigManager>();
private readonly SettingsStore settingsStore;
public RulesetConfigCache(SettingsStore settingsStore)
{
this.settingsStore = settingsStore;
}
/// <summary>
/// Retrieves the <see cref="IRulesetConfigManager"/> for a <see cref="Ruleset"/>.
/// </summary>
/// <param name="ruleset">The <see cref="Ruleset"/> to retrieve the <see cref="IRulesetConfigManager"/> for.</param>
/// <returns>The <see cref="IRulesetConfigManager"/> defined by <paramref name="ruleset"/>, null if <paramref name="ruleset"/> doesn't define one.</returns>
/// <exception cref="InvalidOperationException">If <paramref name="ruleset"/> doesn't have a valid <see cref="RulesetInfo.ID"/>.</exception>
public IRulesetConfigManager GetConfigFor(Ruleset ruleset)
{
if (ruleset.RulesetInfo.ID == null)
throw new InvalidOperationException("The provided ruleset doesn't have a valid id.");
return configCache.GetOrAdd(ruleset.RulesetInfo.ID.Value, _ => ruleset.CreateConfig(settingsStore));
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Configuration;
namespace osu.Game.Rulesets
{
/// <summary>
/// A cache that provides a single <see cref="IRulesetConfigManager"/> per-ruleset.
/// This is done to support referring to and updating ruleset configs from multiple locations in the absence of inter-config bindings.
/// </summary>
public class RulesetConfigCache : Component
{
private readonly Dictionary<int, IRulesetConfigManager> configCache = new Dictionary<int, IRulesetConfigManager>();
private readonly SettingsStore settingsStore;
public RulesetConfigCache(SettingsStore settingsStore)
{
this.settingsStore = settingsStore;
}
/// <summary>
/// Retrieves the <see cref="IRulesetConfigManager"/> for a <see cref="Ruleset"/>.
/// </summary>
/// <param name="ruleset">The <see cref="Ruleset"/> to retrieve the <see cref="IRulesetConfigManager"/> for.</param>
/// <returns>The <see cref="IRulesetConfigManager"/> defined by <paramref name="ruleset"/>, null if <paramref name="ruleset"/> doesn't define one.</returns>
/// <exception cref="InvalidOperationException">If <paramref name="ruleset"/> doesn't have a valid <see cref="RulesetInfo.ID"/>.</exception>
public IRulesetConfigManager GetConfigFor(Ruleset ruleset)
{
if (ruleset.RulesetInfo.ID == null)
throw new InvalidOperationException("The provided ruleset doesn't have a valid id.");
if (configCache.TryGetValue(ruleset.RulesetInfo.ID.Value, out var existing))
return existing;
return configCache[ruleset.RulesetInfo.ID.Value] = ruleset.CreateConfig(settingsStore);
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.