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
30737326b9783ece8d12dffe739cf3cb4bf7a0f6
Allow profiling the builder in Farkle.Samples.Cli.
teo-tsirpanis/Farkle
sample/Farkle.Samples.Cli/Program.cs
sample/Farkle.Samples.Cli/Program.cs
// Copyright (c) 2019 Theodore Tsirpanis // // This software is released under the MIT License. // https://opensource.org/licenses/MIT using System; using System.IO; using static Farkle.Builder.DesigntimeFarkleBuild; namespace Farkle.Samples.Cli { internal static class Program { private const int IterationCount = 1000; private const string JsonPath = "../../tests/resources/generated.json"; private static string _jsonData; private static readonly RuntimeFarkle<object> _syntaxCheck = JSON.CSharp.Language.Runtime.SyntaxCheck(); private static void Execute(Action f, string description) { Console.WriteLine($"Running {description}..."); // GC.Collect(2, GCCollectionMode.Forced, true, true); for (var i = 0; i < IterationCount; i++) f(); } private static bool ParseFarkle<T>(this RuntimeFarkle<T> rf) => rf.Parse(_jsonData).IsOk; private static bool BuildJson() => Build(JSON.CSharp.Language.Designtime).Item1.IsOk; private static bool BuildGML() => BuildGrammarOnly(CreateGrammarDefinition(GOLDMetaLanguage.designtime)).IsOk; private static bool ParseFarkleCSharp() => JSON.CSharp.Language.Runtime.ParseFarkle(); private static bool ParseFarkleFSharp() => JSON.FSharp.Language.Runtime.ParseFarkle(); private static void ParseFarkleSyntaxCheck() => _syntaxCheck.ParseFarkle(); private static bool ParseChiron() => FParsec.CharParsers.run(Chiron.Parsing.jsonR.Value, _jsonData).IsSuccess; private static void Prepare() { _jsonData = File.ReadAllText(JsonPath); Console.WriteLine("JITting Farkle..."); if (!(BuildJson() && BuildGML() && ParseFarkleCSharp() && ParseFarkleFSharp() && ParseChiron())) { throw new Exception("Preparing went wrong."); } } internal static void Main() { Console.WriteLine("This program was made to help profiling Farkle."); Prepare(); Execute(() => ParseFarkleCSharp(), "Farkle C#"); Execute(() => ParseFarkleFSharp(), "Farkle F#"); Execute(ParseFarkleSyntaxCheck, "Farkle Syntax Check"); Execute(() => BuildJson(), "Farkle Build JSON"); Execute(() => BuildGML(), "Farkle Build GOLD Meta-Language"); Execute(() => ParseChiron(), "Chiron"); } } }
// Copyright (c) 2019 Theodore Tsirpanis // // This software is released under the MIT License. // https://opensource.org/licenses/MIT using System; using System.IO; namespace Farkle.Samples.Cli { internal static class Program { private const int IterationCount = 1000; private const string JsonPath = "../../tests/resources/generated.json"; private static string _jsonData; private static readonly RuntimeFarkle<object> _syntaxCheck = JSON.CSharp.Language.Runtime.SyntaxCheck(); private static void Execute(Action f, string description) { Console.WriteLine($"Running {description}..."); // GC.Collect(2, GCCollectionMode.Forced, true, true); for (var i = 0; i < IterationCount; i++) f(); } private static bool ParseFarkle<T>(this RuntimeFarkle<T> rf) => rf.Parse(_jsonData).IsOk; private static bool ParseFarkleCSharp() => JSON.CSharp.Language.Runtime.ParseFarkle(); private static bool ParseFarkleFSharp() => JSON.FSharp.Language.Runtime.ParseFarkle(); private static void ParseFarkleSyntaxCheck() => _syntaxCheck.ParseFarkle(); private static bool ParseChiron() => FParsec.CharParsers.run(Chiron.Parsing.jsonR.Value, _jsonData).IsSuccess; private static void Prepare() { _jsonData = File.ReadAllText(JsonPath); Console.WriteLine("JITting the parsers..."); if (!(ParseFarkleCSharp() && ParseFarkleFSharp() && ParseChiron())) { throw new Exception("Parsing went wrong..."); } } internal static void Main() { Console.WriteLine("This program was made to help profiling Farkle."); Prepare(); Execute(() => ParseFarkleCSharp(), "Farkle C#"); Execute(() => ParseFarkleFSharp(), "Farkle F#"); Execute(() => ParseFarkleSyntaxCheck(), "Farkle Syntax Check"); Execute(() => ParseChiron(), "Chiron"); } } }
mit
C#
ebbd0eac57db61c51a5fe237326c8c686690ee9b
Order by track id
csharpfritz/aspnetcore-app-workshop,jongalloway/aspnetcore-app-workshop,anurse/ConferencePlanner,anurse/ConferencePlanner,dotnet-presentations/aspnetcore-app-workshop,csharpfritz/aspnetcore-app-workshop,dotnet-presentations/aspnetcore-app-workshop,dotnet-presentations/aspnetcore-app-workshop,dotnet-presentations/aspnetcore-app-workshop,anurse/ConferencePlanner,csharpfritz/aspnetcore-app-workshop,csharpfritz/aspnetcore-app-workshop,jongalloway/aspnetcore-app-workshop
src/FrontEnd/Pages/Index.cshtml.cs
src/FrontEnd/Pages/Index.cshtml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using ConferenceDTO; using FrontEnd.Services; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Authorization; namespace FrontEnd.Pages { public class IndexModel : PageModel { private readonly IApiClient _apiClient; private readonly IAuthorizationService _authz; public IndexModel(IApiClient apiClient, IAuthorizationService authz) { _apiClient = apiClient; _authz = authz; } public IEnumerable<IGrouping<DayOfWeek?, IGrouping<DateTimeOffset?, SessionResponse>>> Sessions { get; set; } public bool IsAdmin { get; set; } public async Task OnGet(int day = 0) { IsAdmin = await _authz.AuthorizeAsync(User, "Admin"); var sessions = await _apiClient.GetSessionsAsync(); var firstDay = sessions.Min(s => s.StartTime?.Day); var filterDay = firstDay + day; Sessions = sessions.Where(s => s.StartTime?.Date.Day == filterDay) .OrderBy(s => s.TrackId) .GroupBy(s => s.StartTime) .OrderBy(g => g.Key) .GroupBy(g => g.Key?.DayOfWeek); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using ConferenceDTO; using FrontEnd.Services; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Authorization; namespace FrontEnd.Pages { public class IndexModel : PageModel { private readonly IApiClient _apiClient; private readonly IAuthorizationService _authz; public IndexModel(IApiClient apiClient, IAuthorizationService authz) { _apiClient = apiClient; _authz = authz; } public IEnumerable<IGrouping<DayOfWeek?, IGrouping<DateTimeOffset?, SessionResponse>>> Sessions { get; set; } public bool IsAdmin { get; set; } public async Task OnGet(int day = 0) { IsAdmin = await _authz.AuthorizeAsync(User, "Admin"); var sessions = await _apiClient.GetSessionsAsync(); var firstDay = sessions.Min(s => s.StartTime?.Day); var filterDay = firstDay + day; Sessions = sessions.Where(s => s.StartTime?.Date.Day == filterDay) .OrderBy(s => s.Track?.Name) .GroupBy(s => s.StartTime) .OrderBy(g => g.Key) .GroupBy(g => g.Key?.DayOfWeek); } } }
mit
C#
4dbd4eced9803f4f969de04b04e26bda3fd087bf
Remove explicit path
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Mvc/Views/Home/Index.cshtml
Anlab.Mvc/Views/Home/Index.cshtml
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: September 30, 2020<br /><br /> In response to the emergency need for the analysis of wine for smoke taint, the UC Davis Department of Viticulture and Enology is partnering with the UC Davis Analytical Lab to offer testing<br /><br /> Please click <a href="/media/pdf/anlab_smoke-taint_instructions.pdf" target="_blank">here for more information</a>. </div> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p> <p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and waste water, and feed in support of agricultural and environmental research.</p> <p>For new clients, please note the drop-down menu under “Lab Information” which contains an “Order Completion Help” section to help guide you in creating a work order. Also helpful under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides brief descriptions of our current methods.</p> <p>Please feel free to contact the lab with any questions.</p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> <p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br> Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p> </address> </div>
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: September 30, 2020<br /><br /> In response to the emergency need for the analysis of wine for smoke taint, the UC Davis Department of Viticulture and Enology is partnering with the UC Davis Analytical Lab to offer testing<br /><br /> Please click <a href="https://anlab.ucdavis.edu/media/pdf/anlab_smoke-taint_instructions.pdf" target="_blank">here for more information</a>. </div> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>The laboratory is located in Hoagland Hall with a Sample Receiving area in nearby Hoagland Annex. </p> <p>The laboratory performs analyses on selected chemical constituents of soil, plant, water and waste water, and feed in support of agricultural and environmental research.</p> <p>For new clients, please note the drop-down menu under “Lab Information” which contains an “Order Completion Help” section to help guide you in creating a work order. Also helpful under the “Lab Information” drop-down menu is the “Methods of Analysis” section which provides brief descriptions of our current methods.</p> <p>Please feel free to contact the lab with any questions.</p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> <p>Receiving Hours: 8am - 5pm M - F, </br> except University holidays </br> Sample Receiving Area: Hoagland Annex, </br>Phone: 530-752-0266</p> </address> </div>
mit
C#
f409645e2efaeb996d9d0c4767b4a3089247f138
Change to DbFile model
iliantrifonov/SubtitleCommunitySystem,iliantrifonov/SubtitleCommunitySystem
SubtitleCommunitySystem/SubtitleCommunitySystem.Model/DbFile.cs
SubtitleCommunitySystem/SubtitleCommunitySystem.Model/DbFile.cs
namespace SubtitleCommunitySystem.Model { public class DbFile { public int Id { get; set; } public byte[] Content { get; set; } public string FileName { get; set; } public string ContentType { get; set; } } }
namespace SubtitleCommunitySystem.Model { public class DbFile { public int Id { get; set; } public byte[] Content { get; set; } public string FileName { get; set; } public string ContentFile { get; set; } } }
mit
C#
10f6c98995a9a2ccd62f903e53cc4f1cfa2f6a43
use EditorBrowsable to hide unnecessary property
acple/ParsecSharp
ParsecSharp/Core/Result/Failure.cs
ParsecSharp/Core/Result/Failure.cs
using System; using System.ComponentModel; namespace ParsecSharp { public abstract class Failure<TToken, T> : Result<TToken, T> { [EditorBrowsable(EditorBrowsableState.Never)] public sealed override T Value => throw this.Exception; public abstract IParsecState<TToken> State { get; } public virtual ParsecException Exception => new(this.ToString()); public abstract string Message { get; } public abstract Failure<TToken, TNext> Convert<TNext>(); internal sealed override Result<TToken, TResult> Next<TNext, TResult>(Func<T, Parser<TToken, TNext>> next, Func<Result<TToken, TNext>, Result<TToken, TResult>> cont) => cont(this.Convert<TNext>()); public sealed override TResult CaseOf<TResult>(Func<Failure<TToken, T>, TResult> failure, Func<Success<TToken, T>, TResult> success) => failure(this); public sealed override Result<TToken, TResult> Map<TResult>(Func<T, TResult> function) => this.Convert<TResult>(); public sealed override string ToString() => $"Parser Failure ({this.State.Position.ToString()}): {this.Message}"; } }
using System; namespace ParsecSharp { public abstract class Failure<TToken, T> : Result<TToken, T> { public sealed override T Value => throw this.Exception; public abstract IParsecState<TToken> State { get; } public virtual ParsecException Exception => new(this.ToString()); public abstract string Message { get; } public abstract Failure<TToken, TNext> Convert<TNext>(); internal sealed override Result<TToken, TResult> Next<TNext, TResult>(Func<T, Parser<TToken, TNext>> next, Func<Result<TToken, TNext>, Result<TToken, TResult>> cont) => cont(this.Convert<TNext>()); public sealed override TResult CaseOf<TResult>(Func<Failure<TToken, T>, TResult> failure, Func<Success<TToken, T>, TResult> success) => failure(this); public sealed override Result<TToken, TResult> Map<TResult>(Func<T, TResult> function) => this.Convert<TResult>(); public sealed override string ToString() => $"Parser Failure ({this.State.Position.ToString()}): {this.Message}"; } }
mit
C#
b4101d58ed2e28f20f6f657be21b32a8765c15af
Fix build break caused by BlobStorageTest not updated
studio-nine/Nine.Storage,yufeih/Nine.Storage
test/Server/BlobStorageTest.cs
test/Server/BlobStorageTest.cs
namespace Nine.Storage { using System; using System.Collections.Generic; using Xunit; class BlobStorageTest : BlobStorageSpec<BlobStorageTest> { public override IEnumerable<ITestFactory<IBlobStorage>> GetData() { return new[] { new TestFactory<IBlobStorage>(nameof(BlobStorage), () => new BlobStorage("")), }; } } }
namespace Nine.Storage { using System; using System.Collections.Generic; class BlobStorageTest : BlobStorageSpec<BlobStorageTest> { public override IEnumerable<Func<IBlobStorage>> GetData() { return new[] { new Func<IBlobStorage>(() => new BlobStorage("DefaultEndpointsProtocol=https;AccountName=ninetest;AccountKey=ICfPLTxuKmhIj6XXSdWF4XPHByeXc4POIFpZLuo1EgMCJHpDVnSBEfaxBhV6P/eQ3yxEeGUW6um+VTCIOm1rpQ==")), }; } } }
mit
C#
b473c02003b3e0da2832d863d942d0720998aa15
Clean up file
NuGetPackageExplorer/NuGetPackageExplorer,campersau/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer
Core/Utility/DiagnosticsClient.cs
Core/Utility/DiagnosticsClient.cs
using System; using System.Collections.Generic; using System.Windows; using Microsoft.ApplicationInsights; using Microsoft.ApplicationInsights.Extensibility; using NuGetPe.Utility; namespace NuGetPe { public static class DiagnosticsClient { private static TelemetryClient? _client; public static void Initialize() { TelemetryConfiguration.Active.TelemetryInitializers.Add(new AppVersionTelemetryInitializer()); TelemetryConfiguration.Active.TelemetryInitializers.Add(new EnvironmentTelemetryInitializer()); Application.Current.DispatcherUnhandledException += App_DispatcherUnhandledException; _client = new TelemetryClient(); } public static void OnExit() { if (_client == null) return; _client.Flush(); // Allow time for flushing and sending: System.Threading.Thread.Sleep(1000); } private static void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { TrackException(e.Exception); } public static void TrackEvent(string eventName, IDictionary<string, string>? properties = null, IDictionary<string, double>? metrics = null) { if (_client == null) return; _client.TrackEvent(eventName, properties, metrics); } public static void TrackTrace(string evt, IDictionary<string, string>? properties = null) { if (_client == null) return; _client.TrackTrace(evt, properties); } public static void TrackException(Exception exception, IDictionary<string, string>? properties = null, IDictionary<string, double>? metrics = null) { if (_client == null) return; _client.TrackException(exception, properties, metrics); } public static void TrackPageView(string pageName) { if (_client == null) return; _client.TrackPageView(pageName); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows; using Microsoft.ApplicationInsights; using Microsoft.ApplicationInsights.Extensibility; using NuGetPe.Utility; namespace NuGetPe { public static class DiagnosticsClient { private static bool _initialized; private static TelemetryClient _client; public static void Initialize() { TelemetryConfiguration.Active.TelemetryInitializers.Add(new AppVersionTelemetryInitializer()); TelemetryConfiguration.Active.TelemetryInitializers.Add(new EnvironmentTelemetryInitializer()); Application.Current.DispatcherUnhandledException += App_DispatcherUnhandledException; _initialized = true; _client = new TelemetryClient(); } public static void OnExit() { if (!_initialized) return; _client.Flush(); // Allow time for flushing and sending: System.Threading.Thread.Sleep(1000); } private static void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { TrackException(e.Exception); } public static void TrackEvent(string eventName, IDictionary<string, string>? properties = null, IDictionary<string, double>? metrics = null) { if (!_initialized) return; _client.TrackEvent(eventName, properties, metrics); } public static void TrackTrace(string evt, IDictionary<string, string>? properties = null) { if (!_initialized) return; _client.TrackTrace(evt, properties); } public static void TrackException(Exception exception, IDictionary<string, string>? properties = null, IDictionary<string, double>? metrics = null) { if (!_initialized) return; _client.TrackException(exception, properties, metrics); } public static void TrackPageView(string pageName) { if (!_initialized) return; _client.TrackPageView(pageName); } } }
mit
C#
b9b19952263cb45888d7a9b063b3541cf40a5955
Revert FileListings.cs
robinrodricks/FluentFTP,robinrodricks/FluentFTP,robinrodricks/FluentFTP
FluentFTP/Helpers/FileListings.cs
FluentFTP/Helpers/FileListings.cs
namespace FluentFTP.Helpers { /// <summary> /// Extension methods related to FTP tasks /// </summary> internal static class FileListings { /// <summary> /// Checks if the given file exists in the given file listing. /// Supports servers that return: 1) full paths, 2) only filenames, 3) full paths without slash prefixed /// </summary> /// <param name="fileList">The listing returned by GetNameListing</param> /// <param name="path">The full file path you want to check</param> /// <returns></returns> public static bool FileExistsInNameListing(string[] fileList, string path) { // exit quickly if no paths if (fileList.Length == 0) { return false; } // cleanup file path, get file name var pathName = path.GetFtpFileName(); var pathPrefixed = path.EnsurePrefix("/"); // per entry in the name list foreach (var fileListEntry in fileList) { // FIX: support servers that return: 1) full paths, 2) only filenames, 3) full paths without slash prefixed if (fileListEntry == pathName || fileListEntry == path || fileListEntry.EnsurePrefix("/") == pathPrefixed) { return true; } } return false; } /// <summary> /// Checks if the given file exists in the given file listing. /// </summary> /// <param name="fileList">The listing returned by GetListing</param> /// <param name="path">The full file path you want to check</param> /// <returns></returns> public static bool FileExistsInListing(FtpListItem[] fileList, string path) { // exit quickly if no paths if (fileList == null || fileList.Length == 0) { return false; } // cleanup file path, get file name var trimSlash = new char[] { '/' }; var pathClean = path.Trim(trimSlash); // per entry in the list foreach (var fileListEntry in fileList) { if (fileListEntry.FullName.Trim(trimSlash) == pathClean) { return true; } } return false; } } }
namespace FluentFTP.Helpers { /// <summary> /// Extension methods related to FTP tasks /// </summary> internal static class FileListings { /// <summary> /// Checks if the given file exists in the given file listing. /// Supports servers that return: 1) full paths, 2) only filenames, 3) full paths without slash prefixed /// </summary> /// <param name="fileList">The listing returned by GetNameListing</param> /// <param name="path">The full file path you want to check</param> /// <returns></returns> public static bool FileExistsInNameListing(string[] fileList, string path) { // exit quickly if no paths if (fileList.Length == 0) { return false; } // cleanup file path, get file name var pathName = path.GetFtpFileName(); var pathPrefixed = pathName; pathPrefixed = path.EnsurePrefix("/"); // per entry in the name list foreach (var fileListEntry in fileList) { // FIX: support servers that return: 1) full paths, 2) only filenames, 3) full paths without slash prefixed if (fileListEntry == pathName || fileListEntry == path || fileListEntry.EnsurePrefix("/") == pathPrefixed) { return true; } } return false; } /// <summary> /// Checks if the given file exists in the given file listing. /// </summary> /// <param name="fileList">The listing returned by GetListing</param> /// <param name="path">The full file path you want to check</param> /// <returns></returns> public static bool FileExistsInListing(FtpListItem[] fileList, string path) { // exit quickly if no paths if (fileList == null || fileList.Length == 0) { return false; } // cleanup file path, get file name var trimSlash = new char[] { '/' }; var pathClean = path.Trim(trimSlash); // per entry in the list foreach (var fileListEntry in fileList) { if (fileListEntry.FullName.Trim(trimSlash) == pathClean) { return true; } } return false; } } }
mit
C#
b57b6cead8f5ad04fab49ea0088a92761c1fa0e1
Clean up unused lat/long coordinates in language tests.
jcheng31/DarkSkyApi,jcheng31/ForecastPCL
ForecastPCL.Test/LanguageTests.cs
ForecastPCL.Test/LanguageTests.cs
using System.Threading.Tasks; namespace ForecastPCL.Test { using System; using System.Configuration; using ForecastIOPortable; using NUnit.Framework; [TestFixture] public class LanguageTests { // These coordinates came from the Forecast API documentation, // and should return forecasts with all blocks. private const double AlcatrazLatitude = 37.8267; private const double AlcatrazLongitude = -122.423; /// <summary> /// API key to be used for testing. This should be specified in the /// test project's app.config file. /// </summary> private string apiKey; /// <summary> /// Sets up all tests by retrieving the API key from app.config. /// </summary> [TestFixtureSetUp] public void SetUp() { this.apiKey = ConfigurationManager.AppSettings["ApiKey"]; } [Test] public void AllLanguagesHaveValues() { foreach (Language language in Enum.GetValues(typeof(Language))) { Assert.That(() => language.ToValue(), Throws.Nothing); } } [Test] public async Task UnicodeLanguageIsSupported() { var client = new ForecastApi(this.apiKey); var result = await client.GetWeatherDataAsync(AlcatrazLatitude, AlcatrazLongitude, Unit.Auto, Language.Chinese); Assert.That(result, Is.Not.Null); } } }
using System.Threading.Tasks; namespace ForecastPCL.Test { using System; using System.Configuration; using ForecastIOPortable; using NUnit.Framework; [TestFixture] public class LanguageTests { // These coordinates came from the Forecast API documentation, // and should return forecasts with all blocks. private const double AlcatrazLatitude = 37.8267; private const double AlcatrazLongitude = -122.423; private const double MumbaiLatitude = 18.975; private const double MumbaiLongitude = 72.825833; /// <summary> /// API key to be used for testing. This should be specified in the /// test project's app.config file. /// </summary> private string apiKey; /// <summary> /// Sets up all tests by retrieving the API key from app.config. /// </summary> [TestFixtureSetUp] public void SetUp() { this.apiKey = ConfigurationManager.AppSettings["ApiKey"]; } [Test] public void AllLanguagesHaveValues() { foreach (Language language in Enum.GetValues(typeof(Language))) { Assert.That(() => language.ToValue(), Throws.Nothing); } } [Test] public async Task UnicodeLanguageIsSupported() { var client = new ForecastApi(this.apiKey); var result = await client.GetWeatherDataAsync(AlcatrazLatitude, AlcatrazLongitude, Unit.Auto, Language.Chinese); Assert.That(result, Is.Not.Null); } } }
mit
C#
1ffa81e8d3762ea0956de2ab0966939434103bbe
tweak formatting in targets
adamralph/liteguard,adamralph/liteguard
targets/Program.cs
targets/Program.cs
using System; using System.Threading.Tasks; using SimpleExec; using static Bullseye.Targets; using static SimpleExec.Command; internal class Program { public static Task Main(string[] args) { Target("build", () => RunAsync("dotnet", "build --configuration Release --nologo --verbosity quiet")); Target( "pack", DependsOn("build"), ForEach("LiteGuard.nuspec", "LiteGuard.Source.nuspec"), async nuspec => await RunAsync( "dotnet", "pack LiteGuard --configuration Release --no-build --nologo", configureEnvironment: env => env.Add("NUSPEC_FILE", nuspec))); Target( "test", DependsOn("build"), () => RunAsync("dotnet", "test --configuration Release --no-build --nologo")); Target("default", DependsOn("pack", "test")); return RunTargetsAndExitAsync(args, ex => ex is NonZeroExitCodeException); } }
using System; using System.Threading.Tasks; using SimpleExec; using static Bullseye.Targets; using static SimpleExec.Command; internal class Program { public static Task Main(string[] args) { Target("build", () => RunAsync("dotnet", "build --configuration Release --nologo --verbosity quiet")); Target( "pack", DependsOn("build"), ForEach("LiteGuard.nuspec", "LiteGuard.Source.nuspec"), async nuspec => { await RunAsync("dotnet", "pack LiteGuard --configuration Release --no-build --nologo", configureEnvironment: env => env.Add("NUSPEC_FILE", nuspec)); }); Target( "test", DependsOn("build"), () => RunAsync("dotnet", "test --configuration Release --no-build --nologo")); Target("default", DependsOn("pack", "test")); return RunTargetsAndExitAsync(args, ex => ex is NonZeroExitCodeException); } }
mit
C#
1fadc6e5378aa7f7683450f03cb77c30ecb0faf7
Use ConcurrentDictionary in CachingScriptMetadataResolver
OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn
src/OmniSharp.Script/CachingScriptMetadataResolver.cs
src/OmniSharp.Script/CachingScriptMetadataResolver.cs
using System.Collections.Concurrent; using System.Collections.Immutable; using Microsoft.CodeAnalysis; namespace OmniSharp.Script { public class CachingScriptMetadataResolver : MetadataReferenceResolver { private readonly MetadataReferenceResolver _defaultReferenceResolver; private static ConcurrentDictionary<string, ImmutableArray<PortableExecutableReference>> DirectReferenceCache = new ConcurrentDictionary<string, ImmutableArray<PortableExecutableReference>>(); private static ConcurrentDictionary<string, PortableExecutableReference> MissingReferenceCache = new ConcurrentDictionary<string, PortableExecutableReference>(); public CachingScriptMetadataResolver(MetadataReferenceResolver defaultReferenceResolver) { _defaultReferenceResolver = defaultReferenceResolver; } public override bool Equals(object other) { return _defaultReferenceResolver.Equals(other); } public override int GetHashCode() { return _defaultReferenceResolver.GetHashCode(); } public override bool ResolveMissingAssemblies => _defaultReferenceResolver.ResolveMissingAssemblies; public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity) { return MissingReferenceCache.GetOrAdd(referenceIdentity.Name, _ => _defaultReferenceResolver.ResolveMissingAssembly(definition, referenceIdentity)); } public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) { var key = $"{reference}-{baseFilePath}"; return DirectReferenceCache.GetOrAdd(key, _ => _defaultReferenceResolver.ResolveReference(reference, baseFilePath, properties)); } } }
using System.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis; namespace OmniSharp.Script { public class CachingScriptMetadataResolver : MetadataReferenceResolver { private readonly MetadataReferenceResolver _defaultReferenceResolver; private static Dictionary<string, ImmutableArray<PortableExecutableReference>> DirectReferenceCache = new Dictionary<string, ImmutableArray<PortableExecutableReference>>(); private static Dictionary<string, PortableExecutableReference> MissingReferenceCache = new Dictionary<string, PortableExecutableReference>(); public CachingScriptMetadataResolver(MetadataReferenceResolver defaultReferenceResolver) { _defaultReferenceResolver = defaultReferenceResolver; } public override bool Equals(object other) { return _defaultReferenceResolver.Equals(other); } public override int GetHashCode() { return _defaultReferenceResolver.GetHashCode(); } public override bool ResolveMissingAssemblies => _defaultReferenceResolver.ResolveMissingAssemblies; public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity) { if (MissingReferenceCache.ContainsKey(referenceIdentity.Name)) { return MissingReferenceCache[referenceIdentity.Name]; } var result = _defaultReferenceResolver.ResolveMissingAssembly(definition, referenceIdentity); if (result != null) { MissingReferenceCache[referenceIdentity.Name] = result; } return result; } public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) { var key = $"{reference}-{baseFilePath}"; if (DirectReferenceCache.ContainsKey(key)) { return DirectReferenceCache[key]; } var result = _defaultReferenceResolver.ResolveReference(reference, baseFilePath, properties); if (result.Length > 0) { DirectReferenceCache[key] = result; } return result; } } }
mit
C#
6b127bb5c7b3d1236aef9d665d7e24c989dc651b
Fix font
jamesmontemagno/nibbles
Nibbles.Shared/GameAppDelegate.cs
Nibbles.Shared/GameAppDelegate.cs
using System; using CocosSharp; using Nibbles.Shared.Layers; using CocosDenshion; namespace Nibbles.Shared { public class GameAppDelegate : CCApplicationDelegate { public const string MainFont = "fonts/Roboto-Light.ttf"; #if __ANDROID__ public static Android.App.Activity CurrentActivity { get; set; } #endif public override void ApplicationDidFinishLaunching (CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add ("animations"); application.ContentSearchPaths.Add ("fonts"); application.ContentSearchPaths.Add ("images"); application.ContentSearchPaths.Add ("sounds"); application.ContentSearchPaths.Add ("hd"); var windowSize = mainWindow.WindowSizeInPixels; mainWindow.SetDesignResolutionSize(windowSize.Width, windowSize.Height, CCSceneResolutionPolicy.ExactFit); var scene = GameStartLayer.CreateScene (mainWindow); CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic ("sounds/backgroundMusic", true); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("pop"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring0"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring1"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring2"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring3"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring4"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring5"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("highscore"); CCSimpleAudioEngine.SharedEngine.BackgroundMusicVolume = .6f; CCSimpleAudioEngine.SharedEngine.EffectsVolume = .5f; mainWindow.RunWithScene (scene); } public override void ApplicationDidEnterBackground (CCApplication application) { application.Paused = true;// if you use SimpleAudioEngine, your music must be paused CCSimpleAudioEngine.SharedEngine.PauseBackgroundMusic (); } public override void ApplicationWillEnterForeground (CCApplication application) { application.Paused = false;// if you use SimpleAudioEngine, your music must be paused CCSimpleAudioEngine.SharedEngine.ResumeBackgroundMusic (); } } }
using System; using CocosSharp; using Nibbles.Shared.Layers; using CocosDenshion; namespace Nibbles.Shared { public class GameAppDelegate : CCApplicationDelegate { public const string MainFont = "fonts/Roboto-Light.tff"; #if __ANDROID__ public static Android.App.Activity CurrentActivity { get; set; } #endif public override void ApplicationDidFinishLaunching (CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add ("animations"); application.ContentSearchPaths.Add ("fonts"); application.ContentSearchPaths.Add ("images"); application.ContentSearchPaths.Add ("sounds"); application.ContentSearchPaths.Add ("hd"); var windowSize = mainWindow.WindowSizeInPixels; mainWindow.SetDesignResolutionSize(windowSize.Width, windowSize.Height, CCSceneResolutionPolicy.ExactFit); var scene = GameStartLayer.CreateScene (mainWindow); CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic ("sounds/backgroundMusic", true); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("pop"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring0"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring1"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring2"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring3"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring4"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ring5"); CCSimpleAudioEngine.SharedEngine.PreloadEffect ("highscore"); CCSimpleAudioEngine.SharedEngine.BackgroundMusicVolume = .6f; CCSimpleAudioEngine.SharedEngine.EffectsVolume = .5f; mainWindow.RunWithScene (scene); } public override void ApplicationDidEnterBackground (CCApplication application) { application.Paused = true;// if you use SimpleAudioEngine, your music must be paused CCSimpleAudioEngine.SharedEngine.PauseBackgroundMusic (); } public override void ApplicationWillEnterForeground (CCApplication application) { application.Paused = false;// if you use SimpleAudioEngine, your music must be paused CCSimpleAudioEngine.SharedEngine.ResumeBackgroundMusic (); } } }
mit
C#
6debfc791153acfa4ff711d448477cec632405d1
Remove using.
chromium/vs-chromium,chromium/vs-chromium,chromium/vs-chromium,chromium/vs-chromium
src/Server/FileSystemContents/IFileContentsFactory.cs
src/Server/FileSystemContents/IFileContentsFactory.cs
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. using VsChromium.Core.Files; namespace VsChromium.Server.FileSystemContents { public interface IFileContentsFactory { FileContents ReadFileContents(FullPath path); } }
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. using System; using VsChromium.Core.Files; namespace VsChromium.Server.FileSystemContents { public interface IFileContentsFactory { FileContents ReadFileContents(FullPath path); } }
bsd-3-clause
C#
d13ddca8f763833e9254f826d1600000e20bc5ea
Fix stackoverflow error caused by navigation property in Session model
meutley/ISTS
src/Api/DependencyInjectionConfiguration.cs
src/Api/DependencyInjectionConfiguration.cs
using Microsoft.Extensions.DependencyInjection; using ISTS.Application.Rooms; using ISTS.Application.Schedules; using ISTS.Application.Studios; using ISTS.Domain.Rooms; using ISTS.Domain.Schedules; using ISTS.Domain.Studios; using ISTS.Infrastructure.Repository; namespace ISTS.Api { public static class DependencyInjectionConfiguration { public static void Configure(IServiceCollection services) { services.AddSingleton<ISessionScheduleValidator, SessionScheduleValidator>(); services.AddSingleton<IStudioRepository, StudioRepository>(); services.AddSingleton<IRoomRepository, RoomRepository>(); services.AddSingleton<IStudioService, StudioService>(); services.AddSingleton<IRoomService, RoomService>(); } } }
using Microsoft.Extensions.DependencyInjection; using ISTS.Application.Rooms; using ISTS.Application.Studios; using ISTS.Domain.Rooms; using ISTS.Domain.Studios; using ISTS.Infrastructure.Repository; namespace ISTS.Api { public static class DependencyInjectionConfiguration { public static void Configure(IServiceCollection services) { services.AddSingleton<IStudioRepository, StudioRepository>(); services.AddSingleton<IRoomRepository, RoomRepository>(); services.AddSingleton<IStudioService, StudioService>(); services.AddSingleton<IRoomService, RoomService>(); } } }
mit
C#
834404486d841a960b409a11bbc7e59743f02ce8
Fix View References
PioneerCode/pioneer-blog,PioneerCode/pioneer-blog,PioneerCode/pioneer-blog,PioneerCode/pioneer-blog
src/Pioneer.Blog/Views/Account/Login.cshtml
src/Pioneer.Blog/Views/Account/Login.cshtml
@using Microsoft.AspNetCore.Identity @using Pioneer.Blog.Entity @model Pioneer.Blog.Model.Views.LoginViewModel @inject SignInManager<UserEntity> SignInManager @{ ViewData["Title"] = "Log in"; } <div class="row"> <div class="large-8 large-push-2 columns"> <h2>@ViewData["Title"].</h2> <form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post"> <h4>Use a local account to log in.</h4> <hr /> <div asp-validation-summary="All" class="text-danger"></div> <label asp-for="Email"> Email <input asp-for="Email" class="form-control" /> <span asp-validation-for="Email" class="text-danger"></span> </label> <label asp-for="Password"> Password <input asp-for="Password" class="form-control" /> <span asp-validation-for="Password" class="text-danger"></span> </label> <button type="submit" class="button">Log in</button> </form> </div> </div>
@using Microsoft.AspNetCore.Identity @using Pioneer.Blog.DAL.Entites @model Pioneer.Blog.Model.Views.LoginViewModel @inject SignInManager<UserEntity> SignInManager @{ ViewData["Title"] = "Log in"; } <div class="row"> <div class="large-8 large-push-2 columns"> <h2>@ViewData["Title"].</h2> <form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post"> <h4>Use a local account to log in.</h4> <hr /> <div asp-validation-summary="All" class="text-danger"></div> <label asp-for="Email"> Email <input asp-for="Email" class="form-control" /> <span asp-validation-for="Email" class="text-danger"></span> </label> <label asp-for="Password"> Password <input asp-for="Password" class="form-control" /> <span asp-validation-for="Password" class="text-danger"></span> </label> <button type="submit" class="button">Log in</button> </form> </div> </div>
mit
C#
93229a8c35fdbec67ed73dbbf37258e16d3468b9
Simplify component factory with generics
mysticfall/Alensia
Assets/Editor/Alensia/Core/UI/ComponentFactory.cs
Assets/Editor/Alensia/Core/UI/ComponentFactory.cs
using System; using UnityEditor; using UnityEngine; namespace Alensia.Core.UI { public static class ComponentFactory { [MenuItem("GameObject/UI/Alensia/Button", false, 10)] public static Button CreateButton(MenuCommand command) => CreateComponent(command, Button.CreateInstance); [MenuItem("GameObject/UI/Alensia/Label", false, 10)] public static Label CreateLabel(MenuCommand command) => CreateComponent(command, Label.CreateInstance); [MenuItem("GameObject/UI/Alensia/Panel", false, 10)] public static Panel CreatePanel(MenuCommand command) => CreateComponent(command, Panel.CreateInstance); private static T CreateComponent<T>( MenuCommand command, Func<T> factory) where T : UIComponent { var component = factory.Invoke(); GameObjectUtility.SetParentAndAlign( component.gameObject, command.context as GameObject); Undo.RegisterCreatedObjectUndo(component, "Create " + component.name); Selection.activeObject = component; return component; } } }
using UnityEditor; using UnityEngine; namespace Alensia.Core.UI { public static class ComponentFactory { [MenuItem("GameObject/UI/Alensia/Button", false, 10)] public static Button CreateButton(MenuCommand command) { var button = Button.CreateInstance(); GameObjectUtility.SetParentAndAlign(button.gameObject, command.context as GameObject); Undo.RegisterCreatedObjectUndo(button, "Create " + button.name); Selection.activeObject = button; return button; } [MenuItem("GameObject/UI/Alensia/Label", false, 10)] public static Label CreateLabel(MenuCommand command) { var label = Label.CreateInstance(); GameObjectUtility.SetParentAndAlign(label.gameObject, command.context as GameObject); Undo.RegisterCreatedObjectUndo(label, "Create " + label.name); Selection.activeObject = label; return label; } [MenuItem("GameObject/UI/Alensia/Panel", false, 10)] public static Panel CreatePanel(MenuCommand command) { var panel = Panel.CreateInstance(); GameObjectUtility.SetParentAndAlign(panel.gameObject, command.context as GameObject); Undo.RegisterCreatedObjectUndo(panel, "Create " + panel.name); Selection.activeObject = panel; return panel; } } }
apache-2.0
C#
5fbd0fe51b8c6be4d32afc67087e54d325fc0ce0
Print currentPath in console
stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity
C#Development/BashSoft/BashSoft/IO/InputReader.cs
C#Development/BashSoft/BashSoft/IO/InputReader.cs
namespace BashSoft.IO { using System; using BashSoft.StaticData; public static class InputReader { private const string QuitCommand = "quit"; private const string ExitCommand = "exit"; public static void StartReadingCommands() { OutputWriter.WriteMessage($"{SessionData.CurrentPath}> "); var input = Console.ReadLine(); input = input.Trim(); while (input != QuitCommand && input != ExitCommand) { CommandInterpreter.InterpredCommand(input); OutputWriter.WriteMessage($"{SessionData.CurrentPath}> "); input = Console.ReadLine(); input = input.Trim(); } } } }
namespace BashSoft.IO { using BashSoft.StaticData; using System; public static class InputReader { private const string quitCommand = "quit"; private const string exitCommand = "exit"; public static void StartReadingCommands() { OutputWriter.WriteMessage($"{SessionData.currentPath}> "); var input = Console.ReadLine(); input = input.Trim(); while (input != quitCommand && input != exitCommand) { CommandInterpreter.InterpredCommand(input); OutputWriter.WriteMessage($"{SessionData.currentPath}> "); input = Console.ReadLine(); input = input.Trim(); } } } }
mit
C#
ff29118539d22d5067faac3ba73e84a3f5dfce59
Modify the enode project assembly.cs file
Aaron-Liu/enode,tangxuehua/enode
src/ENode/Properties/AssemblyInfo.cs
src/ENode/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("ENode")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ENode")] [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("bdf470ac-90a3-47cf-9032-a3f7a298a688")] // 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.2.1.0")] [assembly: AssemblyFileVersion("1.2.1.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ENode")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ENode")] [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("bdf470ac-90a3-47cf-9032-a3f7a298a688")] // 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#
324529bb18223fa97db994f451c787e8abc258fa
test bidisi
ziyasal/FluentBootstrapPolicy
FluentBootstrapPolicy.Tests/PolicyContextTests.cs
FluentBootstrapPolicy.Tests/PolicyContextTests.cs
using System; using Autofac; using Common.Testing.NUnit; using NUnit.Framework; namespace FluentBootstrapPolicy.Tests { public class PolicyContextTests : TestBase { private IPolicyContext _policyContext; protected override void FinalizeSetUp() { _policyContext = PolicyContext.Instance; _policyContext.Configure(x => { var builder = new ContainerBuilder(); builder.RegisterModule<TestModule>(); var container = builder.Build(); x.Use(new AutofacServiceLocator(container)) .UseNlog(); }); } [Test] public void Start_Test() { Assert.Throws<Exception>(() => _policyContext.Execute()); } } }
using System; using Autofac; using Common.Testing.NUnit; using NUnit.Framework; namespace FluentBootstrapPolicy.Tests { public class PolicyContextTests : TestBase { private IPolicyContext _policyContext; protected override void FinalizeSetUp() { var builder = new ContainerBuilder(); builder.RegisterModule<TestModule>(); var container = builder.Build(); _policyContext = PolicyContext.Instance; _policyContext.Configure(x => { x .Use(new AutofacServiceLocator(container)) .UseNlog(); }); } [Test] public void Start_Test() { Assert.Throws<Exception>(() => _policyContext.Execute()); } } }
mit
C#
14a554e411ae8c0baa7b052afd0bf65b71039060
Improve Error message when use Asset name.
liarjo/MediaBlutlerTest01
MediaButler.BaseProcess/Base/SelectAssetByStep.cs
MediaButler.BaseProcess/Base/SelectAssetByStep.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MediaButler.Common.workflow; using System.Diagnostics; using MediaButler.Common.ResourceAccess; using MediaButler.Common; using Microsoft.WindowsAzure.MediaServices.Client; namespace MediaButler.BaseProcess { class SelectAssetByStep : MediaButler.Common.workflow.StepHandler { private ButlerProcessRequest myRequest; public override void HandleCompensation(ChainRequest request) { string errorTxt = string.Format("[{0}] process Type {1} instance {2} has not compensation method", this.GetType().FullName, myRequest.ProcessTypeId, myRequest.ProcessInstanceId); Trace.TraceWarning(errorTxt); } public override void HandleExecute(ChainRequest request) { myRequest = (ButlerProcessRequest)request; var myBlobManager = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn); IjsonKeyValue dotControlData = myBlobManager.GetProcessConfig(myRequest.ButlerRequest.ControlFileUri, myRequest.ProcessTypeId); switch (dotControlData.Read(DotControlConfigKeys.SelectAssetByType)) { case "assetid": myRequest.AssetId = dotControlData.Read(DotControlConfigKeys.SelectAssetByValue); break; default: var _MediaServicesContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey); string AssetName = dotControlData.Read(DotControlConfigKeys.SelectAssetByValue); try { IAsset asset = (from m in _MediaServicesContext.Assets select m).Where(m => m.Name == AssetName).FirstOrDefault(); myRequest.AssetId = asset.Id; } catch (Exception X) { throw new Exception("Error Loading Asset by name " + AssetName); } break; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MediaButler.Common.workflow; using System.Diagnostics; using MediaButler.Common.ResourceAccess; using MediaButler.Common; using Microsoft.WindowsAzure.MediaServices.Client; namespace MediaButler.BaseProcess { class SelectAssetByStep : MediaButler.Common.workflow.StepHandler { private ButlerProcessRequest myRequest; public override void HandleCompensation(ChainRequest request) { string errorTxt = string.Format("[{0}] process Type {1} instance {2} has not compensation method", this.GetType().FullName, myRequest.ProcessTypeId, myRequest.ProcessInstanceId); Trace.TraceWarning(errorTxt); } public override void HandleExecute(ChainRequest request) { myRequest = (ButlerProcessRequest)request; var myBlobManager = BlobManagerFactory.CreateBlobManager(myRequest.ProcessConfigConn); IjsonKeyValue dotControlData = myBlobManager.GetProcessConfig(myRequest.ButlerRequest.ControlFileUri, myRequest.ProcessTypeId); switch (dotControlData.Read(DotControlConfigKeys.SelectAssetByType)) { case "assetid": myRequest.AssetId = dotControlData.Read(DotControlConfigKeys.SelectAssetByValue); break; default: var _MediaServicesContext = new CloudMediaContext(myRequest.MediaAccountName, myRequest.MediaAccountKey); string AssetName = dotControlData.Read(DotControlConfigKeys.SelectAssetByValue); IAsset asset = (from m in _MediaServicesContext.Assets select m).Where(m => m.Name == AssetName).FirstOrDefault(); myRequest.AssetId = asset.Id; break; } } } }
mit
C#
5a6a011ef45e44c5f8663bf581505a1c7730a648
Remove the non-active button from the jumbotron.
bigfont/sweet-water-revolver
mvcWebApp/Views/Home/_Jumbotron.cshtml
mvcWebApp/Views/Home/_Jumbotron.cshtml
<section class="container"> <div id="our-jumbotron" class="jumbotron"> <h1>Welcome!</h1> <p>We are Sweet Water Revolver. This is our website. Please look around.</p> </div> </section>
<section class="container"> <div id="our-jumbotron" class="jumbotron"> <h1>Welcome!</h1> <p>We are Sweet Water Revolver. This is our website. Please look around and check out our...</p> <p><a class="btn btn-primary btn-lg" role="button">... showtimes.</a></p> </div> </section>
mit
C#
009b973234c9923d66c5f2975b03cd5f19188bfd
Revert "Newline at end of file missing, added."
marceloyuela/google-cloud-powershell,GoogleCloudPlatform/google-cloud-powershell,marceloyuela/google-cloud-powershell,ILMTitan/google-cloud-powershell,marceloyuela/google-cloud-powershell,chrsmith/google-cloud-powershell
Google.PowerShell/Dns/GcdCmdlet.cs
Google.PowerShell/Dns/GcdCmdlet.cs
 // Copyright 2016 Google Inc. All Rights Reserved. // Licensed under the Apache License Version 2.0. using Google.Apis.Dns.v1; using Google.PowerShell.Common; namespace Google.PowerShell.Dns { /// <summary> /// Base class for Google DNS-based cmdlets. /// </summary> public abstract class GcdCmdlet : GCloudCmdlet { // The Service for the Google DNS API public DnsService Service { get; } protected GcdCmdlet() : this(null) { } protected GcdCmdlet(DnsService service) { Service = service ?? new DnsService(GetBaseClientServiceInitializer()); } } }
 // Copyright 2016 Google Inc. All Rights Reserved. // Licensed under the Apache License Version 2.0. using Google.Apis.Dns.v1; using Google.PowerShell.Common; namespace Google.PowerShell.Dns { /// <summary> /// Base class for Google DNS-based cmdlets. /// </summary> public abstract class GcdCmdlet : GCloudCmdlet { // The Service for the Google DNS API public DnsService Service { get; } protected GcdCmdlet() : this(null) { } protected GcdCmdlet(DnsService service) { Service = service ?? new DnsService(GetBaseClientServiceInitializer()); } } }
apache-2.0
C#
deb6c052bdfecb1dd1471650db5d35aa6801d64b
Fix build error in VS2015
dgnorth/DriftUe4Plugin,dgnorth/DriftUe4Plugin,dgnorth/DriftUe4Plugin,dgnorth/DriftUe4Plugin
Plugins/Drift/Source/RapidJson/RapidJson.Build.cs
Plugins/Drift/Source/RapidJson/RapidJson.Build.cs
// Copyright 2015-2017 Directive Games Limited - All Rights Reserved using UnrealBuildTool; public class RapidJson : ModuleRules { public RapidJson(TargetInfo Target) { bFasterWithoutUnity = true; PCHUsage = PCHUsageMode.NoSharedPCHs; PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... } ); PrivateIncludePaths.AddRange( new string[] { // ... add other private include paths required here ... } ); PublicDependencyModuleNames.AddRange( new string[] { // ... add other public dependencies that you statically link with here ... "Core", "HTTP", } ); PrivateDependencyModuleNames.AddRange( new string[] { // ... add private dependencies that you statically link with here ... } ); if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.PS4)) { Definitions.Add("RAPIDJSON_HAS_CXX11_RVALUE_REFS=1"); } } }
// Copyright 2015-2017 Directive Games Limited - All Rights Reserved using UnrealBuildTool; public class RapidJson : ModuleRules { public RapidJson(TargetInfo Target) { bFasterWithoutUnity = true; PCHUsage = PCHUsageMode.NoSharedPCHs; PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... } ); PrivateIncludePaths.AddRange( new string[] { // ... add other private include paths required here ... } ); PublicDependencyModuleNames.AddRange( new string[] { // ... add other public dependencies that you statically link with here ... "Core", "HTTP", } ); PrivateDependencyModuleNames.AddRange( new string[] { // ... add private dependencies that you statically link with here ... } ); } }
mit
C#
5aee92f855a33912b6c30648e9517d1fde58917e
Add extension method for working out if an entry is deleted or not.
andrew-schofield/keepass2-haveibeenpwned
HaveIBeenPwned/PwEntryExtension.cs
HaveIBeenPwned/PwEntryExtension.cs
using KeePass.Plugins; using KeePassLib; using System; using System.Linq; namespace HaveIBeenPwned { public static class PwEntryExtension { public static DateTime GetPasswordLastModified(this PwEntry entry) { if(entry.History != null && entry.History.Any()) { var sortedEntries = entry.History.OrderByDescending(h => h.LastModificationTime); foreach(var historyEntry in sortedEntries) { if(entry.Strings.GetSafe(PwDefs.PasswordField).ReadString() != historyEntry.Strings.GetSafe(PwDefs.PasswordField).ReadString()) { return historyEntry.LastModificationTime; } } return sortedEntries.Last().LastModificationTime; } return entry.LastModificationTime; } public static bool IsDeleted(this PwEntry entry, IPluginHost pluginHost) { return entry.ParentGroup.Uuid.CompareTo(pluginHost.Database.RecycleBinUuid) == 0; } } }
using KeePassLib; using System; using System.Linq; namespace HaveIBeenPwned { public static class PwEntryExtension { public static DateTime GetPasswordLastModified(this PwEntry entry) { if(entry.History != null && entry.History.Any()) { var sortedEntries = entry.History.OrderByDescending(h => h.LastModificationTime); foreach(var historyEntry in sortedEntries) { if(entry.Strings.GetSafe(PwDefs.PasswordField).ReadString() != historyEntry.Strings.GetSafe(PwDefs.PasswordField).ReadString()) { return historyEntry.LastModificationTime; } } return sortedEntries.Last().LastModificationTime; } return entry.LastModificationTime; } } }
mit
C#
bc850d72037ccf5621d5edf462a87ada9d82c434
Fix script location via AppDomain base dir for web applications
NServiceBusSqlPersistence/NServiceBus.SqlPersistence
src/SqlPersistence/ScriptLocation.cs
src/SqlPersistence/ScriptLocation.cs
using System; using System.IO; using System.Reflection; using NServiceBus; using NServiceBus.Settings; static class ScriptLocation { const string ScriptFolder = "NServiceBus.Persistence.Sql"; public static string FindScriptDirectory(ReadOnlySettings settings) { var currentDirectory = GetCurrentDirectory(settings); return Path.Combine(currentDirectory, ScriptFolder, settings.GetSqlDialect().Name); } static string GetCurrentDirectory(ReadOnlySettings settings) { if (settings.TryGet("SqlPersistence.ScriptDirectory", out string scriptDirectory)) { return scriptDirectory; } var entryAssembly = Assembly.GetEntryAssembly(); if (entryAssembly == null) { var baseDir = AppDomain.CurrentDomain.BaseDirectory; var scriptDir = Path.Combine(baseDir, ScriptFolder); //if the app domain base dir contains the scripts folder, return it. Otherwise add "bin" to the base dir so that web apps work correctly if (Directory.Exists(scriptDir)) { return baseDir; } return Path.Combine(baseDir, "bin"); } var codeBase = entryAssembly.CodeBase; return Directory.GetParent(new Uri(codeBase).LocalPath).FullName; } public static void ValidateScriptExists(string createScript) { if (!File.Exists(createScript)) { throw new Exception($"Expected '{createScript}' to exist. It is possible it was not deployed with the endpoint or NServiceBus.Persistence.Sql.MsBuild nuget was not included in the project."); } } }
using System; using System.IO; using System.Reflection; using NServiceBus; using NServiceBus.Settings; static class ScriptLocation { public static string FindScriptDirectory(ReadOnlySettings settings) { var currentDirectory = GetCurrentDirectory(settings); return Path.Combine(currentDirectory, "NServiceBus.Persistence.Sql", settings.GetSqlDialect().Name); } static string GetCurrentDirectory(ReadOnlySettings settings) { if (settings.TryGet("SqlPersistence.ScriptDirectory", out string scriptDirectory)) { return scriptDirectory; } var entryAssembly = Assembly.GetEntryAssembly(); if (entryAssembly == null) { return AppDomain.CurrentDomain.BaseDirectory; } var codeBase = entryAssembly.CodeBase; return Directory.GetParent(new Uri(codeBase).LocalPath).FullName; } public static void ValidateScriptExists(string createScript) { if (!File.Exists(createScript)) { throw new Exception($"Expected '{createScript}' to exist. It is possible it was not deployed with the endpoint or NServiceBus.Persistence.Sql.MsBuild nuget was not included in the project."); } } }
mit
C#
58bb3da43d484bbd5dda19e4d82072e42fc42758
include databaseName in ConnectionStringInfo
dfaruque/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,linpiero/Serenity,rolembergfilho/Serenity,linpiero/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,dfaruque/Serenity,linpiero/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,linpiero/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,linpiero/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity
Serenity.Data/Connections/ConnectionStringInfo.cs
Serenity.Data/Connections/ConnectionStringInfo.cs
 using System; using System.Data.Common; namespace Serenity.Data { public class ConnectionStringInfo { private string databaseName; public ConnectionStringInfo(string connectionString, string providerName, DbProviderFactory providerFactory) { this.ConnectionString = connectionString; this.ProviderName = providerName; this.ProviderFactory = providerFactory; } public string DatabaseName { get { if (databaseName == null) { var csb = new DbConnectionStringBuilder(); csb.ConnectionString = ConnectionString; databaseName = csb["Initial Catalog"] as string ?? csb["Database"] as string ?? ""; } return databaseName == "" ? null : databaseName; } } public string ConnectionString { get; private set; } public string ProviderName { get; private set; } public DbProviderFactory ProviderFactory { get; private set; } [Obsolete("Use ConnectionString")] public string Item1 { get { return ConnectionString; } } [Obsolete("Use ProviderName")] public string Item2 { get { return ProviderName; } } } }
 using System; using System.Data.Common; namespace Serenity.Data { public class ConnectionStringInfo { public ConnectionStringInfo(string connectionString, string providerName, DbProviderFactory providerFactory) { this.ConnectionString = connectionString; this.ProviderName = providerName; this.ProviderFactory = providerFactory; } public string ConnectionString { get; private set; } public string ProviderName { get; private set; } public DbProviderFactory ProviderFactory { get; private set; } [Obsolete("Use ConnectionString")] public string Item1 { get { return ConnectionString; } } [Obsolete("Use ProviderName")] public string Item2 { get { return ProviderName; } } } }
mit
C#
213bd6f4540e9844fd9503c2635cd9a3f00ceb0b
Implement extracting the property name
Rhaeo/Rhaeo.Mvvm
Sources/Rhaeo.Mvvm/Rhaeo.Mvvm/ObservableObject.cs
Sources/Rhaeo.Mvvm/Rhaeo.Mvvm/ObservableObject.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="ObservableObject.cs" company="Rhaeo"> // Licenced under the MIT licence. // </copyright> // <summary> // Defines the ObservableObject type. // </summary> // -------------------------------------------------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Linq.Expressions; namespace Rhaeo.Mvvm { /// <summary> /// Serves as a back class for object instances obserable through the <see cref="INotifyPropertyChanged"/> interface. /// </summary> public class ObservableObject : INotifyPropertyChanged { #region Events /// <summary> /// Occurs when a property value changes. /// </summary> public event PropertyChangedEventHandler PropertyChanged; #endregion #region Methods /// <summary> /// Raises the <see cref="PropertyChanged"/> event with a property name extracted from the property expression. /// </summary> /// <typeparam name="TViewModel"> /// The view model type. /// </typeparam> /// <typeparam name="TValue"> /// The property value type. /// </typeparam> /// <param name="propertyExpression"> /// The property expression. /// </param> protected void RaisePropertyChanged<TViewModel, TValue>(Expression<Func<TViewModel, TValue>> propertyExpression) where TViewModel : ObservableObject { var propertyName = (propertyExpression.Body as MemberExpression).Member.Name; var propertyChangedHandler = this.PropertyChanged; if (propertyChangedHandler != null) { propertyChangedHandler(this, new PropertyChangedEventArgs(propertyName)); } } #endregion } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Rhaeo.Mvvm { public class ObservableObject { } }
mit
C#
4c4fbb26fb8223d572727771fc17f70c65a0a68c
Update PlexDirHelper.cs
cjmurph/PmsService,cjmurph/PmsService
PlexServiceCommon/PlexDirHelper.cs
PlexServiceCommon/PlexDirHelper.cs
using System; using System.IO; using Microsoft.Win32; namespace PlexServiceCommon { public static class PlexDirHelper { /// <summary> /// Returns the full path and filename of the plex media server executable /// </summary> /// <returns></returns> public static string GetPlexDataDir() { var result = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var path = Path.Combine(result, "Plex Media Server"); if (Directory.Exists(path)) { return path; } result = String.Empty; var is64Bit = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")); var architecture = is64Bit ? RegistryView.Registry64 : RegistryView.Registry32; using var pmsDataKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, architecture) .OpenSubKey(@"Software\Plex, Inc.\Plex Media Server"); if (pmsDataKey == null) { return result; } path = (string) pmsDataKey.GetValue("LocalAppdataPath"); result = path; return result; } } }
using System; using System.IO; using Microsoft.Win32; namespace PlexServiceCommon { public static class PlexDirHelper { /// <summary> /// Returns the full path and filename of the plex media server executable /// </summary> /// <returns></returns> public static string GetPlexDataDir() { var result = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var path = Path.Combine(result, "Plex Media Server"); if (Directory.Exists(path)) { return path; } result = String.Empty; var is64Bit = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")); var architecture = RegistryView.Registry32; if (is64Bit) { architecture = RegistryView.Registry64; } using var pmsDataKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, architecture) .OpenSubKey(@"Software\Plex, Inc.\Plex Media Server"); if (pmsDataKey == null) { return result; } path = (string) pmsDataKey.GetValue("LocalAppdataPath"); result = path; return result; } } }
mit
C#
7692a31d4a329eaa0c6256b21307ab9a37f45041
Build and print the trie
Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews
ProgrammingPraxis/red_squiggles.cs
ProgrammingPraxis/red_squiggles.cs
// https://www.reddit.com/r/dailyprogrammer/comments/3n55f3/20150930_challenge_234_intermediate_red_squiggles/ // // Your challenge today is to implement a real time spell checker and indicate where you would throw the red squiggle. For your dictionary use /usr/share/dict/words // using System; using System.Collections.Generic; using System.IO; using System.Linq; class Trie { private class Node { internal Dictionary<char, Node> Next = new Dictionary<char, Node>(); internal bool IsWord = false; public override String ToString() { return String.Format("[Node.IsWord:{0} {1}]", IsWord, String.Join(", ", Next.Select(x => String.Format("{0} => {1}", x.Key, x.Value.ToString())))); } } private readonly Node Root = new Node(); public void Add(String s) { Node current = Root; for (int i = 0; i < s.Length; i++) { Node next; if (!current.Next.TryGetValue(s[i], out next)) { next = new Node(); current.Next[s[i]] = next; } next.IsWord = i == s.Length - 1; current = next; } } public override String ToString() { return Root.ToString(); } } class Program { static void Main() { Trie trie = new Trie(); using (StreamReader reader = new StreamReader("/usr/share/dict/words")) { String line; while ((line = reader.ReadLine()) != null) { trie.Add(line); } } Console.WriteLine(trie); } }
// https://www.reddit.com/r/dailyprogrammer/comments/3n55f3/20150930_challenge_234_intermediate_red_squiggles/ // // Your challenge today is to implement a real time spell checker and indicate where you would throw the red squiggle. For your dictionary use /usr/share/dict/words // using System; using System.Collections.Generic; using System.IO; using System.Linq; class Trie { private class Node { internal Dictionary<char, Node> Next = new Dictionary<char, Node>(); bool IsWord = false; } } class Program { static void Main() { Trie trie = new Trie(); using (StreamReader reader = new StreamReader("/usr/share/dict/words")) { String line; while ((line = reader.ReadLine()) != null) { Console.WriteLine(line); } } } }
mit
C#
50c7d32ed796b7b60495caf1f4e719bac85272c3
Bump to 1.4.1
i3at/ArchiSteamFarm,JustArchi/ArchiSteamFarm,KlappPc/ArchiSteamFarm,blackpanther989/ArchiSteamFarm,JustArchi/ArchiSteamFarm,i3at/ArchiSteamFarm,KlappPc/ArchiSteamFarm,JustArchi/ArchiSteamFarm,blackpanther989/ArchiSteamFarm,KlappPc/ArchiSteamFarm,JustArchi/ArchiSteamFarm
ArchiSteamFarm/Properties/AssemblyInfo.cs
ArchiSteamFarm/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("ArchiSteamFarm")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ArchiSteamFarm")] [assembly: AssemblyCopyright("Copyright © Łukasz Domeradzki 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("35af7887-08b9-40e8-a5ea-797d8b60b30c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.1.0")] [assembly: AssemblyFileVersion("1.4.1.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ArchiSteamFarm")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ArchiSteamFarm")] [assembly: AssemblyCopyright("Copyright © Łukasz Domeradzki 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("35af7887-08b9-40e8-a5ea-797d8b60b30c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.0.0")] [assembly: AssemblyFileVersion("1.4.0.0")]
apache-2.0
C#
7b2e1a67bf41efb9deb6a18b0b8c613b811a24c7
Check for missing logger config.
winnitron/WinnitronLauncher,winnitron/WinnitronLauncher
Assets/Scripts/System/LogOutputHandler.cs
Assets/Scripts/System/LogOutputHandler.cs
// https://github.com/CharmedMatter/UnityEngine_Log_to_Loggly using UnityEngine; using System.Collections; public class LogOutputHandler : MonoBehaviour { // Create a string to store log level in string level = ""; // Register the HandleLog function on scene start to fire on debug.log events public void OnEnable() { Application.logMessageReceived += HandleLog; } // Remove callback when object goes out of scope public void OnDisable() { Application.logMessageReceived -= HandleLog; } // Capture debug.log output, send logs to Loggly public void HandleLog(string logString, string stackTrace, LogType type) { // Initialize WWWForm and store log level as a string level = type.ToString(); var loggingForm = new WWWForm(); // Add log message to WWWForm loggingForm.AddField("LEVEL", level); loggingForm.AddField("Message", logString); loggingForm.AddField("Stack_Trace", stackTrace); loggingForm.AddField("API_Key", GM.options.GetSyncSettings()["apiKey"]); // Add any User, Game, or Device MetaData that would be useful to finding issues later loggingForm.AddField("Device_Model", SystemInfo.deviceModel); StartCoroutine(SendData(loggingForm)); } public IEnumerator SendData(WWWForm form) { if (GM.options.logger != null) { string token = GM.options.logger["token"]; string url = "http://logs-01.loggly.com/inputs/" + token; // Send WWW Form to Loggly, replace TOKEN with your unique ID from Loggly WWW sendLog = new WWW(url, form); yield return sendLog; } } }
// https://github.com/CharmedMatter/UnityEngine_Log_to_Loggly using UnityEngine; using System.Collections; public class LogOutputHandler : MonoBehaviour { // Create a string to store log level in string level = ""; // Register the HandleLog function on scene start to fire on debug.log events public void OnEnable() { Application.logMessageReceived += HandleLog; } // Remove callback when object goes out of scope public void OnDisable() { Application.logMessageReceived -= HandleLog; } // Capture debug.log output, send logs to Loggly public void HandleLog(string logString, string stackTrace, LogType type) { // Initialize WWWForm and store log level as a string level = type.ToString(); var loggingForm = new WWWForm(); // Add log message to WWWForm loggingForm.AddField("LEVEL", level); loggingForm.AddField("Message", logString); loggingForm.AddField("Stack_Trace", stackTrace); loggingForm.AddField("API_Key", GM.options.GetSyncSettings()["apiKey"]); // Add any User, Game, or Device MetaData that would be useful to finding issues later loggingForm.AddField("Device_Model", SystemInfo.deviceModel); StartCoroutine(SendData(loggingForm)); } public IEnumerator SendData(WWWForm form) { string token = GM.options.logger["token"]; string url = "http://logs-01.loggly.com/inputs/" + token; // Send WWW Form to Loggly, replace TOKEN with your unique ID from Loggly WWW sendLog = new WWW(url, form); yield return sendLog; } }
mit
C#
699dc071ff11c9dabe5b3e8a45bc0f6f2e86f268
Fix AssemblyInfo.cs
martijn00/MvvmCross-Plugins,lothrop/MvvmCross-Plugins,Didux/MvvmCross-Plugins,MatthewSannes/MvvmCross-Plugins
Cirrious/ThreadUtils/Cirrious.MvvmCross.Plugins.ThreadUtils.Wpf/Properties/AssemblyInfo.cs
Cirrious/ThreadUtils/Cirrious.MvvmCross.Plugins.ThreadUtils.Wpf/Properties/AssemblyInfo.cs
// AssemblyInfo.cs // (c) Copyright Cirrious Ltd. http://www.cirrious.com // MvvmCross is licensed using Microsoft Public License (Ms-PL) // Contributions and inspirations noted in readme.md and license.txt // // Project Lead - Stuart Lodge, @slodge, me@slodge.com 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("Cirrious.MvvmCross.Plugins.ThreadUtils.Wpf")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Cirrious.MvvmCross.Plugins.ThreadUtils.Wpf")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 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("Cirrious.MvvmCross.Plugins.ThreadUtils.Wpf")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Cirrious.MvvmCross.Plugins.ThreadUtils.Wpf")] [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("beb48dbf-e252-4462-9a04-8e2ae05f04f0")] // 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#
7a3b5f051f02e2e0689df3232ffac5b76f6d986b
Make ThreadSafeObjectPool actually thread safe
AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia
src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs
src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs
using System.Collections.Generic; namespace Avalonia.Threading { public class ThreadSafeObjectPool<T> where T : class, new() { private Stack<T> _stack = new Stack<T>(); public static ThreadSafeObjectPool<T> Default { get; } = new ThreadSafeObjectPool<T>(); public T Get() { lock (_lock) { if(_stack.Count == 0) return new T(); return _stack.Pop(); } } public void Return(T obj) { lock (_lock) { _stack.Push(obj); } } } }
using System.Collections.Generic; namespace Avalonia.Threading { public class ThreadSafeObjectPool<T> where T : class, new() { private Stack<T> _stack = new Stack<T>(); private object _lock = new object(); public static ThreadSafeObjectPool<T> Default { get; } = new ThreadSafeObjectPool<T>(); public T Get() { lock (_lock) { if(_stack.Count == 0) return new T(); return _stack.Pop(); } } public void Return(T obj) { lock (_stack) { _stack.Push(obj); } } } }
mit
C#
5b14826071ca6a42e3fbd2e00f675bdd99271e7e
remove destination_path
mikymod/crown,taylor001/crown,mikymod/crown,mikymod/crown,galek/crown,galek/crown,taylor001/crown,taylor001/crown,dbartolini/crown,galek/crown,dbartolini/crown,galek/crown,dbartolini/crown,taylor001/crown,mikymod/crown,dbartolini/crown
tools/gui/starter/ProjectDialog.cs
tools/gui/starter/ProjectDialog.cs
using System; using Gtk; namespace starter { public partial class ProjectDialog : Gtk.Dialog { MainWindow win; public ProjectDialog (MainWindow win) { this.Build (); this.win = win; } protected void OnProjectDialogOkClicked (object sender, EventArgs e) { win.project_name = name_entry.Text; win.source_path = source_entry.Text; // win.destination_path = destination_entry.Text; } protected void OnSourceButtonClicked (object sender, EventArgs e) { Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the file to open", this.win, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); if (fc.Run () == (int)ResponseType.Accept) { source_entry.Text = fc.Filename; } fc.Destroy (); } /* protected void OnDestinationButtonClicked (object sender, EventArgs e) { Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the file to open", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); if (fc.Run () == (int)ResponseType.Accept) { destination_entry.Text = fc.Filename; } fc.Destroy (); } */ } }
using System; using Gtk; namespace starter { public partial class ProjectDialog : Gtk.Dialog { MainWindow win; public ProjectDialog (MainWindow win) { this.Build (); this.win = win; } protected void OnProjectDialogOkClicked (object sender, EventArgs e) { win.project_name = name_entry.Text; win.source_path = source_entry.Text; win.destination_path = destination_entry.Text; } protected void OnSourceButtonClicked (object sender, EventArgs e) { Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the file to open", this.win, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); if (fc.Run () == (int)ResponseType.Accept) { source_entry.Text = fc.Filename; } fc.Destroy (); } protected void OnDestinationButtonClicked (object sender, EventArgs e) { Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the file to open", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); if (fc.Run () == (int)ResponseType.Accept) { destination_entry.Text = fc.Filename; } fc.Destroy (); } } }
mit
C#
5a70a677c9f45489de8cf18cb4c6835b0db67e8d
Update InterfaceUrl.cs
rongcloud/server-sdk-dotnet,p3p3pp3/server-sdk-dotnet-async
RongCloudServerSDK/InterfaceUrl.cs
RongCloudServerSDK/InterfaceUrl.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace io.rong { class InterfaceUrl { public static String server_addr = "http://api.cn.ronghub.com"; public static String getTokenUrl = server_addr+"/user/getToken.json"; public static String joinGroupUrl = server_addr + "/group/join.json"; public static String quitGroupUrl = server_addr + "/group/quit.json"; public static String dismissUrl = server_addr + "/group/dismiss.json"; public static String syncGroupUrl = server_addr + "/group/sync.json"; public static String sendMsgUrl = server_addr + "/message/publish.json"; public static String broadcastUrl = server_addr + "/message/broadcast.json"; public static String createChatroomUrl = server_addr + "/chatroom/create.json"; public static String destroyChatroomUrl = server_addr + "/chatroom/destroy.json"; public static String queryChatroomUrl = server_addr + "/chatroom/query.json"; //public static String getTokenUrl = server_addr + "/user/getToken.xml"; //public static String joinGroupUrl = server_addr + "/group/join.xml"; //public static String quitGroupUrl = server_addr + "/group/quit.xml"; //public static String dismissUrl = server_addr + "/group/dismiss.xml"; //public static String syncGroupUrl = server_addr + "/group/sync.xml"; //public static String SendMsgUrl = server_addr + "/message/publish.xml"; //public static String broadcastUrl = server_addr + "/message/broadcast.xml"; //public static String createChatroomUrl = server_addr + "/chatroom/create.xml"; //public static String destroyChatroomUrl = server_addr + "/chatroom/destroy.xml"; //public static String queryChatroomUrl = server_addr + "/chatroom/query.xml"; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace io.rong { class InterfaceUrl { public static String server_addr = "https://api.cn.ronghub.com"; public static String getTokenUrl = server_addr+"/user/getToken.json"; public static String joinGroupUrl = server_addr + "/group/join.json"; public static String quitGroupUrl = server_addr + "/group/quit.json"; public static String dismissUrl = server_addr + "/group/dismiss.json"; public static String syncGroupUrl = server_addr + "/group/sync.json"; public static String sendMsgUrl = server_addr + "/message/publish.json"; public static String broadcastUrl = server_addr + "/message/broadcast.json"; public static String createChatroomUrl = server_addr + "/chatroom/create.json"; public static String destroyChatroomUrl = server_addr + "/chatroom/destroy.json"; public static String queryChatroomUrl = server_addr + "/chatroom/query.json"; //public static String getTokenUrl = server_addr + "/user/getToken.xml"; //public static String joinGroupUrl = server_addr + "/group/join.xml"; //public static String quitGroupUrl = server_addr + "/group/quit.xml"; //public static String dismissUrl = server_addr + "/group/dismiss.xml"; //public static String syncGroupUrl = server_addr + "/group/sync.xml"; //public static String SendMsgUrl = server_addr + "/message/publish.xml"; //public static String broadcastUrl = server_addr + "/message/broadcast.xml"; //public static String createChatroomUrl = server_addr + "/chatroom/create.xml"; //public static String destroyChatroomUrl = server_addr + "/chatroom/destroy.xml"; //public static String queryChatroomUrl = server_addr + "/chatroom/query.xml"; } }
mit
C#
e1cce88ae5d587b3bd625e4e812e66259b379a19
Allow rotating the screen without crashing by overriding the Configuration changes.
ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework
SampleGame.Android/MainActivity.cs
SampleGame.Android/MainActivity.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using Android.App; using Android.OS; using Android.Content.PM; using Android.Views; using System; using Android.Runtime; using Android.Content.Res; namespace SampleGame.Android { [Activity(Label = "SampleGame", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, MainLauncher = true, Theme = "@android:style/Theme.NoTitleBar")] public class MainActivity : Activity { private SampleGameView sampleGameView; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Window.AddFlags(WindowManagerFlags.Fullscreen); Window.AddFlags(WindowManagerFlags.KeepScreenOn); SetContentView(sampleGameView = new SampleGameView(this)); } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using Android.App; using Android.OS; using Android.Content.PM; using Android.Views; namespace SampleGame.Android { [Activity(Label = "SampleGame", MainLauncher = true, ScreenOrientation = ScreenOrientation.Landscape, Theme = "@android:style/Theme.NoTitleBar")] public class MainActivity : Activity { protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Window.AddFlags(WindowManagerFlags.Fullscreen); Window.AddFlags(WindowManagerFlags.KeepScreenOn); SetContentView(new SampleGameView(this)); } } }
mit
C#
c1f416b1ccb6cea656d90c128c120048d9619a81
Add back missing rethrow
peppy/osu,ZLima12/osu,smoogipoo/osu,DrabWeb/osu,naoey/osu,peppy/osu,2yangk23/osu,naoey/osu,ZLima12/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,naoey/osu,DrabWeb/osu,smoogipoo/osu,johnneijzen/osu,NeoAdonis/osu,ppy/osu,EVAST9919/osu,UselessToucan/osu,UselessToucan/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu-new,DrabWeb/osu,2yangk23/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,EVAST9919/osu,ppy/osu
osu.Game/Database/DatabaseWriteUsage.cs
osu.Game/Database/DatabaseWriteUsage.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; namespace osu.Game.Database { public class DatabaseWriteUsage : IDisposable { public readonly OsuDbContext Context; private readonly Action<DatabaseWriteUsage> usageCompleted; public DatabaseWriteUsage(OsuDbContext context, Action<DatabaseWriteUsage> onCompleted) { Context = context; usageCompleted = onCompleted; } public bool PerformedWrite { get; private set; } private bool isDisposed; public List<Exception> Errors = new List<Exception>(); /// <summary> /// Whether this write usage will commit a transaction on completion. /// If false, there is a parent usage responsible for transaction commit. /// </summary> public bool IsTransactionLeader = false; protected void Dispose(bool disposing) { if (isDisposed) return; isDisposed = true; try { PerformedWrite |= Context.SaveChanges() > 0; } catch (Exception e) { Errors.Add(e); throw; } finally { usageCompleted?.Invoke(this); } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } ~DatabaseWriteUsage() { Dispose(false); } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; namespace osu.Game.Database { public class DatabaseWriteUsage : IDisposable { public readonly OsuDbContext Context; private readonly Action<DatabaseWriteUsage> usageCompleted; public DatabaseWriteUsage(OsuDbContext context, Action<DatabaseWriteUsage> onCompleted) { Context = context; usageCompleted = onCompleted; } public bool PerformedWrite { get; private set; } private bool isDisposed; public List<Exception> Errors = new List<Exception>(); /// <summary> /// Whether this write usage will commit a transaction on completion. /// If false, there is a parent usage responsible for transaction commit. /// </summary> public bool IsTransactionLeader = false; protected void Dispose(bool disposing) { if (isDisposed) return; isDisposed = true; try { PerformedWrite |= Context.SaveChanges() > 0; } catch (Exception e) { Errors.Add(e); } finally { usageCompleted?.Invoke(this); } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } ~DatabaseWriteUsage() { Dispose(false); } } }
mit
C#
c2cd9d22bc54aaa8771a66e21f5203a4494ca112
add summary to IAbpPerRequestRedisCacheManager
aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,luchaoshuai/aspnetboilerplate
src/Abp.AspNetCore.PerRequestRedisCache/Runtime/Caching/Redis/IAbpPerRequestRedisCacheManager.cs
src/Abp.AspNetCore.PerRequestRedisCache/Runtime/Caching/Redis/IAbpPerRequestRedisCacheManager.cs
namespace Abp.Runtime.Caching.Redis { /// <summary> /// An upper level container for <see cref="ICache"/> objects. /// <para> /// ICache objects requested from <see cref="IAbpPerRequestRedisCacheManager"/> stores redis caches per http context. And it does not try to pull it again from redis during the http context. /// It should not be used if the changes on this data in one instance of the project can causes an error in the other instance of the project. /// It is only recommended to use it in cases that you know cache will never be changed until current http context is done or it is not an important value. (for example some ui view settings etc.) /// Otherwise use <see cref="ICacheManager"/> /// </para> /// A cache manager should work as Singleton and track and manage <see cref="ICache"/> objects. /// </summary> public interface IAbpPerRequestRedisCacheManager : ICacheManager { } }
namespace Abp.Runtime.Caching.Redis { public interface IAbpPerRequestRedisCacheManager : ICacheManager { } }
mit
C#
5b8caab38f39b4dea017ac8e918f4e29bcef0de8
fix number parsing for decimal and scientific notations
maul-esel/CobaltAHK,maul-esel/CobaltAHK
CobaltAHK/Expressions/Literals.cs
CobaltAHK/Expressions/Literals.cs
using System.Collections.Generic; using System.Globalization; namespace CobaltAHK.Expressions { public abstract class ValueLiteralExpression : ValueExpression { protected ValueLiteralExpression(SourcePosition pos) : base(pos) { } } public class StringLiteralExpression : ValueLiteralExpression { public StringLiteralExpression(SourcePosition pos, string val) : base(pos) { str = val; } private readonly string str; public string String { get { return str; } } } public class NumberLiteralExpression : ValueLiteralExpression { public NumberLiteralExpression(SourcePosition pos, string val, Syntax.NumberType type) : base(pos) { strVal = val; numType = type; } private readonly string strVal; private readonly Syntax.NumberType numType; public object GetValue() { switch (numType) { case Syntax.NumberType.Integer: return uint.Parse(strVal); case Syntax.NumberType.Hexadecimal: return uint.Parse(strVal.Substring(2), NumberStyles.AllowHexSpecifier); case Syntax.NumberType.Decimal: return double.Parse(strVal, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture.NumberFormat); case Syntax.NumberType.Scientific: return double.Parse(strVal, NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent, CultureInfo.InvariantCulture.NumberFormat); } throw new System.Exception(); // todo } } public class ObjectLiteralExpression : ValueLiteralExpression { public ObjectLiteralExpression(SourcePosition pos, IDictionary<ValueExpression, ValueExpression> obj) : base(pos) { dict = obj; } private readonly IDictionary<ValueExpression, ValueExpression> dict; public IDictionary<ValueExpression, ValueExpression> Dictionary { get { return dict; } } } public class ArrayLiteralExpression : ValueLiteralExpression { public ArrayLiteralExpression(SourcePosition pos, IEnumerable<ValueExpression> arr) : base(pos) { list = arr; } private readonly IEnumerable<ValueExpression> list; public IEnumerable<ValueExpression> List { get { return list; } } } }
using System.Collections.Generic; using System.Globalization; namespace CobaltAHK.Expressions { public abstract class ValueLiteralExpression : ValueExpression { protected ValueLiteralExpression(SourcePosition pos) : base(pos) { } } public class StringLiteralExpression : ValueLiteralExpression { public StringLiteralExpression(SourcePosition pos, string val) : base(pos) { str = val; } private readonly string str; public string String { get { return str; } } } public class NumberLiteralExpression : ValueLiteralExpression { public NumberLiteralExpression(SourcePosition pos, string val, Syntax.NumberType type) : base(pos) { strVal = val; numType = type; } private readonly string strVal; private readonly Syntax.NumberType numType; public object GetValue() { switch (numType) { case Syntax.NumberType.Integer: return uint.Parse(strVal); case Syntax.NumberType.Hexadecimal: return uint.Parse(strVal.Substring(2), NumberStyles.AllowHexSpecifier); case Syntax.NumberType.Decimal: return double.Parse(strVal, NumberStyles.AllowDecimalPoint); case Syntax.NumberType.Scientific: return double.Parse(strVal, NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent); } throw new System.Exception(); // todo } } public class ObjectLiteralExpression : ValueLiteralExpression { public ObjectLiteralExpression(SourcePosition pos, IDictionary<ValueExpression, ValueExpression> obj) : base(pos) { dict = obj; } private readonly IDictionary<ValueExpression, ValueExpression> dict; public IDictionary<ValueExpression, ValueExpression> Dictionary { get { return dict; } } } public class ArrayLiteralExpression : ValueLiteralExpression { public ArrayLiteralExpression(SourcePosition pos, IEnumerable<ValueExpression> arr) : base(pos) { list = arr; } private readonly IEnumerable<ValueExpression> list; public IEnumerable<ValueExpression> List { get { return list; } } } }
mit
C#
b856f4410297d81ebdca9888cbcf3fcb79f2588c
Fix #1268333 - Increase the selection handle size and tolerance.
PintaProject/Pinta,Mailaender/Pinta,PintaProject/Pinta,jakeclawson/Pinta,Fenex/Pinta,Mailaender/Pinta,jakeclawson/Pinta,PintaProject/Pinta,Fenex/Pinta
Pinta.Tools/Tools/ToolControl/ToolControl.cs
Pinta.Tools/Tools/ToolControl/ToolControl.cs
// // ToolControl.cs // // Author: // Olivier Dufour <olivier.duff@gmail.com> // // Copyright (c) 2011 Olivier Dufour // // 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 Cairo; using Gdk; using Pinta.Core; namespace Pinta.Tools { public class ToolControl { public ToolControl (MouseHandler moveAction) { this.action = moveAction; Position = new PointD (-5, -5); } private const int Size = 6; private const int Tolerance = 10; public static readonly Cairo.Color FillColor = new Cairo.Color (0, 0, 1, 0.5); public static readonly Cairo.Color StrokeColor = new Cairo.Color (0, 0, 1, 0.7); private MouseHandler action; public PointD Position {get; set;} public bool IsInside (PointD point) { return (Math.Abs (point.X - Position.X) <= Tolerance) && (Math.Abs (point.Y - Position.Y) <= Tolerance); } public void HandleMouseMove (double x, double y, Gdk.ModifierType state) { action (x, y, state); } public void Render (Layer layer) { double scale_factor = (1.0 / PintaCore.Workspace.ActiveWorkspace.Scale); using (Context g = new Context (layer.Surface)) { var rect = new Cairo.Rectangle (Position.X - scale_factor * Size / 2, Position.Y - scale_factor * Size / 2, scale_factor * Size, scale_factor * Size); g.FillStrokedRectangle (rect, FillColor, StrokeColor, 1); } } } }
// // ToolControl.cs // // Author: // Olivier Dufour <olivier.duff@gmail.com> // // Copyright (c) 2011 Olivier Dufour // // 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 Cairo; using Gdk; using Pinta.Core; namespace Pinta.Tools { public class ToolControl { public ToolControl (MouseHandler moveAction) { this.action = moveAction; Position = new PointD (-5, -5); } private const int Tolerance = 3; public static readonly Cairo.Color FillColor = new Cairo.Color (0, 0, 1, 0.5); public static readonly Cairo.Color StrokeColor = new Cairo.Color (0, 0, 1, 0.7); private MouseHandler action; public PointD Position {get; set;} public bool IsInside (PointD point) { return (Math.Abs (point.X - Position.X) <= Tolerance) && (Math.Abs (point.Y - Position.Y) <= Tolerance); } public void HandleMouseMove (double x, double y, Gdk.ModifierType state) { action (x, y, state); } public void Render (Layer layer) { double scale_factor = (1.0 / PintaCore.Workspace.ActiveWorkspace.Scale); using (Context g = new Context (layer.Surface)) { var rect = new Cairo.Rectangle (Position.X - scale_factor * 2, Position.Y - scale_factor * 2, scale_factor * 4, scale_factor * 4); g.FillStrokedRectangle (rect, FillColor, StrokeColor, 1); } } } }
mit
C#
67dcf4f9cf4402946162ce48a7f7fae50d11df1a
Remove Nts reference from Mapsui.Samples.iOS
charlenni/Mapsui,charlenni/Mapsui
Samples/Mapsui.Samples.iOS/ViewController.cs
Samples/Mapsui.Samples.iOS/ViewController.cs
using System; using System.Diagnostics; using System.IO; using System.Text; using Mapsui.UI.iOS; using UIKit; using CoreGraphics; using Mapsui.UI; using Mapsui.Samples.Common.Helpers; using Mapsui.Samples.Common.Maps; namespace Mapsui.Samples.iOS { public partial class ViewController : UIViewController { public ViewController(IntPtr handle) : base(handle) { } public override void ViewDidLoad() { base.ViewDidLoad(); // Hack to tell the platform independent samples where the files can be found on iOS. MbTilesSample.MbTilesLocation = MbTilesLocationOnIos; // Never tested this. PDD. MbTilesHelper.DeployMbTilesFile(s => File.Create(Path.Combine(MbTilesLocationOnIos, s))); var mapControl = CreateMap(View!.Bounds); mapControl.Info += MapOnInfo; View = mapControl; } private void MapOnInfo(object sender, MapInfoEventArgs e) { if (e.MapInfo?.Feature == null) return; Debug.WriteLine(ToString(e.MapInfo.Feature)); } private string ToString(IFeature feature) { var result = new StringBuilder(); foreach (var field in feature.Fields) { result.Append($"{field}={feature[field]}, "); } return result.ToString(); } private static MapControl CreateMap(CGRect bounds) { return new MapControl(bounds) { Map = InfoLayersSample.CreateMap(), UnSnapRotationDegrees = 30, ReSnapRotationDegrees = 5 }; } private static string MbTilesLocationOnIos => Environment.GetFolderPath(Environment.SpecialFolder.Personal); } }
using System; using System.Diagnostics; using System.IO; using System.Text; using Mapsui.UI.iOS; using UIKit; using CoreGraphics; using Mapsui.UI; using Mapsui.Samples.Common.Helpers; using Mapsui.Samples.Common.Maps; using Mapsui.Nts; namespace Mapsui.Samples.iOS { public partial class ViewController : UIViewController { public ViewController(IntPtr handle) : base(handle) { } public override void ViewDidLoad() { base.ViewDidLoad(); // Hack to tell the platform independent samples where the files can be found on iOS. MbTilesSample.MbTilesLocation = MbTilesLocationOnIos; // Never tested this. PDD. MbTilesHelper.DeployMbTilesFile(s => File.Create(Path.Combine(MbTilesLocationOnIos, s))); var mapControl = CreateMap(View!.Bounds); mapControl.Info += MapOnInfo; View = mapControl; } private void MapOnInfo(object sender, MapInfoEventArgs e) { if (e.MapInfo?.Feature == null) return; Debug.WriteLine(ToString(e.MapInfo.Feature)); } private string ToString(IFeature feature) { var result = new StringBuilder(); foreach (var field in feature.Fields) { result.Append($"{field}={feature[field]}, "); } if (feature is GeometryFeature geometryFeature) result.Append($"Geometry={geometryFeature.Geometry}"); return result.ToString(); } private static MapControl CreateMap(CGRect bounds) { return new MapControl(bounds) { Map = InfoLayersSample.CreateMap(), UnSnapRotationDegrees = 30, ReSnapRotationDegrees = 5 }; } private static string MbTilesLocationOnIos => Environment.GetFolderPath(Environment.SpecialFolder.Personal); } }
mit
C#
739d6a52cce9cbc07698e51137218ad09a28a746
fix namespace
RapidScada/scada,RapidScada/scada,RapidScada/scada,RapidScada/scada
ScadaComm/ScadaComm/ScadaCommMono/Program.cs
ScadaComm/ScadaComm/ScadaCommMono/Program.cs
/* * Copyright 2015 Mikhail Shiryaev * * 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. * * * Product : Rapid SCADA * Module : SCADA-Communicator Console Application for Mono .NET framework * Summary : The main entry point for the application * * Author : Mikhail Shiryaev * Created : 2015 * Modified : 2015 */ using Scada.Comm.Engine; using System; using System.IO; using System.Threading; namespace Scada.Comm.Mono { /// <summary> /// The main entry point for the application. /// </summary> class Program { static void Main(string[] args) { // запуск службы Console.WriteLine("Starting SCADA-Communicator..."); Manager manager = new Manager(); manager.StartService(); Console.WriteLine("SCADA-Communicator is started"); Console.WriteLine("Press 'x' or create 'commstop' file to stop SCADA-Communicator"); // остановка службы при нажатии 'x' или обнаружении файла остановки FileListener stopFileListener = new FileListener("Cmd" + Path.DirectorySeparatorChar + "commstop"); while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.X || stopFileListener.FileFound)) Thread.Sleep(ScadaUtils.ThreadDelay); manager.StopService(); stopFileListener.DeleteFile(); stopFileListener.Abort(); Console.WriteLine("SCADA-Communicator is stopped"); } } }
/* * Copyright 2015 Mikhail Shiryaev * * 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. * * * Product : Rapid SCADA * Module : SCADA-Communicator Console Application for Mono .NET framework * Summary : The main entry point for the application * * Author : Mikhail Shiryaev * Created : 2015 * Modified : 2015 */ using Scada.Comm.Engine; using System; using System.IO; using System.Threading; namespace Scada.Server.Mono { /// <summary> /// The main entry point for the application. /// </summary> class Program { static void Main(string[] args) { // запуск службы Console.WriteLine("Starting SCADA-Communicator..."); Manager manager = new Manager(); manager.StartService(); Console.WriteLine("SCADA-Communicator is started"); Console.WriteLine("Press 'x' or create 'commstop' file to stop SCADA-Communicator"); // остановка службы при нажатии 'x' или обнаружении файла остановки FileListener stopFileListener = new FileListener("Cmd" + Path.DirectorySeparatorChar + "commstop"); while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.X || stopFileListener.FileFound)) Thread.Sleep(ScadaUtils.ThreadDelay); manager.StopService(); stopFileListener.DeleteFile(); stopFileListener.Abort(); Console.WriteLine("SCADA-Communicator is stopped"); } } }
apache-2.0
C#
733aed7afbdaff5c79b226f73c8b9ecb71fdeb97
Fix #24: Only subscribe to Invalid URI messages once
IrvingtonProgramming/InteractApp,IrvingtonProgramming/InteractApp,IrvingtonProgramming/InteractApp
InteractApp/EventInfoPage.xaml.cs
InteractApp/EventInfoPage.xaml.cs
using Xamarin.Forms; using Android.Support.Design.Widget; using Java.Security.Cert; namespace InteractApp { public partial class EventInfoPage : ContentPage { private static bool _subscribed = false; readonly EventInfoPageViewModel _viewModel; public EventInfoPageViewModel ViewModel { get { return _viewModel; } } public EventInfoPage (Event evt) { InitializeComponent (); _viewModel = new EventInfoPageViewModel (evt); BindingContext = _viewModel; ToolbarItems.Add (new ToolbarItem { Text = "RSVP", Order = ToolbarItemOrder.Primary, Command = new Command (ViewModel.RSVP), }); if (!_subscribed) { MessagingCenter.Subscribe<EventInfoPageViewModel> (this, "Invalid URI", (sender) => { DisplayAlert ("Oops", "Invalid URI. Either you can't RSVP to this, or we screwed up. If you believe we screwed up, please contact Interact.", "YESSIR"); }); _subscribed = true; } } } }
using Xamarin.Forms; namespace InteractApp { public partial class EventInfoPage : ContentPage { readonly EventInfoPageViewModel _viewModel; public EventInfoPageViewModel ViewModel { get { return _viewModel; } } public EventInfoPage (Event evt) { InitializeComponent (); _viewModel = new EventInfoPageViewModel (evt); BindingContext = _viewModel; ToolbarItems.Add (new ToolbarItem { Text = "RSVP", Order = ToolbarItemOrder.Primary, Command = new Command (ViewModel.RSVP), }); MessagingCenter.Subscribe<EventInfoPageViewModel> (this, "Invalid URI", (sender) => { DisplayAlert ("Oops", "Invalid URI. Either you can't RSVP to this, or we screwed up. If you believe we screwed up, please contact Interact.", "YESSIR"); }); } } }
mit
C#
a100f1a5fd7a220d0ac82389dd6582f1e046b642
Add a Stop method to timeout. Maybe it should be renamed though, since you cant restart it.
jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos,jacksonh/manos,jmptrader/manos,jacksonh/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,jmptrader/manos,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jmptrader/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy
src/Manos/Manos/Timeout.cs
src/Manos/Manos/Timeout.cs
// // Copyright (C) 2010 Jackson Harper (jackson@manosdemono.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 System; namespace Manos { /// <summary> /// Provides a mechanism for things to happen periodically within a ManosApp. /// Timeouts are gauranteed to happen at some moment on or after the TimeSpan specified has ellapsed. /// /// Timeouts will never run before the specified TimeSpan has ellapsed. /// /// Use the method <see cref="Manos.IO.IOLoop"/> "AddTimeout" method to register each Timeout. /// </summary> public class Timeout { internal TimeSpan begin; internal TimeSpan span; internal IRepeatBehavior repeat; internal object data; internal TimeoutCallback callback; private bool stopped; public Timeout (TimeSpan span, IRepeatBehavior repeat, object data, TimeoutCallback callback) : this (TimeSpan.Zero, span, repeat,data, callback) { } public Timeout (TimeSpan begin, TimeSpan span, IRepeatBehavior repeat, object data, TimeoutCallback callback) { this.begin = begin; this.span = span; this.repeat = repeat; this.data = data; this.callback = callback; } /// <summary> /// Causes the action specified in the constructor to be executed. Infrastructure. /// </summary> /// <param name="app"> /// A <see cref="ManosApp"/> /// </param> public void Run (ManosApp app) { if (stopped) return; try { callback (app, data); } catch (Exception e) { Console.Error.WriteLine ("Exception in timeout callback."); Console.Error.WriteLine (e); } repeat.RepeatPerformed (); } /// <summary> /// Stop the current timeout from further execution. Once a timeout is stopped it can not be restarted /// </summary> public void Stop () { stopped = true; } /// <summary> /// Inidicates that the IOLoop should retain this timeout, because it will be run again at some point in the future. Infrastructure. /// </summary> public bool ShouldContinueToRepeat () { return !stopped || repeat.ShouldContinueToRepeat (); } } }
// // Copyright (C) 2010 Jackson Harper (jackson@manosdemono.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 System; namespace Manos { /// <summary> /// Provides a mechanism for things to happen periodically within a ManosApp. /// Timeouts are gauranteed to happen at some moment on or after the TimeSpan specified has ellapsed. /// /// Timeouts will never run before the specified TimeSpan has ellapsed. /// /// Use the method <see cref="Manos.IO.IOLoop"/> "AddTimeout" method to register each Timeout. /// </summary> public class Timeout { internal TimeSpan begin; internal TimeSpan span; internal IRepeatBehavior repeat; internal object data; internal TimeoutCallback callback; public Timeout (TimeSpan span, IRepeatBehavior repeat, object data, TimeoutCallback callback) : this (TimeSpan.Zero, span, repeat,data, callback) { } public Timeout (TimeSpan begin, TimeSpan span, IRepeatBehavior repeat, object data, TimeoutCallback callback) { this.begin = begin; this.span = span; this.repeat = repeat; this.data = data; this.callback = callback; } /// <summary> /// Causes the action specified in the constructor to be executed. Infrastructure. /// </summary> /// <param name="app"> /// A <see cref="ManosApp"/> /// </param> public void Run (ManosApp app) { try { callback (app, data); } catch (Exception e) { Console.Error.WriteLine ("Exception in timeout callback."); Console.Error.WriteLine (e); } repeat.RepeatPerformed (); } /// <summary> /// Inidicates that the IOLoop should retain this timeout, because it will be run again at some point in the future. Infrastructure. /// </summary> public bool ShouldContinueToRepeat () { return repeat.ShouldContinueToRepeat (); } } }
mit
C#
23c145a03a68a06f5fcd529b9c9411f6098b9abd
Work on robot software - #13
henkmollema/MindstormR,henkmollema/MindstormR,henkmollema/MindstormR
src/MindstormR.EV3/Main.cs
src/MindstormR.EV3/Main.cs
using System; using System.Diagnostics; using MonoBrickFirmware; using MonoBrickFirmware.Display.Dialogs; using MonoBrickFirmware.Display; using MonoBrickFirmware.Movement; using System.Threading; using System.Net; namespace MonoBrickHelloWorld { class MainClass { private static int _id; public static void Main(string[] args) { try { const string baseUrl = "http://test.henkmollema.nl/robot/"; var sw = Stopwatch.StartNew(); var client = new WebClient(); string s = client.DownloadString(baseUrl + "login"); sw.Stop(); if (!int.TryParse(s, out _id)) { Info("Invalid ID from the webserver: '{0}'. ({1:n2}s)", true, "Error", s, sw.Elapsed.TotalSeconds); return; } Info("Robot logged in. ID: {0}. ({1:n2}s)", _id, sw.Elapsed.TotalSeconds); for (int i = 0; i < 5; i++) { sw.Restart(); string data = client.DownloadString(baseUrl + 1020 + "/command"); sw.Stop(); Info("Command from robot 1020: '{0}'. ({1:n2})", data, sw.Elapsed.TotalSeconds); } } catch (Exception ex) { string msg = ex.Message; } } private static void Info(string format, params object[] arg) { new InfoDialog(string.Format(format, arg), true).Show(); } private static void Info(string format, bool waitForOk, params object[] arg) { new InfoDialog(string.Format(format, arg), waitForOk).Show(); } private static void Info(string format, bool waitForOk, string title, params object[] arg) { new InfoDialog(string.Format(format, arg), waitForOk, title).Show(); } } }
using System; using MonoBrickFirmware; using MonoBrickFirmware.Display.Dialogs; using MonoBrickFirmware.Display; using MonoBrickFirmware.Movement; using System.Threading; using System.Net; namespace MonoBrickHelloWorld { class MainClass { private static int _id; public static void Main(string[] args) { try { string url = "http://test.henkmollema.nl/robot/login"; WebClient client = new WebClient(); string s = client.DownloadString(url); if (!int.TryParse(s, out _id)) { new InfoDialog(string.Format("Invalid ID from the webserver: '{0}'.", s), true, "Error").Show(); return; } new InfoDialog("Robot id: " + _id, true).Show(); } catch (Exception ex) { string msg = ex.Message; } } } }
mit
C#
f48e1d8ec163e8dc786100a0d842c36010510c7b
Increment version before creating release (0.2.5).
VictorZakharov/pinwin
PinWin/Properties/AssemblyInfo.cs
PinWin/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("PinWin")] [assembly: AssemblyDescription("Allows user to make desktop windows top most")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PinWin")] [assembly: AssemblyCopyright("Copyright © Victor Zakharov 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7ae6966c-0686-4ac4-afbb-9ffd7bf7b81c")] // 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.2.5")] [assembly: AssemblyFileVersion("0.2.5")]
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("PinWin")] [assembly: AssemblyDescription("Allows user to make desktop windows top most")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PinWin")] [assembly: AssemblyCopyright("Copyright © Victor Zakharov 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7ae6966c-0686-4ac4-afbb-9ffd7bf7b81c")] // 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.2.4")] [assembly: AssemblyFileVersion("0.2.4")]
mit
C#
ae82631a265aae3351a74b65c006d7acdcc3202a
Add StringParameterClone test
TheBerkin/Rant
Rant.Tests/Expressions/Strings.cs
Rant.Tests/Expressions/Strings.cs
using NUnit.Framework; namespace Rant.Tests.Expressions { [TestFixture] public class Strings { private readonly RantEngine rant = new RantEngine(); [Test] [TestCase("test", Result = "test")] [TestCase("<noun>", Result = "<noun>")] public string RegularStrings(string value) { return rant.Do($"[@ \"{value}\" ]").Main; } [Test] [TestCase("<noun>")] public void PatternStrings(string value) { var result = rant.Do($"[@ $\"{value}\"() ]").Main; Assert.NotNull(result); Assert.GreaterOrEqual(result.Length, 2); Assert.AreNotEqual(value, result); } [Test] [TestCase("<noun>")] public void ReturnPatternStrings(string value) { var result = rant.Do($"[@ $\"{value}\" ]").Main; Assert.NotNull(result); Assert.GreaterOrEqual(result.Length, 2); Assert.AreNotEqual(value, result); } [Test] public void Concatenation() { Assert.AreEqual("test string", rant.Do("[@ \"test\" ~ \" string\" ]").Main); } [Test] public void PatternStringConcat() { var result = rant.Do("[@ ($\"[case:upper]test \" ~ \"string\")() ]").Main; Assert.AreEqual("TEST STRING", result); } [Test] public void StringParameterClone() { var output = rant.Do(@" [@{ var strTestFunc = (a, b) => { a ~= b; }; var str = ""foo""; strTestFunc(str, ""bar""); return str; }] "); Assert.AreEqual("foo", output.Main); } } }
using NUnit.Framework; namespace Rant.Tests.Expressions { [TestFixture] public class Strings { private readonly RantEngine rant = new RantEngine(); [Test] [TestCase("test", Result = "test")] [TestCase("<noun>", Result = "<noun>")] public string RegularStrings(string value) { return rant.Do($"[@ \"{value}\" ]").Main; } [Test] [TestCase("<noun>")] public void PatternStrings(string value) { var result = rant.Do($"[@ $\"{value}\"() ]").Main; Assert.NotNull(result); Assert.GreaterOrEqual(result.Length, 2); Assert.AreNotEqual(value, result); } [Test] [TestCase("<noun>")] public void ReturnPatternStrings(string value) { var result = rant.Do($"[@ $\"{value}\" ]").Main; Assert.NotNull(result); Assert.GreaterOrEqual(result.Length, 2); Assert.AreNotEqual(value, result); } [Test] public void Concatenation() { Assert.AreEqual("test string", rant.Do("[@ \"test\" ~ \" string\" ]").Main); } [Test] public void PatternStringConcat() { var result = rant.Do("[@ ($\"[case:upper]test \" ~ \"string\")() ]").Main; Assert.AreEqual("TEST STRING", result); } } }
mit
C#
b1543b53a0b4fd7278541f9374092d93c86f36a8
Remove unused constant
Brightspace/D2L.Security.OAuth2
D2L.Security.OAuth2/Validation/D2L.Security.RequestAuthentication.Tests/Utilities/TestUris.cs
D2L.Security.OAuth2/Validation/D2L.Security.RequestAuthentication.Tests/Utilities/TestUris.cs
using System; namespace D2L.Security.RequestAuthentication.Tests.Utilities { internal static class TestUris { private static readonly Uri AUTH_SERVER_SITE = new Uri( "https://phwinsl01.proddev.d2l:44333" ); internal static readonly Uri TOKEN_VERIFICATION_AUTHORITY_URI = new Uri( AUTH_SERVER_SITE, "core/" ); } }
using System; namespace D2L.Security.RequestAuthentication.Tests.Utilities { internal static class TestUris { private static readonly Uri AUTH_SERVER_SITE = new Uri( "https://phwinsl01.proddev.d2l:44333" ); internal static readonly Uri TOKEN_VERIFICATION_AUTHORITY_URI = new Uri( AUTH_SERVER_SITE, "core/" ); internal static readonly string ISSUER_URL = "https://api.d2l.com/auth"; } }
apache-2.0
C#
b3d947086bc0ed56928ce9e57ceee46a53547957
修改FileUtils.GetSizeDisplayName的参数类型到long
zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,303248153/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb,zkweb-framework/ZKWeb
ZKWeb.Utils/Functions/FileUtils.cs
ZKWeb.Utils/Functions/FileUtils.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ZKWeb.Utils.Functions { /// <summary> /// 文件工具类 /// </summary> public static class FileUtils { /// <summary> /// 获取字节大小的显示名称 /// 自动转换成KB、MB或GB格式 /// </summary> /// <param name="bytes">字节数</param> /// <returns></returns> public static string GetSizeDisplayName(long bytes) { if (bytes >= 1073741824) { return $"{Decimal.Round((decimal)bytes / 1073741824, 2)}GB"; } else if (bytes >= 1048576) { return $"{Decimal.Round((decimal)bytes / 1048576, 2)}MB"; } else if (bytes >= 1024) { return $"{Decimal.Round((decimal)bytes / 1024, 2)}KB"; } return $"{bytes}Bytes"; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ZKWeb.Utils.Functions { /// <summary> /// 文件工具类 /// </summary> public static class FileUtils { /// <summary> /// 获取字节大小的显示名称 /// 自动转换成KB、MB或GB格式 /// </summary> /// <param name="bytes"></param> /// <returns></returns> public static string GetSizeDisplayName(int bytes) { if (bytes >= 1073741824) { return $"{Decimal.Round((decimal)bytes / 1073741824, 2)}GB"; } else if (bytes >= 1048576) { return $"{Decimal.Round((decimal)bytes / 1048576, 2)}MB"; } else if (bytes >= 1024) { return $"{Decimal.Round((decimal)bytes / 1024, 2)}KB"; } return $"{bytes}Bytes"; } } }
mit
C#
5f139e62a25e2c3304b2b2869a6dcf70acb33e52
Fix animation
atompacman/ConfitureCreative
Assets/Script/AnimationScript.cs
Assets/Script/AnimationScript.cs
using UnityEngine; using System.Collections.Generic; using UnityEditor; using UnityEngine.UI; using System.IO; public class AnimationScript : MonoBehaviour { const int lastFrame = 21; const int loopFrame = 12; const float frameInterval = 0.3f; List<Texture> frameImages = new List<Texture>(); private int curFrame = 0; private float lastFrameTime; // Use this for initialization void Start () { string[] allFiles = Directory.GetFiles("Assets/Textures/Animation1"); float time = 0.0f; foreach (var file in allFiles) { if (Path.GetExtension(file) == ".meta") continue; var obj = AssetDatabase.LoadAssetAtPath<Texture>(file); if (obj != null) { frameImages.Add(obj as Texture); time += 0.3f; } } //addFrame(0.0f, AssetDatabase.LoadAssetAtPath<Texture>("Assets/Textures/Animation1/f0.jpg")); //addFrame(1.0f, AssetDatabase.LoadAssetAtPath<Texture>("Assets/Textures/Animation1/f1.jpg")); GetComponent<RawImage>().texture = frameImages[curFrame]; lastFrameTime = Time.timeSinceLevelLoad; } // Update is called once per frame void Update () { if (Time.timeSinceLevelLoad - lastFrameTime >= frameInterval) { curFrame++; if (curFrame > lastFrame) { curFrame = loopFrame; } // Set texture GetComponent<RawImage>().texture = frameImages[curFrame]; lastFrameTime = Time.timeSinceLevelLoad; } } public void Reset() { curFrame = 0; lastFrameTime = Time.timeSinceLevelLoad; GetComponent<RawImage>().texture = frameImages[curFrame]; } }
using UnityEngine; using System.Collections.Generic; using UnityEditor; using UnityEngine.UI; using System.IO; public class AnimationScript : MonoBehaviour { const int lastFrame = 25; const int loopFrame = 16; const float frameInterval = 0.3f; List<Texture> frameImages = new List<Texture>(); private int curFrame = 0; private float lastFrameTime; // Use this for initialization void Start () { string[] allFiles = Directory.GetFiles("Assets/Textures/Animation1"); float time = 0.0f; foreach (var file in allFiles) { if (Path.GetExtension(file) == ".meta") continue; var obj = AssetDatabase.LoadAssetAtPath<Texture>(file); if (obj != null) { frameImages.Add(obj as Texture); time += 0.3f; } } //addFrame(0.0f, AssetDatabase.LoadAssetAtPath<Texture>("Assets/Textures/Animation1/f0.jpg")); //addFrame(1.0f, AssetDatabase.LoadAssetAtPath<Texture>("Assets/Textures/Animation1/f1.jpg")); GetComponent<RawImage>().texture = frameImages[curFrame]; lastFrameTime = Time.timeSinceLevelLoad; } // Update is called once per frame void Update () { if (Time.timeSinceLevelLoad - lastFrameTime >= frameInterval) { curFrame++; if (curFrame > lastFrame) { curFrame = loopFrame; } // Set texture GetComponent<RawImage>().texture = frameImages[curFrame]; lastFrameTime = Time.timeSinceLevelLoad; } } public void Reset() { curFrame = 0; lastFrameTime = Time.timeSinceLevelLoad; GetComponent<RawImage>().texture = frameImages[curFrame]; } }
mit
C#
4be287a8bbc742bb4b0758adb32a7be78bd6a09c
Write the autolink's URL so we can see the autolink.
Kryptos-FR/markdig.wpf,Kryptos-FR/markdig-wpf
src/Markdig.Wpf/Renderers/Wpf/Inlines/AutoLinkInlineRenderer.cs
src/Markdig.Wpf/Renderers/Wpf/Inlines/AutoLinkInlineRenderer.cs
// Copyright (c) 2016-2017 Nicolas Musset. All rights reserved. // This file is licensed under the MIT license. // See the LICENSE.md file in the project root for more information. using System; using System.Windows.Documents; using Markdig.Annotations; using Markdig.Syntax.Inlines; using Markdig.Wpf; namespace Markdig.Renderers.Wpf.Inlines { /// <summary> /// A WPF renderer for a <see cref="AutolinkInline"/>. /// </summary> /// <seealso cref="Markdig.Renderers.Wpf.WpfObjectRenderer{Markdig.Syntax.Inlines.AutolinkInline}" /> public class AutolinkInlineRenderer : WpfObjectRenderer<AutolinkInline> { /// <inheritdoc/> protected override void Write([NotNull] WpfRenderer renderer, [NotNull] AutolinkInline link) { var url = link.Url; if (!Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute)) { url = "#"; } var hyperlink = new Hyperlink { Command = Commands.Hyperlink, CommandParameter = url, NavigateUri = new Uri(url, UriKind.RelativeOrAbsolute), ToolTip = url, }; renderer.Push(hyperlink); renderer.WriteText(link.Url); renderer.Pop(); } } }
// Copyright (c) 2016-2017 Nicolas Musset. All rights reserved. // This file is licensed under the MIT license. // See the LICENSE.md file in the project root for more information. using System; using System.Windows.Documents; using Markdig.Annotations; using Markdig.Syntax.Inlines; using Markdig.Wpf; namespace Markdig.Renderers.Wpf.Inlines { /// <summary> /// A WPF renderer for a <see cref="AutolinkInline"/>. /// </summary> /// <seealso cref="Markdig.Renderers.Wpf.WpfObjectRenderer{Markdig.Syntax.Inlines.AutolinkInline}" /> public class AutolinkInlineRenderer : WpfObjectRenderer<AutolinkInline> { /// <inheritdoc/> protected override void Write([NotNull] WpfRenderer renderer, [NotNull] AutolinkInline link) { var url = link.Url; if (!Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute)) { url = "#"; } var hyperlink = new Hyperlink { Command = Commands.Hyperlink, CommandParameter = url, NavigateUri = new Uri(url, UriKind.RelativeOrAbsolute), ToolTip = url, }; renderer.WriteInline(hyperlink); } } }
mit
C#
d381494ef083440506f85fb542d363497b3e723a
Use MvcJsonOptions json serializer formatting when generating swagger.json
domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Swashbuckle.AspNetCore,domaindrivendev/Ahoy,oconics/Ahoy,domaindrivendev/Ahoy,domaindrivendev/Swashbuckle.AspNetCore,oconics/Ahoy,domaindrivendev/Ahoy
src/Swashbuckle.Swagger/Application/SwaggerSerializerFactory.cs
src/Swashbuckle.Swagger/Application/SwaggerSerializerFactory.cs
using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using Newtonsoft.Json; namespace Swashbuckle.Swagger.Application { public class SwaggerSerializerFactory { internal static JsonSerializer Create(IOptions<MvcJsonOptions> mvcJsonOptions) { // TODO: Should this handle case where mvcJsonOptions.Value == null? return new JsonSerializer { NullValueHandling = NullValueHandling.Ignore, Formatting = mvcJsonOptions.Value.SerializerSettings.Formatting, ContractResolver = new SwaggerContractResolver(mvcJsonOptions.Value.SerializerSettings) }; } } }
using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using Newtonsoft.Json; namespace Swashbuckle.Swagger.Application { public class SwaggerSerializerFactory { internal static JsonSerializer Create(IOptions<MvcJsonOptions> mvcJsonOptions) { // TODO: Should this handle case where mvcJsonOptions.Value == null? return new JsonSerializer { NullValueHandling = NullValueHandling.Ignore, ContractResolver = new SwaggerContractResolver(mvcJsonOptions.Value.SerializerSettings) }; } } }
mit
C#
72c8417bdf9bdc9e4ddb610b028e32d4664f3ed9
Fix type
scho/gameoflife
GameOfLife/Model/GameInitializer.cs
GameOfLife/Model/GameInitializer.cs
using System.Collections.Generic; using System.Linq; namespace GameOfLife.Model { public class GameInitializer { private IList<IList<Cell>> field; private readonly bool[][] initialState; public GameInitializer(bool[][] initialState) { this.initialState = initialState; } public IList<IList<Cell>> Initialize() { SetUpGame(); return field; } private void SetUpGame() { field = new List<IList<Cell>>(); foreach (bool[] rowState in initialState) { SetUpRow(rowState); } } private void SetUpRow(bool[] initialRowState) { field.Add(new List<Cell>()); foreach (bool isAlive in initialRowState) { SetUpCell(isAlive); } } private void SetUpCell(bool isAlive) { var row = field.Last(); var cell = CreateCell(isAlive); row.Add(cell); new NeighborhoodInitializer(field, cell).Initialize(); } private static Cell CreateCell(bool cellState) { if (cellState) { return Cell.CreateAlive(); } return Cell.CreateDead(); } } }
using System.Collections.Generic; using System.Linq; namespace GameOfLife.Model { public class GameInitializer { private IList<IList<Cell>> field; private readonly bool[][] initialState; public GameInitializer(bool[][] initialState) { this.initialState = initialState; } public IList<IList<Cell>> Initialize() { SetUpGame(); return field; } private void SetUpGame() { field = new List<IList<Cell>>(); foreach (bool[] rowState in initialState) { SetUpRow(rowState); } } private void SetUpRow(bool[] initialRowState) { field.Add(new List<Cell>()); foreach (bool isAlive in initialRowState) { SetUpCell(isAlive); } } private void SetUpCell(bool isAlive) { var row = field.Last(); var cell = CreateCell(isAlive); row.Add(cell); new NieghborhoodInitializer(field, cell).Initialize(); } private static Cell CreateCell(bool cellState) { if (cellState) { return Cell.CreateAlive(); } return Cell.CreateDead(); } } }
mit
C#
e7a5e30aad18487885aa5d0d6c75772a9b9bfc46
Enforce CLS compliance.
eggrobin/Principia,eggrobin/Principia,Norgg/Principia,Norgg/Principia,mockingbirdnest/Principia,pleroy/Principia,pleroy/Principia,mockingbirdnest/Principia,mockingbirdnest/Principia,pleroy/Principia,Norgg/Principia,eggrobin/Principia,Norgg/Principia,mockingbirdnest/Principia,pleroy/Principia
Geometry/Properties/AssemblyInfo.cs
Geometry/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("Geometry")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Geometry")] [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("df6ae89e-db46-4a87-8a3b-b28b0fe8629f")] // 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")] // Enforce CLS compliance. [assembly: System.CLSCompliant(true)]
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("Geometry")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Geometry")] [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("df6ae89e-db46-4a87-8a3b-b28b0fe8629f")] // 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#
e0f0d102bbbd40400965cca6e37bdd72b4eadecb
Disable Raven's Embedded HTTP server
alastairs/cgowebsite,alastairs/cgowebsite
src/CGO.Web/NinjectModules/RavenModule.cs
src/CGO.Web/NinjectModules/RavenModule.cs
using Ninject; using Ninject.Modules; using Ninject.Web.Common; using Raven.Client; using Raven.Client.Embedded; namespace CGO.Web.NinjectModules { public class RavenModule : NinjectModule { public override void Load() { Kernel.Bind<IDocumentStore>().ToMethod(_ => InitialiseDocumentStore()).InSingletonScope(); Kernel.Bind<IDocumentSession>().ToMethod(_ => Kernel.Get<IDocumentStore>().OpenSession()).InRequestScope(); } private static IDocumentStore InitialiseDocumentStore() { var documentStore = new EmbeddableDocumentStore { DataDirectory = "CGO.raven", Configuration = { Port = 28645 } }; documentStore.Initialize(); documentStore.InitializeProfiling(); return documentStore; } } }
using Ninject; using Ninject.Modules; using Ninject.Web.Common; using Raven.Client; using Raven.Client.Embedded; namespace CGO.Web.NinjectModules { public class RavenModule : NinjectModule { public override void Load() { Kernel.Bind<IDocumentStore>().ToMethod(_ => InitialiseDocumentStore()).InSingletonScope(); Kernel.Bind<IDocumentSession>().ToMethod(_ => Kernel.Get<IDocumentStore>().OpenSession()).InRequestScope(); } private static IDocumentStore InitialiseDocumentStore() { var documentStore = new EmbeddableDocumentStore { DataDirectory = "CGO.raven", UseEmbeddedHttpServer = true, Configuration = { Port = 28645 } }; documentStore.Initialize(); documentStore.InitializeProfiling(); return documentStore; } } }
mit
C#
529673cb22089b3bf90822c8f4a378ca90f75f6f
Update version number.
Damnae/storybrew
editor/Properties/AssemblyInfo.cs
editor/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("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © Damnae 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // 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.83.*")]
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("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © Damnae 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // 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.82.*")]
mit
C#
e94d04f9196e3bdec9226bcfb89571249f62b6f3
Add newer algorithms to the AssemblyHashAlgorithm enum. (#656)
mono/cecil,jbevain/cecil,fnajera-rac-de/cecil
Mono.Cecil/AssemblyHashAlgorithm.cs
Mono.Cecil/AssemblyHashAlgorithm.cs
// // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2015 Jb Evain // Copyright (c) 2008 - 2011 Novell, Inc. // // Licensed under the MIT/X11 license. // namespace Mono.Cecil { public enum AssemblyHashAlgorithm : uint { None = 0x0000, MD5 = 0x8003, SHA1 = 0x8004, SHA256 = 0x800C, SHA384 = 0x800D, SHA512 = 0x800E, Reserved = 0x8003, // MD5 } }
// // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2015 Jb Evain // Copyright (c) 2008 - 2011 Novell, Inc. // // Licensed under the MIT/X11 license. // namespace Mono.Cecil { public enum AssemblyHashAlgorithm : uint { None = 0x0000, Reserved = 0x8003, // MD5 SHA1 = 0x8004 } }
mit
C#
649c65bee4cfc17ec7d527ed322bd6b02054819d
Update StatInfo.cs - fixed variable type to match database entity
NinjaVault/NinjaHive,NinjaVault/NinjaHive
NinjaHive.Contract/DTOs/StatInfo.cs
NinjaHive.Contract/DTOs/StatInfo.cs
using System; using System.ComponentModel.DataAnnotations; using NinjaHive.Core.Validations; namespace NinjaHive.Contract.DTOs { public class StatInfo { [NonEmptyGuid] public Guid Id { get; set; } public int Health { get; set; } public int Magic { get; set; } public int Attack { get; set; } public int Defense { get; set; } public int Agility { get; set; } public int Intelligence { get; set; } public int Hunger { get; set; } public int Stamina { get; set; } public double Resistance { get; set; } } }
using System; using System.ComponentModel.DataAnnotations; using NinjaHive.Core.Validations; namespace NinjaHive.Contract.DTOs { public class StatInfo { [NonEmptyGuid] public Guid Id { get; set; } public int Health { get; set; } public int Magic { get; set; } public int Attack { get; set; } public int Defense { get; set; } public int Agility { get; set; } public int Intelligence { get; set; } public int Hunger { get; set; } public int Stamina { get; set; } public int Resistance { get; set; } } }
apache-2.0
C#
456cf86841e05b3bfb74be04bcc6128791edd0ef
Read serial port in separate thread
paasovaara/nes-zapper,paasovaara/nes-zapper
Unity/zapper-shooter/Assets/Scripts/ArduinoListener.cs
Unity/zapper-shooter/Assets/Scripts/ArduinoListener.cs
using UnityEngine; using System.Collections; using System.IO.Ports; using System.Threading; /** * For System.IO.Ports namespace you need to enable .Net 2.0 instead of .Net 2.0 subset (which is default). * * You can find this setting from "Edit > project settings > player" * */ public enum ComPort { COM3, COM4 } public class ArduinoListener : MonoBehaviour { SerialPort m_serial = null; [SerializeField] private ComPort m_comPort; public string toString(ComPort com) { switch (com) { case ComPort.COM3: return "COM3"; case ComPort.COM4: return "COM4"; } return "unknown"; } // Use this for initialization void Start () { string comPort = toString(m_comPort); m_serial = new SerialPort(comPort, 9600); //m_serial.NewLine //set new line char m_serial.Open(); if (m_serial.IsOpen) { Debug.Log("Serial port opened " + comPort); Thread t = new Thread(new ThreadStart(serialLoop)); t.Start(); //TODO stop thread and close serial port while closing the app } else { Debug.LogError("Failed to open serial port " + comPort); } } public void OnDestroy() { //clean all resources m_serial.Close();//Will this exit the thread loop also? wait for the thread..? } // Update is called once per frame void Update () { /*if (m_serial.IsOpen) { Debug.Log("Reading serial port"); string input = m_serial.ReadLine();//by default this blocks, so put this to separate thread, not to main loop }*/ } public void serialLoop() { Debug.Log("Starting serial loop"); while (m_serial.IsOpen) { Debug.Log("Reading new message"); //readline blocks until EOL string input = m_serial.ReadLine(); handleMessage(input); //TODO exit loop if closed. might require enabling timeouts } Debug.Log("Stopping serial loop"); } private void handleMessage(string msg) { Debug.Log("Read message: " + msg); } }
using UnityEngine; using System.Collections; using System.IO.Ports; /** * For System.IO.Ports namespace you need to enable .Net 2.0 instead of .Net 2.0 subset (which is default). * * You can find this setting from "Edit > project settings > player" * */ public enum ComPort { COM3, COM4 } public class ArduinoListener : MonoBehaviour { SerialPort m_serial = null; [SerializeField] private ComPort m_comPort; public string toString(ComPort com) { switch (com) { case ComPort.COM3: return "COM3"; case ComPort.COM4: return "COM4"; } return "unknown"; } // Use this for initialization void Start () { string comPort = toString(m_comPort); m_serial = new SerialPort(comPort, 9600); //m_serial.NewLine //set new line char m_serial.Open(); if (m_serial.IsOpen) { Debug.Log("Serial port opened " + comPort); } else { Debug.LogError("Failed to open serial port " + comPort); } } // Update is called once per frame void Update () { if (m_serial.IsOpen) { Debug.Log("Reading serial port"); string input = m_serial.ReadLine();//by default this blocks, so put this to separate thread, not to main loop } } }
mit
C#
bc54d8e810d0e564ea3a7b0db644ab0d1ca67f32
make ctrl+g general navigation key
kbilsted/KeyboordUsage
code/Configuration/UserStates/UserStateStandardConfiguraion.cs
code/Configuration/UserStates/UserStateStandardConfiguraion.cs
using System; using System.Collections.Generic; using System.Windows.Forms; using KeyboordUsage.Configuration.Keyboard; namespace KeyboordUsage.Configuration.UserStates { class UserStateStandardConfiguraion { private readonly CommandLineArgs commandLineArgs; public UserStateStandardConfiguraion(CommandLineArgs commandLineArgs) { this.commandLineArgs = commandLineArgs; } public UserState CreateDefaultState() { var stdKeyClassConfiguration = CreateStdKeyClassConfiguration(); var recodingSession = new RecodingSession(DateTime.Now, new Dictionary<Keys, int>(), new RatioCalculator()); return new UserState(AppConstants.CurrentVersion, recodingSession, new List<RecodingSession>(), CreateGuiConfiguration(), stdKeyClassConfiguration); } public GuiConfiguration CreateGuiConfiguration() { return new GuiConfiguration(10, 10, 1125, 550, 1); } public KeyClassConfiguration CreateStdKeyClassConfiguration() { var destructionKeys = KeyboardConstants.CombineKeysWithStandardModifiers(new[] { "Back", "Delete" }); destructionKeys.Add("Z, Control"); destructionKeys.Add("X, Control"); var navs = new [] { "Home", "PageUp", "End", "Next", "Up", "Left", "Down", "Right" }; var navKeys = KeyboardConstants.CombineKeysWithStandardModifiers(navs); navKeys.Add("G, Control"); if (commandLineArgs.UseVisualStudioNavigation) { navKeys.AddRange(KeyboardConstants.CombineKeysWithStandardModifiers(new[] {"F3", "F12"})); navKeys.AddRange(KeyboardConstants.KeysCombinedWithCodeModifiers(new[] {"T", "F6", "F7", "F8"})); navKeys.AddRange(KeyboardConstants.KeysCombinedWithControlAndShiftControl(new[] { "OemMinus", "Tab", "I" })); navKeys.Add("A, Shift, Control, Alt"); } var metaKeys = new List<string>() { "Escape", "F1", "F2", "F4", "F5", "F9", "F10", "F11", "LControlKey", "RLControlKey", "LWin", "LMenu", "RMenu", "Fn", "Apps" }; if (!commandLineArgs.UseVisualStudioNavigation) { metaKeys.AddRange(new [] { "F3", "F6", "F7", "F8", "F12"}); } var meta = KeyboardConstants.CombineKeysWithStandardModifiers(metaKeys.ToArray()); return new KeyClassConfiguration() { DestructiveKeyData = destructionKeys, MetaKeyData = meta, NaviationKeyData = navKeys, }; } } }
using System; using System.Collections.Generic; using System.Windows.Forms; using KeyboordUsage.Configuration.Keyboard; namespace KeyboordUsage.Configuration.UserStates { class UserStateStandardConfiguraion { private readonly CommandLineArgs commandLineArgs; public UserStateStandardConfiguraion(CommandLineArgs commandLineArgs) { this.commandLineArgs = commandLineArgs; } public UserState CreateDefaultState() { var stdKeyClassConfiguration = CreateStdKeyClassConfiguration(); var recodingSession = new RecodingSession(DateTime.Now, new Dictionary<Keys, int>(), new RatioCalculator()); return new UserState(AppConstants.CurrentVersion, recodingSession, new List<RecodingSession>(), CreateGuiConfiguration(), stdKeyClassConfiguration); } public GuiConfiguration CreateGuiConfiguration() { return new GuiConfiguration(10, 10, 1125, 550, 1); } public KeyClassConfiguration CreateStdKeyClassConfiguration() { var destructionKeys = KeyboardConstants.CombineKeysWithStandardModifiers(new[] { "Back", "Delete" }); destructionKeys.Add("Z, Control"); destructionKeys.Add("X, Control"); var navs = new [] { "Home", "PageUp", "End", "Next", "Up", "Left", "Down", "Right" }; var navKeys = KeyboardConstants.CombineKeysWithStandardModifiers(navs); if (commandLineArgs.UseVisualStudioNavigation) { navKeys.AddRange(KeyboardConstants.CombineKeysWithStandardModifiers(new[] {"F3", "F12"})); navKeys.AddRange(KeyboardConstants.KeysCombinedWithCodeModifiers(new[] {"T", "F6", "F7", "F8"})); navKeys.Add("G, Control"); navKeys.AddRange(KeyboardConstants.KeysCombinedWithControlAndShiftControl(new[] { "OemMinus", "Tab", "I" })); navKeys.Add("A, Shift, Control, Alt"); } var metaKeys = new List<string>() { "Escape", "F1", "F2", "F4", "F5", "F9", "F10", "F11", "LControlKey", "RLControlKey", "LWin", "LMenu", "RMenu", "Fn", "Apps" }; if (!commandLineArgs.UseVisualStudioNavigation) { metaKeys.AddRange(new [] { "F3", "F6", "F7", "F8", "F12"}); } var meta = KeyboardConstants.CombineKeysWithStandardModifiers(metaKeys.ToArray()); return new KeyClassConfiguration() { DestructiveKeyData = destructionKeys, MetaKeyData = meta, NaviationKeyData = navKeys, }; } } }
apache-2.0
C#
80441df8d5ffef18d8472501a645e36a819cfe6f
set working directory
stwalkerster/eyeinthesky,stwalkerster/eyeinthesky,stwalkerster/eyeinthesky
EyeInTheSky/Commands/Version.cs
EyeInTheSky/Commands/Version.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Text; namespace EyeInTheSky.Commands { class Version : GenericCommand { public Version() { this.requiredAccessLevel = User.UserRights.Developer; } #region Overrides of GenericCommand protected override void execute(User source, string destination, string[] tokens) { string bindir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Substring(6); if (GlobalFunctions.realArrayLength(tokens) < 1) { Process p = new Process { StartInfo = { UseShellExecute = false, RedirectStandardOutput = true, FileName = "git", Arguments = "describe", WorkingDirectory = bindir } }; p.Start(); string output = p.StandardOutput.ReadToEnd(); p.WaitForExit(); EyeInTheSkyBot.irc_freenode.ircPrivmsg(destination, output); return; } } #endregion } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Text; namespace EyeInTheSky.Commands { class Version : GenericCommand { public Version() { this.requiredAccessLevel = User.UserRights.Developer; } #region Overrides of GenericCommand protected override void execute(User source, string destination, string[] tokens) { string bindir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Substring(6); if (GlobalFunctions.realArrayLength(tokens) < 1) { Process p = new Process { StartInfo = { UseShellExecute = false, RedirectStandardOutput = true, FileName = "git", Arguments = "describe" } }; p.Start(); string output = p.StandardOutput.ReadToEnd(); p.WaitForExit(); EyeInTheSkyBot.irc_freenode.ircPrivmsg(destination, output); return; } } #endregion } }
mit
C#
9b94131d14ffbb304c977f728e6a2b21f2802124
add property to gameobject
TeamLeoTolstoy/Leo
Game/StopTheBunny/GameObject.cs
Game/StopTheBunny/GameObject.cs
namespace StopTheBunny { public abstract class GameObject { public UpperLeftPoint UpperLeftPoint { get; set; } public abstract char Sign { get; set; } public abstract Color Color { get; set; } } }
namespace StopTheBunny { public abstract class GameObject { protected int posiotionX; protected int positionY; public int PositionX { get { return this.posiotionX; } set { if (value<0 || value>) { } } } public abstract int PositionY { get; set; } public abstract char Sign { get; set; } public abstract Color Color { get; set; } } }
mit
C#
3d05bd4cbfceb211fa8c5c0b8e69b0a68519fb9a
Change signature
yskatsumata/resharper-workshop,gorohoroh/resharper-workshop,gorohoroh/resharper-workshop,JetBrains/resharper-workshop,gorohoroh/resharper-workshop,JetBrains/resharper-workshop,yskatsumata/resharper-workshop,yskatsumata/resharper-workshop,JetBrains/resharper-workshop
04-Refactoring/05-Change_signature.cs
04-Refactoring/05-Change_signature.cs
namespace JetBrains.ReSharper.Koans.Refactoring { // Change Signature // // Update a method signature, adding, removing or reordering parameters // // Ctrl+R, S (VS) // Ctrl+F6 (IntelliJ) public class ChangeSignature { // 1. Change method signature // Place text caret on Method and invoke Change Signature // In dialog, change name, return type and parameters // Can add, remove, reorder parameters, change type and modifier (ref, out) // Add an int parameter called "iq". Click next // ReSharper prompts how to handle the new parameter in calling code // Can leave code non-compilable, use a default value (0), use a specific value // or resolve with call tree // 1a. Select resolve with call tree // Refactoring tool window opens showing CallMethod usage and three options // user edit, create field "iq", create parameter "iq" in CallMethod // Selecting any of these options updates the calling code // Can uncheck and select other option // Close tool window when done public void Method(string name, int age) { } public void CallMethod() { Method("Deborah", 32); } } public class ApplyChangeSignatureRefactoring { // 2. Apply Change Signature refactoring, after change // MANUALLY add a parameter, ReSharper highlights signature with dotted line // Alt+Enter and select Apply Change Signature Refactoring // ReSharper displays dialog with visualisation of the change public void AddParameterMethod(string name, int age) { } // 3. Apply Change Signature refactoring, after change // MANUALLY reorder the parameters (Ctrl+Shift+Alt+Left/Right) // ReSharper highlights signature with dotted line // Alt+Enter and select Apply Change Signature Refactoring // ReSharper displays dialog with visualisation of the change public void ReorderMethod(string name, int age) { } public void CallMethods() { AddParameterMethod("Deborah", 32); ReorderMethod("Deborah", 32); } } }
namespace Refactoring { public class Change_signature { } }
apache-2.0
C#
2b3afdd6cb112a498eec3e86af510252fc63cc41
Update Pantheon.cs
metaphorce/leaguesharp
MetaSmite/Champions/Pantheon.cs
MetaSmite/Champions/Pantheon.cs
using System; using LeagueSharp; using LeagueSharp.Common; using SharpDX; namespace MetaSmite.Champions { public static class Pantheon { internal static Spell champSpell; private static Menu Config = MetaSmite.Config; private static double totalDamage; private static double spellDamage; public static void Load() { //Load spells champSpell = new Spell(SpellSlot.Q, 600f); //Spell usage. Config.AddItem(new MenuItem("Enabled-" + MetaSmite.Player.ChampionName, MetaSmite.Player.ChampionName + "-" + champSpell.Slot)).SetValue(true); //Events Game.OnUpdate += OnGameUpdate; } private static void OnGameUpdate(EventArgs args) { if (Config.Item("Enabled").GetValue<KeyBind>().Active || Config.Item("EnabledH").GetValue<KeyBind>().Active) { if (SmiteManager.mob != null && Config.Item(SmiteManager.mob.BaseSkinName).GetValue<bool>() && Vector3.Distance(MetaSmite.Player.ServerPosition, SmiteManager.mob.ServerPosition) <= champSpell.Range) { spellDamage = MetaSmite.Player.GetSpellDamage(SmiteManager.mob, champSpell.Slot); totalDamage = spellDamage + SmiteManager.damage; if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && SmiteManager.smite.IsReady() && champSpell.IsReady() && totalDamage >= SmiteManager.mob.Health) { MetaSmite.Player.Spellbook.CastSpell(champSpell.Slot, SmiteManager.mob); } if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && champSpell.IsReady() && spellDamage >= SmiteManager.mob.Health) { MetaSmite.Player.Spellbook.CastSpell(champSpell.Slot, SmiteManager.mob); } } } } } }
using System; using LeagueSharp; using LeagueSharp.Common; using SharpDX; namespace MetaSmite.Champions { public static class Pantheon { internal static Spell champSpell; private static Menu Config = MetaSmite.Config; private static double totalDamage; private static double spellDamage; public static void Load() { //Load spells champSpell = new Spell(SpellSlot.Q, 600f); //Spell usage. Config.AddItem(new MenuItem("Enabled-" + MetaSmite.Player.ChampionName, MetaSmite.Player.ChampionName + "-" + champSpell.Slot)).SetValue(true); //Events Game.OnGameUpdate += OnGameUpdate; } private static void OnGameUpdate(EventArgs args) { if (Config.Item("Enabled").GetValue<KeyBind>().Active || Config.Item("EnabledH").GetValue<KeyBind>().Active) { if (SmiteManager.mob != null && Config.Item(SmiteManager.mob.BaseSkinName).GetValue<bool>() && Vector3.Distance(MetaSmite.Player.ServerPosition, SmiteManager.mob.ServerPosition) <= champSpell.Range) { spellDamage = MetaSmite.Player.GetSpellDamage(SmiteManager.mob, champSpell.Slot); totalDamage = spellDamage + SmiteManager.damage; if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && SmiteManager.smite.IsReady() && champSpell.IsReady() && totalDamage >= SmiteManager.mob.Health) { MetaSmite.Player.Spellbook.CastSpell(champSpell.Slot, SmiteManager.mob); } if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && champSpell.IsReady() && spellDamage >= SmiteManager.mob.Health) { MetaSmite.Player.Spellbook.CastSpell(champSpell.Slot, SmiteManager.mob); } } } } } }
mit
C#
86fedfa945ada920fade2663e8f30123f3e4a099
Make ListBoxItem focusable thus selectable.
jkoritzinsky/Perspex,susloparovdenis/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,MrDaedra/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,susloparovdenis/Perspex,grokys/Perspex,sagamors/Perspex,susloparovdenis/Perspex,ncarrillo/Perspex,MrDaedra/Avalonia,wieslawsoltes/Perspex,bbqchickenrobot/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,susloparovdenis/Avalonia,wieslawsoltes/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,DavidKarlas/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,punker76/Perspex,danwalmsley/Perspex,grokys/Perspex,OronDF343/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,tshcherban/Perspex,Perspex/Perspex,OronDF343/Avalonia,jazzay/Perspex,SuperJMN/Avalonia,kekekeks/Perspex,wieslawsoltes/Perspex,kekekeks/Perspex,akrisiun/Perspex
Perspex.Controls/ListBoxItem.cs
Perspex.Controls/ListBoxItem.cs
// ----------------------------------------------------------------------- // <copyright file="ListBoxItem.cs" company="Steven Kirk"> // Copyright 2015 MIT Licence. See licence.md for more information. // </copyright> // ----------------------------------------------------------------------- namespace Perspex.Controls { using Perspex.Controls.Mixins; /// <summary> /// A selectable item in a <see cref="ListBox"/>. /// </summary> public class ListBoxItem : ContentControl, ISelectable { /// <summary> /// Defines the <see cref="IsSelected"/> property. /// </summary> public static readonly PerspexProperty<bool> IsSelectedProperty = PerspexProperty.Register<ListBoxItem, bool>(nameof(IsSelected)); /// <summary> /// Initializes static members of the <see cref="ListBoxItem"/> class. /// </summary> static ListBoxItem() { SelectableMixin.Attach<ListBoxItem>(IsSelectedProperty); FocusableProperty.OverrideDefaultValue<ListBoxItem>(true); } /// <summary> /// Gets or sets the selection state of the item. /// </summary> public bool IsSelected { get { return this.GetValue(IsSelectedProperty); } set { this.SetValue(IsSelectedProperty, value); } } } }
// ----------------------------------------------------------------------- // <copyright file="ListBoxItem.cs" company="Steven Kirk"> // Copyright 2015 MIT Licence. See licence.md for more information. // </copyright> // ----------------------------------------------------------------------- namespace Perspex.Controls { using Perspex.Controls.Mixins; /// <summary> /// A selectable item in a <see cref="ListBox"/>. /// </summary> public class ListBoxItem : ContentControl, ISelectable { /// <summary> /// Defines the <see cref="IsSelected"/> property. /// </summary> public static readonly PerspexProperty<bool> IsSelectedProperty = PerspexProperty.Register<ListBoxItem, bool>(nameof(IsSelected)); /// <summary> /// Initializes static members of the <see cref="ListBoxItem"/> class. /// </summary> static ListBoxItem() { SelectableMixin.Attach<ListBoxItem>(IsSelectedProperty); } /// <summary> /// Gets or sets the selection state of the item. /// </summary> public bool IsSelected { get { return this.GetValue(IsSelectedProperty); } set { this.SetValue(IsSelectedProperty, value); } } } }
mit
C#
48a5e57f5efd66fc9c204a5722584d84f2d188b5
Fix Uninstall-Package failing to find package.
mrward/monodevelop-nuget-extensions,mrward/monodevelop-nuget-extensions
src/MonoDevelop.PackageManagement.Cmdlets/MonoDevelop.PackageManagement.Cmdlets/UninstallPackageCmdlet.cs
src/MonoDevelop.PackageManagement.Cmdlets/MonoDevelop.PackageManagement.Cmdlets/UninstallPackageCmdlet.cs
// // UninstallPackageCmdlet.cs // // Author: // Matt Ward <ward.matt@gmail.com> // // Copyright (C) 2011-2014 Matthew Ward // // 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.Management.Automation; using ICSharpCode.PackageManagement.Scripting; using MonoDevelop.PackageManagement; using NuGet; namespace ICSharpCode.PackageManagement.Cmdlets { [Cmdlet (VerbsLifecycle.Uninstall, "Package", DefaultParameterSetName = ParameterAttribute.AllParameterSets)] public class UninstallPackageCmdlet : PackageManagementCmdlet { public UninstallPackageCmdlet () : this ( PackageManagementExtendedServices.ConsoleHost, null) { } public UninstallPackageCmdlet ( IPackageManagementConsoleHost consoleHost, ICmdletTerminatingError terminatingError) : base (consoleHost, terminatingError) { } [Parameter (Position = 0, Mandatory = true)] public string Id { get; set; } [Parameter (Position = 1)] public string ProjectName { get; set; } [Parameter (Position = 2)] public SemanticVersion Version { get; set; } [Parameter] public SwitchParameter Force { get; set; } [Parameter] public SwitchParameter RemoveDependencies { get; set; } protected override void ProcessRecord () { ThrowErrorIfProjectNotOpen (); using (IDisposable monitor = CreateEventsMonitor ()) { UninstallPackage (); } } void UninstallPackage () { ExtendedPackageManagementProject project = GetProject (); UninstallPackageAction action = CreateUninstallPackageAction (project); ExecuteWithScriptRunner (project, () => { action.Execute (); }); } ExtendedPackageManagementProject GetProject () { string source = null; return (ExtendedPackageManagementProject)ConsoleHost.GetProject (source, ProjectName); } UninstallPackageAction CreateUninstallPackageAction (ExtendedPackageManagementProject project) { UninstallPackageAction action = project.CreateUninstallPackageAction (); action.Package = project.ProjectManager.LocalRepository.FindPackage (Id, Version); action.ForceRemove = Force.IsPresent; action.RemoveDependencies = RemoveDependencies.IsPresent; // action.PackageScriptRunner = this; return action; } } }
// // UninstallPackageCmdlet.cs // // Author: // Matt Ward <ward.matt@gmail.com> // // Copyright (C) 2011-2014 Matthew Ward // // 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.Management.Automation; using ICSharpCode.PackageManagement.Scripting; using MonoDevelop.PackageManagement; using NuGet; namespace ICSharpCode.PackageManagement.Cmdlets { [Cmdlet (VerbsLifecycle.Uninstall, "Package", DefaultParameterSetName = ParameterAttribute.AllParameterSets)] public class UninstallPackageCmdlet : PackageManagementCmdlet { public UninstallPackageCmdlet () : this ( PackageManagementExtendedServices.ConsoleHost, null) { } public UninstallPackageCmdlet ( IPackageManagementConsoleHost consoleHost, ICmdletTerminatingError terminatingError) : base (consoleHost, terminatingError) { } [Parameter (Position = 0, Mandatory = true)] public string Id { get; set; } [Parameter (Position = 1)] public string ProjectName { get; set; } [Parameter (Position = 2)] public SemanticVersion Version { get; set; } [Parameter] public SwitchParameter Force { get; set; } [Parameter] public SwitchParameter RemoveDependencies { get; set; } protected override void ProcessRecord () { ThrowErrorIfProjectNotOpen (); using (IDisposable monitor = CreateEventsMonitor ()) { UninstallPackage (); } } void UninstallPackage () { IPackageManagementProject project = GetProject (); UninstallPackageAction action = CreateUninstallPackageAction (project); ExecuteWithScriptRunner (project, () => { action.Execute (); }); } IPackageManagementProject GetProject () { string source = null; return ConsoleHost.GetProject (source, ProjectName); } UninstallPackageAction CreateUninstallPackageAction (IPackageManagementProject project) { UninstallPackageAction action = project.CreateUninstallPackageAction (); action.PackageId = Id; action.PackageVersion = Version; action.ForceRemove = Force.IsPresent; action.RemoveDependencies = RemoveDependencies.IsPresent; // action.PackageScriptRunner = this; return action; } } }
mit
C#
d719aa4de393c6f8644b75f6e675ac986d9edc5c
Test Commit
TanmayDharmaraj/Hack-The-Algo
TheLoveLetterMystery/Program.cs
TheLoveLetterMystery/Program.cs
using System; using System.Linq; using System.Text; namespace TheLoveLetterMystery { class Program { static void Main(string[] args) { int testCases = Convert.ToInt32(Console.ReadLine()); int[] output = new int[testCases]; int count = 0; for (int i = 0; i < testCases; i++) { string console_input = Console.ReadLine(); char[] input = console_input.ToCharArray(); int halfLength = (input.Length) / 2; for (int j = 0; j < halfLength; j++) { char left_letter = input[j]; char right_letter = input[input.Length - 1 - j]; if (left_letter != right_letter) { count += Math.Abs((int)right_letter - (int)left_letter); } } output[i] = count; count = 0; } foreach (int value in output) { Console.WriteLine(value); } Console.ReadLine(); } } }
using System; using System.Linq; using System.Text; namespace TheLoveLetterMystery { class Program { static void Main(string[] args) { int testCases = Convert.ToInt32(Console.ReadLine()); int[] output = new int[testCases]; int count = 0; for (int i = 0; i < testCases; i++) { string console_input = Console.ReadLine(); char[] input = console_input.ToCharArray(); int halfLength = (input.Length) / 2; for (int j = 0; j < halfLength; j++) { char left_letter = input[j]; char right_letter = input[input.Length - 1 - j]; if (left_letter != right_letter) { count += Math.Abs((int)right_letter - (int)left_letter); } } output[i] = count; count = 0; } foreach (int value in output) { Console.WriteLine(value); } Console.ReadLine(); } } }
mit
C#
b207594a6c954506e5d745ca492907c30638bfb0
Update View convention to recognize MainWindow
distantcam/Pirac
src/Pirac/Conventions/ViewConvention.cs
src/Pirac/Conventions/ViewConvention.cs
using System; using Conventional.Conventions; namespace Pirac.Conventions { internal class ViewConvention : Convention { public ViewConvention() { Must.Pass(t => t.IsClass && (t.Name.EndsWith("View") || t.Name == "MainWindow"), "Name ends with View or is named MainWindow"); Should.BeAConcreteClass(); BaseName = t => t.Name == "MainWindow" ? t.Name : t.Name.Substring(0, t.Name.Length - 4); Variants.Add(new DelegateBaseFilter((t, b) => { if (t.Name == "MainWindow" && b == "MainWindow") return true; return t.Name == b + "View"; })); } class DelegateBaseFilter : IBaseFilter { private readonly Func<Type, string, bool> predicate; public DelegateBaseFilter(Func<Type, string, bool> predicate) { this.predicate = predicate; } public bool Matches(Type t, string baseName) { return predicate(t, baseName); } } } }
using Conventional.Conventions; namespace Pirac.Conventions { internal class ViewConvention : Convention { public ViewConvention() { Must.HaveNameEndWith("View").BeAClass(); Should.BeAConcreteClass(); BaseName = t => t.Name.Substring(0, t.Name.Length - 4); Variants.HaveBaseNameAndEndWith("View"); } } }
mit
C#
9383954d1658b31721eb510df5f2b54fa367014f
fix track description struct name encoding issue
xue-blood/wpfVlc,marcomeyer/Vlc.DotNet,thephez/Vlc.DotNet,jeremyVignelles/Vlc.DotNet,marcomeyer/Vlc.DotNet,xue-blood/wpfVlc,ZeBobo5/Vlc.DotNet,thephez/Vlc.DotNet
src/Vlc.DotNet.Core/TrackDescription.cs
src/Vlc.DotNet.Core/TrackDescription.cs
using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; using Vlc.DotNet.Core.Interops.Signatures; namespace Vlc.DotNet.Core { public sealed class TrackDescription { public int ID { get; private set; } public string Name { get; private set; } internal TrackDescription(int id, string name) { ID = id; Name = name; } internal static List<TrackDescription> GetSubTrackDescription(IntPtr moduleRef) { var result = new List<TrackDescription>(); if (moduleRef != IntPtr.Zero) { var module = (TrackDescriptionStructure)Marshal.PtrToStructure(moduleRef, typeof(TrackDescriptionStructure)); var name = Encoding.UTF8.GetString(Encoding.Default.GetBytes(module.Name)); result.Add(new TrackDescription(module.Id, name)); var data = GetSubTrackDescription(module.NextTrackDescription); result.AddRange(data); } return result; } } }
using System; using System.Collections.Generic; using System.Runtime.InteropServices; using Vlc.DotNet.Core.Interops.Signatures; namespace Vlc.DotNet.Core { public sealed class TrackDescription { public int ID { get; private set; } public string Name { get; private set; } internal TrackDescription(int id, string name) { ID = id; Name = name; } internal static List<TrackDescription> GetSubTrackDescription(IntPtr moduleRef) { var result = new List<TrackDescription>(); if (moduleRef != IntPtr.Zero) { var module = (TrackDescriptionStructure)Marshal.PtrToStructure(moduleRef, typeof(TrackDescriptionStructure)); result.Add(new TrackDescription(module.Id, module.Name)); var data = GetSubTrackDescription(module.NextTrackDescription); result.AddRange(data); } return result; } } }
mit
C#
ea61116b28b576ba502cd3ebd38646656d33b7c2
Update BrianBunke.cs
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/BrianBunke.cs
src/Firehose.Web/Authors/BrianBunke.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class BrianBunke : IAmACommunityMember, IFilterMyBlogPosts { public string FirstName => "Brian"; public string LastName => "Bunke"; public string ShortBioOrTagLine => "A self-deprecating Systems Automator interested in learning, testing, documenting, and open source."; public string StateOrRegion => "WA, USA"; public string EmailAddress => "me@brianbunke.com"; public string TwitterHandle => "brianbunke"; public string GitHubHandle => "brianbunke"; public string GravatarHash => "5eb2b9485a755280dc633d2a9ab2160b"; public GeoPosition Position => new GeoPosition(48.751911, -122.478685); public Uri WebSite => new Uri("https://www.brianbunke.com/"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.brianbunke.com/feed.xml"); } } public bool Filter(SyndicationItem item) { return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell")); } public string FeedLanguageCode => "en"; } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class BrianBunke : IAmACommunityMember, IFilterMyBlogPosts { public string FirstName => "Brian"; public string LastName => "Bunke"; public string ShortBioOrTagLine => "A self-deprecating Systems Automator interested in learning, testing, documenting, and open source."; public string StateOrRegion => "WA, USA"; public string EmailAddress => "me@brianbunke.com"; public string TwitterHandle => "brianbunke"; public string GitHubHandle => "brianbunke"; public string GravatarHash => ""; public GeoPosition Position => new GeoPosition(48.751911, -122.478685); public Uri WebSite => new Uri("https://www.brianbunke.com/"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.brianbunke.com/feed.xml"); } } public bool Filter(SyndicationItem item) { return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell")); } public string FeedLanguageCode => "en"; } }
mit
C#
5eb24f09cf7f04037cee14b837dc9187fb1ead8d
Make subscribe a bit more sync
northspb/RawRabbit,pardahlman/RawRabbit
src/RawRabbit/Operations/Subscriber.cs
src/RawRabbit/Operations/Subscriber.cs
using System; using System.Threading.Tasks; using RawRabbit.Common; using RawRabbit.Configuration.Subscribe; using RawRabbit.Consumer.Contract; using RawRabbit.Context; using RawRabbit.Context.Enhancer; using RawRabbit.Context.Provider; using RawRabbit.Logging; using RawRabbit.Operations.Contracts; using RawRabbit.Serialization; namespace RawRabbit.Operations { public class Subscriber<TMessageContext> : OperatorBase, ISubscriber<TMessageContext> where TMessageContext : IMessageContext { private readonly IConsumerFactory _consumerFactory; private readonly IMessageContextProvider<TMessageContext> _contextProvider; private readonly IContextEnhancer _contextEnhancer; private readonly ILogger _logger = LogManager.GetLogger<Subscriber<TMessageContext>>(); public Subscriber(IChannelFactory channelFactory, IConsumerFactory consumerFactory, IMessageSerializer serializer, IMessageContextProvider<TMessageContext> contextProvider, IContextEnhancer contextEnhancer) : base(channelFactory, serializer) { _consumerFactory = consumerFactory; _contextProvider = contextProvider; _contextEnhancer = contextEnhancer; } public void SubscribeAsync<T>(Func<T, TMessageContext, Task> subscribeMethod, SubscriptionConfiguration config) { DeclareQueue(config.Queue); DeclareExchange(config.Exchange); BindQueue(config.Queue, config.Exchange, config.RoutingKey); SubscribeAsync(config, subscribeMethod); } private void SubscribeAsync<T>(SubscriptionConfiguration cfg, Func<T, TMessageContext, Task> subscribeMethod) { var consumer = _consumerFactory.CreateConsumer(cfg); consumer.OnMessageAsync = (o, args) => { var body = Serializer.Deserialize<T>(args.Body); var context = _contextProvider.ExtractContext(args.BasicProperties.Headers[_contextProvider.ContextHeaderName]); _contextEnhancer.WireUpContextFeatures(context, consumer, args); return subscribeMethod(body, context); }; consumer.Model.BasicConsume(cfg.Queue.QueueName, cfg.NoAck, consumer); _logger.LogDebug($"Setting up a consumer on queue {cfg.Queue.QueueName} with NoAck set to {cfg.NoAck}."); } public override void Dispose() { _logger.LogDebug("Disposing Subscriber."); base.Dispose(); (_consumerFactory as IDisposable)?.Dispose(); } } }
using System; using System.Threading.Tasks; using RawRabbit.Common; using RawRabbit.Configuration.Subscribe; using RawRabbit.Consumer.Contract; using RawRabbit.Context; using RawRabbit.Context.Enhancer; using RawRabbit.Context.Provider; using RawRabbit.Logging; using RawRabbit.Operations.Contracts; using RawRabbit.Serialization; namespace RawRabbit.Operations { public class Subscriber<TMessageContext> : OperatorBase, ISubscriber<TMessageContext> where TMessageContext : IMessageContext { private readonly IConsumerFactory _consumerFactory; private readonly IMessageContextProvider<TMessageContext> _contextProvider; private readonly IContextEnhancer _contextEnhancer; private readonly ILogger _logger = LogManager.GetLogger<Subscriber<TMessageContext>>(); public Subscriber(IChannelFactory channelFactory, IConsumerFactory consumerFactory, IMessageSerializer serializer, IMessageContextProvider<TMessageContext> contextProvider, IContextEnhancer contextEnhancer) : base(channelFactory, serializer) { _consumerFactory = consumerFactory; _contextProvider = contextProvider; _contextEnhancer = contextEnhancer; } public void SubscribeAsync<T>(Func<T, TMessageContext, Task> subscribeMethod, SubscriptionConfiguration config) { DeclareQueue(config.Queue); DeclareExchange(config.Exchange); BindQueue(config.Queue, config.Exchange, config.RoutingKey); SubscribeAsync(config, subscribeMethod); } private void SubscribeAsync<T>(SubscriptionConfiguration cfg, Func<T, TMessageContext, Task> subscribeMethod) { var consumer = _consumerFactory.CreateConsumer(cfg); consumer.OnMessageAsync = (o, args) => { var bodyTask = Task.Run(() => Serializer.Deserialize<T>(args.Body)); var contextTask = _contextProvider .ExtractContextAsync(args.BasicProperties.Headers[_contextProvider.ContextHeaderName]) .ContinueWith(ctxTask => { _contextEnhancer.WireUpContextFeatures(ctxTask.Result, consumer, args); return ctxTask.Result; }); return Task .WhenAll(bodyTask, contextTask) .ContinueWith(task => subscribeMethod(bodyTask.Result, contextTask.Result)); }; consumer.Model.BasicConsume(cfg.Queue.QueueName, cfg.NoAck, consumer); _logger.LogDebug($"Setting up a consumer on queue {cfg.Queue.QueueName} with NoAck set to {cfg.NoAck}."); } public override void Dispose() { _logger.LogDebug("Disposing Subscriber."); base.Dispose(); (_consumerFactory as IDisposable)?.Dispose(); } } }
mit
C#
6f98c94b7f28b4021ebea040dccaef6a265e2293
Remove unused import
takenet/elephant
src/Take.Elephant.Sql/SqlExtensions.cs
src/Take.Elephant.Sql/SqlExtensions.cs
using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Linq; using Take.Elephant.Sql.Mapping; namespace Take.Elephant.Sql { public static class SqlExtensions { /// <summary> /// Transform to a flat string with comma separate values. /// </summary> /// <param name="values"></param> /// <returns></returns> public static string ToCommaSeparate(this IEnumerable<string> values) { return values.Aggregate((a, b) => $"{a},{b}").TrimEnd(','); } public static DbParameter ToDbParameter(this KeyValuePair<string, object> keyValuePair, IDatabaseDriver databaseDriver) { return databaseDriver.CreateParameter(databaseDriver.ParseParameterName(keyValuePair.Key), keyValuePair.Value); } public static DbParameter ToDbParameter(this KeyValuePair<string, object> keyValuePair, IDatabaseDriver databaseDriver, SqlType sqlType) { return databaseDriver.CreateParameter(databaseDriver.ParseParameterName(keyValuePair.Key), keyValuePair.Value, sqlType); } public static DbParameter ToDbParameter( this KeyValuePair<string, object> keyValuePair, IDatabaseDriver databaseDriver, IDictionary<string, SqlType> columnTypes) { SqlType sqlType; if (columnTypes.TryGetValue(keyValuePair.Key, out sqlType)) { return keyValuePair.ToDbParameter(databaseDriver, sqlType); } // Queries with multiples parameters for same column add separator between the parameter name and the parameter number. // Try to get the sqlType for parameter spliting the key on the parameter separator var key = keyValuePair.Key.Split(SqlExpressionTranslator.PARAMETER_COUNT_SEPARATOR)[0]; return columnTypes.TryGetValue(key, out sqlType) ? keyValuePair.ToDbParameter(databaseDriver, sqlType) : keyValuePair.ToDbParameter(databaseDriver); } public static IEnumerable<DbParameter> ToDbParameters( this IDictionary<string, object> parameters, IDatabaseDriver databaseDriver, ITable table) { return parameters.Select(p => p.ToDbParameter(databaseDriver, table.Columns)); } } }
using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Linq; using System.Text.RegularExpressions; using Take.Elephant.Sql.Mapping; namespace Take.Elephant.Sql { public static class SqlExtensions { /// <summary> /// Transform to a flat string with comma separate values. /// </summary> /// <param name="values"></param> /// <returns></returns> public static string ToCommaSeparate(this IEnumerable<string> values) { return values.Aggregate((a, b) => $"{a},{b}").TrimEnd(','); } public static DbParameter ToDbParameter(this KeyValuePair<string, object> keyValuePair, IDatabaseDriver databaseDriver) { return databaseDriver.CreateParameter(databaseDriver.ParseParameterName(keyValuePair.Key), keyValuePair.Value); } public static DbParameter ToDbParameter(this KeyValuePair<string, object> keyValuePair, IDatabaseDriver databaseDriver, SqlType sqlType) { return databaseDriver.CreateParameter(databaseDriver.ParseParameterName(keyValuePair.Key), keyValuePair.Value, sqlType); } public static DbParameter ToDbParameter( this KeyValuePair<string, object> keyValuePair, IDatabaseDriver databaseDriver, IDictionary<string, SqlType> columnTypes) { SqlType sqlType; if (columnTypes.TryGetValue(keyValuePair.Key, out sqlType)) { return keyValuePair.ToDbParameter(databaseDriver, sqlType); } // Queries with multiples parameters for same column add separator between the parameter name and the parameter number. // Try to get the sqlType for parameter spliting the key on the parameter separator var key = keyValuePair.Key.Split(SqlExpressionTranslator.PARAMETER_COUNT_SEPARATOR)[0]; return columnTypes.TryGetValue(key, out sqlType) ? keyValuePair.ToDbParameter(databaseDriver, sqlType) : keyValuePair.ToDbParameter(databaseDriver); } public static IEnumerable<DbParameter> ToDbParameters( this IDictionary<string, object> parameters, IDatabaseDriver databaseDriver, ITable table) { return parameters.Select(p => p.ToDbParameter(databaseDriver, table.Columns)); } } }
apache-2.0
C#
85830fbd4588ab8c4ea82efcb40ba65c5d6491d8
Fix task delay
proyecto26/Xamarin
src/android/App/App/Utilities/Azure.cs
src/android/App/App/Utilities/Azure.cs
using Microsoft.WindowsAzure.MobileServices; using System.Threading.Tasks; using Newtonsoft.Json; using Moq; using Newtonsoft.Json.Linq; using System.Threading; namespace App.Utilities { public class ServiceHelper { private IMobileServiceTable<User> _userTable; //MobileServiceClient client = new MobileServiceClient(@"http://my-website.azurewebsites.net/"); private Mock<IMobileServiceClient> mockClient; private Mock<IMobileServiceTable<User>> mockTable; public ServiceHelper() { mockClient = new Mock<IMobileServiceClient>(MockBehavior.Strict); mockTable = new Mock<IMobileServiceTable<User>>(MockBehavior.Strict); mockTable .Setup(m => m.InsertAsync(It.IsAny<User>())) .Returns(Task.Delay(5000)); mockClient .Setup(m => m.GetTable<User>()) .Returns(mockTable.Object); } public async Task<bool> addUser(string email, string name, string deviceId) { try { _userTable = mockClient.Object.GetTable<User>(); await _userTable.InsertAsync(new User { Email = email, Name = name, DeviceId = deviceId }); return true; } catch { return false; } } } public class User { public string Id { get; set; } public string Email { get; set; } public string Name { get; set; } public string DeviceId { get; set; } } }
using Microsoft.WindowsAzure.MobileServices; using System.Threading.Tasks; using Newtonsoft.Json; using Moq; using Newtonsoft.Json.Linq; using System.Threading; namespace App.Utilities { public class ServiceHelper { private IMobileServiceTable<User> _userTable; //MobileServiceClient client = new MobileServiceClient(@"http://my-website.azurewebsites.net/"); private Mock<IMobileServiceClient> mockClient; private Mock<IMobileServiceTable<User>> mockTable; public ServiceHelper() { mockClient = new Mock<IMobileServiceClient>(MockBehavior.Loose); mockTable = new Mock<IMobileServiceTable<User>>(MockBehavior.Loose); var item = new User(); mockTable .Setup(m => m.InsertAsync(item)) .Returns(() => { Thread.Sleep(10000); return Task.CompletedTask; }); mockClient .Setup(m => m.GetTable<User>()) .Returns(mockTable.Object); } public async Task<bool> addUser(string email, string name, string deviceId) { try { _userTable = mockClient.Object.GetTable<User>(); await _userTable.InsertAsync(new User { Email = email, Name = name, DeviceId = deviceId }); } catch (System.Exception) { return false; } return true; } } public class User { public string Id { get; set; } public string Email { get; set; } public string Name { get; set; } public string DeviceId { get; set; } } }
mit
C#
c764e459af72f1d6319b7bf3ea669db12bc12cdd
Rename variable
appharbor/appharbor-cli
src/AppHarbor/Commands/CreateCommand.cs
src/AppHarbor/Commands/CreateCommand.cs
using System; using System.Linq; namespace AppHarbor.Commands { public class CreateCommand : ICommand { private readonly IAppHarborClient _appHarborClient; private readonly ApplicationConfiguration _applicationConfiguration; public CreateCommand(IAppHarborClient appHarborClient, ApplicationConfiguration applicationConfiguration) { _appHarborClient = appHarborClient; _applicationConfiguration = applicationConfiguration; } public void Execute(string[] arguments) { if (arguments.Length == 0) { throw new CommandException("An application name must be provided to create an application"); } var result = _appHarborClient.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()); } } }
using System; using System.Linq; namespace AppHarbor.Commands { public class CreateCommand : ICommand { private readonly IAppHarborClient _appHarborClient; private readonly ApplicationConfiguration _applicationConfiguration; public CreateCommand(IAppHarborClient appHarborClient, ApplicationConfiguration applicationConfiguration) { _appHarborClient = appHarborClient; _applicationConfiguration = applicationConfiguration; } public void Execute(string[] arguments) { if (arguments.Length == 0) { throw new CommandException("An application name must be provided to create an application"); } var test = _appHarborClient.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()); } } }
mit
C#
809fc29bb7947355d3af1e1c421d230a59c0b2c4
Handle null _value
tmeschter/roslyn,mmitche/roslyn,panopticoncentral/roslyn,DustinCampbell/roslyn,dpoeschl/roslyn,sharwell/roslyn,VSadov/roslyn,dotnet/roslyn,MattWindsor91/roslyn,khyperia/roslyn,Giftednewt/roslyn,paulvanbrenk/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,MattWindsor91/roslyn,eriawan/roslyn,abock/roslyn,eriawan/roslyn,diryboy/roslyn,AmadeusW/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mgoertz-msft/roslyn,wvdd007/roslyn,paulvanbrenk/roslyn,abock/roslyn,reaction1989/roslyn,reaction1989/roslyn,mavasani/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tmat/roslyn,wvdd007/roslyn,jmarolf/roslyn,MichalStrehovsky/roslyn,heejaechang/roslyn,orthoxerox/roslyn,jasonmalinowski/roslyn,jamesqo/roslyn,cston/roslyn,davkean/roslyn,khyperia/roslyn,KirillOsenkov/roslyn,sharwell/roslyn,tmeschter/roslyn,tvand7093/roslyn,pdelvo/roslyn,Giftednewt/roslyn,srivatsn/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,swaroop-sridhar/roslyn,shyamnamboodiripad/roslyn,bkoelman/roslyn,swaroop-sridhar/roslyn,tannergooding/roslyn,sharwell/roslyn,kelltrick/roslyn,genlu/roslyn,mattscheffer/roslyn,jkotas/roslyn,kelltrick/roslyn,heejaechang/roslyn,panopticoncentral/roslyn,jcouv/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,panopticoncentral/roslyn,MattWindsor91/roslyn,khyperia/roslyn,weltkante/roslyn,robinsedlaczek/roslyn,abock/roslyn,diryboy/roslyn,pdelvo/roslyn,MichalStrehovsky/roslyn,Giftednewt/roslyn,agocke/roslyn,OmarTawfik/roslyn,brettfo/roslyn,orthoxerox/roslyn,aelij/roslyn,TyOverby/roslyn,robinsedlaczek/roslyn,pdelvo/roslyn,CyrusNajmabadi/roslyn,lorcanmooney/roslyn,dotnet/roslyn,bartdesmet/roslyn,weltkante/roslyn,nguerrera/roslyn,AnthonyDGreen/roslyn,stephentoub/roslyn,agocke/roslyn,AlekseyTs/roslyn,nguerrera/roslyn,stephentoub/roslyn,AmadeusW/roslyn,aelij/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,stephentoub/roslyn,CaptainHayashi/roslyn,dotnet/roslyn,MichalStrehovsky/roslyn,robinsedlaczek/roslyn,AmadeusW/roslyn,mattscheffer/roslyn,physhi/roslyn,paulvanbrenk/roslyn,jkotas/roslyn,aelij/roslyn,OmarTawfik/roslyn,jmarolf/roslyn,jkotas/roslyn,davkean/roslyn,tannergooding/roslyn,dpoeschl/roslyn,srivatsn/roslyn,brettfo/roslyn,mgoertz-msft/roslyn,AnthonyDGreen/roslyn,jasonmalinowski/roslyn,agocke/roslyn,wvdd007/roslyn,CaptainHayashi/roslyn,jmarolf/roslyn,AnthonyDGreen/roslyn,bartdesmet/roslyn,VSadov/roslyn,ErikSchierboom/roslyn,Hosch250/roslyn,orthoxerox/roslyn,lorcanmooney/roslyn,jamesqo/roslyn,eriawan/roslyn,physhi/roslyn,TyOverby/roslyn,gafter/roslyn,tvand7093/roslyn,tmeschter/roslyn,mmitche/roslyn,KevinRansom/roslyn,MattWindsor91/roslyn,tmat/roslyn,brettfo/roslyn,bkoelman/roslyn,nguerrera/roslyn,jcouv/roslyn,dpoeschl/roslyn,xasx/roslyn,jcouv/roslyn,xasx/roslyn,shyamnamboodiripad/roslyn,mmitche/roslyn,physhi/roslyn,Hosch250/roslyn,tannergooding/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,tvand7093/roslyn,AlekseyTs/roslyn,TyOverby/roslyn,DustinCampbell/roslyn,diryboy/roslyn,lorcanmooney/roslyn,KevinRansom/roslyn,VSadov/roslyn,CaptainHayashi/roslyn,genlu/roslyn,DustinCampbell/roslyn,davkean/roslyn,shyamnamboodiripad/roslyn,cston/roslyn,reaction1989/roslyn,tmat/roslyn,jamesqo/roslyn,mattscheffer/roslyn,OmarTawfik/roslyn,bkoelman/roslyn,gafter/roslyn,cston/roslyn,kelltrick/roslyn,weltkante/roslyn,KevinRansom/roslyn,srivatsn/roslyn,AlekseyTs/roslyn,swaroop-sridhar/roslyn,Hosch250/roslyn,gafter/roslyn,xasx/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,genlu/roslyn
src/Compilers/Core/Portable/Optional.cs
src/Compilers/Core/Portable/Optional.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; namespace Microsoft.CodeAnalysis { /// <summary> /// Combines a value, <see cref="Value"/>, and a flag, <see cref="HasValue"/>, /// indicating whether or not that value is meaningful. /// </summary> /// <typeparam name="T">The type of the value.</typeparam> public struct Optional<T> { private readonly bool _hasValue; private readonly T _value; /// <summary> /// Constructs an <see cref="Optional{T}"/> with a meaningful value. /// </summary> /// <param name="value"></param> public Optional(T value) { _hasValue = true; _value = value; } /// <summary> /// Returns <see langword="true"/> if the <see cref="Value"/> will return a meaningful value. /// </summary> /// <returns></returns> public bool HasValue { get { return _hasValue; } } /// <summary> /// Gets the value of the current object. Not meaningful unless <see cref="HasValue"/> returns <see langword="true"/>. /// </summary> /// <remarks> /// <para>Unlike <see cref="Nullable{T}.Value"/>, this property does not throw an exception when /// <see cref="HasValue"/> is <see langword="false"/>.</para> /// </remarks> /// <returns> /// <para>The value if <see cref="HasValue"/> is <see langword="true"/>; otherwise, the default value for type /// <typeparamref name="T"/>.</para> /// </returns> public T Value { get { return _value; } } /// <summary> /// Creates a new object initialized to a meaningful value. /// </summary> /// <param name="value"></param> public static implicit operator Optional<T>(T value) { return new Optional<T>(value); } /// <summary> /// Returns a string representation of this object. /// </summary> public override string ToString() { // Note: For nullable types, it's possible to have _hasValue true and _value null. return _hasValue ? _value?.ToString() ?? "null" : "unspecified"; } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; namespace Microsoft.CodeAnalysis { /// <summary> /// Combines a value, <see cref="Value"/>, and a flag, <see cref="HasValue"/>, /// indicating whether or not that value is meaningful. /// </summary> /// <typeparam name="T">The type of the value.</typeparam> public struct Optional<T> { private readonly bool _hasValue; private readonly T _value; /// <summary> /// Constructs an <see cref="Optional{T}"/> with a meaningful value. /// </summary> /// <param name="value"></param> public Optional(T value) { _hasValue = true; _value = value; } /// <summary> /// Returns <see langword="true"/> if the <see cref="Value"/> will return a meaningful value. /// </summary> /// <returns></returns> public bool HasValue { get { return _hasValue; } } /// <summary> /// Gets the value of the current object. Not meaningful unless <see cref="HasValue"/> returns <see langword="true"/>. /// </summary> /// <remarks> /// <para>Unlike <see cref="Nullable{T}.Value"/>, this property does not throw an exception when /// <see cref="HasValue"/> is <see langword="false"/>.</para> /// </remarks> /// <returns> /// <para>The value if <see cref="HasValue"/> is <see langword="true"/>; otherwise, the default value for type /// <typeparamref name="T"/>.</para> /// </returns> public T Value { get { return _value; } } /// <summary> /// Creates a new object initialized to a meaningful value. /// </summary> /// <param name="value"></param> public static implicit operator Optional<T>(T value) { return new Optional<T>(value); } /// <summary> /// Returns a string representation of this object. /// </summary> public override string ToString() { return _hasValue ? _value.ToString() : "null"; } } }
mit
C#
64810a8aee2c73eebe27c59a78730fa31218a7e0
update console logger, removes coloring from all except error logging
tsolarin/dotnet-globals,tsolarin/dotnet-globals
src/DotNet.Globals.Cli/ConsoleLogger.cs
src/DotNet.Globals.Cli/ConsoleLogger.cs
namespace DotNet.Globals.Cli { using System; using DotNet.Globals.Core.Logging; class ConsoleLogger : ILogger { private void Log(string data) => Console.WriteLine(data); public void LogSuccess(string data) => Log($"LOG: {data}"); public void LogError(string data) { Console.ForegroundColor = ConsoleColor.DarkRed; Log(data); Console.ResetColor(); } public void LogInformation(string data) => Log($"INFO: {data}"); public void LogVerbose(string data) { } public void LogWarning(string data) => Log($"WARNING: {data}"); } }
namespace DotNet.Globals.Cli { using System; using DotNet.Globals.Core.Logging; class ConsoleLogger : ILogger { private void Log(string data) { Console.WriteLine(data); } public void LogSuccess(string data) { Console.ForegroundColor = ConsoleColor.DarkGreen; Log(data); Console.ResetColor(); } public void LogError(string data) { Console.ForegroundColor = ConsoleColor.DarkRed; Log(data); Console.ResetColor(); } public void LogInformation(string data) => Log(data); public void LogVerbose(string data) => Log(data); public void LogWarning(string data) { Console.ForegroundColor = ConsoleColor.DarkYellow; Log(data); Console.ResetColor(); } } }
mit
C#
ded606b306d7e046df14964c68021157c7dbe0f4
Fix Overlap detection
ektrah/nsec
src/Cryptography/Utilities.cs
src/Cryptography/Utilities.cs
using System; using System.Runtime.CompilerServices; namespace NSec.Cryptography { internal static class Utilities { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe bool Overlap( ReadOnlySpan<byte> first, ReadOnlySpan<byte> second) { return Overlap(first, second, out _); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe bool Overlap( ReadOnlySpan<byte> first, ReadOnlySpan<byte> second, out IntPtr byteOffset) { byteOffset = Unsafe.ByteOffset(ref first.DangerousGetPinnableReference(), ref second.DangerousGetPinnableReference()); return (sizeof(IntPtr) == sizeof(int)) ? !first.IsEmpty && !second.IsEmpty && unchecked((uint)byteOffset < (uint)first.Length || (uint)byteOffset > (uint)-second.Length) : !first.IsEmpty && !second.IsEmpty && unchecked((ulong)byteOffset < (ulong)first.Length || (ulong)byteOffset > (ulong)-second.Length); } } }
using System; using System.Runtime.CompilerServices; namespace NSec.Cryptography { internal static class Utilities { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe bool Overlap( ReadOnlySpan<byte> first, ReadOnlySpan<byte> second) { return Overlap(first, second, out _); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe bool Overlap( ReadOnlySpan<byte> first, ReadOnlySpan<byte> second, out IntPtr byteOffset) { byteOffset = Unsafe.ByteOffset(ref first.DangerousGetPinnableReference(), ref second.DangerousGetPinnableReference()); return (sizeof(IntPtr) == sizeof(int)) ? second.Length != 0 && unchecked((uint)byteOffset < (uint)first.Length || (uint)byteOffset > (uint)-second.Length) : second.Length != 0 && unchecked((ulong)byteOffset < (ulong)first.Length || (ulong)byteOffset > (ulong)-second.Length); } } }
mit
C#
b620ce7ff8552fc8d09b35acfa0acb891e17a653
Change version to 0.3
kornelijepetak/incident-cs
IncidentCS/Properties/AssemblyInfo.cs
IncidentCS/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Incident CS")] [assembly: AssemblyDescription("A world of everything random")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IncidentCS")] [assembly: AssemblyCopyright("Copyright © 2015 Kornelije Petak")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("3d979b62-8988-4740-97d3-fca97e9f0277")] [assembly: AssemblyVersion("0.0.3.0")] [assembly: AssemblyFileVersion("0.0.3.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Incident CS")] [assembly: AssemblyDescription("A world of everything random")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IncidentCS")] [assembly: AssemblyCopyright("Copyright © 2015 Kornelije Petak")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("3d979b62-8988-4740-97d3-fca97e9f0277")] [assembly: AssemblyVersion("0.0.2.0")] [assembly: AssemblyFileVersion("0.0.2.0")]
mit
C#
f2494a0983dbb70e68f6332b7d5eb9d079ac47ec
Update AssemblyInfo.cs
Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal
Master/Appleseed/Projects/Appleseed.Framework.Providers.AppleseedMembershipProvider/Properties/AssemblyInfo.cs
Master/Appleseed/Projects/Appleseed.Framework.Providers.AppleseedMembershipProvider/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( "Appleseed.Framework.Providers.AppleseedMembershipProvider" )] [assembly: AssemblyDescription("Appleseed Portal and Content Management System")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ANANT Corporation")] [assembly: AssemblyProduct("Appleseed Portal")] [assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-2017")] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible( false )] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid( "32cc44c1-479d-41e0-bd50-ae0d12c3dcb1" )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion( "1.4.98.383" )] [assembly: AssemblyFileVersion( "1.4.98.383" )]
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( "Appleseed.Framework.Providers.AppleseedMembershipProvider" )] [assembly: AssemblyDescription("Appleseed Portal and Content Management System")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ANANT Corporation")] [assembly: AssemblyProduct("Appleseed Portal")] [assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-2016")] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible( false )] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid( "32cc44c1-479d-41e0-bd50-ae0d12c3dcb1" )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion( "1.0.0.0" )] [assembly: AssemblyFileVersion( "1.0.0.0" )]
apache-2.0
C#
663c2e327c88d0839dd7ebd683318b956ca7b5be
Add nofollow to API example links
ShamsulAmry/Malaysia-GST-Checker
Amry.Gst.Web/Views/Home/Api.cshtml
Amry.Gst.Web/Views/Home/Api.cshtml
@{ ViewBag.Title = "Malaysia GST Checker - Developer API"; ViewBag.PageTag = PageTag.Api; } <div class="row"> <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8"> <h1>API for Developers</h1> <div class="panel panel-primary"> <div class="panel-heading"> <div class="panel-title">Few Examples</div> </div> <div class="panel-body"> <ol> <li>Search by GST Number: <a href="~/api/GstNo/001609433088" target="_blank" rel="nofollow">http://gst.amry.my/api/GstNo/001609433088</a></li> <li>Search by Business Registration Number: <a href="~/api/BizRegNo/419060-A" target="_blank" rel="nofollow">http://gst.amry.my/api/BizRegNo/419060-A</a></li> <li>Search by Business Name: <a href="~/api/BizName/POS_M" target="_blank" rel="nofollow">http://gst.amry.my/api/BizName/POS_M</a></li> </ol> </div> </div> <div class="panel panel-warning"> <div class="panel-heading"> <div class="panel-title">Disclaimer</div> </div> <div class="panel-body"> <ol> <li>The data is not mine. I simply made an API that will get the data from the official website.</li> <li>I reserve the right to change the API or bring it down at any time without notice.</li> <li>You are free to use this API and I shall not be held responsible on what comes out of the usage of this API.</li> </ol> </div> </div> </div> </div>
@{ ViewBag.Title = "Malaysia GST Checker - Developer API"; ViewBag.PageTag = PageTag.Api; } <div class="row"> <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8"> <h1>API for Developers</h1> <div class="panel panel-primary"> <div class="panel-heading"> <div class="panel-title">Few Examples</div> </div> <div class="panel-body"> <ol> <li>Search by GST Number: <a href="~/api/GstNo/001609433088" target="_blank">http://gst.amry.my/api/GstNo/001609433088</a></li> <li>Search by Business Registration Number: <a href="~/api/BizRegNo/419060-A" target="_blank">http://gst.amry.my/api/BizRegNo/419060-A</a></li> <li>Search by Business Name: <a href="~/api/BizName/POS_M" target="_blank">http://gst.amry.my/api/BizName/POS_M</a></li> </ol> </div> </div> <div class="panel panel-warning"> <div class="panel-heading"> <div class="panel-title">Disclaimer</div> </div> <div class="panel-body"> <ol> <li>The data is not mine. I simply made an API that will get the data from the official website.</li> <li>I reserve the right to change the API or bring it down at any time without notice.</li> <li>You are free to use this API and I shall not be held responsible on what comes out of the usage of this API.</li> </ol> </div> </div> </div> </div>
mit
C#
dcae587c89f2838561b98a0b3f49cf2c892e485d
Handle SocketException in UT
PNSolutions/MegaApiClient,gpailler/MegaApiClient
MegaApiClient.Tests/PollyWebClient.cs
MegaApiClient.Tests/PollyWebClient.cs
using System; using System.IO; using System.Net; using System.Net.Sockets; using Polly; namespace CG.Web.MegaApiClient.Tests { internal class PollyWebClient : IWebClient { private readonly IWebClient _webClient; private readonly Policy _policy; public PollyWebClient(IWebClient webClient, int maxRetry) { this._webClient = webClient; this._policy = Policy .Handle<WebException>(ex => ex.Status == WebExceptionStatus.Timeout) .Or<SocketException>() .WaitAndRetry(maxRetry, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (ex, ts) => Console.WriteLine(ex.Message)); } public string PostRequestJson(Uri url, string jsonData) { return this._policy.Execute(() => this._webClient.PostRequestJson(url, jsonData)); } public string PostRequestRaw(Uri url, Stream dataStream) { return this._policy.Execute(() => this._webClient.PostRequestRaw(url, dataStream)); } public Stream GetRequestRaw(Uri url) { return this._policy.Execute(() => this._webClient.GetRequestRaw(url)); } } }
using System; using System.IO; using System.Net; using Polly; namespace CG.Web.MegaApiClient.Tests { internal class PollyWebClient : IWebClient { private readonly IWebClient _webClient; private readonly Policy _policy; public PollyWebClient(IWebClient webClient, int maxRetry) { this._webClient = webClient; this._policy = Policy .Handle<WebException>(ex => ex.Status == WebExceptionStatus.Timeout) .WaitAndRetry(maxRetry, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (ex, ts) => Console.WriteLine(ex.Message)); } public string PostRequestJson(Uri url, string jsonData) { return this._policy.Execute(() => this._webClient.PostRequestJson(url, jsonData)); } public string PostRequestRaw(Uri url, Stream dataStream) { return this._policy.Execute(() => this._webClient.PostRequestRaw(url, dataStream)); } public Stream GetRequestRaw(Uri url) { return this._policy.Execute(() => this._webClient.GetRequestRaw(url)); } } }
mit
C#
35910f7c58afa2ddfc7c62551003ade407afc2e0
Add Title to Notification object
ucdavis/Badges,ucdavis/Badges
Badges.Core/Domain/Notification.cs
Badges.Core/Domain/Notification.cs
using System; using FluentNHibernate.Mapping; namespace Badges.Core.Domain { public class Notification : DomainObjectGuid { public virtual User To { get; set; } public virtual bool Pending { get; set; } public virtual DateTime Created { get; set; } public virtual string Message { get; set; } public virtual string Title { get; set; } } public class NotificationMap : ClassMap<Notification> { public NotificationMap() { Id(x => x.Id).GeneratedBy.GuidComb(); Map(x => x.Pending).Not.Nullable(); Map(x => x.Created).Not.Nullable(); Map(x => x.Message).StringMaxLength(); Map(x => x.Title).StringMaxLength(); References(x => x.To).Not.Nullable(); } } }
using System; using FluentNHibernate.Mapping; namespace Badges.Core.Domain { public class Notification : DomainObjectGuid { public virtual User To { get; set; } public virtual bool Pending { get; set; } public virtual DateTime Created { get; set; } public virtual string Message { get; set; } } public class NotificationMap : ClassMap<Notification> { public NotificationMap() { Id(x => x.Id).GeneratedBy.GuidComb(); Map(x => x.Pending).Not.Nullable(); Map(x => x.Created).Not.Nullable(); Map(x => x.Message).StringMaxLength(); References(x => x.To).Not.Nullable(); } } }
mpl-2.0
C#
b0319dd872a3ab3ef0b3e4d8f6cb6fdb364ba843
Increase test coverage.
gustavofrizzo/BinInfo
BinInfoUnitTest/BinInfoUnitTest.cs
BinInfoUnitTest/BinInfoUnitTest.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using BinInfo; namespace BinInfoUnitTest { [TestClass] public class BinInfoUnitTest { [TestMethod] public void Find_BinListTest() { IssuerInformation info = BinList.Find("431940"); Assert.AreEqual("431940", info.Bin); Assert.AreEqual("VISA", info.Brand); Assert.AreEqual("IE", info.CountryCode); Assert.AreEqual("Ireland", info.CountryName); Assert.AreEqual("BANK OF IRELAND", info.Bank); Assert.AreEqual("DEBIT", info.CardType); Assert.AreEqual("53", info.Latitude); Assert.AreEqual("-8", info.Longitude); Assert.AreEqual("", info.SubBrand); Assert.AreEqual("", info.CardCategory); } [TestMethod] [ExpectedException(typeof(ArgumentNullException))] public void ArgumentNullException_BinListTest() { var info = BinList.Find(null); } [TestMethod] [ExpectedException(typeof(ArgumentException))] public void ArgumentException_BinListTest() { var info = BinList.Find("333g12"); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using BinInfo; namespace BinInfoUnitTest { [TestClass] public class BinInfoUnitTest { [TestMethod] public void Find_BinListTest() { IssuerInformation info = BinList.Find("431940"); Assert.AreEqual("431940", info.Bin); Assert.AreEqual("VISA", info.Brand); Assert.AreEqual("IE", info.CountryCode); Assert.AreEqual("Ireland", info.CountryName); Assert.AreEqual("BANK OF IRELAND", info.Bank); Assert.AreEqual("DEBIT", info.CardType); Assert.AreEqual("53", info.Latitude); Assert.AreEqual("-8", info.Longitude); Assert.AreEqual("", info.SubBrand); Assert.AreEqual("", info.CardCategory); } } }
mit
C#
db1c0b83ab014a70549d1f3a5f0a17674f21136d
Change reference to DependencyInjection.IServiceCollection
acastaner/acastaner.fr-mvc6,acastaner/acastaner.fr-mvc6
src/acastaner_mvc6/Startup.cs
src/acastaner_mvc6/Startup.cs
using System; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.Framework.DependencyInjection; namespace acastaner_mvc6 { public class Startup { public void ConfigureServices(Microsoft.Framework.DependencyInjection.IServiceCollection services) { services.AddMvc(); } public void Configure(IApplicationBuilder app) { app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); }); } } }
using System; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.Framework.DependencyInjection; namespace acastaner_mvc6 { public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddMvc(); } public void Configure(IApplicationBuilder app) { app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); }); } } }
mit
C#
10c20edee1427615d04447b2ffa7cd9fb0cd58b9
Install NuGet as a tool
mitchelsellers/Dnn.Platform,mitchelsellers/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,bdukes/Dnn.Platform,valadas/Dnn.Platform,dnnsoftware/Dnn.Platform,nvisionative/Dnn.Platform,mitchelsellers/Dnn.Platform,valadas/Dnn.Platform,dnnsoftware/Dnn.Platform,nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,valadas/Dnn.Platform,valadas/Dnn.Platform,bdukes/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.Platform,bdukes/Dnn.Platform,nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,bdukes/Dnn.Platform
Build/Program.cs
Build/Program.cs
using System; using System.Collections.Generic; using System.IO; using Cake.Core; using Cake.Core.Configuration; using Cake.Frosting; using Cake.NuGet; public class Program : IFrostingStartup { public static int Main(string[] args) { // Create the host. var host = new CakeHostBuilder() .WithArguments(args) .UseStartup<Program>() .Build(); // Run the host. return host.Run(); } public void Configure(ICakeServices services) { services.UseContext<Context>(); services.UseLifetime<Lifetime>(); services.UseWorkingDirectory(".."); // from https://github.com/cake-build/cake/discussions/2931 var module = new NuGetModule(new CakeConfiguration(new Dictionary<string, string>())); module.Register(services); services.UseTool(new Uri("nuget:?package=GitVersion.CommandLine&version=5.0.1")); services.UseTool(new Uri("nuget:?package=Microsoft.TestPlatform&version=16.8.0")); services.UseTool(new Uri("nuget:?package=NUnitTestAdapter&version=2.3.0")); services.UseTool(new Uri("nuget:?package=NuGet.CommandLine&version=5.8.0")); } }
using System; using System.Collections.Generic; using System.IO; using Cake.Core; using Cake.Core.Configuration; using Cake.Frosting; using Cake.NuGet; public class Program : IFrostingStartup { public static int Main(string[] args) { // Create the host. var host = new CakeHostBuilder() .WithArguments(args) .UseStartup<Program>() .Build(); // Run the host. return host.Run(); } public void Configure(ICakeServices services) { services.UseContext<Context>(); services.UseLifetime<Lifetime>(); services.UseWorkingDirectory(".."); // from https://github.com/cake-build/cake/discussions/2931 var module = new NuGetModule(new CakeConfiguration(new Dictionary<string, string>())); module.Register(services); services.UseTool(new Uri("nuget:?package=GitVersion.CommandLine&version=5.0.1")); services.UseTool(new Uri("nuget:?package=Microsoft.TestPlatform&version=16.8.0")); services.UseTool(new Uri("nuget:?package=NUnitTestAdapter&version=2.3.0")); } }
mit
C#
065b1ef0b93ac98967b087de62cde0206ba4d586
Create Status.UNC.
AIWolfSharp/AIWolf_NET,AIWolfSharp/AIWolfCore
AIWolfLib/Status.cs
AIWolfLib/Status.cs
// // Status.cs // // Copyright (c) 2016 Takashi OTSUKI // // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // namespace AIWolf.Lib { #if JHELP /// <summary> /// プレイヤーの生死 /// </summary> #else /// <summary> /// Enumeration type for player's status (alive/dead). /// </summary> #endif public enum Status { #if JHELP /// <summary> /// 不明 /// </summary> #else /// <summary> /// Uncertain. /// </summary> #endif UNC, #if JHELP /// <summary> /// 生存 /// </summary> #else /// <summary> /// Alive. /// </summary> #endif ALIVE, #if JHELP /// <summary> /// 死亡 /// </summary> #else /// <summary> /// Dead. /// </summary> #endif DEAD } }
// // Status.cs // // Copyright (c) 2016 Takashi OTSUKI // // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // namespace AIWolf.Lib { #if JHELP /// <summary> /// プレイヤーの生死 /// </summary> #else /// <summary> /// Enumeration type for player's status (alive/dead). /// </summary> #endif public enum Status { #if JHELP /// <summary> /// 生存 /// </summary> #else /// <summary> /// Alive. /// </summary> #endif ALIVE, #if JHELP /// <summary> /// 死亡 /// </summary> #else /// <summary> /// Dead. /// </summary> #endif DEAD } }
mit
C#
9a61cf08ecc25d9bb0b5e52e98335d047f05cb00
Include <see> tag in UIActionForm description.
PenguinF/sandra-three
Sandra.UI/AppTemplate/UIActionForm.cs
Sandra.UI/AppTemplate/UIActionForm.cs
#region License /********************************************************************************* * UIActionForm.cs * * Copyright (c) 2004-2019 Henk Nicolai * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * **********************************************************************************/ #endregion using Eutherion.UIActions; using Eutherion.Win.UIActions; using System; using System.Windows.Forms; namespace Eutherion.Win.AppTemplate { /// <summary> /// Top level <see cref="Form"/> which ties in with the UIAction framework. /// </summary> public class UIActionForm : Form, IUIActionHandlerProvider { /// <summary> /// Gets the action handler for this control. /// </summary> public UIActionHandler ActionHandler { get; } = new UIActionHandler(); protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { try { // This code makes shortcuts work for all UIActionHandlers. return UIActionUtilities.TryExecute(keyData, FocusHelper.GetFocusedControl()) || base.ProcessCmdKey(ref msg, keyData); } catch (Exception e) { MessageBox.Show(e.Message); return true; } } } }
#region License /********************************************************************************* * UIActionForm.cs * * Copyright (c) 2004-2019 Henk Nicolai * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * **********************************************************************************/ #endregion using Eutherion.UIActions; using Eutherion.Win.UIActions; using System; using System.Windows.Forms; namespace Eutherion.Win.AppTemplate { /// <summary> /// Top level Form which ties in with the UIAction framework. /// </summary> public class UIActionForm : Form, IUIActionHandlerProvider { /// <summary> /// Gets the action handler for this control. /// </summary> public UIActionHandler ActionHandler { get; } = new UIActionHandler(); protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { try { // This code makes shortcuts work for all UIActionHandlers. return UIActionUtilities.TryExecute(keyData, FocusHelper.GetFocusedControl()) || base.ProcessCmdKey(ref msg, keyData); } catch (Exception e) { MessageBox.Show(e.Message); return true; } } } }
apache-2.0
C#
f2fdca6d267121e0e7ae42f6d47fca325c84896a
Make BiggestKillScore signed
glitch100/Halo-API
HaloEzAPI/Model/Response/Stats/CampaignPlayerStat.cs
HaloEzAPI/Model/Response/Stats/CampaignPlayerStat.cs
using HaloEzAPI.Converter; using Newtonsoft.Json; namespace HaloEzAPI.Model.Response.Stats { public class CampaignPlayerStat : PlayerMatchBreakdown { public int BiggestKillScore { get; set; } public FlexibleStats FlexibleStats { get; set; } [JsonConverter(typeof(ScoreConverter))] public int Score { get; set; } public Player Player { get; set; } public int TeamId { get; set; } public int Rank { get; set; } public bool DNF { get; set; } public string AvgLifeTimeOfPlayer { get; set; } } }
using HaloEzAPI.Converter; using Newtonsoft.Json; namespace HaloEzAPI.Model.Response.Stats { public class CampaignPlayerStat : PlayerMatchBreakdown { public uint BiggestKillScore { get; set; } public FlexibleStats FlexibleStats { get; set; } [JsonConverter(typeof(ScoreConverter))] public int Score { get; set; } public Player Player { get; set; } public int TeamId { get; set; } public int Rank { get; set; } public bool DNF { get; set; } public string AvgLifeTimeOfPlayer { get; set; } } }
mit
C#
784cec48fad09535dd2202c9cbf4a388612ba23d
Move DataFolder config get to static member initializer
AnshulYADAV007/Lean,AlexCatarino/Lean,jameschch/Lean,AnshulYADAV007/Lean,kaffeebrauer/Lean,desimonk/Lean,wowgeeker/Lean,exhau/Lean,bizcad/LeanAbhi,rchien/Lean,dalebrubaker/Lean,bizcad/LeanITrend,Phoenix1271/Lean,tzaavi/Lean,Mendelone/forex_trading,mabeale/Lean,devalkeralia/Lean,bizcad/LeanJJN,andrewhart098/Lean,QuantConnect/Lean,redmeros/Lean,Jay-Jay-D/LeanSTP,iamkingmaker/Lean,rchien/Lean,florentchandelier/Lean,Phoenix1271/Lean,squideyes/Lean,dalebrubaker/Lean,dpavlenkov/Lean,AnObfuscator/Lean,StefanoRaggi/Lean,devalkeralia/Lean,Phoenix1271/Lean,bdilber/Lean,racksen/Lean,bdilber/Lean,rchien/Lean,AlexCatarino/Lean,Neoracle/Lean,bizcad/LeanITrend,tomhunter-gh/Lean,bizcad/Lean,bizcad/LeanITrend,kaffeebrauer/Lean,squideyes/Lean,AnshulYADAV007/Lean,Mendelone/forex_trading,Neoracle/Lean,florentchandelier/Lean,Obawoba/Lean,JKarathiya/Lean,young-zhang/Lean,bizcad/LeanJJN,QuantConnect/Lean,tomhunter-gh/Lean,squideyes/Lean,bizcad/LeanJJN,jameschch/Lean,bizcad/Lean,JKarathiya/Lean,Mendelone/forex_trading,andrewhart098/Lean,dpavlenkov/Lean,desimonk/Lean,racksen/Lean,JKarathiya/Lean,tomhunter-gh/Lean,Obawoba/Lean,florentchandelier/Lean,devalkeralia/Lean,FrancisGauthier/Lean,wowgeeker/Lean,FrancisGauthier/Lean,young-zhang/Lean,andrewhart098/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,racksen/Lean,iamkingmaker/Lean,bdilber/Lean,Jay-Jay-D/LeanSTP,desimonk/Lean,dalebrubaker/Lean,young-zhang/Lean,Jay-Jay-D/LeanSTP,bizcad/Lean,kaffeebrauer/Lean,redmeros/Lean,AnshulYADAV007/Lean,mabeale/Lean,dpavlenkov/Lean,kaffeebrauer/Lean,mabeale/Lean,young-zhang/Lean,jameschch/Lean,QuantConnect/Lean,tomhunter-gh/Lean,Neoracle/Lean,tzaavi/Lean,jameschch/Lean,iamkingmaker/Lean,AnshulYADAV007/Lean,bizcad/Lean,mabeale/Lean,StefanoRaggi/Lean,AnObfuscator/Lean,Jay-Jay-D/LeanSTP,AnObfuscator/Lean,StefanoRaggi/Lean,exhau/Lean,desimonk/Lean,redmeros/Lean,tzaavi/Lean,AlexCatarino/Lean,Neoracle/Lean,exhau/Lean,exhau/Lean,iamkingmaker/Lean,redmeros/Lean,bizcad/LeanITrend,JKarathiya/Lean,andrewhart098/Lean,jameschch/Lean,AnObfuscator/Lean,florentchandelier/Lean,devalkeralia/Lean,wowgeeker/Lean,squideyes/Lean,Jay-Jay-D/LeanSTP,bizcad/LeanAbhi,Mendelone/forex_trading,kaffeebrauer/Lean,dalebrubaker/Lean,FrancisGauthier/Lean,Obawoba/Lean,QuantConnect/Lean,Phoenix1271/Lean,Obawoba/Lean,dpavlenkov/Lean,racksen/Lean,AlexCatarino/Lean,wowgeeker/Lean,bizcad/LeanAbhi,FrancisGauthier/Lean,bizcad/LeanJJN,tzaavi/Lean,bdilber/Lean,bizcad/LeanAbhi,rchien/Lean
Common/Constants.cs
Common/Constants.cs
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using QuantConnect.Configuration; namespace QuantConnect { /// <summary> /// Provides application level constant values /// </summary> public static class Constants { private static readonly string DataFolderPath = Config.Get("data-folder", @"../../../Data/"); /// <summary> /// The root directory of the data folder for this application /// </summary> public static string DataFolder { get { return DataFolderPath; } } /// <summary> /// The directory used for storing downloaded remote files /// </summary> public const string Cache = "./cache/data"; /// <summary> /// The version of lean /// </summary> public static readonly string Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); } }
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using QuantConnect.Configuration; namespace QuantConnect { /// <summary> /// Provides application level constant values /// </summary> public static class Constants { /// <summary> /// The root directory of the data folder for this application /// </summary> public static string DataFolder { get { return Config.Get("data-folder", @"../../../Data/"); } } /// <summary> /// The directory used for storing downloaded remote files /// </summary> public const string Cache = "./cache/data"; /// <summary> /// The version of lean /// </summary> public static readonly string Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); } }
apache-2.0
C#
4931eaa1aa4b42e30123d2f34ce8c787a38b468f
fix string in test
ResourceDataInc/Simpler.Data,ResourceDataInc/Simpler.Data,gregoryjscott/Simpler,gregoryjscott/Simpler,ResourceDataInc/Simpler.Data
Simpler.Tests/Core/Tasks/CreateJobTest.cs
Simpler.Tests/Core/Tasks/CreateJobTest.cs
using NUnit.Framework; using Simpler.Core.Jobs; using Simpler.Tests.Core.Mocks; namespace Simpler.Tests.Core.Jobs { [TestFixture] public class CreateJobTest { [Test] public void should_just_provide_instance_if_given_type_is_not_decorated_with_execution_callbacks_attribute() { // Arrange var job = new CreateTask { JobType = typeof(MockTask) }; // Act job.Run(); // Assert Assert.That(job.JobInstance, Is.InstanceOf<MockTask>()); Assert.That(job.JobInstance.GetType().Name, Is.Not.EqualTo("MockTaskWithAttributesProxy")); } [Test] public void should_provide_proxy_instance_if_given_type_is_decorated_with_execution_callbacks_attribute() { // Arrange var job = new CreateTask { JobType = typeof(MockTaskWithAttributes) }; // Act job.Run(); // Assert Assert.That(job.JobInstance, Is.InstanceOf<MockTaskWithAttributes>()); Assert.That(job.JobInstance.GetType().Name, Is.EqualTo("MockTaskWithAttributesProxy")); } } }
using NUnit.Framework; using Simpler.Core.Jobs; using Simpler.Tests.Core.Mocks; namespace Simpler.Tests.Core.Jobs { [TestFixture] public class CreateJobTest { [Test] public void should_just_provide_instance_if_given_type_is_not_decorated_with_execution_callbacks_attribute() { // Arrange var job = new CreateTask { JobType = typeof(MockTask) }; // Act job.Run(); // Assert Assert.That(job.JobInstance, Is.InstanceOf<MockTask>()); Assert.That(job.JobInstance.GetType().Name, Is.Not.EqualTo("MockJobWithOnExecuteAttributeProxy")); } [Test] public void should_provide_proxy_instance_if_given_type_is_decorated_with_execution_callbacks_attribute() { // Arrange var job = new CreateTask { JobType = typeof(MockTaskWithAttributes) }; // Act job.Run(); // Assert Assert.That(job.JobInstance, Is.InstanceOf<MockTaskWithAttributes>()); Assert.That(job.JobInstance.GetType().Name, Is.EqualTo("MockJobWithAttributesProxy")); } } }
mit
C#
4fd42ccc71a0bfa63a48475130b2081c0be89bef
mark ILightSource as IAether element
tainicom/Aether
Source/Elementary/Photons/ILightSource.cs
Source/Elementary/Photons/ILightSource.cs
#region License // Copyright 2015 Kastellanos Nikolaos // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using Microsoft.Xna.Framework; namespace tainicom.Aether.Elementary.Photons { public interface ILightSource: IAether { Vector3 LightSourceColor {get;set;} float Intensity {get;set;} float MaximumRadius {get;set;} Vector3 PremultiplyColor { get; } } }
#region License // Copyright 2015 Kastellanos Nikolaos // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using Microsoft.Xna.Framework; namespace tainicom.Aether.Elementary.Photons { public interface ILightSource { Vector3 LightSourceColor {get;set;} float Intensity {get;set;} float MaximumRadius {get;set;} Vector3 PremultiplyColor { get; } } }
apache-2.0
C#
4afafc9784a6ef8c60634fcf68c864c69fdf6285
Use a path for storage that doesn't include version and company name
zr40/kyru-dotnet,zr40/kyru-dotnet
Kyru/Core/Config.cs
Kyru/Core/Config.cs
using System; using System.IO; namespace Kyru.Core { internal sealed class Config { internal string storeDirectory; internal Config() { storeDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Kyru", "objects"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace Kyru.Core { class Config { internal readonly string storeDirectory; internal Config() { storeDirectory = Path.Combine(System.Windows.Forms.Application.UserAppDataPath); } } }
bsd-3-clause
C#
1bb695c09d16f52b76bcd87f0b778bcf60da91a7
change [RestService] paths to Routes.Add
ServiceStack/ServiceStack.Examples,ServiceStack/ServiceStack.Examples,zhaokunfay/ServiceStack.Examples,zhaokunfay/ServiceStack.Examples,assaframan/MoviesRestForAppHarbor,zhaokunfay/ServiceStack.Examples,zhaokunfay/ServiceStack.Examples,assaframan/MoviesRestForAppHarbor,ServiceStack/ServiceStack.Examples,ServiceStack/ServiceStack.Examples,assaframan/MoviesRestForAppHarbor
src/Backbone.Todos/Global.asax.cs
src/Backbone.Todos/Global.asax.cs
using System; using ServiceStack.Redis; using ServiceStack.ServiceInterface; using ServiceStack.WebHost.Endpoints; //The entire C# source code for the ServiceStack + Redis TODO REST backend. There is no other .cs :) namespace Backbone.Todos { //Register REST Paths public class Todo //REST Resource DTO { public long Id { get; set; } public string Content { get; set; } public int Order { get; set; } public bool Done { get; set; } } //Todo REST Service implementation public class TodoService : RestServiceBase<Todo> { public IRedisClientsManager RedisManager { get; set; } //Injected by IOC public override object OnGet(Todo request) { //return all todos if (request.Id == default(long)) return RedisManager.ExecAs<Todo>(r => r.GetAll()); //return single todo return RedisManager.ExecAs<Todo>(r => r.GetById(request.Id)); } //Handles creaing a new and updating existing todo public override object OnPost(Todo todo) { RedisManager.ExecAs<Todo>(r => { //Get next id for new todo if (todo.Id == default(long)) todo.Id = r.GetNextSequence(); r.Store(todo); }); return todo; } public override object OnDelete(Todo request) { RedisManager.ExecAs<Todo>(r => r.DeleteById(request.Id)); return null; } } //Configure ServiceStack.NET web service host public class AppHost : AppHostBase { //Tell ServiceStack the name and where to find your web services public AppHost() : base("Backbone.js TODO", typeof(TodoService).Assembly) { } public override void Configure(Funq.Container container) { //Register Redis factory in Funq IOC container.Register<IRedisClientsManager>(new BasicRedisClientManager("localhost:6379")); Routes .Add<Todo>("/todos") .Add<Todo>("/todos/{Id}"); } } public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { new AppHost().Init(); //Start ServiceStack App } } }
using System; using ServiceStack.Redis; using ServiceStack.ServiceInterface; using ServiceStack.WebHost.Endpoints; using ServiceStack.ServiceHost; //The entire C# source code for the ServiceStack + Redis TODO REST backend. There is no other .cs :) namespace Backbone.Todos { //Register REST Paths [RestService("/todos")] [RestService("/todos/{Id}")] public class Todo //REST Resource DTO { public long Id { get; set; } public string Content { get; set; } public int Order { get; set; } public bool Done { get; set; } } //Todo REST Service implementation public class TodoService : RestServiceBase<Todo> { public IRedisClientsManager RedisManager { get; set; } //Injected by IOC public override object OnGet(Todo request) { //return all todos if (request.Id == default(long)) return RedisManager.ExecAs<Todo>(r => r.GetAll()); //return single todo return RedisManager.ExecAs<Todo>(r => r.GetById(request.Id)); } //Handles creaing a new and updating existing todo public override object OnPost(Todo todo) { RedisManager.ExecAs<Todo>(r => { //Get next id for new todo if (todo.Id == default(long)) todo.Id = r.GetNextSequence(); r.Store(todo); }); return todo; } public override object OnDelete(Todo request) { RedisManager.ExecAs<Todo>(r => r.DeleteById(request.Id)); return null; } } //Configure ServiceStack.NET web service host public class AppHost : AppHostBase { //Tell ServiceStack the name and where to find your web services public AppHost() : base("Backbone.js TODO", typeof(TodoService).Assembly) { } public override void Configure(Funq.Container container) { //Register Redis factory in Funq IOC container.Register<IRedisClientsManager>(new BasicRedisClientManager("localhost:6379")); } } public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { new AppHost().Init(); //Start ServiceStack App } } }
bsd-3-clause
C#
f49376ccf38bc24923b67c654c2ecfb3931d11b5
add error test
j2ghz/IntranetGJAK,j2ghz/IntranetGJAK
UnitTests/Class1.cs
UnitTests/Class1.cs
using IntranetGJAK.Controllers; using Microsoft.AspNet.Mvc; using Xunit; namespace UnitTests { // This project can output the Class library as a NuGet Package. // To enable this option, right-click on the project and select the Properties menu item. In the Build tab select "Produce outputs on build". public class Home { [Fact] public void ControllerNotNull() { Assert.True(true); } [Fact] public void Error() { var controller = new HomeController(); Assert.NotNull(controller); var result = controller.Error(); Assert.NotNull(result); Assert.IsType<ViewResult>(result); ViewResult view = (ViewResult)result; Assert.NotNull(view); Assert.Equal("~/Views/Shared/Error.cshtml", view.ViewName); } } public class UploadController { [Fact] public void ControllerNotNull() { Assert.False(true); } } }
using IntranetGJAK.Controllers; using Xunit; namespace UnitTests { // This project can output the Class library as a NuGet Package. // To enable this option, right-click on the project and select the Properties menu item. In the Build tab select "Produce outputs on build". public class Home { [Fact] public void ControllerNotNull() { Assert.True(true); } } public class UploadController { [Fact] public void ControllerNotNull() { Assert.False(true); } } }
agpl-3.0
C#
5cc8ab4d9c1fb82d31c981bf54023a24fbc35b08
Update the static content module to fit the new API.
jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,jmptrader/manos,jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,jmptrader/manos,jacksonh/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,mdavid/manos-spdy
data/mango-tool/layouts/default/StaticContentModule.cs
data/mango-tool/layouts/default/StaticContentModule.cs
using System; using System.IO; using Mango; // // This the default StaticContentModule that comes with all Mango apps // if you do not wish to serve any static content with Mango you can // remove its route handler from <YourApp>.cs's constructor and delete // this file. // // All Content placed on the Content/ folder should be handled by this // module. // namespace AppNameFoo { public class StaticContentModule : MangoModule { public StaticContentModule () { Get ("*", Content); } public static void Content (IMangoContext ctx) { string path = ctx.Request.LocalPath; if (path.StartsWith ("/")) path = path.Substring (1); if (File.Exists (path)) { ctx.Response.SendFile (path); } else ctx.Response.StatusCode = 404; } } }
using System; using System.IO; using Mango; // // This the default StaticContentModule that comes with all Mango apps // if you do not wish to serve any static content with Mango you can // remove its route handler from <YourApp>.cs's constructor and delete // this file. // // All Content placed on the Content/ folder should be handled by this // module. // namespace $APPNAME { public class StaticContentModule : MangoModule { public StaticContentModule () { Get ("*", Content); } public static void Content (MangoContext ctx) { string path = ctx.Request.LocalPath; if (path.StartsWith ("/")) path = path.Substring (1); if (File.Exists (path)) { ctx.Response.SendFile (path); } else ctx.Response.StatusCode = 404; } } }
mit
C#
e24ffd611b8c4f0bd266d974db5a7879eba38158
Fix default category for new addins
mhutch/MonoDevelop.AddinMaker,mhutch/MonoDevelop.AddinMaker
Templates/Properties/AddinInfo.cs
Templates/Properties/AddinInfo.cs
using System; using Mono.Addins; using Mono.Addins.Description; [assembly:Addin ( "${ProjectName}", Namespace = "${ProjectName}", Version = "1.0" )] [assembly:AddinName ("${ProjectName}")] [assembly:AddinCategory ("IDE extensions")] [assembly:AddinDescription ("${ProjectName}")] [assembly:AddinAuthor ("${AuthorName}")]
using System; using Mono.Addins; using Mono.Addins.Description; [assembly:Addin ( "${ProjectName}", Namespace = "${ProjectName}", Version = "1.0" )] [assembly:AddinName ("${ProjectName}")] [assembly:AddinCategory ("${ProjectName}")] [assembly:AddinDescription ("${ProjectName}")] [assembly:AddinAuthor ("${AuthorName}")]
mit
C#
ffd8f9f8ccaaf3cd5fdb420ba85f48af1e680d1e
Bump version
McNeight/SharpZipLib
src/AssemblyInfo.cs
src/AssemblyInfo.cs
// AssemblyInfo.cs // // Copyright (C) 2001 Mike Krueger // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // Linking this library statically or dynamically with other modules is // making a combined work based on this library. Thus, the terms and // conditions of the GNU General Public License cover the whole // combination. // // As a special exception, the copyright holders of this library give you // permission to link this library with independent modules to produce an // executable, regardless of the license terms of these independent // modules, and to copy and distribute the resulting executable under // terms of your choice, provided that you also meet, for each linked // independent module, the terms and conditions of the license of that // module. An independent module is a module which is not derived from // or based on this library. If you modify this library, you may extend // this exception to your version of the library, but you are not // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. using System; using System.Reflection; using System.Runtime.CompilerServices; [assembly: CLSCompliant(true)] [assembly: AssemblyTitle("ICSharpCode.SharpZipLibrary")] [assembly: AssemblyDescription("A free C# compression library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("#ZipLibrary")] [assembly: AssemblyCopyright("Copyright Mike Krueger 2001-2004")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("0.83.0.0")] [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("../ICSharpCode.SharpZipLib.key")]
// AssemblyInfo.cs // // Copyright (C) 2001 Mike Krueger // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // Linking this library statically or dynamically with other modules is // making a combined work based on this library. Thus, the terms and // conditions of the GNU General Public License cover the whole // combination. // // As a special exception, the copyright holders of this library give you // permission to link this library with independent modules to produce an // executable, regardless of the license terms of these independent // modules, and to copy and distribute the resulting executable under // terms of your choice, provided that you also meet, for each linked // independent module, the terms and conditions of the license of that // module. An independent module is a module which is not derived from // or based on this library. If you modify this library, you may extend // this exception to your version of the library, but you are not // obligated to do so. If you do not wish to do so, delete this // exception statement from your version. using System; using System.Reflection; using System.Runtime.CompilerServices; [assembly: CLSCompliant(true)] [assembly: AssemblyTitle("ICSharpCode.SharpZipLibrary")] [assembly: AssemblyDescription("A free C# compression library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("#ZipLibrary")] [assembly: AssemblyCopyright("Copyright Mike Krueger 2001-2004")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("0.82.0.1709")] [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("../ICSharpCode.SharpZipLib.key")]
mit
C#
fafb76821c11f2213afce115c039cd19ec14991b
Fix Collapse
CyberCRI/Hero.Coli,CyberCRI/Hero.Coli
Assets/BioBricksCollapse.cs
Assets/BioBricksCollapse.cs
using UnityEngine; using System.Collections; using System.Collections.Generic; public class BioBricksCollapse : MonoBehaviour { [SerializeField] private Transform[] _bricksTransform; private float _distanceBetweenMiddleBricks; private float _distanceBetweenSideBricksL; private float _distanceBetweenSideBricksR; [SerializeField] private Texture _referenceTexture; private CraftDeviceSlot _craftDeviceSlot; // Use this for initialization void Start () { _distanceBetweenMiddleBricks = Vector3.Distance(_bricksTransform[1].localPosition, _bricksTransform[2].localPosition) - _referenceTexture.width; _distanceBetweenSideBricksL = Vector3.Distance(_bricksTransform[0].localPosition, _bricksTransform[1].localPosition) + (_distanceBetweenMiddleBricks / 2) - _referenceTexture.width; _distanceBetweenSideBricksR = Vector3.Distance(_bricksTransform[2].localPosition, _bricksTransform[3].localPosition) + (_distanceBetweenMiddleBricks / 2) - _referenceTexture.width; _craftDeviceSlot = this.gameObject.GetComponent<CraftDeviceSlot>(); } public void Collapse() { _bricksTransform[1].localPosition = new Vector3(_bricksTransform[1].localPosition.x + (_distanceBetweenMiddleBricks / 2), _bricksTransform[1].localPosition.y, _bricksTransform[1].localPosition.z); _bricksTransform[2].localPosition = new Vector3(_bricksTransform[2].localPosition.x - (_distanceBetweenMiddleBricks / 2), _bricksTransform[2].localPosition.y, _bricksTransform[2].localPosition.z); _bricksTransform[0].localPosition = new Vector3(_bricksTransform[0].localPosition.x + (_distanceBetweenSideBricksL), _bricksTransform[0].localPosition.y, _bricksTransform[0].localPosition.z); _bricksTransform[3].localPosition = new Vector3(_bricksTransform[3].localPosition.x - (_distanceBetweenSideBricksL), _bricksTransform[3].localPosition.y, _bricksTransform[3].localPosition.z); var slotList = _craftDeviceSlot.GetCraftZoneDisplayedBioBricks() as CraftZoneDisplayedBioBrick[]; for (var i = 0; i < slotList.Length; i++) { slotList[i].transform.localPosition = _bricksTransform[i].localPosition; } } }
using UnityEngine; using System.Collections; using System.Collections.Generic; public class BioBricksCollapse : MonoBehaviour { [SerializeField] private Transform[] _bricksTransform; private float _distanceBetweenMiddleBricks; private float _distanceBetweenSideBricksL; private float _distanceBetweenSideBricksR; [SerializeField] private Texture _referenceTexture; private CraftDeviceSlot _craftDeviceSlot; // Use this for initialization void Start () { _distanceBetweenMiddleBricks = Vector3.Distance(_bricksTransform[1].localPosition, _bricksTransform[2].localPosition) - _referenceTexture.width; _distanceBetweenSideBricksL = Vector3.Distance(_bricksTransform[0].localPosition, _bricksTransform[1].localPosition) + (_distanceBetweenMiddleBricks / 2) - _referenceTexture.width; _distanceBetweenSideBricksR = Vector3.Distance(_bricksTransform[2].localPosition, _bricksTransform[3].localPosition) + (_distanceBetweenMiddleBricks / 2) - _referenceTexture.width; _craftDeviceSlot = this.gameObject.GetComponent<CraftDeviceSlot>(); } // Update is called once per frame void Update () { if (Input.GetKeyDown(KeyCode.Keypad0)) { Collapse(); } } public void Collapse() { _bricksTransform[1].localPosition = new Vector3(_bricksTransform[1].localPosition.x + (_distanceBetweenMiddleBricks / 2), _bricksTransform[1].localPosition.y, _bricksTransform[1].localPosition.z); _bricksTransform[2].localPosition = new Vector3(_bricksTransform[2].localPosition.x - (_distanceBetweenMiddleBricks / 2), _bricksTransform[2].localPosition.y, _bricksTransform[2].localPosition.z); _bricksTransform[0].localPosition = new Vector3(_bricksTransform[0].localPosition.x + (_distanceBetweenSideBricksL), _bricksTransform[0].localPosition.y, _bricksTransform[0].localPosition.z); _bricksTransform[3].localPosition = new Vector3(_bricksTransform[3].localPosition.x - (_distanceBetweenSideBricksL), _bricksTransform[3].localPosition.y, _bricksTransform[3].localPosition.z); var slotList = _craftDeviceSlot.GetCraftZoneDisplayedBioBricks() as CraftZoneDisplayedBioBrick[]; for (var i = 0; i < slotList.Length; i++) { slotList[i].transform.localPosition = _bricksTransform[i].localPosition; } } }
mit
C#
aca52f77adbe04de50d6ea2466b974d7e4edf2eb
update lexeme comments
bilsaboob/Pliant,patrickhuber/Pliant
libraries/Pliant/Lexeme.cs
libraries/Pliant/Lexeme.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Pliant { /// <summary> /// A Lexeme is something special. It acts like a token and a mini parser. /// </summary> public class Lexeme { private StringBuilder _catpure; private PulseRecognizer _recognizer; public Lexeme(ILexerRule lexerRule) { _catpure = new StringBuilder(); _recognizer = new PulseRecognizer(lexerRule.Grammar); } public string Capture { get { return _catpure.ToString(); } } public bool Match(char c) { int originalChartSize = _recognizer.Chart.Count; _recognizer.Pulse(c); bool characterWasMatched = originalChartSize < _recognizer.Chart.Count; if (characterWasMatched) _catpure.Append(c); return characterWasMatched; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Pliant { /// <summary> /// A Lexeme is something special. It is not a production. /// </summary> public class Lexeme { private StringBuilder _catpure; private PulseRecognizer _recognizer; public Lexeme(ILexerRule lexerRule) { _catpure = new StringBuilder(); _recognizer = new PulseRecognizer(lexerRule.Grammar); } public string Capture { get { return _catpure.ToString(); } } public bool Match(char c) { int originalChartSize = _recognizer.Chart.Count; _recognizer.Pulse(c); bool characterWasMatched = originalChartSize < _recognizer.Chart.Count; if (characterWasMatched) _catpure.Append(c); return characterWasMatched; } } }
mit
C#
1bb45a91188d99b206c56fb7c2c3039fc2bfb3b4
Fix UserConfig creating a directory instead of a file
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
Configuration/UserConfig.cs
Configuration/UserConfig.cs
using System; using System.Drawing; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; namespace TweetDick.Configuration{ [Serializable] sealed class UserConfig{ private static readonly IFormatter Formatter = new BinaryFormatter(); // START OF CONFIGURATION public bool IgnoreMigration { get; set; } public bool IsMaximized { get; set; } public Point WindowLocation { get; set; } public Size WindowSize { get; set; } // END OF CONFIGURATION [NonSerialized] private readonly string file; private UserConfig(string file){ this.file = file; } public bool Save(){ try{ string directory = Path.GetDirectoryName(file); if (directory == null)return false; Directory.CreateDirectory(directory); using(Stream stream = new FileStream(file,FileMode.Create,FileAccess.Write,FileShare.None)){ Formatter.Serialize(stream,this); } return true; }catch(Exception){ // TODO return false; } } public static UserConfig Load(string file){ UserConfig config = null; try{ using(Stream stream = new FileStream(file,FileMode.Open,FileAccess.Read,FileShare.Read)){ config = Formatter.Deserialize(stream) as UserConfig; } }catch(FileNotFoundException){ }catch(Exception){ // TODO } return config ?? new UserConfig(file); } } }
using System; using System.Drawing; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; namespace TweetDick.Configuration{ [Serializable] sealed class UserConfig{ private static readonly IFormatter Formatter = new BinaryFormatter(); // START OF CONFIGURATION public bool IgnoreMigration { get; set; } public bool IsMaximized { get; set; } public Point WindowLocation { get; set; } public Size WindowSize { get; set; } // END OF CONFIGURATION [NonSerialized] private readonly string file; private UserConfig(string file){ this.file = file; } public bool Save(){ try{ Directory.CreateDirectory(file); using(Stream stream = new FileStream(file,FileMode.Create,FileAccess.Write,FileShare.None)){ Formatter.Serialize(stream,this); } return true; }catch(Exception){ // TODO return false; } } public static UserConfig Load(string file){ UserConfig config = null; try{ using(Stream stream = new FileStream(file,FileMode.Open,FileAccess.Read,FileShare.Read)){ config = Formatter.Deserialize(stream) as UserConfig; } }catch(FileNotFoundException){ }catch(Exception){ // TODO } return config ?? new UserConfig(file); } } }
mit
C#