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
449d204656cdfd00e855bcbd64dabe84edca6590
build version: 3.9.71.6
wiesel78/Canwell.OrmLite.MSAccess2003
Source/GlobalAssemblyInfo.cs
Source/GlobalAssemblyInfo.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by Cake. // </auto-generated> //------------------------------------------------------------------------------ using System.Reflection; [assembly: AssemblyCompany("canwell - IT Solutions")] [assembly: AssemblyVersion("3.9.71.6")] [assembly: AssemblyFileVersion("3.9.71.6")] [assembly: AssemblyInformationalVersion("3.9.71.6")] [assembly: AssemblyCopyright("Copyright © 2016")]
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by Cake. // </auto-generated> //------------------------------------------------------------------------------ using System.Reflection; [assembly: AssemblyCompany("canwell - IT Solutions")] [assembly: AssemblyVersion("3.9.71.5")] [assembly: AssemblyFileVersion("3.9.71.5")] [assembly: AssemblyInformationalVersion("3.9.71.5")] [assembly: AssemblyCopyright("Copyright © 2016")]
bsd-3-clause
C#
edeed1b05e70ed72ca16d10e9f6ab451cbc71e7f
Fix bug when time stamp included as part of date
ekincaglar/clarizen
Ekin.Clarizen.Tests/Steps/TestHelperSteps.cs
Ekin.Clarizen.Tests/Steps/TestHelperSteps.cs
using System; using System.Collections.Generic; using Clarizen.Tests.Context; using Ekin.Clarizen.Tests.Models; using Moq; using TechTalk.SpecFlow; using TechTalk.SpecFlow.Assist; using Xunit; namespace Ekin.Clarizen.Tests.Steps { [Binding] public class TestHelperSteps : BaseApiSteps { public TestHelperSteps(BaseContext context) : base(context) { } [Given(@"When I set the TimeProvider date to '(.*)'")] public void GivenWhenISetTheTimeProviderDateTo(string date) { DateTime nowDateTime; DateTime todayDateTime; if (!date.Contains(':')) { todayDateTime = Convert.ToDateTime(date + " 00:00:00"); nowDateTime = Convert.ToDateTime(date += " 23:14:59"); } else { todayDateTime = Convert.ToDateTime(Convert.ToDateTime(date).ToString("d MMM yyyy 0:00:00")) ; nowDateTime = Convert.ToDateTime(date); } var timeMock = new Mock<TimeProvider>(); timeMock.SetupGet(tp => tp.Now).Returns(nowDateTime); timeMock.SetupGet(tp => tp.Today).Returns(todayDateTime); TimeProvider.Current = timeMock.Object; } [Given(@"I TestHelper function convertToDateTime with the following")] public void GivenITestHelperFunctionConvertToDateTimeWithTheFollowing(Table table) { var results = new List<TestClass1>(); foreach (var row in table.Rows) { var value = row["Value"]; var expected = Convert.ToDateTime(row["Result"]); var includeTime = row["IncludeTime"].ToString().ToLower(); var actualDateFormat = "d MMM yyyy"; if (includeTime=="true") { actualDateFormat += " HH:mm:ss"; } var actual = TestHelper.ConvertToDateTime(value).ToString(actualDateFormat); results.Add(new TestClass1(){Value = value,Result = actual, IncludeTime = row["IncludeTime"] }); } table.CompareToSet(results); } } }
using System; using System.Collections.Generic; using Clarizen.Tests.Context; using Ekin.Clarizen.Tests.Models; using Moq; using TechTalk.SpecFlow; using TechTalk.SpecFlow.Assist; using Xunit; namespace Ekin.Clarizen.Tests.Steps { [Binding] public class TestHelperSteps : BaseApiSteps { public TestHelperSteps(BaseContext context) : base(context) { } [Given(@"When I set the TimeProvider date to '(.*)'")] public void GivenWhenISetTheTimeProviderDateTo(string date) { var todayDateTime = Convert.ToDateTime(date + " 00:00:00"); var nowDateTime = Convert.ToDateTime(date + " 23:59:59"); var timeMock = new Mock<TimeProvider>(); timeMock.SetupGet(tp => tp.Now).Returns(nowDateTime); timeMock.SetupGet(tp => tp.Today).Returns(todayDateTime); TimeProvider.Current = timeMock.Object; } [Given(@"I TestHelper function convertToDateTime with the following")] public void GivenITestHelperFunctionConvertToDateTimeWithTheFollowing(Table table) { var results = new List<TestClass1>(); foreach (var row in table.Rows) { var value = row["Value"]; var expected = Convert.ToDateTime(row["Result"]); var includeTime = row["IncludeTime"].ToString().ToLower(); var actualDateFormat = "d MMM yyyy"; if (includeTime=="true") { actualDateFormat += " HH:mm:ss"; } var actual = TestHelper.ConvertToDateTime(value).ToString(actualDateFormat); results.Add(new TestClass1(){Value = value,Result = actual, IncludeTime = row["IncludeTime"] }); } table.CompareToSet(results); } } }
mit
C#
4f0508c1c5aad22271c7c447f08d4adf238833e1
Add get all files method
fredatgithub/UsefulFunctions
FonctionsUtiles.Fred.Csharp/FunctionsWindows.cs
FonctionsUtiles.Fred.Csharp/FunctionsWindows.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Security.Principal; namespace FonctionsUtiles.Fred.Csharp { public class FunctionsWindows { public static bool IsInWinPath(string substring) { bool result = false; string winPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine); if (winPath != null) result = winPath.Contains(substring); return result; } public static string DisplayTitle() { Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); return $@"V{fvi.FileMajorPart}.{fvi.FileMinorPart}.{fvi.FileBuildPart}.{fvi.FilePrivatePart}"; } public static bool IsAdministrator() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsInRole(WindowsBuiltInRole.Administrator); } public static bool IsAdmin() { return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); } public static IEnumerable<Process> GetAllProcesses() { Process[] processlist = Process.GetProcesses(); return processlist.ToList(); } public static bool IsProcessRunningById(Process process) { try { Process.GetProcessById(process.Id); } catch (InvalidOperationException) { return false; } catch (ArgumentException) { return false; } return true; } public static bool IsProcessRunningByName(string processName) { try { Process.GetProcessesByName(processName); } catch (InvalidOperationException) { return false; } catch (ArgumentException) { return false; } return true; } public static Process GetProcessByName(string processName) { Process result = new Process(); foreach (Process process in GetAllProcesses()) { if (process.ProcessName == processName) { result = process; break; } } return result; } public static IEnumerable<FileInfo> GetAllLargeFilesWithLinq(string path) { var query = new DirectoryInfo(path).GetFiles() .OrderByDescending(file => file.Length); return query; } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Security.Principal; namespace FonctionsUtiles.Fred.Csharp { public class FunctionsWindows { public static bool IsInWinPath(string substring) { bool result = false; string winPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine); if (winPath != null) result = winPath.Contains(substring); return result; } public static string DisplayTitle() { Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); return $@"V{fvi.FileMajorPart}.{fvi.FileMinorPart}.{fvi.FileBuildPart}.{fvi.FilePrivatePart}"; } public static bool IsAdministrator() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsInRole(WindowsBuiltInRole.Administrator); } public static bool IsAdmin() { return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); } public static IEnumerable<Process> GetAllProcesses() { Process[] processlist = Process.GetProcesses(); return processlist.ToList(); } public static bool IsProcessRunningById(Process process) { try { Process.GetProcessById(process.Id); } catch (InvalidOperationException) { return false; } catch (ArgumentException) { return false; } return true; } public static bool IsProcessRunningByName(string processName) { try { Process.GetProcessesByName(processName); } catch (InvalidOperationException) { return false; } catch (ArgumentException) { return false; } return true; } public static Process GetProcessByName(string processName) { Process result = new Process(); foreach (Process process in GetAllProcesses()) { if (process.ProcessName == processName) { result = process; break; } } return result; } } }
mit
C#
ee0e9171976dbc33eec1106325a336f7c53cadb2
Edit cancel button because don't work
vasilchavdarov/SoftUniBlog,vasilchavdarov/SoftUniBlog,vasilchavdarov/SoftUniBlog
Blog/Blog/Views/Article/Create.cshtml
Blog/Blog/Views/Article/Create.cshtml
@model Blog.Models.Article @{ ViewBag.Title = "Create"; } <div class="container"> <div class="well"> <h2>Create Article</h2> @using (Html.BeginForm("Create", "Article", FormMethod.Post, new { @class = "form-horizontal" })) { @Html.AntiForgeryToken() @Html.ValidationSummary("", new { @class = "text-danger" }) <div class="form-group"> @Html.LabelFor(m => m.Title, new { @class = "control-label col-sm-4" }) <div class="col-sm-4"> @Html.TextBoxFor(m => m.Title, new { @class = "form-control" }) </div> </div> <div class="form-group"> @Html.LabelFor(m => m.Content, new { @class = "control-label col-sm-4" }) <div class="col-sm-4"> @Html.TextAreaFor(m => m.Content, new { @class = "form-control", @rows = "7" }) </div> </div> <div class="form-group"> @Html.LabelFor(m => m.ImageUrl, new { @class = "control-label col-sm-4" }) <div class="col-sm-4"> @Html.TextBoxFor(m => m.ImageUrl, new { @class = "form-control" }) </div> </div> <div class="form-group"> <div class="col-sm-4 col-sm-offset-4"> @Html.ActionLink("Cancel", "Index", "Home", null, new { @class = "btn btn-default" }) <input type="submit" value="Create" class="btn btn-success" /> </div> </div> } </div> </div>
@model Blog.Models.Article @{ ViewBag.Title = "Create"; } <div class="container"> <div class="well"> <h2>Create Article</h2> @using (Html.BeginForm("Create", "Article", FormMethod.Post, new { @class = "form-horizontal" })) { @Html.AntiForgeryToken() @Html.ValidationSummary("", new { @class = "text-danger" }) <div class="form-group"> @Html.LabelFor(m => m.Title, new { @class = "control-label col-sm-4" }) <div class="col-sm-4"> @Html.TextBoxFor(m => m.Title, new { @class = "form-control" }) </div> </div> <div class="form-group"> @Html.LabelFor(m => m.Content, new { @class = "control-label col-sm-4" }) <div class="col-sm-4"> @Html.TextAreaFor(m => m.Content, new { @class = "form-control", @rows = "7" }) </div> </div> <div class="form-group"> @Html.LabelFor(m => m.ImageUrl, new { @class = "control-label col-sm-4" }) <div class="col-sm-4"> @Html.TextBoxFor(m => m.ImageUrl, new { @class = "form-control" }) </div> </div> <div class="form-group"> <div class="col-sm-4 col-sm-offset-4"> @Html.ActionLink("Cancel", "Index", "Article", null, new { @class = "btn btn-default" }) <input type="submit" value="Create" class="btn btn-success" /> </div> </div> } </div> </div>
mit
C#
2f4c3b821e8a74d719114baf6b6ce55569f81cba
Add IDisposable to IConsulClient
PlayFab/consuldotnet
Consul/Interfaces/IConsulClient.cs
Consul/Interfaces/IConsulClient.cs
// ----------------------------------------------------------------------- // <copyright file="Health.cs" company="PlayFab Inc"> // Copyright 2015 PlayFab Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> // ----------------------------------------------------------------------- using System; using System.Threading; namespace Consul { public interface IConsulClient : IDisposable { IACLEndpoint ACL { get; } IDisposableLock AcquireLock(LockOptions opts); IDisposableLock AcquireLock(LockOptions opts, CancellationToken ct); IDisposableLock AcquireLock(string key); IDisposableLock AcquireLock(string key, CancellationToken ct); IDisposableSemaphore AcquireSemaphore(SemaphoreOptions opts); IDisposableSemaphore AcquireSemaphore(string prefix, int limit); IAgentEndpoint Agent { get; } ICatalogEndpoint Catalog { get; } IDistributedLock CreateLock(LockOptions opts); IDistributedLock CreateLock(string key); IEventEndpoint Event { get; } void ExecuteAbortableLocked(LockOptions opts, Action action); void ExecuteAbortableLocked(LockOptions opts, CancellationToken ct, Action action); void ExecuteAbortableLocked(string key, Action action); void ExecuteAbortableLocked(string key, CancellationToken ct, Action action); void ExecuteInSemaphore(SemaphoreOptions opts, Action a); void ExecuteInSemaphore(string prefix, int limit, Action a); void ExecuteLocked(LockOptions opts, Action action); void ExecuteLocked(LockOptions opts, CancellationToken ct, Action action); void ExecuteLocked(string key, Action action); void ExecuteLocked(string key, CancellationToken ct, Action action); IHealthEndpoint Health { get; } IKVEndpoint KV { get; } IRawEndpoint Raw { get; } IDistributedSemaphore Semaphore(SemaphoreOptions opts); IDistributedSemaphore Semaphore(string prefix, int limit); ISessionEndpoint Session { get; } IStatusEndpoint Status { get; } } }
// ----------------------------------------------------------------------- // <copyright file="Health.cs" company="PlayFab Inc"> // Copyright 2015 PlayFab Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> // ----------------------------------------------------------------------- using System; using System.Threading; namespace Consul { public interface IConsulClient { IACLEndpoint ACL { get; } IDisposableLock AcquireLock(LockOptions opts); IDisposableLock AcquireLock(LockOptions opts, CancellationToken ct); IDisposableLock AcquireLock(string key); IDisposableLock AcquireLock(string key, CancellationToken ct); IDisposableSemaphore AcquireSemaphore(SemaphoreOptions opts); IDisposableSemaphore AcquireSemaphore(string prefix, int limit); IAgentEndpoint Agent { get; } ICatalogEndpoint Catalog { get; } IDistributedLock CreateLock(LockOptions opts); IDistributedLock CreateLock(string key); IEventEndpoint Event { get; } void ExecuteAbortableLocked(LockOptions opts, Action action); void ExecuteAbortableLocked(LockOptions opts, CancellationToken ct, Action action); void ExecuteAbortableLocked(string key, Action action); void ExecuteAbortableLocked(string key, CancellationToken ct, Action action); void ExecuteInSemaphore(SemaphoreOptions opts, Action a); void ExecuteInSemaphore(string prefix, int limit, Action a); void ExecuteLocked(LockOptions opts, Action action); void ExecuteLocked(LockOptions opts, CancellationToken ct, Action action); void ExecuteLocked(string key, Action action); void ExecuteLocked(string key, CancellationToken ct, Action action); IHealthEndpoint Health { get; } IKVEndpoint KV { get; } IRawEndpoint Raw { get; } IDistributedSemaphore Semaphore(SemaphoreOptions opts); IDistributedSemaphore Semaphore(string prefix, int limit); ISessionEndpoint Session { get; } IStatusEndpoint Status { get; } } }
apache-2.0
C#
de5eb12cb51addcbf5438861bc217e63876b9286
add xmldoc for IAwaitable
navaei/BotBuilder,mmatkow/BotBuilder,dr-em/BotBuilder,stevengum97/BotBuilder,msft-shahins/BotBuilder,dr-em/BotBuilder,digibaraka/BotBuilder,Clairety/ConnectMe,msft-shahins/BotBuilder,xiangyan99/BotBuilder,yakumo/BotBuilder,yakumo/BotBuilder,digibaraka/BotBuilder,mmatkow/BotBuilder,mmatkow/BotBuilder,navaei/BotBuilder,jockorob/BotBuilder,yakumo/BotBuilder,digibaraka/BotBuilder,msft-shahins/BotBuilder,Clairety/ConnectMe,stevengum97/BotBuilder,xiangyan99/BotBuilder,navaei/BotBuilder,stevengum97/BotBuilder,jockorob/BotBuilder,Clairety/ConnectMe,xiangyan99/BotBuilder,yakumo/BotBuilder,mmatkow/BotBuilder,jockorob/BotBuilder,msft-shahins/BotBuilder,navaei/BotBuilder,Clairety/ConnectMe,jockorob/BotBuilder,dr-em/BotBuilder,dr-em/BotBuilder,stevengum97/BotBuilder,digibaraka/BotBuilder,xiangyan99/BotBuilder
CSharp/Library/Fibers/Awaitable.cs
CSharp/Library/Fibers/Awaitable.cs
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. // // Microsoft Bot Framework: http://botframework.com // // Bot Builder SDK Github: // https://github.com/Microsoft/BotBuilder // // Copyright (c) Microsoft Corporation // All rights reserved. // // MIT License: // 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.Runtime.CompilerServices; namespace Microsoft.Bot.Builder.Fibers.Internals { public interface IAwaiter<out T> : INotifyCompletion { bool IsCompleted { get; } T GetResult(); } } namespace Microsoft.Bot.Builder { /// <summary> /// Explicit interface to support the compiling of async/await. /// </summary> /// <typeparam name="T">The type of the contained value.</typeparam> public interface IAwaitable<out T> { /// <summary> /// Get the awaiter for this awaitable item. /// </summary> /// <returns>The awaiter.</returns> Fibers.Internals.IAwaiter<T> GetAwaiter(); } }
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. // // Microsoft Bot Framework: http://botframework.com // // Bot Builder SDK Github: // https://github.com/Microsoft/BotBuilder // // Copyright (c) Microsoft Corporation // All rights reserved. // // MIT License: // 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.Runtime.CompilerServices; namespace Microsoft.Bot.Builder.Fibers.Internals { public interface IAwaiter<out T> : INotifyCompletion { bool IsCompleted { get; } T GetResult(); } } namespace Microsoft.Bot.Builder { public interface IAwaitable<out T> { Fibers.Internals.IAwaiter<T> GetAwaiter(); } }
mit
C#
7937bdb8311f418babd2a525add44a65fcac6b36
update to 1.0.6.0
tdiehl/raygun4net,articulate/raygun4net,MindscapeHQ/raygun4net,articulate/raygun4net,tdiehl/raygun4net,MindscapeHQ/raygun4net,nelsonsar/raygun4net,nelsonsar/raygun4net,MindscapeHQ/raygun4net,ddunkin/raygun4net,ddunkin/raygun4net
Mindscape.Raygun4Net/Properties/AssemblyInfo.cs
Mindscape.Raygun4Net/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("Mindscape.Raygun4Net")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Mindscape.Raygun4Net")] [assembly: AssemblyCopyright("Copyright © 2012")] [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("72856682-3b04-495f-8e1f-bdd4b698b20e")] // 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.6.0")] [assembly: AssemblyFileVersion("1.0.6.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("Mindscape.Raygun4Net")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Mindscape.Raygun4Net")] [assembly: AssemblyCopyright("Copyright © 2012")] [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("72856682-3b04-495f-8e1f-bdd4b698b20e")] // 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.5.0")] [assembly: AssemblyFileVersion("1.0.5.0")]
mit
C#
f6028cd5845d2f150bae30139dba68d7eca7854b
Update FolderOptions.cs
A51UK/File-Repository
File-Repository/Enum/FolderOptions.cs
File-Repository/Enum/FolderOptions.cs
/* * Copyright 2017 Craig Lee Mark Adams Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. * * * */ using System; using System.Collections.Generic; using System.Text; namespace File_Repository.Enum { public enum FolderOptions { CreateIfNull, NotCreateIfNull, } }
/* * Copyright 2017 Criag Lee Mark Adams Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. * * * */ using System; using System.Collections.Generic; using System.Text; namespace File_Repository.Enum { public enum FolderOptions { CreateIfNull, NotCreateIfNull, } }
apache-2.0
C#
1d873cacce967f99ed992ba00d24433bc1f0da29
remove GetService Method
AspectCore/AspectCore-Framework,AspectCore/Lite,AspectCore/Abstractions,AspectCore/AspectCore-Framework
src/AspectCore.Abstractions/Extensions/ServiceProviderExtensions.cs
src/AspectCore.Abstractions/Extensions/ServiceProviderExtensions.cs
using System; namespace AspectCore.Abstractions.Extensions { public static class ServiceProviderExtensions { public static IAspectActivator GetAspectActivator(this IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } return (IAspectActivator)provider.GetService(typeof(IAspectActivator)); } } }
using System; namespace AspectCore.Abstractions.Extensions { public static class ServiceProviderExtensions { public static IAspectActivator GetAspectActivator(this IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } return (IAspectActivator)provider.GetService(typeof(IAspectActivator)); } public static T GetService<T>(this IOriginalServiceProvider originalServiceProvider) { if (originalServiceProvider == null) { throw new ArgumentNullException(nameof(originalServiceProvider)); } return (T)originalServiceProvider.GetService(typeof(T)); } } }
mit
C#
772a4b829aa22dd00e4a0f8475bda72a2c2d304a
Handle exceptions in SourceAdded (bgo#612407)
arfbtwn/hyena,arfbtwn/hyena,dufoli/hyena,GNOME/hyena,dufoli/hyena,petejohanson/hyena,GNOME/hyena,petejohanson/hyena
src/Hyena/Hyena/EventArgs.cs
src/Hyena/Hyena/EventArgs.cs
// // EventArgs.cs // // Author: // Alexander Kojevnikov <alexander@kojevnikov.com> // // Copyright (C) 2009-2010 Alexander Kojevnikov // // 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 Hyena { public class EventArgs<T> : System.EventArgs { private readonly T value; public EventArgs (T value) { this.value = value; } public T Value { get { return value; } } } public static class EventExtensions { public static void SafeInvoke<T> (this T @event, params object[] args) where T : class { var multicast = @event as MulticastDelegate; if (multicast != null) { foreach (var handler in multicast.GetInvocationList ()) { try { handler.DynamicInvoke (args); } catch (Exception e) { Log.Exception (e); } } } } } }
// // EventArgs.cs // // Author: // Alexander Kojevnikov <alexander@kojevnikov.com> // // Copyright (C) 2009 Alexander Kojevnikov // // 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. // namespace Hyena { public class EventArgs<T> : System.EventArgs { private readonly T value; public EventArgs (T value) { this.value = value; } public T Value { get { return value; } } } }
mit
C#
682bef36be87d0495ed1a53292b377658a06f460
Update Program.cs
mtsuker/GitTest1
ConsoleApp1/ConsoleApp1/Program.cs
ConsoleApp1/ConsoleApp1/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { //github change + edit } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { //github change } } }
mit
C#
c111b1edff046663dd4bf4f4338d87d2c7608fd1
add loading baseclass methods
Pondidum/Ledger.Stores.Fs,Pondidum/Ledger.Stores.Fs
Ledger.Stores.Fs.Tests/TestBase.cs
Ledger.Stores.Fs.Tests/TestBase.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using Ledger.Infrastructure; using NSubstitute; using TestsDomain; namespace Ledger.Stores.Fs.Tests { public class TestBase { public List<string> Events { get; private set; } public List<string> Snapshots { get; private set; } public TestBase() { Events = new List<string>(); Snapshots = new List<string>(); } protected void Save(AggregateRoot<Guid> aggregate) { var events = new MemoryStream(); var snapshots = new MemoryStream(); var fileSystem = Substitute.For<IFileSystem>(); fileSystem.AppendTo("fs\\Guid.events.json").Returns(events); fileSystem.AppendTo("fs\\Guid.snapshots.json").Returns(snapshots); var fs = new FileEventStore(fileSystem, "fs"); var store = new AggregateStore<Guid>(fs); store.Save(aggregate); Events.Clear(); Events.AddRange(FromStream(events)); Snapshots.Clear(); Snapshots.AddRange(FromStream(snapshots)); } protected Candidate Load(Guid id) { var events = ToStream(Events); var snapshots = ToStream(Snapshots); var fileSystem = Substitute.For<IFileSystem>(); fileSystem.AppendTo("fs\\Guid.events.json").Returns(events); fileSystem.AppendTo("fs\\Guid.snapshots.json").Returns(snapshots); var fs = new FileEventStore(fileSystem, "fs"); var store = new AggregateStore<Guid>(fs); return store.Load(id, () => new Candidate()); } private static List<string> FromStream(MemoryStream stream) { var copy = new MemoryStream(stream.ToArray()); using (var reader = new StreamReader(copy)) { return reader .ReadToEnd() .Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries) .ToList(); } } private static Stream ToStream(IEnumerable<string> items) { var ms = new MemoryStream(); var sw = new StreamWriter(ms); items.ForEach(x => sw.WriteLine(x)); ms.Position = 0; return ms; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using NSubstitute; namespace Ledger.Stores.Fs.Tests { public class TestBase { public List<string> Events { get; private set; } public List<string> Snapshots { get; private set; } public TestBase() { Events = new List<string>(); Snapshots = new List<string>(); } protected void Save(AggregateRoot<Guid> aggregate) { var events = new MemoryStream(); var snapshots = new MemoryStream(); var fileSystem = Substitute.For<IFileSystem>(); fileSystem.AppendTo("fs\\Guid.events.json").Returns(events); fileSystem.AppendTo("fs\\Guid.snapshots.json").Returns(snapshots); var fs = new FileEventStore(fileSystem, "fs"); var store = new AggregateStore<Guid>(fs); store.Save(aggregate); Events.Clear(); Events.AddRange(FromStream(events)); Snapshots.Clear(); Snapshots.AddRange(FromStream(snapshots)); } private static List<string> FromStream(MemoryStream stream) { var copy = new MemoryStream(stream.ToArray()); using (var reader = new StreamReader(copy)) { return reader .ReadToEnd() .Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries) .ToList(); } } } }
lgpl-2.1
C#
e8b4a7ec73b8d2cfc7fe420143d1dff8d2c51bfd
バージョン番号更新。
YKSoftware/YKToolkit.Controls
YKToolkit.Controls/Properties/AssemblyInfo.cs
YKToolkit.Controls/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("YKToolkit.Controls")] #if NET4 [assembly: AssemblyDescription(".NET Framework 4.0 用 の WPF カスタムコントロールライブラリです。")] #else [assembly: AssemblyDescription("WPF カスタムコントロールライブラリです。")] #endif [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("YKSoftware")] [assembly: AssemblyProduct("YKToolkit.Controls")] [assembly: AssemblyCopyright("Copyright © 2015 YKSoftware")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly:ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyVersion("2.4.5.1")]
using System.Reflection; using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("YKToolkit.Controls")] #if NET4 [assembly: AssemblyDescription(".NET Framework 4.0 用 の WPF カスタムコントロールライブラリです。")] #else [assembly: AssemblyDescription("WPF カスタムコントロールライブラリです。")] #endif [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("YKSoftware")] [assembly: AssemblyProduct("YKToolkit.Controls")] [assembly: AssemblyCopyright("Copyright © 2015 YKSoftware")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly:ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyVersion("2.4.5.0")]
mit
C#
594038a3641028b1e298dfd40b2a0831921ce260
Fix crash when picking selected date; fix #28
arthurrump/Zermelo.App.UWP
Zermelo.App.UWP/Schedule/ScheduleView.xaml.cs
Zermelo.App.UWP/Schedule/ScheduleView.xaml.cs
using System; using System.Linq; using Autofac; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; namespace Zermelo.App.UWP.Schedule { public sealed partial class ScheduleView : Page { public ScheduleView() { this.InitializeComponent(); ViewModel = (App.Current as App).Container.Resolve<ScheduleViewModel>(); NavigationCacheMode = NavigationCacheMode.Enabled; CalendarView.SelectedDates.Add(ViewModel.Date); } public ScheduleViewModel ViewModel { get; } private void ScheduleListView_ItemClick(object sender, ItemClickEventArgs e) { ViewModel.SelectedAppointment = e.ClickedItem as Appointment; Modal.IsModal = true; } private void CalendarView_SelectedDatesChanged(CalendarView sender, CalendarViewSelectedDatesChangedEventArgs args) { if (args.AddedDates.Count > 0) ViewModel.Date = args.AddedDates.FirstOrDefault(); else CalendarView.SelectedDates.Add(ViewModel.Date); } private void CalendarView_CalendarViewDayItemChanging(CalendarView sender, CalendarViewDayItemChangingEventArgs args) { var day = args.Item.Date.DayOfWeek; if (day == DayOfWeek.Saturday || day == DayOfWeek.Sunday) args.Item.IsBlackout = true; } } }
using System; using System.Linq; using Autofac; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; namespace Zermelo.App.UWP.Schedule { public sealed partial class ScheduleView : Page { public ScheduleView() { this.InitializeComponent(); ViewModel = (App.Current as App).Container.Resolve<ScheduleViewModel>(); NavigationCacheMode = NavigationCacheMode.Enabled; CalendarView.SelectedDates.Add(ViewModel.Date); } public ScheduleViewModel ViewModel { get; } private void ScheduleListView_ItemClick(object sender, ItemClickEventArgs e) { ViewModel.SelectedAppointment = e.ClickedItem as Appointment; Modal.IsModal = true; } private void CalendarView_SelectedDatesChanged(CalendarView sender, CalendarViewSelectedDatesChangedEventArgs args) { ViewModel.Date = args.AddedDates.FirstOrDefault(); } private void CalendarView_CalendarViewDayItemChanging(CalendarView sender, CalendarViewDayItemChangingEventArgs args) { var day = args.Item.Date.DayOfWeek; if (day == DayOfWeek.Saturday || day == DayOfWeek.Sunday) args.Item.IsBlackout = true; } } }
mit
C#
a644ad0589c136bfd7b5e0a862b96f5c8e454cd7
Implement Kart portion of interface. Basically, it is a simplified version of CarControl that performs top level logic to path plan
intel-cornellcup/sim-ai,maZang/ModbotPathPlan,maZang/ModbotPathPlan,intel-cornellcup/sim-ai,intel-cornellcup/sim-ai,maZang/ModbotPathPlan
ModbotPathPlan/Assets/Scripts/Kart.cs
ModbotPathPlan/Assets/Scripts/Kart.cs
using UnityEngine; using System; using System.Collections.Generic; public class Kart : MonoBehaviour { public List<Vector3> wayPoints; //list of waypoints for the car public int current_point; //the current waypoint PathPlanning pathPlanner; // Represents the path planning object public void SetUpKart () { //Set initial waypoint to 0 current_point = 0; //Perform path planning GameObject pathPlanGameObject = GameObject.Find("GameMapWithNav"); pathPlanner = pathPlanGameObject.GetComponent<PathPlanning>(); pathPlanner.SetUpPathPlanning (transform.position); wayPoints = new List<Vector3> (); foreach (GenerateGraph.Node pathNode in pathPlanner.path) { wayPoints.Add(pathNode.point); } } }
using UnityEngine; using System; using System.Collections.Generic; public class Kart : MonoBehaviour { public List<Vector3> wayPoints; //list of waypoints for the car public int current_point; //the current waypoint public void SetUpKart (List<Vector3> wayPoints, int current_point) { this.wayPoints = wayPoints; this.current_point = current_point; } }
mit
C#
23183bce9e01408be41c1f05c5caa68c9adc0f26
fix May15 test
MetacoSA/NBitcoin,thepunctuatedhorizon/BrickCoinAlpha.0.0.1,lontivero/NBitcoin,bitcoinbrisbane/NBitcoin,MetacoSA/NBitcoin,NicolasDorier/NBitcoin,you21979/NBitcoin,stratisproject/NStratis,dangershony/NStratis,HermanSchoenfeld/NBitcoin
NBitcoin.Tests/checkblock_tests.cs
NBitcoin.Tests/checkblock_tests.cs
using NBitcoin.DataEncoders; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; using Xunit; namespace NBitcoin.Tests { public class checkblock_tests { [Fact] [Trait("Core", "Core")] public void May15() { // Putting a 1MB binary file in the git repository is not a great // idea, so this test is only run if you manually download // test/data/Mar12Fork.dat from // http://sourceforge.net/projects/bitcoin/files/Bitcoin/blockchain/Mar12Fork.dat/download var tMay15 = Utils.UnixTimeToDateTime(1368576000); ValidationState state = Network.Main.CreateValidationState(); state.CheckProofOfWork = false; state.Now = tMay15; // Test as if it was right at May 15 Block forkingBlock = read_block("Mar12Fork.dat"); // After May 15'th, big blocks are OK: forkingBlock.Header.BlockTime = tMay15; // Invalidates PoW Assert.True(state.CheckBlock(forkingBlock)); } [Fact] [Trait("UnitTest", "UnitTest")] public void CanCalculateMerkleRoot() { Block block = new Block(); block.ReadWrite(Encoders.Hex.DecodeData(File.ReadAllText(@"data\block169482.txt"))); Assert.Equal(block.Header.HashMerkleRoot, block.GetMerkleRoot().Hash); } private Block read_block(string blockName) { var file = "Data/" + blockName; if(File.Exists(file)) { Block b = new Block(); b.ReadWrite(File.ReadAllBytes(file)); // skip msgheader/size return b; } else { WebClient client = new WebClient(); client.DownloadFile("http://webbtc.com/block/0000000000000024b58eeb1134432f00497a6a860412996e7a260f47126eed07.bin", file); return read_block(blockName); } } } }
using NBitcoin.DataEncoders; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; using Xunit; namespace NBitcoin.Tests { public class checkblock_tests { [Fact] [Trait("Core", "Core")] public void May15() { // Putting a 1MB binary file in the git repository is not a great // idea, so this test is only run if you manually download // test/data/Mar12Fork.dat from // http://sourceforge.net/projects/bitcoin/files/Bitcoin/blockchain/Mar12Fork.dat/download var tMay15 = Utils.UnixTimeToDateTime(1368576000); ValidationState state = Network.Main.CreateValidationState(); state.CheckProofOfWork = false; state.Now = tMay15; // Test as if it was right at May 15 Block forkingBlock = read_block("Mar12Fork.dat"); // After May 15'th, big blocks are OK: forkingBlock.Header.BlockTime = tMay15; // Invalidates PoW Assert.True(state.CheckBlock(forkingBlock)); } [Fact] [Trait("UnitTest", "UnitTest")] public void CanCalculateMerkleRoot() { Block block = new Block(); block.ReadWrite(Encoders.Hex.DecodeData(File.ReadAllText(@"data\block169482.txt"))); Assert.Equal(block.Header.HashMerkleRoot, block.GetMerkleRoot().Hash); } private Block read_block(string blockName) { var file = "Data/" + blockName; if(File.Exists(file)) { Block b = new Block(); b.ReadWrite(File.ReadAllBytes(file), 8); // skip msgheader/size return b; } else { WebClient client = new WebClient(); client.DownloadFile("http://webbtc.com/block/0000000000000024b58eeb1134432f00497a6a860412996e7a260f47126eed07.bin", file); return read_block(blockName); } } } }
mit
C#
68129626ab4a700e64489763f39edd4ef44b93d8
Make TestResultPage internal.
dsplaisted/pcltesting,AArnott/pcltesting
PCLTesting.Forms/TestResultPage.cs
PCLTesting.Forms/TestResultPage.cs
namespace PCLTesting.Infrastructure { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Validation; using Xamarin.Forms; internal class TestResultPage : ContentPage { public TestResultPage(Test test) { Requires.NotNull(test, "test"); this.BindingContext = test; this.Title = test.Name; var grid = new Grid { ColumnDefinitions = new ColumnDefinitionCollection{ new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, RowDefinitions = new RowDefinitionCollection{ new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star)}, }, Padding = new Thickness(10), }; var title = new Label { Font = Font.SystemFontOfSize(NamedSize.Large), }; title.SetBinding<Test>(Label.TextProperty, vm => vm.Name); grid.Children.Add(title); var result = new Label(); result.SetBinding<Test>(Label.TextProperty, vm => vm.FullFailureExplanation); var scrollViewer = new ScrollView { Content = result, }; scrollViewer.SetValue(Grid.RowProperty, 1); grid.Children.Add(scrollViewer); this.Content = grid; } } }
namespace PCLTesting.Infrastructure { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Validation; using Xamarin.Forms; public class TestResultPage : ContentPage { public TestResultPage(Test test) { Requires.NotNull(test, "test"); this.BindingContext = test; this.Title = test.Name; var grid = new Grid { ColumnDefinitions = new ColumnDefinitionCollection{ new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, RowDefinitions = new RowDefinitionCollection{ new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star)}, }, Padding = new Thickness(10), }; var title = new Label { Font = Font.SystemFontOfSize(NamedSize.Large), }; title.SetBinding<Test>(Label.TextProperty, vm => vm.Name); grid.Children.Add(title); var result = new Label(); result.SetBinding<Test>(Label.TextProperty, vm => vm.FullFailureExplanation); var scrollViewer = new ScrollView { Content = result, }; scrollViewer.SetValue(Grid.RowProperty, 1); grid.Children.Add(scrollViewer); this.Content = grid; } } }
mit
C#
49770ceda40f148896e138bc0bbc7db79626557f
Add non-generic polygon type that uses double type by default.
taylorhutchison/Geode
Geode/Geometry/Polygon.cs
Geode/Geometry/Polygon.cs
using System; using System.Collections.Generic; using System.Text; namespace Geode.Geometry { public class Polygon: IGeoType { public string Type => "Polygon"; public IEnumerable<IEnumerable<double>> Coordinates { get; set; } public Polygon(IEnumerable<IEnumerable<double>> coordinates) { Coordinates = coordinates; } } public class Polygon<T> : IGeoType { public string Type => "Polygon"; public IEnumerable<IEnumerable<T>> Coordinates { get; set; } public Polygon(IEnumerable<IEnumerable<T>> coordinates) { Coordinates = coordinates; } } }
using System; using System.Collections.Generic; using System.Text; namespace Geode.Geometry { public class Polygon<T> : IGeoType { public string Type => "Polygon"; public IEnumerable<IEnumerable<T>> Coordinates { get; set; } public Polygon(IEnumerable<IEnumerable<T>> coordinates) { Coordinates = coordinates; } } }
mit
C#
adf6c7e86712fb4cea47a8503d6a21f0976816fc
Change to caps
JimFung/GGJ2015RAMS
RAMS/Assets/Scripts/changeScene.cs
RAMS/Assets/Scripts/changeScene.cs
using UnityEngine; using System.Collections; public class ChangeScene1 : MonoBehaviour { [SerializeField] AudioClip select; public static bool flag = false; public static float startTime = 0; public static int sceneValue ; public void changeToScene(int scene){ if (scene == -1) { Application.Quit(); } audio.PlayOneShot(select); startTime = Time.time; sceneValue = scene; flag = true; } }
using UnityEngine; using System.Collections; public class ChangeScene : MonoBehaviour { [SerializeField] AudioClip select; public static bool flag = false; public static float startTime = 0; public static int sceneValue ; public void changeToScene(int scene){ if (scene == -1) { Application.Quit(); } audio.PlayOneShot(select); startTime = Time.time; sceneValue = scene; flag = true; } }
mit
C#
411d2c3be492292d070e2d5b83eb9d03b0596bbc
fix context rename
WojcikMike/docs.particular.net
Snippets/Snippets_6/Headers/IncomingBehavior.cs
Snippets/Snippets_6/Headers/IncomingBehavior.cs
namespace Snippets6.Headers { using System; using System.Collections.Generic; using System.Threading.Tasks; using NServiceBus; using NServiceBus.Pipeline; #region header-incoming-behavior public class IncomingBehavior : Behavior<IncomingPhysicalMessageContext> { public override async Task Invoke(IncomingPhysicalMessageContext context, Func<Task> next) { Dictionary<string, string> headers = context.Message.Headers; string nsbVersion = headers[Headers.NServiceBusVersion]; string customHeader = headers["MyCustomHeader"]; await next(); } } #endregion }
namespace Snippets6.Headers { using System; using System.Collections.Generic; using System.Threading.Tasks; using NServiceBus; using NServiceBus.Pipeline; #region header-incoming-behavior public class IncomingBehavior : Behavior<PhysicalMessageProcessingContext> { public override async Task Invoke(PhysicalMessageProcessingContext context, Func<Task> next) { Dictionary<string, string> headers = context.Message.Headers; string nsbVersion = headers[Headers.NServiceBusVersion]; string customHeader = headers["MyCustomHeader"]; await next(); } } #endregion }
apache-2.0
C#
8cd477c717e62f68906f9a3c6dc862e273e88cc7
include the number 9
modulexcite/RandomGen,aliostad/RandomGen,jkonecki/RandomGen,aliostad/RandomGen
src/RandomGen/PhoneNumbersLink.cs
src/RandomGen/PhoneNumbersLink.cs
using System; using System.Collections.Generic; using RandomGen.Fluent; namespace RandomGen { class PhoneNumbersLink : IPhoneNumbers { private readonly RandomLink _random; private readonly Func<int> _generate; internal PhoneNumbersLink(RandomLink random) { this._random = random; this._generate = this._random.Numbers.Integers(0, 10); } string MaskToString(string mask) { return string.Join("", MaskToEnumerable(mask)); } IEnumerable<string> MaskToEnumerable(string mask) { foreach (var character in mask) { if (character == 'x') { yield return this._generate().ToString(); } else { yield return character.ToString(); } } } string NumberFormatToMask(NumberFormat format) { switch (format) { case NumberFormat.UKLandLine: return "01xxx xxxxxx"; case NumberFormat.UKMobile: return "07xxx xxxxxx"; } throw new NotSupportedException("format not supported"); } public Func<string> FromMask(string mask) { return () => MaskToString(mask); } public Func<string> WithFormat(NumberFormat format) { return FromMask(NumberFormatToMask(format)); } public Func<string> WithRandomFormat() { // work out the number of items in the enum, and select a random member // (assuming the values in the enum are simple consecutive numbers) return WithFormat((NumberFormat)this._random.Numbers.Integers(0, (int)Enum.GetValues(typeof(NumberFormat)).Length -1)()); } } }
using System; using System.Collections.Generic; using RandomGen.Fluent; namespace RandomGen { class PhoneNumbersLink : IPhoneNumbers { private readonly RandomLink _random; private readonly Func<int> _generate; internal PhoneNumbersLink(RandomLink random) { this._random = random; this._generate = this._random.Numbers.Integers(0, 9); } string MaskToString(string mask) { return string.Join("", MaskToEnumerable(mask)); } IEnumerable<string> MaskToEnumerable(string mask) { foreach (var character in mask) { if (character == 'x') { yield return this._generate().ToString(); } else { yield return character.ToString(); } } } string NumberFormatToMask(NumberFormat format) { switch (format) { case NumberFormat.UKLandLine: return "01xxx xxxxxx"; case NumberFormat.UKMobile: return "07xxx xxxxxx"; } throw new NotSupportedException("format not supported"); } public Func<string> FromMask(string mask) { return () => MaskToString(mask); } public Func<string> WithFormat(NumberFormat format) { return FromMask(NumberFormatToMask(format)); } public Func<string> WithRandomFormat() { // work out the number of items in the enum, and select a random member // (assuming the values in the enum are simple consecutive numbers) return WithFormat((NumberFormat)this._random.Numbers.Integers(0, (int)Enum.GetValues(typeof(NumberFormat)).Length -1)()); } } }
mit
C#
47d6ba61dd7014087d6195e628420fa922d25694
Update tests/Avalonia.Markup.UnitTests/Extensions/IEnummerableExtension.cs
AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,Perspex/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia
tests/Avalonia.Markup.UnitTests/Extensions/IEnummerableExtension.cs
tests/Avalonia.Markup.UnitTests/Extensions/IEnummerableExtension.cs
using System; using System.Collections; namespace Avalonia.Markup.UnitTests { internal static class IEnumerableExtensions { public static object ElementAt(this IEnumerable source, int index) { var i = -1; var enumerator = source.GetEnumerator(); while (enumerator.MoveNext() && ++i < index); if (i == index) { return enumerator.Current; } throw new ArgumentOutOfRangeException(nameof(index)); } } }
using System; using System.Collections; namespace Avalonia.Markup.UnitTests { static class IEnummerableExtension { public static object ElementAt(this IEnumerable source, int index) { var i = -1; var enumerator = source.GetEnumerator(); while (enumerator.MoveNext() && ++i < index); if (i == index) { return enumerator.Current; } throw new ArgumentOutOfRangeException(nameof(index)); } } }
mit
C#
8cd8f1c36b75f49764bb9c0537110a5b9463b192
update about
NickSerg/water-meter,NickSerg/water-meter,NickSerg/water-meter
WaterMeter/WM.AspNetMvc/Views/Home/About.cshtml
WaterMeter/WM.AspNetMvc/Views/Home/About.cshtml
@{ ViewBag.Title = "Информация"; } <h2>@ViewBag.Title</h2> <h3>@ViewBag.Message</h3> <p>Система регистрации показаний пробора учёта</p>
@{ ViewBag.Title = "Информация"; } <h2>@ViewBag.Title</h2> <h3>@ViewBag.Message</h3> <p>Система регистрации показаний пробора учёта.</p>
apache-2.0
C#
2b751669ed693f5e433725c97a07783b236569c5
Drop '$' characters from variables
exodrifter/unity-raconteur,dpek/unity-raconteur
Assets/Raconteur/Util/Expressions/ValueVariable.cs
Assets/Raconteur/Util/Expressions/ValueVariable.cs
namespace DPek.Raconteur.Util.Expressions { /// <summary> /// A Variable represents a string in an expression that refers to a /// variable. /// </summary> public class ValueVariable : Value { /// <summary> /// The name of the variable to look up and modify. /// </summary> private string m_variable; public ValueVariable(string variable) { m_variable = variable.Replace("$", ""); } public override Value GetValue(StoryState state) { string value = state.GetVariable(m_variable); object number = ParseNumber(value); if(number != null) { return new ValueNumber(value); } return new ValueString(value); } public override object GetRawValue(StoryState state) { string value = state.GetVariable(m_variable); object number = ParseNumber(value); if(number != null) { return number; } return value; } public override void SetValue(StoryState state, Value value) { state.SetVariable(m_variable, value.AsString(state)); } public override string AsString(StoryState state) { return state.GetVariable(m_variable); } /// <summary> /// Returns a string that represents this object for debugging purposes. /// </summary> /// <returns> /// A string that represents this object for debugging purposes. /// </returns> public override string ToString () { return "var:" + m_variable; } } }
namespace DPek.Raconteur.Util.Expressions { /// <summary> /// A Variable represents a string in an expression that refers to a /// variable. /// </summary> public class ValueVariable : Value { /// <summary> /// The name of the variable to look up and modify. /// </summary> private string m_variable; public ValueVariable(string variable) { m_variable = variable; } public override Value GetValue(StoryState state) { string value = state.GetVariable(m_variable); object number = ParseNumber(value); if(number != null) { return new ValueNumber(value); } return new ValueString(value); } public override object GetRawValue(StoryState state) { string value = state.GetVariable(m_variable); object number = ParseNumber(value); if(number != null) { return number; } return value; } public override void SetValue(StoryState state, Value value) { state.SetVariable(m_variable, value.AsString(state)); } public override string AsString(StoryState state) { return state.GetVariable(m_variable); } /// <summary> /// Returns a string that represents this object for debugging purposes. /// </summary> /// <returns> /// A string that represents this object for debugging purposes. /// </returns> public override string ToString () { return "var:" + m_variable; } } }
bsd-3-clause
C#
342d06ef49f36630e2b52e30b99efb1d4cbe28ee
Update Stability.cs
tiksn/TIKSN-Framework
TIKSN.Core/Versioning/Stability.cs
TIKSN.Core/Versioning/Stability.cs
namespace TIKSN.Versioning { public enum Stability { Stable, Unstable } }
namespace TIKSN.Versioning { public enum Stability { Stable, Unstable, } }
mit
C#
4596bdeaace6c02aa37c14e7b71b781d3b042811
Bump version to 0.35.0-beta
github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity
common/SolutionInfo.cs
common/SolutionInfo.cs
#pragma warning disable 436 using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyProduct("GitHub for Unity")] [assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)] [assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)] [assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)] [assembly: ComVisible(false)] [assembly: AssemblyCompany("GitHub, Inc.")] [assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)] //Required for NSubstitute [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)] //Required for Unity compilation [assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)] namespace System { internal static class AssemblyVersionInformation { // this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics internal const string VersionForAssembly = "0.35.0"; // Actual real version internal const string Version = "0.35.0-beta"; } }
#pragma warning disable 436 using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyProduct("GitHub for Unity")] [assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)] [assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)] [assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)] [assembly: ComVisible(false)] [assembly: AssemblyCompany("GitHub, Inc.")] [assembly: AssemblyCopyright("Copyright GitHub, Inc. 2017-2018")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)] //Required for NSubstitute [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)] //Required for Unity compilation [assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)] namespace System { internal static class AssemblyVersionInformation { // this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics internal const string VersionForAssembly = "0.34.1"; // Actual real version internal const string Version = "0.34.1-beta"; } }
mit
C#
e99310b59cfddbad40882e187a79668cdd865bb4
Add JsonConstructor attribute
peppy/osu,NeoAdonis/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu
osu.Game/Online/Rooms/BeatmapAvailability.cs
osu.Game/Online/Rooms/BeatmapAvailability.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using Newtonsoft.Json; namespace osu.Game.Online.Rooms { /// <summary> /// The local availability information about a certain beatmap for the client. /// </summary> public class BeatmapAvailability : IEquatable<BeatmapAvailability> { /// <summary> /// The beatmap's availability state. /// </summary> public readonly DownloadState State; /// <summary> /// The beatmap's downloading progress, null when not in <see cref="DownloadState.Downloading"/> state. /// </summary> public readonly double? DownloadProgress; [JsonConstructor] private BeatmapAvailability(DownloadState state, double? downloadProgress = null) { State = state; DownloadProgress = downloadProgress; } public static BeatmapAvailability NotDownload() => new BeatmapAvailability(DownloadState.NotDownloaded); public static BeatmapAvailability Downloading(double progress) => new BeatmapAvailability(DownloadState.Downloading, progress); public static BeatmapAvailability Downloaded() => new BeatmapAvailability(DownloadState.Downloaded); public static BeatmapAvailability LocallyAvailable() => new BeatmapAvailability(DownloadState.LocallyAvailable); public bool Equals(BeatmapAvailability other) => other != null && State == other.State && DownloadProgress == other.DownloadProgress; public override string ToString() => $"{string.Join(", ", State, $"{DownloadProgress:0.00%}")}"; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; namespace osu.Game.Online.Rooms { /// <summary> /// The local availability information about a certain beatmap for the client. /// </summary> public class BeatmapAvailability : IEquatable<BeatmapAvailability> { /// <summary> /// The beatmap's availability state. /// </summary> public readonly DownloadState State; /// <summary> /// The beatmap's downloading progress, null when not in <see cref="DownloadState.Downloading"/> state. /// </summary> public readonly double? DownloadProgress; private BeatmapAvailability(DownloadState state, double? downloadProgress = null) { State = state; DownloadProgress = downloadProgress; } public static BeatmapAvailability NotDownload() => new BeatmapAvailability(DownloadState.NotDownloaded); public static BeatmapAvailability Downloading(double progress) => new BeatmapAvailability(DownloadState.Downloading, progress); public static BeatmapAvailability Downloaded() => new BeatmapAvailability(DownloadState.Downloaded); public static BeatmapAvailability LocallyAvailable() => new BeatmapAvailability(DownloadState.LocallyAvailable); public bool Equals(BeatmapAvailability other) => other != null && State == other.State && DownloadProgress == other.DownloadProgress; public override string ToString() => $"{string.Join(", ", State, $"{DownloadProgress:0.00%}")}"; } }
mit
C#
eed061adf8554909bcc012612e8da3293d6c34ed
fix some obsolescence warnings
fozzzgate/xamarin-bluetooth-le,xabre/xamarin-bluetooth-le
Source/MvvmCross.Plugins.BLE.macOS/Plugin.cs
Source/MvvmCross.Plugins.BLE.macOS/Plugin.cs
using Foundation; using MvvmCross.IoC; using MvvmCross.Logging; using MvvmCross.Plugin; using Plugin.BLE; using Plugin.BLE.Abstractions; using Plugin.BLE.Abstractions.Contracts; [assembly: Preserve] namespace MvvmCross.Plugins.BLE.macOS { [Preserve(AllMembers = true)] [MvxPlugin] public class Plugin : IMvxPlugin { public Plugin() { var log = Mvx.IoCProvider.Resolve<IMvxLog>(); Trace.TraceImplementation = log.Trace; } public void Load() { Trace.Message("Loading bluetooth low energy plugin"); Mvx.IoCProvider.LazyConstructAndRegisterSingleton<IBluetoothLE>(() => CrossBluetoothLE.Current); Mvx.IoCProvider.LazyConstructAndRegisterSingleton<IAdapter>(() => Mvx.IoCProvider.Resolve<IBluetoothLE>().Adapter); } } }
using Foundation; using MvvmCross.Logging; using MvvmCross.Plugin; using Plugin.BLE; using Plugin.BLE.Abstractions; using Plugin.BLE.Abstractions.Contracts; [assembly: Preserve] namespace MvvmCross.Plugins.BLE.macOS { [Preserve(AllMembers = true)] [MvxPlugin] public class Plugin : IMvxPlugin { public Plugin() { var log = Mvx.Resolve<IMvxLog>(); Trace.TraceImplementation = log.Trace; } public void Load() { Trace.Message("Loading bluetooth low energy plugin"); Mvx.LazyConstructAndRegisterSingleton(() => CrossBluetoothLE.Current); Mvx.LazyConstructAndRegisterSingleton(() => Mvx.Resolve<IBluetoothLE>().Adapter); } } }
apache-2.0
C#
befb78f83b890f847b16cbcd2c52310bc7d15975
Simplify LegacySkinResourceStore by deriving from ResourceStore
peppy/osu,smoogipoo/osu,2yangk23/osu,peppy/osu-new,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,EVAST9919/osu,johnneijzen/osu,NeoAdonis/osu,2yangk23/osu,ppy/osu
osu.Game/Skinning/LegacySkinResourceStore.cs
osu.Game/Skinning/LegacySkinResourceStore.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Linq; using osu.Framework.IO.Stores; using osu.Game.Database; namespace osu.Game.Skinning { public class LegacySkinResourceStore<T> : ResourceStore<byte[]> where T : INamedFileInfo { private readonly IHasFiles<T> source; public LegacySkinResourceStore(IHasFiles<T> source, IResourceStore<byte[]> underlyingStore) : base(underlyingStore) { this.source = source; } protected override IEnumerable<string> GetFilenames(string name) { if (source.Files == null) yield break; foreach (var filename in base.GetFilenames(name)) { var path = getPathForFile(filename); if (path != null) yield return path; } } private string getPathForFile(string filename) => source.Files.Find(f => string.Equals(f.Filename, filename, StringComparison.InvariantCultureIgnoreCase))?.FileInfo.StoragePath; public override IEnumerable<string> GetAvailableResources() => source.Files.Select(f => f.Filename); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using osu.Framework.IO.Stores; using osu.Game.Database; namespace osu.Game.Skinning { public class LegacySkinResourceStore<T> : IResourceStore<byte[]> where T : INamedFileInfo { private readonly IHasFiles<T> source; private readonly IResourceStore<byte[]> underlyingStore; private string getPathForFile(string filename) { if (source.Files == null) return null; var file = source.Files.Find(f => string.Equals(f.Filename, filename, StringComparison.InvariantCultureIgnoreCase)); return file?.FileInfo.StoragePath; } public LegacySkinResourceStore(IHasFiles<T> source, IResourceStore<byte[]> underlyingStore) { this.source = source; this.underlyingStore = underlyingStore; } public Stream GetStream(string name) { string path = getPathForFile(name); return path == null ? null : underlyingStore.GetStream(path); } public IEnumerable<string> GetAvailableResources() => source.Files.Select(f => f.Filename); byte[] IResourceStore<byte[]>.Get(string name) => GetAsync(name).Result; public Task<byte[]> GetAsync(string name) { string path = getPathForFile(name); return path == null ? Task.FromResult<byte[]>(null) : underlyingStore.GetAsync(path); } #region IDisposable Support private bool isDisposed; protected virtual void Dispose(bool disposing) { if (!isDisposed) { isDisposed = true; } } ~LegacySkinResourceStore() { Dispose(false); } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion } }
mit
C#
a8c74ec791104649abd6d8162fd835fa613e39ff
Print version of firmware
treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk
NET/Demos/Console/Blink/Program.cs
NET/Demos/Console/Blink/Program.cs
using System; using Treehopper; using System.Threading.Tasks; using System.Diagnostics; using System.Collections.Generic; namespace Blink { /// <summary> /// This demo blinks the built-in LED using basic procedural programming. /// </summary> /// <remarks> /// <para> /// This example illustrates how to work with Treehopper boards procedurally to blink an LED. /// </para> /// </remarks> class Program { static void Main(string[] args) { RunBlink().Wait(); } static async Task RunBlink() { Utilities.Map(1, 5, 3, 2, 5); while (true) { Console.Write("Waiting for board..."); // Get a reference to the first TreehopperUsb board connected. This will await indefinitely until a board is connected. //TreehopperManager manager = new TreehopperManager(); //manager.BoardAdded += Manager_BoardAdded; TreehopperUsb Board = await ConnectionService.Instance.GetFirstDeviceAsync(); Console.WriteLine("Found board: " + Board); Console.WriteLine("Version: " + Board.Version); // You must explicitly open a board before communicating with it await Board.ConnectAsync(); while (Board.IsConnected) { // toggle the LED Board.Led = !Board.Led; // wait 500 ms await Task.Delay(500); } // We arrive here when the board has been disconnected Console.WriteLine("Board has been disconnected."); } } private static void Manager_BoardAdded(TreehopperManager sender, TreehopperBoard board) { //throw new NotImplementedException(); } } }
using System; using Treehopper; using System.Threading.Tasks; using System.Diagnostics; using System.Collections.Generic; namespace Blink { /// <summary> /// This demo blinks the built-in LED using basic procedural programming. /// </summary> /// <remarks> /// <para> /// This example illustrates how to work with Treehopper boards procedurally to blink an LED. /// </para> /// </remarks> class Program { static void Main(string[] args) { RunBlink().Wait(); } static async Task RunBlink() { Utilities.Map(1, 5, 3, 2, 5); while (true) { Console.Write("Waiting for board..."); // Get a reference to the first TreehopperUsb board connected. This will await indefinitely until a board is connected. //TreehopperManager manager = new TreehopperManager(); //manager.BoardAdded += Manager_BoardAdded; TreehopperUsb Board = await ConnectionService.Instance.GetFirstDeviceAsync(); Console.WriteLine("Found board: " + Board); // You must explicitly open a board before communicating with it await Board.ConnectAsync(); while (Board.IsConnected) { // toggle the LED Board.Led = !Board.Led; // wait 500 ms await Task.Delay(500); } // We arrive here when the board has been disconnected Console.WriteLine("Board has been disconnected."); } } private static void Manager_BoardAdded(TreehopperManager sender, TreehopperBoard board) { //throw new NotImplementedException(); } } }
mit
C#
95e117fddd3b51ff2f988820ae6d5747e9fde692
Add a test for SKSwizzle
mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp,mono/SkiaSharp
tests/Tests/SKPixmapTest.cs
tests/Tests/SKPixmapTest.cs
using System; using System.Runtime.InteropServices; using Xunit; namespace SkiaSharp.Tests { public class SKPixmapTest : SKTest { [SkippableFact] public void ReadPixelSucceeds() { var info = new SKImageInfo(10, 10); var ptr1 = Marshal.AllocCoTaskMem(info.BytesSize); var pix1 = new SKPixmap(info, ptr1); var ptr2 = Marshal.AllocCoTaskMem(info.BytesSize); var result = pix1.ReadPixels(info, ptr2, info.RowBytes); Assert.True(result); } [SkippableFact] public void WithMethodsDoNotModifySource() { var info = new SKImageInfo(100, 30, SKColorType.Rgb565, SKAlphaType.Unpremul); var pixmap = new SKPixmap(info, (IntPtr)123); Assert.Equal(SKColorType.Rgb565, pixmap.ColorType); Assert.Equal((IntPtr)123, pixmap.GetPixels()); var copy = pixmap.WithColorType(SKColorType.Index8); Assert.Equal(SKColorType.Rgb565, pixmap.ColorType); Assert.Equal((IntPtr)123, pixmap.GetPixels()); Assert.Equal(SKColorType.Index8, copy.ColorType); Assert.Equal((IntPtr)123, copy.GetPixels()); } [SkippableFact] public void ReadPixelCopiesData() { var info = new SKImageInfo(10, 10); using (var bmp1 = new SKBitmap(info)) using (var pix1 = bmp1.PeekPixels()) using (var bmp2 = new SKBitmap(info)) using (var pix2 = bmp2.PeekPixels()) { bmp1.Erase(SKColors.Blue); bmp1.Erase(SKColors.Green); Assert.NotEqual(Marshal.ReadInt64(pix1.GetPixels()), Marshal.ReadInt64(pix2.GetPixels())); var result = pix1.ReadPixels(pix2); Assert.True(result); Assert.Equal(Marshal.ReadInt64(pix1.GetPixels()), Marshal.ReadInt64(pix2.GetPixels())); } } [SkippableFact] public void SwizzleSwapsRedAndBlue() { var info = new SKImageInfo(10, 10); using (var bmp = new SKBitmap(info)) { bmp.Erase(SKColors.Red); Assert.Equal(SKColors.Red, bmp.Pixels[0]); SKSwizzle.SwapRedBlue(bmp.GetPixels(out var length), (int)length); Assert.Equal(SKColors.Blue, bmp.Pixels[0]); } } } }
using System; using System.Runtime.InteropServices; using Xunit; namespace SkiaSharp.Tests { public class SKPixmapTest : SKTest { [SkippableFact] public void ReadPixelSucceeds() { var info = new SKImageInfo(10, 10); var ptr1 = Marshal.AllocCoTaskMem(info.BytesSize); var pix1 = new SKPixmap(info, ptr1); var ptr2 = Marshal.AllocCoTaskMem(info.BytesSize); var result = pix1.ReadPixels(info, ptr2, info.RowBytes); Assert.True(result); } [SkippableFact] public void WithMethodsDoNotModifySource() { var info = new SKImageInfo(100, 30, SKColorType.Rgb565, SKAlphaType.Unpremul); var pixmap = new SKPixmap(info, (IntPtr)123); Assert.Equal(SKColorType.Rgb565, pixmap.ColorType); Assert.Equal((IntPtr)123, pixmap.GetPixels()); var copy = pixmap.WithColorType(SKColorType.Index8); Assert.Equal(SKColorType.Rgb565, pixmap.ColorType); Assert.Equal((IntPtr)123, pixmap.GetPixels()); Assert.Equal(SKColorType.Index8, copy.ColorType); Assert.Equal((IntPtr)123, copy.GetPixels()); } [SkippableFact] public void ReadPixelCopiesData() { var info = new SKImageInfo(10, 10); using (var bmp1 = new SKBitmap(info)) using (var pix1 = bmp1.PeekPixels()) using (var bmp2 = new SKBitmap(info)) using (var pix2 = bmp2.PeekPixels()) { bmp1.Erase(SKColors.Blue); bmp1.Erase(SKColors.Green); Assert.NotEqual(Marshal.ReadInt64(pix1.GetPixels()), Marshal.ReadInt64(pix2.GetPixels())); var result = pix1.ReadPixels(pix2); Assert.True(result); Assert.Equal(Marshal.ReadInt64(pix1.GetPixels()), Marshal.ReadInt64(pix2.GetPixels())); } } } }
mit
C#
9402930be306bf433f71958f8f5014407dd9c49a
Add 'Required' field to AjaxMethodParameterAttribute
SnowflakePowered/snowflake,faint32/snowflake-1,faint32/snowflake-1,RonnChyran/snowflake,faint32/snowflake-1,RonnChyran/snowflake,RonnChyran/snowflake,SnowflakePowered/snowflake,SnowflakePowered/snowflake
Snowflake.API/Ajax/AjaxMethodParameterAttribute.cs
Snowflake.API/Ajax/AjaxMethodParameterAttribute.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Snowflake.Ajax { /// <summary> /// A metadata attribute to indicate parameter methods /// Does not affect execution. /// </summary> [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] public class AjaxMethodParameterAttribute : Attribute { //The name of the parameter public string ParameterName { get; set; } /// <summary> /// The type of parameter /// </summary> public AjaxMethodParameterType ParameterType { get; set; } /// <summary> /// Whether the parameter is required /// </summary> public bool Required { get; set; } } public enum AjaxMethodParameterType { StringParameter, ObjectParameter, ArrayParameter, BoolParameter, IntParameter } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Snowflake.Ajax { /// <summary> /// A metadata attribute to indicate parameter methods /// Does not affect execution. /// </summary> [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] public class AjaxMethodParameterAttribute : Attribute { public string ParameterName { get; set; } public AjaxMethodParameterType ParameterType { get; set; } } public enum AjaxMethodParameterType { StringParameter, ObjectParameter, ArrayParameter, BoolParameter, IntParameter } }
mpl-2.0
C#
535b5ee81dc85c750b29b840270161b799b0364c
Update profile strings.
Azure-Samples/MyDriving,Azure-Samples/MyDriving,Azure-Samples/MyDriving
XamarinApp/MyTrips/MyTrips.iOS/Screens/ProfileTableViewController.cs
XamarinApp/MyTrips/MyTrips.iOS/Screens/ProfileTableViewController.cs
using Foundation; using System; using UIKit; namespace MyTrips.iOS { public partial class ProfileTableViewController : UITableViewController { public ProfileTableViewController (IntPtr handle) : base (handle) { } public override void ViewDidLoad() { base.ViewDidLoad(); UpdateHeader(64); } void UpdateHeader(int percentage) { lblPercentage.Text = $"{percentage}%"; lblBetterThan.Text = $"Better driver than {percentage}% of Americans."; var defaultAttributes = new UIStringAttributes { ForegroundColor = lblDrivingSkills.TextColor, }; var hitAttributes = new UIStringAttributes { ForegroundColor = Colors.PRIMARY, }; /* var attributedString = new NSMutableAttributedString(lblDrivingSkills.Text); attributedString.SetAttributes(defaultAttributes.Dictionary, new NSRange(0, lblDrivingSkills.Text.Length)); attributedString.SetAttributes(hitAttributes.Dictionary, new NSRange(15, lblDrivingSkills.Text.Length)); lblDrivingSkills.AttributedText = attributedString; */ } #region UITableViewSource public override nint RowsInSection(UITableView tableView, nint section) { return 6; } public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell("STAT_CELL_IDENTIFIER") as ProfileStatCell; if (cell == null) { cell = new ProfileStatCell(new NSString("STAT_CELL_IDENTIFIER")); } cell.StatName = "Miles"; cell.Text = "65,876 mi"; cell.SideColor = UIColor.FromRGB(77, 133, 202); return cell; } #endregion } }
using Foundation; using System; using UIKit; namespace MyTrips.iOS { public partial class ProfileTableViewController : UITableViewController { public ProfileTableViewController (IntPtr handle) : base (handle) { } public override void ViewDidLoad() { base.ViewDidLoad(); UpdateHeader(64); } void UpdateHeader(int percentage) { lblPercentage.Text = $"{percentage}%"; lblBetterThan.Text = $"Better driver than {percentage} of Americans"; var defaultAttributes = new UIStringAttributes { ForegroundColor = lblDrivingSkills.TextColor, }; var hitAttributes = new UIStringAttributes { ForegroundColor = Colors.PRIMARY, }; /* var attributedString = new NSMutableAttributedString(lblDrivingSkills.Text); attributedString.SetAttributes(defaultAttributes.Dictionary, new NSRange(0, lblDrivingSkills.Text.Length)); attributedString.SetAttributes(hitAttributes.Dictionary, new NSRange(15, lblDrivingSkills.Text.Length)); lblDrivingSkills.AttributedText = attributedString; */ } #region UITableViewSource public override nint RowsInSection(UITableView tableView, nint section) { return 6; } public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell("STAT_CELL_IDENTIFIER") as ProfileStatCell; if (cell == null) { cell = new ProfileStatCell(new NSString("STAT_CELL_IDENTIFIER")); } cell.StatName = "Miles"; cell.Text = "65,876 mi"; cell.SideColor = UIColor.FromRGB(77, 133, 202); return cell; } #endregion } }
mit
C#
1cd9b6d93b48274179fa8b1859a0040b6878390b
INcrease timeout
lahma/MassTransit,abombss/MassTransit,lahma/MassTransit,ccellar/MassTransit,petedavis/MassTransit,vebin/MassTransit,D3-LucaPiombino/MassTransit,ccellar/MassTransit,abombss/MassTransit,lahma/MassTransit,ccellar/MassTransit,lahma/MassTransit,vebin/MassTransit,petedavis/MassTransit,lahma/MassTransit,ccellar/MassTransit,abombss/MassTransit,jsmale/MassTransit
src/Containers/MassTransit.Containers.Tests/Scenarios/When_registering_a_consumer.cs
src/Containers/MassTransit.Containers.Tests/Scenarios/When_registering_a_consumer.cs
// Copyright 2007-2012 Chris Patterson, Dru Sellers, Travis Smith, et. al. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. namespace MassTransit.Containers.Tests.Scenarios { using System.Linq; using System.Threading; using Magnum.Extensions; using Magnum.TestFramework; using Testing; [Scenario] public abstract class When_registering_a_consumer : Given_a_service_bus_instance { [When] public void Registering_a_consumer() { } [Then] public void Should_have_a_subscription_for_the_consumer_message_type() { LocalBus.HasSubscription<SimpleMessageInterface>().Count() .ShouldEqual(1, "No subscription for the SimpleMessageInterface was found."); } [Then] public void Should_have_a_subscription_for_the_nested_consumer_type() { LocalBus.HasSubscription<AnotherMessageInterface>().Count() .ShouldEqual(1, "Only one subscription should be registered for another consumer"); } [Then] public void Should_receive_using_the_first_consumer() { const string name = "Joe"; var complete = new ManualResetEvent(false); LocalBus.SubscribeHandler<SimpleMessageClass>(x => complete.Set()); LocalBus.Publish(new SimpleMessageClass(name)); complete.WaitOne(8.Seconds()); GetSimpleConsumer() .Last.Name.ShouldEqual(name); } protected abstract SimpleConsumer GetSimpleConsumer(); } }
// Copyright 2007-2011 Chris Patterson, Dru Sellers, Travis Smith, et. al. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. namespace MassTransit.Containers.Tests.Scenarios { using System.Linq; using Magnum.TestFramework; using Testing; [Scenario] public abstract class When_registering_a_consumer : Given_a_service_bus_instance { [When] public void Registering_a_consumer() { } [Then] public void Should_have_a_subscription_for_the_consumer_message_type() { LocalBus.HasSubscription<SimpleMessageInterface>().Count() .ShouldEqual(1, "No subscription for the SimpleMessageInterface was found."); } [Then] public void Should_have_a_subscription_for_the_nested_consumer_type() { LocalBus.HasSubscription<AnotherMessageInterface>().Count() .ShouldEqual(1, "Only one subscription should be registered for another consumer"); } [Then] public void Should_receive_using_the_first_consumer() { const string name = "Joe"; LocalBus.Publish(new SimpleMessageClass(name)); GetSimpleConsumer() .Last.Name.ShouldEqual(name); } protected abstract SimpleConsumer GetSimpleConsumer(); } }
apache-2.0
C#
daae454f26147aa4d6f54f1a64e6d4713144ea23
Fix resource type
AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell
src/ResourceManager/SignalR/Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs
src/ResourceManager/SignalR/Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs
using Microsoft.Azure.Commands.Common.Strategies; using Microsoft.Azure.Management.SignalR; using Microsoft.Azure.Management.SignalR.Models; namespace Microsoft.Azure.Commands.SignalR.Strategies.SignalRRp { static class SignalRStrategy { public static ResourceStrategy<SignalRResource> Strategy { get; } = ResourceStrategy.Create( type: new ResourceType("Microsoft.SignalRService", "SignalR"), getOperations: (SignalRManagementClient client) => client.Signalr, getAsync: (o, p) => o.GetAsync(p.ResourceGroupName, p.Name, p.CancellationToken), createOrUpdateAsync: (o, p) => o.CreateOrUpdateAsync( p.ResourceGroupName, p.Name, new SignalRCreateParameters( p.Model.Location, p.Model.Tags, p.Model.Signalrsku, new SignalRCreateOrUpdateProperties(p.Model.HostNamePrefix)), p.CancellationToken), getLocation: config => config.Location, setLocation: (config, location) => config.Location = location, createTime: c => 5, compulsoryLocation: true); } }
using Microsoft.Azure.Commands.Common.Strategies; using Microsoft.Azure.Management.SignalR; using Microsoft.Azure.Management.SignalR.Models; namespace Microsoft.Azure.Commands.SignalR.Strategies.SignalRRp { static class SignalRStrategy { public static ResourceStrategy<SignalRResource> Strategy { get; } = ResourceStrategy.Create( type: new ResourceType("Microsoft.SignalR", "SignalR"), getOperations: (SignalRManagementClient client) => client.Signalr, getAsync: (o, p) => o.GetAsync(p.ResourceGroupName, p.Name, p.CancellationToken), createOrUpdateAsync: (o, p) => o.CreateOrUpdateAsync( p.ResourceGroupName, p.Name, new SignalRCreateParameters( p.Model.Location, p.Model.Tags, p.Model.Signalrsku, new SignalRCreateOrUpdateProperties(p.Model.HostNamePrefix)), p.CancellationToken), getLocation: config => config.Location, setLocation: (config, location) => config.Location = location, createTime: c => 5, compulsoryLocation: true); } }
apache-2.0
C#
31386f24618f758b4d411cc7cb768e4ceb8cd359
replace contents as per details in ticket.
SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers
src/SFA.DAS.EmployerUsers.Web/Views/TermsAndConditions/_TermsAndConditionBody.cshtml
src/SFA.DAS.EmployerUsers.Web/Views/TermsAndConditions/_TermsAndConditionBody.cshtml
<p>To use this service, you agree to:</p> <ul class="list list-bullet"> <li>sign out at the end of each session</li> <li>input truthful and accurate information</li> <li>adhere to the <a href="http://www.legislation.gov.uk/ukpga/1990/18/contents" target="_blank">Computer Misuse Act 1990</a></li> <li>keep your sign in details secure</li> <li>not use discriminatory wording as set out in the <a href="https://www.gov.uk/guidance/equality-act-2010-guidance#equalities-act-2010-legislation" target="_blank">Equality Act 2010</a></li> <li>make sure the published rates of pay comply with the <a href="https://www.gov.uk/national-minimum-wage-rates" target="_blank">National Minimum Wage</a> guidelines and are not misleading to candidates</li> <li>adhere to all relevant <a href="https://www.gov.uk/browse/employing-people" target="_blank">UK employment law</a></li> <li>only use the recruitment section of the service if you pay the apprenticeship levy or you are part of our testing phase</li> <li>your apprenticeship adverts being publicly accessible, including the possibility of partner websites displaying them</li> <li>comply with the government safeguarding policies for <a href="https://www.gov.uk/government/publications/ofsted-safeguarding-policy" target="_blank">children</a> and <a href="https://www.gov.uk/government/publications/safeguarding-policy-protecting-vulnerable-adults" target="_blank">vulnerable adults</a></li> <li>not provide feedback on a training provider where there is a conflict of interest</li> </ul> <p>Your contact details and information associated with your account will be collected and used for the support and administration of your account.</p> <p>We will not:</p> <ul class="list list-bullet"> <li>use or disclose this information for other purposes (except where we're legally required to do so)</li> <li>use your details for any marketing purposes or for any reason unrelated to the use of your account</li> </ul> <p>We may update these terms and conditions at any time without notice. You'll agree to any changes if you continue to use this service ​after the terms and conditions have been updated​.</p>
<p>To use this service, you agree to:</p> <ul class="list list-bullet"> <li>sign out at the end of each session</li> <li>input truthful and accurate information</li> <li>adhere to the <a href="http://www.legislation.gov.uk/ukpga/1990/18/contents" target="_blank">Computer Misuse Act 1990</a></li> <li>keep your sign in details secure</li> <li>not use discriminatory wording as set out in the <a href="https://www.gov.uk/guidance/equality-act-2010-guidance#equalities-act-2010-legislation" target="_blank">Equality Act 2010</a></li> <li>make sure the published rates of pay comply with the <a href="https://www.gov.uk/national-minimum-wage-rates" target="_blank">National Minimum Wage</a> guidelines and are not misleading to candidates</li> <li>adhere to all relevant <a href="https://www.gov.uk/browse/employing-people" target="_blank">UK employment law</a></li> <li>only use the recruitment section of the service if you pay the apprenticeship levy</li> <li>your apprenticeship adverts being publicly accessible, including the possibility of partner websites displaying them</li> <li>comply with the government safeguarding policies for <a href="https://www.gov.uk/government/publications/ofsted-safeguarding-policy" target="_blank">children</a> and <a href="https://www.gov.uk/government/publications/safeguarding-policy-protecting-vulnerable-adults" target="_blank">vulnerable adults</a></li> <li>not provide feedback on a training provider where there is a conflict of interest</li> </ul> <p>Your contact details and information associated with your account will be collected and used for the support and administration of your account.</p> <p>We will not:</p> <ul class="list list-bullet"> <li>use or disclose this information for other purposes (except where we're legally required to do so)</li> <li>use your details for any marketing purposes or for any reason unrelated to the use of your account</li> </ul> <p>We may update these terms and conditions at any time without notice. You'll agree to any changes if you continue to use this service ​after the terms and conditions have been updated​.</p>
mit
C#
4e8edfdeabcf78baf12657c9ac6d8838bca41f4c
Add Shuffle
garlab/Ext.NET
Ext.NET/EnumerableExtension.cs
Ext.NET/EnumerableExtension.cs
using System; using System.Collections.Generic; using System.Text.RegularExpressions; namespace Ext.NET { public static class EnumerableExtension { public static void Each<T>(this IEnumerable<T> enumerable, Action<T> action) { foreach (var item in enumerable) { action(item); } } public static IEnumerable<T> Grep<T>(this IEnumerable<T> enumerable, string pattern) { foreach (var item in enumerable) { if (item.ToString().Contains(pattern)) { yield return item; } } } public static IEnumerable<T> EGrep<T>(this IEnumerable<T> enumerable, string pattern, RegexOptions option = RegexOptions.None) { var regex = new Regex(pattern, option); foreach (var item in enumerable) { if (regex.IsMatch(item.ToString())) { yield return item; } } } public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source) { var random = new Random(); return source.ShuffleIterator(random); } public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random random) { return source.ShuffleIterator(random); } private static IEnumerable<T> ShuffleIterator<T>(this IEnumerable<T> source, Random random) { var buffer = new List<T>(source); for (int i = 0; i < buffer.Count; ++i) { int j = random.Next(i, buffer.Count); yield return buffer[j]; buffer[j] = buffer[i]; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace Ext.NET { public static class EnumerableExtension { public static void Each<T>(this IEnumerable<T> enumerable, Action<T> action) { foreach (var item in enumerable) { action(item); } } public static IEnumerable<T> Grep<T>(this IEnumerable<T> enumerable, string pattern) { foreach (var item in enumerable) { if (item.ToString().Contains(pattern)) { yield return item; } } } public static IEnumerable<T> EGrep<T>(this IEnumerable<T> enumerable, string pattern, RegexOptions option = RegexOptions.None) { var regex = new Regex(pattern, option); foreach (var item in enumerable) { if (regex.IsMatch(item.ToString())) { yield return item; } } } } }
mit
C#
0a38c79f1091052a7df0e516f50bd62525b6d79c
fix build
Recognos/Metrics.NET,Recognos/Metrics.NET,Liwoj/Metrics.NET,Liwoj/Metrics.NET
Src/Metrics/MetricData/ValueReader.cs
Src/Metrics/MetricData/ValueReader.cs
using Metrics.Core; namespace Metrics.MetricData { public static class ValueReader { private static readonly CounterValue EmptyCounter = new CounterValue(0); private static readonly MeterValue EmptyMeter = new MeterValue(0, 0.0, 0.0, 0.0, 0.0, TimeUnit.Seconds); private static readonly HistogramValue EmptyHistogram = new HistogramValue(0, 0.0, null, 0.0, null, 0.0, 0.0, null, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); private static readonly TimerValue EmptyTimer = new TimerValue(EmptyMeter, EmptyHistogram, 0, 0, TimeUnit.Milliseconds); public static CounterValue GetCurrentValue(Counter metric) { var implementation = metric as CounterImplementation; if (implementation != null) { return implementation.Value; } return EmptyCounter; } public static MeterValue GetCurrentValue(Meter metric) { var implementation = metric as MeterImplementation; if (implementation != null) { return implementation.Value; } return EmptyMeter; } public static HistogramValue GetCurrentValue(Histogram metric) { var implementation = metric as HistogramImplementation; if (implementation != null) { return implementation.Value; } return EmptyHistogram; } public static TimerValue GetCurrentValue(Timer metric) { var implementation = metric as TimerImplementation; if (implementation != null) { return implementation.Value; } return EmptyTimer; } } }
using Metrics.Core; namespace Metrics.MetricData { public static class ValueReader { private static readonly CounterValue EmptyCounter = new CounterValue(0); private static readonly MeterValue EmptyMeter = new MeterValue(0, 0.0, 0.0, 0.0, 0.0, TimeUnit.Seconds); private static readonly HistogramValue EmptyHistogram = new HistogramValue(0, 0.0, null, 0.0, null, 0.0, 0.0, null, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); private static readonly TimerValue EmptyTimer = new TimerValue(EmptyMeter, EmptyHistogram, 0, TimeUnit.Milliseconds); public static CounterValue GetCurrentValue(Counter metric) { var implementation = metric as CounterImplementation; if (implementation != null) { return implementation.Value; } return EmptyCounter; } public static MeterValue GetCurrentValue(Meter metric) { var implementation = metric as MeterImplementation; if (implementation != null) { return implementation.Value; } return EmptyMeter; } public static HistogramValue GetCurrentValue(Histogram metric) { var implementation = metric as HistogramImplementation; if (implementation != null) { return implementation.Value; } return EmptyHistogram; } public static TimerValue GetCurrentValue(Timer metric) { var implementation = metric as TimerImplementation; if (implementation != null) { return implementation.Value; } return EmptyTimer; } } }
apache-2.0
C#
a32e30a641eedc1e4fb7826a21e769d353cee39a
Add 1.15
archrival/SubsonicSharp
Subsonic.Common/SubsonicApiVersion.cs
Subsonic.Common/SubsonicApiVersion.cs
using System; namespace Subsonic.Common { public static class SubsonicApiVersion { public static readonly Version Version1_0_0 = Version.Parse("1.0.0"); public static readonly Version Version1_1_0 = Version.Parse("1.1.0"); public static readonly Version Version1_1_1 = Version.Parse("1.1.1"); public static readonly Version Version1_2_0 = Version.Parse("1.2.0"); public static readonly Version Version1_3_0 = Version.Parse("1.3.0"); public static readonly Version Version1_4_0 = Version.Parse("1.4.0"); public static readonly Version Version1_5_0 = Version.Parse("1.5.0"); public static readonly Version Version1_6_0 = Version.Parse("1.6.0"); public static readonly Version Version1_7_0 = Version.Parse("1.7.0"); public static readonly Version Version1_8_0 = Version.Parse("1.8.0"); public static readonly Version Version1_9_0 = Version.Parse("1.9.0"); public static readonly Version Version1_10_0 = Version.Parse("1.10.0"); public static readonly Version Version1_10_1 = Version.Parse("1.10.1"); public static readonly Version Version1_10_2 = Version.Parse("1.10.2"); public static readonly Version Version1_11_0 = Version.Parse("1.11.0"); public static readonly Version Version1_12_0 = Version.Parse("1.12.0"); public static readonly Version Version1_13_0 = Version.Parse("1.13.0"); public static readonly Version Version1_14_0 = Version.Parse("1.14.0"); public static readonly Version Version1_15_0 = Version.Parse("1.15.0"); public static readonly Version Max = Version1_15_0; } }
using System; namespace Subsonic.Common { public static class SubsonicApiVersion { public static readonly Version Version1_0_0 = Version.Parse("1.0.0"); public static readonly Version Version1_1_0 = Version.Parse("1.1.0"); public static readonly Version Version1_1_1 = Version.Parse("1.1.1"); public static readonly Version Version1_2_0 = Version.Parse("1.2.0"); public static readonly Version Version1_3_0 = Version.Parse("1.3.0"); public static readonly Version Version1_4_0 = Version.Parse("1.4.0"); public static readonly Version Version1_5_0 = Version.Parse("1.5.0"); public static readonly Version Version1_6_0 = Version.Parse("1.6.0"); public static readonly Version Version1_7_0 = Version.Parse("1.7.0"); public static readonly Version Version1_8_0 = Version.Parse("1.8.0"); public static readonly Version Version1_9_0 = Version.Parse("1.9.0"); public static readonly Version Version1_10_0 = Version.Parse("1.10.0"); public static readonly Version Version1_10_1 = Version.Parse("1.10.1"); public static readonly Version Version1_10_2 = Version.Parse("1.10.2"); public static readonly Version Version1_11_0 = Version.Parse("1.11.0"); public static readonly Version Version1_12_0 = Version.Parse("1.12.0"); public static readonly Version Version1_13_0 = Version.Parse("1.13.0"); public static readonly Version Version1_14_0 = Version.Parse("1.14.0"); public static readonly Version Max = Version1_14_0; } }
mit
C#
183a852b938280ceb90826c862b4ca72e49dafdc
Fix unit test
akarpov89/MicroFlow
test/FlowTests/Flow2Tests.cs
test/FlowTests/Flow2Tests.cs
using System.Collections.Generic; using NSubstitute; using NUnit.Framework; namespace MicroFlow.Test { [TestFixture] public class Flow2Tests { [Test] public void FlowIsValid() { // Arrange var writer = Substitute.For<IWriter>(); var flow = new Flow2 {Writer = writer}; // Act var validationResult = flow.Validate(); // Assert Assert.That(validationResult.HasErrors, Is.False); } [Test, TestCaseSource(nameof(Cases))] public void RunCase(int a, int b, int c, string expectedMessage) { // Arrange var writer = Substitute.For<IWriter>(); var flow = new Flow2 {Writer = writer, A = a, B = b, C = c}; // Act flow.Run().Wait(); // Assert writer.Received().Write(expectedMessage); } public static IEnumerable<TestCaseData> Cases { get { yield return Case(1, 2, 3, "2 + 3 + 4 = 9"); yield return Case(0, 8, 19, "1 + 9 + 20 = 30"); } } private static TestCaseData Case(int a, int b, int c, string message) => new TestCaseData(a, b, c, message); } }
using System.Collections.Generic; using NSubstitute; using NUnit.Framework; namespace MicroFlow.Test { [TestFixture] public class Flow2Tests { [Test] public void FlowIsValid() { // Arrange var writer = Substitute.For<IWriter>(); var flow = new Flow2 {Writer = writer}; // Act var validationResult = flow.Validate(); // Assert Assert.That(validationResult.HasErrors, Is.False); } [Test, TestCaseSource(nameof(Cases))] public void RunCase(int a, int b, int c, string expectedMessage) { // Arrange var writer = Substitute.For<IWriter>(); var flow = new Flow2 {Writer = writer}; // Act flow.Run().Wait(); // Assert writer.Received().Write(expectedMessage); } public static IEnumerable<TestCaseData> Cases { get { yield return Case(1, 2, 3, "2 + 3 + 4 = 9"); yield return Case(0, 8, 19, "1 + 9 + 20 = 30"); } } private static TestCaseData Case(int a, int b, int c, string message) => new TestCaseData(a, b, c, message); } }
mit
C#
6fda3622150e62318d9ae95ccecebe2977844264
Check JsonErrorInfo parameters and store them.
PenguinF/sandra-three
Sandra.UI.WF/Storage/JsonSyntax.cs
Sandra.UI.WF/Storage/JsonSyntax.cs
#region License /********************************************************************************* * JsonSyntax.cs * * Copyright (c) 2004-2018 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 System; namespace Sandra.UI.WF.Storage { public class JsonTerminalSymbol { public string Json { get; } public int Start { get; } public int Length { get; } public JsonTerminalSymbol(string json, int start, int length) { if (json == null) throw new ArgumentNullException(nameof(json)); if (start < 0) throw new ArgumentOutOfRangeException(nameof(start)); if (length < 0) throw new ArgumentOutOfRangeException(nameof(length)); if (json.Length < start) throw new ArgumentOutOfRangeException(nameof(start)); if (json.Length < start + length) throw new ArgumentOutOfRangeException(nameof(length)); Json = json; Start = start; Length = length; } } public class JsonErrorInfo { public string Message { get; } public int Start { get; } public int Length { get; } public JsonErrorInfo(string message, int start, int length) { if (message == null) throw new ArgumentNullException(nameof(message)); if (start < 0) throw new ArgumentOutOfRangeException(nameof(start)); if (length < 0) throw new ArgumentOutOfRangeException(nameof(length)); Message = message; Start = start; Length = length; } } }
#region License /********************************************************************************* * JsonSyntax.cs * * Copyright (c) 2004-2018 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 System; namespace Sandra.UI.WF.Storage { public class JsonTerminalSymbol { public string Json { get; } public int Start { get; } public int Length { get; } public JsonTerminalSymbol(string json, int start, int length) { if (json == null) throw new ArgumentNullException(nameof(json)); if (start < 0) throw new ArgumentOutOfRangeException(nameof(start)); if (length < 0) throw new ArgumentOutOfRangeException(nameof(length)); if (json.Length < start) throw new ArgumentOutOfRangeException(nameof(start)); if (json.Length < start + length) throw new ArgumentOutOfRangeException(nameof(length)); Json = json; Start = start; Length = length; } } public class JsonErrorInfo { public string Message { get; } public int Start { get; } public int Length { get; } public JsonErrorInfo(string message, int start, int length) { } } }
apache-2.0
C#
644606b63a0558f222bf8fd09d7cf86a0b10bf0a
Increment version to 2.6.8.3
qwertie/Loyc,qwertie/Loyc
Core/AssemblyVersion.cs
Core/AssemblyVersion.cs
using System.Reflection; [assembly: AssemblyCopyright("Copyright ©2019. Licence: LGPL")] // 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 '.*' - but you shouldn't, because it will cause a simple "Rebuild All" // command to change the version number which, I guess, produces an incompatible // assembly in the presence of strong names (strong naming prevents two assemblies // from linking together without an exact match.) [assembly: AssemblyVersion("2.6.8.3")] [assembly: AssemblyFileVersion("2.6.8.3")]
using System.Reflection; [assembly: AssemblyCopyright("Copyright ©2019. Licence: LGPL")] // 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 '.*' - but you shouldn't, because it will cause a simple "Rebuild All" // command to change the version number which, I guess, produces an incompatible // assembly in the presence of strong names (strong naming prevents two assemblies // from linking together without an exact match.) [assembly: AssemblyVersion("2.6.8.2")] [assembly: AssemblyFileVersion("2.6.8.2")]
lgpl-2.1
C#
3e6ee2d34ddd52cc13da3b9c10d57e67fb60dcd6
Remove code involving MessageBox that did not belong in this class
xyon1/Expenditure-App
ServiceProvider/SettingsManager.cs
ServiceProvider/SettingsManager.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ServiceProvider { public static class SettingsManager { internal static void CheckForXmlFileDirectory(Func<string> getXmlFilePath, Action<string, string> messageForUser) { if (string.IsNullOrEmpty(DataStorage.Default.xmlFileDirectory)) { DataStorage.Default.xmlFileDirectory = getXmlFilePath.Invoke(); DataStorage.Default.Save(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ServiceProvider { public static class SettingsManager { internal static void CheckForXmlFileDirectory(Func<string> getXmlFilePath, Action<string, string> messageForUser) { if (string.IsNullOrEmpty(DataStorage.Default.xmlFileDirectory)) { messageForUser.Invoke("Please press OK and choose a folder to store your expenditure in", "Setup"); DataStorage.Default.xmlFileDirectory = getXmlFilePath.Invoke(); DataStorage.Default.Save(); } } } }
apache-2.0
C#
a84b8c642077d7f5eb2af6cf223bf6bdea1485f0
Fix bug where ParseExpression doesn't parse an expression but a query
terrajobst/nquery-vnext
NQuery.Language/SyntaxTree.cs
NQuery.Language/SyntaxTree.cs
using System; namespace NQuery.Language { public sealed class SyntaxTree { private readonly CompilationUnitSyntax _root; private readonly TextBuffer _textBuffer; private SyntaxTree(CompilationUnitSyntax root, TextBuffer textBuffer) { _root = root; _textBuffer = textBuffer; } public static SyntaxTree ParseQuery(string source) { var parser = new Parser(source); var query = parser.ParseRootQuery(); var textBuffer = new TextBuffer(source); return new SyntaxTree(query, textBuffer); } public static SyntaxTree ParseExpression(string source) { var parser = new Parser(source); var expression = parser.ParseRootExpression(); var textBuffer = new TextBuffer(source); return new SyntaxTree(expression, textBuffer); } public CompilationUnitSyntax Root { get { return _root; } } public TextBuffer TextBuffer { get { return _textBuffer; } } } }
using System; namespace NQuery.Language { public sealed class SyntaxTree { private readonly CompilationUnitSyntax _root; private readonly TextBuffer _textBuffer; private SyntaxTree(CompilationUnitSyntax root, TextBuffer textBuffer) { _root = root; _textBuffer = textBuffer; } public static SyntaxTree ParseQuery(string source) { var parser = new Parser(source); var query = parser.ParseRootQuery(); var textBuffer = new TextBuffer(source); return new SyntaxTree(query, textBuffer); } public static SyntaxTree ParseExpression(string source) { var parser = new Parser(source); var expression = parser.ParseRootQuery(); var textBuffer = new TextBuffer(source); return new SyntaxTree(expression, textBuffer); } public CompilationUnitSyntax Root { get { return _root; } } public TextBuffer TextBuffer { get { return _textBuffer; } } } }
mit
C#
0dd1ffc92b4c2a4c2bcdc926cf828048d6198f9f
Set MaximumInputs value properly
RonnChyran/snowflake,SnowflakePowered/snowflake,RonnChyran/snowflake,faint32/snowflake-1,faint32/snowflake-1,faint32/snowflake-1,SnowflakePowered/snowflake,SnowflakePowered/snowflake,RonnChyran/snowflake
Snowflake/Platform/PlatformInfo.cs
Snowflake/Platform/PlatformInfo.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Snowflake.Information.MediaStore; using Snowflake.Information; using Snowflake.Controller; using System.Collections.ObjectModel; using Snowflake.Extensions; using Newtonsoft.Json.Linq; namespace Snowflake.Platform { public class PlatformInfo : Info, IPlatformInfo { public PlatformInfo(string platformId, string name, IMediaStore mediastore, IDictionary<string, string> metadata, IList<string> fileExtensions, IPlatformDefaults platformDefaults, IList<string> controllers, int maximumInputs, IPlatformControllerPorts controllerPorts): base(platformId, name, mediastore, metadata) { this.FileExtensions = fileExtensions; this.Defaults = platformDefaults; this.Controllers = controllers; this.ControllerPorts = controllerPorts; this.MaximumInputs = maximumInputs; } public IList<string> FileExtensions { get; private set; } public IPlatformDefaults Defaults { get; set; } public IList<string> Controllers { get; private set; } public IPlatformControllerPorts ControllerPorts { get; private set; } public int MaximumInputs { get; private set; } public static IPlatformInfo FromJsonProtoTemplate(IDictionary<string, dynamic> jsonDictionary) { IPlatformDefaults platformDefaults = jsonDictionary["Defaults"].ToObject<PlatformDefaults>(); // string controllerId = return new PlatformInfo( jsonDictionary["PlatformId"], jsonDictionary["Name"], new FileMediaStore(jsonDictionary["MediaStoreKey"]), jsonDictionary["Metadata"].ToObject<Dictionary<string, string>>(), jsonDictionary["FileExtensions"].ToObject<List<string>>(), platformDefaults, jsonDictionary["Controllers"].ToObject<List<string>>(), (int)jsonDictionary["MaximumInputs"] , PlatformControllerPorts.ParseControllerPorts(jsonDictionary["ControllerPorts"].ToObject<Dictionary<string, string>>()) ); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Snowflake.Information.MediaStore; using Snowflake.Information; using Snowflake.Controller; using System.Collections.ObjectModel; using Snowflake.Extensions; using Newtonsoft.Json.Linq; namespace Snowflake.Platform { public class PlatformInfo : Info, IPlatformInfo { public PlatformInfo(string platformId, string name, IMediaStore mediastore, IDictionary<string, string> metadata, IList<string> fileExtensions, IPlatformDefaults platformDefaults, IList<string> controllers, int maximumInputs, IPlatformControllerPorts controllerPorts): base(platformId, name, mediastore, metadata) { this.FileExtensions = fileExtensions; this.Defaults = platformDefaults; this.Controllers = controllers; this.ControllerPorts = controllerPorts; } public IList<string> FileExtensions { get; private set; } public IPlatformDefaults Defaults { get; set; } public IList<string> Controllers { get; private set; } public IPlatformControllerPorts ControllerPorts { get; private set; } public int MaximumInputs { get; private set; } public static IPlatformInfo FromJsonProtoTemplate(IDictionary<string, dynamic> jsonDictionary) { IPlatformDefaults platformDefaults = jsonDictionary["Defaults"].ToObject<PlatformDefaults>(); // string controllerId = return new PlatformInfo( jsonDictionary["PlatformId"], jsonDictionary["Name"], new FileMediaStore(jsonDictionary["MediaStoreKey"]), jsonDictionary["Metadata"].ToObject<Dictionary<string, string>>(), jsonDictionary["FileExtensions"].ToObject<List<string>>(), platformDefaults, jsonDictionary["Controllers"].ToObject<List<string>>(), (int)jsonDictionary["MaximumInputs"] , PlatformControllerPorts.ParseControllerPorts(jsonDictionary["ControllerPorts"].ToObject<Dictionary<string, string>>()) ); } } }
mpl-2.0
C#
8851e0078e580aefd039bc788ed7adaca70eb4ae
Add missing check on Array size
NicolasDorier/NBitcoin,MetacoSA/NBitcoin,MetacoSA/NBitcoin
NBitcoin/Protocol/VarString.cs
NBitcoin/Protocol/VarString.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NBitcoin.Protocol { public class VarString : IBitcoinSerializable { public VarString() { _Bytes = new byte[0]; } byte[] _Bytes; public int Length { get { return _Bytes.Length; } } public VarString(byte[] bytes) { if(bytes == null) throw new ArgumentNullException(nameof(bytes)); _Bytes = bytes; } public byte[] GetString() { return GetString(false); } public byte[] GetString(bool @unsafe) { if(@unsafe) return _Bytes; return _Bytes.ToArray(); } #region IBitcoinSerializable Members public void ReadWrite(BitcoinStream stream) { var len = new VarInt((ulong)_Bytes.Length); stream.ReadWrite(ref len); if(!stream.Serializing) { if(len.ToLong() > (uint)stream.MaxArraySize) throw new ArgumentOutOfRangeException("Array size not big"); _Bytes = new byte[len.ToLong()]; } stream.ReadWrite(ref _Bytes); } internal static void StaticWrite(BitcoinStream bs, byte[] bytes) { var len = bytes == null ? 0 : (ulong)bytes.Length; if(len > (uint)bs.MaxArraySize) throw new ArgumentOutOfRangeException("Array size too big"); VarInt.StaticWrite(bs, len); if(bytes != null) bs.ReadWrite(ref bytes); } internal static void StaticRead(BitcoinStream bs, ref byte[] bytes) { var len = VarInt.StaticRead(bs); if(len > (uint)bs.MaxArraySize) throw new ArgumentOutOfRangeException("Array size too big"); bytes = new byte[len]; bs.ReadWrite(ref bytes); } #endregion } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NBitcoin.Protocol { public class VarString : IBitcoinSerializable { public VarString() { _Bytes = new byte[0]; } byte[] _Bytes; public int Length { get { return _Bytes.Length; } } public VarString(byte[] bytes) { if(bytes == null) throw new ArgumentNullException(nameof(bytes)); _Bytes = bytes; } public byte[] GetString() { return GetString(false); } public byte[] GetString(bool @unsafe) { if(@unsafe) return _Bytes; return _Bytes.ToArray(); } #region IBitcoinSerializable Members public void ReadWrite(BitcoinStream stream) { var len = new VarInt((ulong)_Bytes.Length); stream.ReadWrite(ref len); if(!stream.Serializing) { if(len.ToLong() > (uint)stream.MaxArraySize) throw new ArgumentOutOfRangeException("Array size not big"); _Bytes = new byte[len.ToLong()]; } stream.ReadWrite(ref _Bytes); } internal static void StaticWrite(BitcoinStream bs, byte[] bytes) { VarInt.StaticWrite(bs, (ulong)bytes.Length); bs.ReadWrite(ref bytes); } internal static void StaticRead(BitcoinStream bs, ref byte[] bytes) { var len = VarInt.StaticRead(bs); bytes = new byte[len]; bs.ReadWrite(ref bytes); } #endregion } }
mit
C#
23bb03bc09a10833a9fbe535f7d11b54fab23af3
Add internal weight calculation for requirements
victoria92/university-program-generator,victoria92/university-program-generator
UniProgramGen/Data/Requirements.cs
UniProgramGen/Data/Requirements.cs
using System.Collections.Generic; using UniProgramGen; using System.Linq; namespace UniProgramGen.Data { public class Requirements { public const uint TOTAL_HOURS = 15; public const uint TOTAL_WEEK_HOURS = 5 * TOTAL_HOURS; public readonly double weight; public readonly List<Helpers.TimeSlot> availableTimeSlots; public readonly List<Room> requiredRooms; private double internalWeight; public Requirements(double weight, List<Helpers.TimeSlot> availableTimeSlots, List<Room> requiredRooms) { this.weight = weight; this.availableTimeSlots = availableTimeSlots; this.requiredRooms = requiredRooms; } internal void CalculateInternalWeight(int roomsLength) { var availableTime = availableTimeSlots.Aggregate((uint) 0, (total, timeSlot) => total + timeSlot.EndHour - timeSlot.StartHour); internalWeight = ((availableTime / TOTAL_WEEK_HOURS) + (requiredRooms.Count / roomsLength)) / 2; } } }
using System.Collections.Generic; using UniProgramGen; namespace UniProgramGen.Data { public class Requirements { public readonly double weight; public readonly List<Helpers.TimeSlot> availableTimeSlots; public readonly List<Room> requiredRooms; public Requirements(double weight, List<Helpers.TimeSlot> availableTimeSlots, List<Room> requiredRooms) { this.weight = weight; this.availableTimeSlots = availableTimeSlots; this.requiredRooms = requiredRooms; } } }
bsd-2-clause
C#
6a3ea187ad97d436342facb394cabed05e3ff876
Fix test json file path on unix systems
stranne/Vasttrafik.NET,stranne/Vasttrafik.NET
src/Stranne.VasttrafikNET.Tests/Helpers/JsonHelper.cs
src/Stranne.VasttrafikNET.Tests/Helpers/JsonHelper.cs
using System.IO; using Stranne.VasttrafikNET.Tests.Json; namespace Stranne.VasttrafikNET.Tests.Helpers { public static class JsonHelper { public static string GetJson(JsonFile jsonFile) { var fileName = $"{jsonFile}.json"; var json = File.ReadAllText($@"Json/{fileName}"); return json; } } }
using System.IO; using Stranne.VasttrafikNET.Tests.Json; namespace Stranne.VasttrafikNET.Tests.Helpers { public static class JsonHelper { public static string GetJson(JsonFile jsonFile) { var fileName = $"{jsonFile}.json"; var json = File.ReadAllText($@"Json\{fileName}"); return json; } } }
mit
C#
b07ff17b0824ba47f7f448872ab6820624ff5b9d
Simplify constructor
MobileEssentials/Merq
src/Vsix/Merq.Vsix/Components/AsyncManagerProvider.cs
src/Vsix/Merq.Vsix/Components/AsyncManagerProvider.cs
using System; using System.ComponentModel; using System.ComponentModel.Composition; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Merq.Properties; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Threading; namespace Merq { /// <summary> /// We switch the implementation of the async manager depending /// on the Visual Studio version. /// </summary> [PartCreationPolicy (CreationPolicy.Shared)] internal class AsyncManagerProvider { [ImportingConstructor] public AsyncManagerProvider (JoinableTaskContext context) => AsyncManager = new AsyncManager(context); /// <summary> /// Exports the <see cref="IAsyncManager"/>. /// </summary> [Export] public IAsyncManager AsyncManager { get; } } }
using System; using System.ComponentModel; using System.ComponentModel.Composition; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Merq.Properties; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Threading; namespace Merq { /// <summary> /// We switch the implementation of the async manager depending /// on the Visual Studio version. /// </summary> [PartCreationPolicy (CreationPolicy.Shared)] internal class AsyncManagerProvider { [ImportingConstructor] public AsyncManagerProvider ([Import] JoinableTaskContext context) { AsyncManager = new AsyncManager(context); } /// <summary> /// Exports the <see cref="IAsyncManager"/>. /// </summary> [Export] public IAsyncManager AsyncManager { get; } } }
mit
C#
f66002c46f8246903d3bdefc1c2bf30581bff635
Fix for searching for basebuilder already defined on all assemblies
Ar3sDevelopment/Caelan.Frameworks.Common
Caelan.Frameworks.Common/Classes/GenericBuilder.cs
Caelan.Frameworks.Common/Classes/GenericBuilder.cs
using System; using System.Linq; using System.Reflection; using AutoMapper; namespace Caelan.Frameworks.Common.Classes { public static class GenericBuilder { public static BaseBuilder<TSource, TDestination> Create<TSource, TDestination>() where TDestination : class, new() where TSource : class, new() { var builder = new BaseBuilder<TSource, TDestination>(); var customBuilder = Assembly.GetExecutingAssembly().GetReferencedAssemblies().OrderBy(t => t.Name).Select(Assembly.Load).SelectMany(assembly => assembly.GetTypes().Where(t => t.BaseType == builder.GetType())).SingleOrDefault(); if (customBuilder != null) builder = Activator.CreateInstance(customBuilder) as BaseBuilder<TSource, TDestination>; if (Mapper.FindTypeMapFor<TSource, TDestination>() == null) Mapper.AddProfile(builder); return builder; } } }
using AutoMapper; namespace Caelan.Frameworks.Common.Classes { public static class GenericBuilder { public static BaseBuilder<TSource, TDestination> Create<TSource, TDestination>() where TDestination : class, new() where TSource : class, new() { var builder = new BaseBuilder<TSource, TDestination>(); if (Mapper.FindTypeMapFor<TSource, TDestination>() == null) Mapper.AddProfile(builder); return builder; } } }
mit
C#
07dfdcf9d0330817a47a40549a1cb2052462dbad
rename Log::Log to Log::LogMessage to fix compilation
HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,HaliteChallenge/Halite-II
airesources/CSharp/Halite2/hlt/Log.cs
airesources/CSharp/Halite2/hlt/Log.cs
using System.IO; namespace Halite2.hlt { public class Log { private TextWriter file; private static Log instance; private Log(TextWriter f) { file = f; } public static void Initialize(TextWriter f) { instance = new Log(f); } public static void LogMessage(string message) { try { instance.file.WriteLine(message); instance.file.Flush(); } catch (IOException) { } } } }
using System.IO; namespace Halite2.hlt { public class Log { private TextWriter file; private static Log instance; private Log(TextWriter f) { file = f; } public static void Initialize(TextWriter f) { instance = new Log(f); } public static void Log(string message) { try { instance.file.WriteLine(message); instance.file.Flush(); } catch (IOException) { } } } }
mit
C#
c9dbcc552c58546220f5651f34a305b3f615df30
Change Namespace
muhammedikinci/FuzzyCore
FuzzyCore/ConcreteCommands/GetProcesses_Command.cs
FuzzyCore/ConcreteCommands/GetProcesses_Command.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FuzzyCore.Server.Data; namespace FuzzyCore.Server { public class GetProcesses_Command : Command { public GetProcesses_Command(JsonCommand comm) : base(comm) { } public override void Execute() { Console.WriteLine(Comm.CommandType); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using fuzzyControl.Server.Data; namespace fuzzyControl.Server { public class GetProcesses_Command : Command { public GetProcesses_Command(JsonCommand comm) : base(comm) { } public override void Execute() { Console.WriteLine(Comm.CommandType); } } }
mit
C#
f10e28dbfdd3a2f7a6dde9cc950bed230a441dc0
Make DelegatingMetaObject work with field as well as property, and start to add some exceptions
MikeBeaton/SqlProfiler
DelegatingMetaObject.cs
DelegatingMetaObject.cs
using System; using System.Dynamic; using System.Linq.Expressions; using System.Reflection; namespace SqlProfiler { // TO DO: internal public class DelegatingMetaObject : DynamicMetaObject { private readonly DynamicMetaObject _innerMetaObject; /// <summary> /// Create delegating meta-object: methods and properties which can't be handled by the outer object are handled by the inner object, which /// can be an <see cref="IDynamicMetaObjectProvider"/> (including, but not limited to <see cref="MSDynamicObject"/>) or just a plain object. /// </summary> public DelegatingMetaObject(Expression expression, object outerObject, string innnerMemberName, BindingFlags bindingAttr = BindingFlags.Instance) : base(expression, BindingRestrictions.Empty, outerObject) { var outerType = outerObject.GetType(); PropertyInfo innerProperty = outerType.GetProperty(innnerMemberName, bindingAttr); FieldInfo innerField = (innerProperty != null) ? null : outerType.GetField(innnerMemberName, bindingAttr); if (innerProperty == null && innerField == null) { throw new InvalidOperationException(string.Format("There is no {0} Property or Field named '{1}' in {2}", bindingAttr, innnerMemberName, outerType)); } var innerObject = innerProperty != null ? innerProperty.GetValue(outerObject) : innerField.GetValue(outerObject); Expression self = Expression.Convert(Expression, LimitType); Expression innerExpression = innerProperty != null ? Expression.Property(self, innerProperty) : Expression.Field(self, innerField); var innerDynamicProvider = innerObject as IDynamicMetaObjectProvider; if (innerDynamicProvider != null) { _innerMetaObject = innerDynamicProvider.GetMetaObject(innerExpression); } else { _innerMetaObject = new DynamicMetaObject(innerExpression, BindingRestrictions.Empty, innerObject); } } public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) { DynamicMetaObject retval = _innerMetaObject.BindInvokeMember(binder, args); // call any parent object non-dynamic methods before trying wrapped object retval = binder.FallbackInvokeMember(this, args, retval); return retval; } public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value) { DynamicMetaObject retval = _innerMetaObject.BindSetMember(binder, value); // set any parent object non-dynamic member before trying wrapped object retval = binder.FallbackSetMember(this, value, retval); return retval; } public override DynamicMetaObject BindGetMember(GetMemberBinder binder) { DynamicMetaObject retval = _innerMetaObject.BindGetMember(binder); // get from any parent object non-dynamic member before trying wrapped object retval = binder.FallbackGetMember(this, retval); return retval; } } }
using System; using System.Dynamic; using System.Linq.Expressions; using System.Reflection; namespace SqlProfiler { // TO DO: internal public class DelegatingMetaObject : DynamicMetaObject { private readonly DynamicMetaObject _innerMetaObject; /// <summary> /// Create delegating meta-object: methods and properties which can't be handled by the outer object are handled by the inner object, which /// can be an <see cref="IDynamicMetaObjectProvider"/> (including, but not limited to <see cref="MSDynamicObject"/>) or just a plain object. /// </summary> public DelegatingMetaObject(Expression expression, object outerObject, string wrappedPropertyName, BindingFlags binding = BindingFlags.Instance) : base(expression, BindingRestrictions.Empty, outerObject) { PropertyInfo innerProperty = outerObject.GetType().GetProperty(wrappedPropertyName, binding); var innerObject = innerProperty.GetValue(outerObject); Expression self = Expression.Convert(Expression, LimitType); Expression innerExpression = Expression.Property(self, innerProperty); var innerDynamicProvider = innerObject as IDynamicMetaObjectProvider; if (innerDynamicProvider != null) { _innerMetaObject = innerDynamicProvider.GetMetaObject(innerExpression); } else { _innerMetaObject = new DynamicMetaObject(innerExpression, BindingRestrictions.Empty, innerObject); } } public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) { DynamicMetaObject retval = _innerMetaObject.BindInvokeMember(binder, args); // call any parent object non-dynamic methods before trying wrapped object retval = binder.FallbackInvokeMember(this, args, retval); return retval; } public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value) { DynamicMetaObject retval = _innerMetaObject.BindSetMember(binder, value); // set any parent object non-dynamic member before trying wrapped object retval = binder.FallbackSetMember(this, value, retval); return retval; } public override DynamicMetaObject BindGetMember(GetMemberBinder binder) { DynamicMetaObject retval = _innerMetaObject.BindGetMember(binder); // get from any parent object non-dynamic member before trying wrapped object retval = binder.FallbackGetMember(this, retval); return retval; } } }
bsd-3-clause
C#
6676c8402281b2ac1466b0d8db8d5fc876910860
Increase render distance for Overlay layer. Fixes large overlay tiles popping in
ethanmoffat/EndlessClient
EndlessClient/Rendering/MapEntityRenderers/OverlayLayerRenderer.cs
EndlessClient/Rendering/MapEntityRenderers/OverlayLayerRenderer.cs
using EndlessClient.Rendering.Map; using EOLib.Domain.Character; using EOLib.Domain.Map; using EOLib.Graphics; using EOLib.IO.Map; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace EndlessClient.Rendering.MapEntityRenderers { public class OverlayLayerRenderer : BaseMapEntityRenderer { private readonly INativeGraphicsManager _nativeGraphicsManager; private readonly ICurrentMapProvider _currentMapProvider; public override MapRenderLayer RenderLayer => MapRenderLayer.Overlay; protected override int RenderDistance => 14; public OverlayLayerRenderer(INativeGraphicsManager nativeGraphicsManager, ICurrentMapProvider currentMapProvider, ICharacterProvider characterProvider, IRenderOffsetCalculator renderOffsetCalculator) : base(characterProvider, renderOffsetCalculator) { _nativeGraphicsManager = nativeGraphicsManager; _currentMapProvider = currentMapProvider; } protected override bool ElementExistsAt(int row, int col) { return CurrentMap.GFX[MapLayer.OverlayObjects][row, col] > 0; } public override void RenderElementAt(SpriteBatch spriteBatch, int row, int col, int alpha, Vector2 additionalOffset = default) { int gfxNum = CurrentMap.GFX[MapLayer.OverlayObjects][row, col]; var gfx = _nativeGraphicsManager.TextureFromResource(GFXTypes.MapOverlay, gfxNum, true); var pos = GetDrawCoordinatesFromGridUnits(col, row); pos -= new Vector2(gfx.Width / 2, gfx.Height - 32); spriteBatch.Draw(gfx, pos + additionalOffset, Color.FromNonPremultiplied(255, 255, 255, alpha)); } private IMapFile CurrentMap => _currentMapProvider.CurrentMap; } }
using EndlessClient.Rendering.Map; using EOLib.Domain.Character; using EOLib.Domain.Map; using EOLib.Graphics; using EOLib.IO.Map; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace EndlessClient.Rendering.MapEntityRenderers { public class OverlayLayerRenderer : BaseMapEntityRenderer { private readonly INativeGraphicsManager _nativeGraphicsManager; private readonly ICurrentMapProvider _currentMapProvider; public override MapRenderLayer RenderLayer => MapRenderLayer.Overlay; protected override int RenderDistance => 10; public OverlayLayerRenderer(INativeGraphicsManager nativeGraphicsManager, ICurrentMapProvider currentMapProvider, ICharacterProvider characterProvider, IRenderOffsetCalculator renderOffsetCalculator) : base(characterProvider, renderOffsetCalculator) { _nativeGraphicsManager = nativeGraphicsManager; _currentMapProvider = currentMapProvider; } protected override bool ElementExistsAt(int row, int col) { return CurrentMap.GFX[MapLayer.OverlayObjects][row, col] > 0; } public override void RenderElementAt(SpriteBatch spriteBatch, int row, int col, int alpha, Vector2 additionalOffset = default) { int gfxNum = CurrentMap.GFX[MapLayer.OverlayObjects][row, col]; var gfx = _nativeGraphicsManager.TextureFromResource(GFXTypes.MapOverlay, gfxNum, true); var pos = GetDrawCoordinatesFromGridUnits(col, row); pos -= new Vector2(gfx.Width / 2, gfx.Height - 32); spriteBatch.Draw(gfx, pos + additionalOffset, Color.FromNonPremultiplied(255, 255, 255, alpha)); } private IMapFile CurrentMap => _currentMapProvider.CurrentMap; } }
mit
C#
222d63a4919b27245e90b163871be9d6e81176f3
Update EnumerableExtensions.Split.cs
NN---/CodeJam,rsdn/CodeJam
Main/src/Collections/EnumerableExtensions.Split.cs
Main/src/Collections/EnumerableExtensions.Split.cs
using System; using System.Collections.Generic; using JetBrains.Annotations; namespace CodeJam.Collections { partial class EnumerableExtensions { /// <summary> /// Splits the input sequence into a sequence of chunks of the specified size. /// </summary> /// <param name="source">The sequence to split into chunks.</param> /// <param name="size">The size of the chunks.</param> /// <returns> /// A sequence of chunks of the specified size. /// </returns> [NotNull, Pure] public static IEnumerable<T[]> Split<T>([NotNull] this IEnumerable<T> source, int size) { if (source == null) throw new ArgumentNullException(nameof(source)); if (size <= 0) throw new ArgumentOutOfRangeException(nameof(size)); return SplitImpl(source, size); } private static IEnumerable<T[]> SplitImpl<T>(IEnumerable<T> source, int size) { using (var enumerator = source.GetEnumerator()) while (enumerator.MoveNext()) yield return SplitSequence(enumerator, size); } // IT: We need an additional method that returns Enumerable<T>: // // private static Enumerable<T> SplitSequence<T>(IEnumerator<T> source, int size) // { // yield return source.Current; // // for (var i = 1; i < batchSize && source.MoveNext(); i++) // yield return source.Current; // } // private static T[] SplitSequence<T>(IEnumerator<T> enumerator, int size) { var count = 0; var items = new T[size]; do { items[count++] = enumerator.Current; } while (count < size && enumerator.MoveNext()); if (count < size) Array.Resize(ref items, count); return items; } } }
using System; using System.Collections.Generic; using JetBrains.Annotations; namespace CodeJam.Collections { partial class EnumerableExtensions { /// <summary> /// Splits the input sequence into a sequence of chunks of the specified size. /// </summary> /// <param name="source">The sequence to split into chunks.</param> /// <param name="size">The size of the chunks.</param> /// <returns> /// A sequence of chunks of the specified size. /// </returns> [NotNull, Pure] public static IEnumerable<T[]> Split<T>([NotNull] this IEnumerable<T> source, int size) { if (source == null) throw new ArgumentNullException(nameof(source)); if (size <= 0) throw new ArgumentOutOfRangeException(nameof(size)); return SplitImpl(source, size); } private static IEnumerable<T[]> SplitImpl<T>(IEnumerable<T> source, int size) { using (var enumerator = source.GetEnumerator()) while (enumerator.MoveNext()) yield return SplitSequence(enumerator, size); } // IT: This method should return Enumerable<T>: // // private static Enumerable[] SplitSequence<T>(IEnumerator<T> source, int size) // { // yield return source.Current; // // for (var i = 1; i < batchSize && source.MoveNext(); i++) // yield return source.Current; // } // // If we need overload that returns T[] we can call it SplitArray. // private static T[] SplitSequence<T>(IEnumerator<T> enumerator, int size) { var count = 0; var items = new T[size]; do { items[count++] = enumerator.Current; } while (count < size && enumerator.MoveNext()); if (count < size) Array.Resize(ref items, count); return items; } } }
mit
C#
259d8597623a8db390187fad7b6d78191e307bcc
Add stream variant of GetFileHeader()
detaybey/MimeBank
MimeBank/MimeChecker.cs
MimeBank/MimeChecker.cs
/* * Programmed by Umut Celenli umut@celenli.com */ using System.Collections.Generic; using System.IO; using System.Linq; namespace MimeBank { /// <summary> /// This is the main class to check the file mime type /// Header list is loaded once /// </summary> public class MimeChecker { private const int maxBufferSize = 256; private static List<FileHeader> list { get; set; } private List<FileHeader> List { get { if (list == null) { list = HeaderData.GetList(); } return list; } } private byte[] Buffer; public MimeChecker() { Buffer = new byte[maxBufferSize]; } public FileHeader GetFileHeader(Stream stream) { stream.Read(Buffer, 0, maxBufferSize); return this.List.FirstOrDefault(mime => mime.Check(Buffer)); } public FileHeader GetFileHeader(string file) { using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read)) { return GetFileHeader(stream); } } } }
/* * Programmed by Umut Celenli umut@celenli.com */ using System.Collections.Generic; using System.IO; using System.Linq; namespace MimeBank { /// <summary> /// This is the main class to check the file mime type /// Header list is loaded once /// </summary> public class MimeChecker { private const int maxBufferSize = 256; private static List<FileHeader> list { get; set; } private List<FileHeader> List { get { if (list == null) { list = HeaderData.GetList(); } return list; } } private byte[] Buffer; public MimeChecker() { Buffer = new byte[maxBufferSize]; } public FileHeader GetFileHeader(string file) { using (var fs = new FileStream(file, FileMode.Open, FileAccess.Read)) { fs.Read(Buffer, 0, maxBufferSize); } return this.List.FirstOrDefault(mime => mime.Check(Buffer)); } } }
apache-2.0
C#
321873c0fbfdbf3713b45327147a63545dd980bc
Redact DB password in logging
BlythMeister/Ensconce,BlythMeister/Ensconce,15below/Ensconce,15below/Ensconce
src/Ensconce.Cli/DatabaseInteraction.cs
src/Ensconce.Cli/DatabaseInteraction.cs
using Ensconce.Database; using Ensconce.Helpers; using System.Data.SqlClient; namespace Ensconce.Cli { internal static class DatabaseInteraction { internal static void DoDeployment() { SqlConnectionStringBuilder connStr = null; if (!string.IsNullOrEmpty(Arguments.ConnectionString)) { connStr = new SqlConnectionStringBuilder(Arguments.ConnectionString.Render()); } else if (!string.IsNullOrEmpty(Arguments.DatabaseName)) { connStr = Database.Database.GetLocalConnectionStringFromDatabaseName(Arguments.DatabaseName.Render()); } Logging.Log("Deploying scripts from {0} using connection string {1}", Arguments.DeployFrom, RedactPassword(connStr)); var database = new Database.Database(connStr, Arguments.WarnOnOneTimeScriptChanges) { WithTransaction = Arguments.WithTransaction, OutputPath = Arguments.RoundhouseOutputPath }; database.Deploy(Arguments.DeployFrom, Arguments.DatabaseRepository.Render(), Arguments.DropDatabase, Arguments.DatabaseCommandTimeout); } private static SqlConnectionStringBuilder RedactPassword(SqlConnectionStringBuilder connStr) { return string.IsNullOrEmpty(connStr.Password) ? connStr : new SqlConnectionStringBuilder(connStr.ConnectionString) { Password = new string('*', connStr.Password.Length) }; } } }
using Ensconce.Database; using Ensconce.Helpers; using System.Data.SqlClient; namespace Ensconce.Cli { internal static class DatabaseInteraction { internal static void DoDeployment() { SqlConnectionStringBuilder connStr = null; if (!string.IsNullOrEmpty(Arguments.ConnectionString)) { connStr = new SqlConnectionStringBuilder(Arguments.ConnectionString.Render()); } else if (!string.IsNullOrEmpty(Arguments.DatabaseName)) { connStr = Database.Database.GetLocalConnectionStringFromDatabaseName(Arguments.DatabaseName.Render()); } Logging.Log("Deploying scripts from {0} using connection string {1}", Arguments.DeployFrom, connStr.ConnectionString); var database = new Database.Database(connStr, Arguments.WarnOnOneTimeScriptChanges) { WithTransaction = Arguments.WithTransaction, OutputPath = Arguments.RoundhouseOutputPath }; database.Deploy(Arguments.DeployFrom, Arguments.DatabaseRepository.Render(), Arguments.DropDatabase, Arguments.DatabaseCommandTimeout); } } }
mit
C#
c908e13d15a7659b27ee4254fedc0315651862c3
Rename GetAllEntitiesPermissions To Query
tidm/TAuthorization
src/TAuthorization/TAuthorization.Test/TestAuthorizationDataStore.cs
src/TAuthorization/TAuthorization.Test/TestAuthorizationDataStore.cs
using System; using System.Collections.Generic; using System.Linq; namespace TAuthorization.Test { public class TestAuthorizationDataStore : IAuthorizationDataStore { private readonly IList<EntityPermission> _entityPermissions; public TestAuthorizationDataStore() { _entityPermissions = new List<EntityPermission>(); } public IQueryable<EntityPermission> Query() { return _entityPermissions.AsQueryable(); } public void Delete(List<EntityPermission> permissions) { foreach (var entityPermission in _entityPermissions) { _entityPermissions.Remove(entityPermission); } } public EntityPermission Insert(EntityPermission ep) { _entityPermissions.Add(ep); return ep; } public EntityPermission Update(EntityPermission entityPermission) { var permission = _entityPermissions.SingleOrDefault(ep => ep.Id == entityPermission.Id); if (permission != null) { permission.EntityId = entityPermission.EntityId; permission.ActionName = entityPermission.ActionName; permission.ActionCategory = entityPermission.ActionCategory; permission.RoleName = entityPermission.RoleName; permission.Permission = entityPermission.Permission; } else { throw new Exception("Entity Permision With this id not found"); } return entityPermission; } } }
using System; using System.Collections.Generic; using System.Linq; namespace TAuthorization.Test { public class TestAuthorizationDataStore : IAuthorizationDataStore { private readonly IList<EntityPermission> _entityPermissions; public TestAuthorizationDataStore() { _entityPermissions = new List<EntityPermission>(); } public IQueryable<EntityPermission> GetAllEntityPermisions() { return _entityPermissions.AsQueryable(); } public void Delete(List<EntityPermission> permissions) { foreach (var entityPermission in _entityPermissions) { _entityPermissions.Remove(entityPermission); } } public EntityPermission Insert(EntityPermission ep) { _entityPermissions.Add(ep); return ep; } public EntityPermission Update(EntityPermission entityPermission) { var permission = _entityPermissions.SingleOrDefault(ep => ep.Id == entityPermission.Id); if (permission != null) { permission.EntityId = entityPermission.EntityId; permission.ActionName = entityPermission.ActionName; permission.ActionCategory = entityPermission.ActionCategory; permission.RoleName = entityPermission.RoleName; permission.Permission = entityPermission.Permission; } else { throw new Exception("Entity Permision With this id not found"); } return entityPermission; } } }
mit
C#
b94964b88671643a7b8caa205ec951acc54ad747
Disable the master mobile site.
GeraldBecker/TechProFantasySoccer,GeraldBecker/TechProFantasySoccer,GeraldBecker/TechProFantasySoccer
TechProFantasySoccer/TechProFantasySoccer/App_Start/RouteConfig.cs
TechProFantasySoccer/TechProFantasySoccer/App_Start/RouteConfig.cs
using System; using System.Collections.Generic; using System.Web; using System.Web.Routing; using Microsoft.AspNet.FriendlyUrls; namespace TechProFantasySoccer { public static class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { /*var settings = new FriendlyUrlSettings(); settings.AutoRedirectMode = RedirectMode.Permanent; routes.EnableFriendlyUrls(settings);*/ //Commenting the above code and using the below line gets rid of the master mobile site. routes.EnableFriendlyUrls(); } } }
using System; using System.Collections.Generic; using System.Web; using System.Web.Routing; using Microsoft.AspNet.FriendlyUrls; namespace TechProFantasySoccer { public static class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { var settings = new FriendlyUrlSettings(); settings.AutoRedirectMode = RedirectMode.Permanent; routes.EnableFriendlyUrls(settings); } } }
mit
C#
42e16ce3e1715d11ce879a4c4eec931a56d50dc7
Fix #124 with InvariantCulture in double.TryParse()
rianjs/ical.net
ical.NET/Serialization/iCalendar/Serializers/DataTypes/GeographicLocationSerializer.cs
ical.NET/Serialization/iCalendar/Serializers/DataTypes/GeographicLocationSerializer.cs
using System; using System.IO; using Ical.Net.DataTypes; using Ical.Net.Interfaces.DataTypes; using System.Globalization; namespace Ical.Net.Serialization.iCalendar.Serializers.DataTypes { public class GeographicLocationSerializer : EncodableDataTypeSerializer { public override Type TargetType => typeof (GeographicLocation); public override string SerializeToString(object obj) { var g = obj as IGeographicLocation; if (g == null) { return null; } var value = g.Latitude.ToString("0.000000") + ";" + g.Longitude.ToString("0.000000"); return Encode(g, value); } public GeographicLocation Deserialize(string value) { if (string.IsNullOrWhiteSpace(value)) { return null; } var g = CreateAndAssociate() as GeographicLocation; if (g == null) { return null; } // Decode the value, if necessary! value = Decode(g, value); var values = value.Split(new [] {';'}, StringSplitOptions.RemoveEmptyEntries); if (values.Length != 2) { return null; } double lat; double lon; double.TryParse(values[0], NumberStyles.Any, CultureInfo.InvariantCulture, out lat); double.TryParse(values[1], NumberStyles.Any, CultureInfo.InvariantCulture, out lon); g.Latitude = lat; g.Longitude = lon; return g; } public override object Deserialize(TextReader tr) => Deserialize(tr.ReadToEnd()); } }
using System; using System.IO; using Ical.Net.DataTypes; using Ical.Net.Interfaces.DataTypes; namespace Ical.Net.Serialization.iCalendar.Serializers.DataTypes { public class GeographicLocationSerializer : EncodableDataTypeSerializer { public override Type TargetType => typeof (GeographicLocation); public override string SerializeToString(object obj) { var g = obj as IGeographicLocation; if (g == null) { return null; } var value = g.Latitude.ToString("0.000000") + ";" + g.Longitude.ToString("0.000000"); return Encode(g, value); } public GeographicLocation Deserialize(string value) { if (string.IsNullOrWhiteSpace(value)) { return null; } var g = CreateAndAssociate() as GeographicLocation; if (g == null) { return null; } // Decode the value, if necessary! value = Decode(g, value); var values = value.Split(new [] {';'}, StringSplitOptions.RemoveEmptyEntries); if (values.Length != 2) { return null; } double lat; double lon; double.TryParse(values[0], out lat); double.TryParse(values[1], out lon); g.Latitude = lat; g.Longitude = lon; return g; } public override object Deserialize(TextReader tr) => Deserialize(tr.ReadToEnd()); } }
mit
C#
a6faa3e9d933a2d43be453782c82b99489af3cd2
Add a GitHub link.
MrJoy/UnityGit
Panels/GitAboutPanel.cs
Panels/GitAboutPanel.cs
using UnityEngine; using UnityEditor; public class GitAboutPanel : GitPanel { private GUIContent gitShellVersion = new GUIContent("UnityGit " + GitShell.VERSION); private GUIContent gitShellCopyright = new GUIContent("(C)Copyright 2010 MrJoy, Inc."); private GUIContent gitShellLink = new GUIContent("http://github.com/MrJoy/UnityGit"); private GUIContent gitVersion = null, gitBinary = null; private bool cantFindGit = false; protected void LoadInfo() { if(gitVersion == null) { try { gitVersion = new GUIContent("Git Version: " + ShellHelpers.OutputFromCommand("git", "--version").Replace("git version ", "").Replace("\n", "")); gitBinary = new GUIContent("Git Binary: " + ShellHelpers.OutputFromCommand("which", "git").Replace("\n", "")); cantFindGit = false; } catch { gitVersion = new GUIContent("Git Version:"); gitBinary = new GUIContent("Git Binary: Can't find git binary!"); cantFindGit = true; } } } public override void OnEnable() { LoadInfo(); } public override void OnGUI() { GUILayout.Label(gitShellVersion, GitStyles.BoldLabel); GUILayout.Label(gitShellCopyright, GitStyles.MiniLabel); LinkTo(gitShellLink, gitShellLink.text); EditorGUILayout.Separator(); Color c = GUI.color; GUI.color = (cantFindGit) ? Color.red : Color.black; GUILayout.Label(gitVersion, GitStyles.WhiteLabel); GUILayout.Label(gitBinary, GitStyles.WhiteLabel); GUI.color = c; } }
using UnityEngine; using UnityEditor; public class GitAboutPanel : GitPanel { private GUIContent gitShellVersion = new GUIContent("UnityGit " + GitShell.VERSION); private GUIContent gitShellCopyright = new GUIContent("(C)Copyright 2010 MrJoy, Inc."); private GUIContent gitVersion = null, gitBinary = null; private bool cantFindGit = false; protected void LoadInfo() { if(gitVersion == null) { try { gitVersion = new GUIContent("Git Version: " + ShellHelpers.OutputFromCommand("git", "--version").Replace("git version ", "").Replace("\n", "")); gitBinary = new GUIContent("Git Binary: " + ShellHelpers.OutputFromCommand("which", "git").Replace("\n", "")); cantFindGit = false; } catch { gitVersion = new GUIContent("Git Version:"); gitBinary = new GUIContent("Git Binary: Can't find git binary!"); cantFindGit = true; } } } public override void OnEnable() { LoadInfo(); } public override void OnGUI() { GUILayout.Label(gitShellVersion, GitStyles.BoldLabel); GUILayout.Label(gitShellCopyright, GitStyles.MiniLabel); EditorGUILayout.Separator(); Color c = GUI.color; GUI.color = (cantFindGit) ? Color.red : Color.black; GUILayout.Label(gitVersion, GitStyles.WhiteLabel); GUILayout.Label(gitBinary, GitStyles.WhiteLabel); GUI.color = c; } }
mit
C#
dbd95354e8d802e8d1044992c5ca5e42668037ab
Make FortunaShaDouble256Extractor thread-safe.
henricj/SpongePrng,henricj/SpongePrng,henricj/SpongePrng
SpongePrng/Fortuna/FortunaShaDouble256Extractor.cs
SpongePrng/Fortuna/FortunaShaDouble256Extractor.cs
// Copyright (c) 2015 Henric Jungheim <software@henric.org> // // 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 SpongePrng.Fortuna { public sealed class FortunaShaDouble256Extractor : IEntropyExtractor { readonly object _lock = new object(); readonly ShaDouble256 _shaDouble256 = new ShaDouble256(); public void Dispose() { _shaDouble256.Dispose(); } public int ByteCapacity { get { return 256 / 8; } } public void Reset(byte[] key, int offset, int length) { lock (_lock) { _shaDouble256.Initialize(); if (null != key && length > 0) _shaDouble256.TransformBlock(key, offset, length); } } public void AddEntropy(byte[] entropy, int offset, int length) { lock (_lock) { _shaDouble256.TransformBlock(entropy, offset, length); } } public int Read(byte[] buffer, int offset, int length) { byte[] hash; lock (_lock) { _shaDouble256.TransformFinalBlock(null, 0, 0); hash = _shaDouble256.Hash; } var readLength = Math.Min(length, hash.Length); Array.Copy(hash, 0, buffer, offset, readLength); return readLength; } } }
// Copyright (c) 2015 Henric Jungheim <software@henric.org> // // 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 SpongePrng.Fortuna { public sealed class FortunaShaDouble256Extractor : IEntropyExtractor { readonly ShaDouble256 _shaDouble256 = new ShaDouble256(); public void Dispose() { _shaDouble256.Dispose(); } public int ByteCapacity { get { return 256 / 8; } } public void Reset(byte[] key, int offset, int length) { _shaDouble256.Initialize(); if (null != key && length > 0) _shaDouble256.TransformBlock(key, offset, length); } public void AddEntropy(byte[] entropy, int offset, int length) { _shaDouble256.TransformBlock(entropy, offset, length); } public int Read(byte[] buffer, int offset, int length) { _shaDouble256.TransformFinalBlock(null, 0, 0); var hash = _shaDouble256.Hash; var readLength = Math.Min(length, hash.Length); Array.Copy(hash, 0, buffer, offset, readLength); return readLength; } } }
mit
C#
34d08ed1cae56a48114f98e41825687c9fa568c9
fix bug
gparlakov/chat-teamwork,gparlakov/chat-teamwork
WS-Team-Work/Chat.FileExtensions/ImageValidator.cs
WS-Team-Work/Chat.FileExtensions/ImageValidator.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chat.FileExtensions { public static class ImageValidator { static string[] allowedImgageFormat = new string[] { "JPG","JPEG", "IMG", "GIF", "ICO", "JFIF", "Exif", "TIFF", "RAW", "GIF", "BMP", "PNG", "PPM", "PGM", "PBM", "PNM", "PFM", "PAM", "WEBP"}; public static bool CheckImageFormat(string file) { string[] gettingTheFormat = file.Split(new char[] { '.' }); string fileFormat = gettingTheFormat[gettingTheFormat.Length - 1].ToUpper(); foreach (var format in allowedImgageFormat) { if (format == fileFormat) { return true; } } return false; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chat.FileExtensions { public static class ImageValidator { static string[] allowedImgageFormat = new string[] { "jpg","jpeg", "img", "gif", "ico", "JPEG", "JFIF", "Exif", "TIFF", "RAW", "GIF", "BMP", "PNG", "PPM", "PGM", "PBM", "PNM", "PFM", "PAM", "WEBP"}; public static bool CheckImageFormat(string file) { string[] gettingTheFormat = file.Split(new char[] { '.' }); string fileFormat = gettingTheFormat[gettingTheFormat.Length - 1]; foreach (var format in allowedImgageFormat) { if (format == fileFormat) { return true; } } return false; } } }
mit
C#
4323bf77797b7be6ad488b908672dba69faa57cf
Install default rules only if no customs are provided
tmds/Tmds.DBus
Monitor.cs
Monitor.cs
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Collections.Generic; using NDesk.DBus; using org.freedesktop.DBus; public class ManagedDBusTest { public static void Main (string[] args) { string addr = Address.SessionBus; if (args.Length == 1) { string arg = args[0]; switch (arg) { case "--system": addr = Address.SystemBus; break; case "--session": addr = Address.SessionBus; break; default: Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]"); Console.Error.WriteLine (" If no watch expressions are provided, defaults will be used."); return; } } Connection conn = new Connection (false); conn.Open (addr); conn.Authenticate (); ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); string name = "org.freedesktop.DBus"; Bus bus = conn.GetObject<Bus> (name, opath); bus.NameAcquired += delegate (string acquired_name) { Console.WriteLine ("NameAcquired: " + acquired_name); }; bus.Hello (); //hack to process the NameAcquired signal synchronously conn.HandleSignal (conn.ReadMessage ()); if (args.Length > 1) { //install custom match rules only for (int i = 1 ; i != args.Length ; i++) bus.AddMatch (args[i]); } else { //no custom match rules, install the defaults bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error)); } while (true) { Message msg = conn.ReadMessage (); Console.WriteLine ("Message:"); Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType); //foreach (HeaderField hf in msg.HeaderFields) // Console.WriteLine ("\t" + hf.Code + ": " + hf.Value); foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields) Console.WriteLine ("\t" + field.Key + ": " + field.Value); if (msg.Body != null) { Console.WriteLine ("\tBody:"); MessageReader reader = new MessageReader (msg); //TODO: this needs to be done more intelligently try { foreach (DType dtype in msg.Signature.Data) { if (dtype == DType.Invalid) continue; object arg; reader.GetValue (dtype, out arg); Console.WriteLine ("\t\t" + dtype + ": " + arg); } } catch { Console.WriteLine ("\t\tmonitor is too dumb to decode message body"); } } Console.WriteLine (); } } }
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Collections.Generic; using NDesk.DBus; using org.freedesktop.DBus; public class ManagedDBusTest { public static void Main (string[] args) { string addr = Address.SessionBus; if (args.Length == 1) { string arg = args[0]; switch (arg) { case "--system": addr = Address.SystemBus; break; case "--session": addr = Address.SessionBus; break; default: Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]"); return; } } Connection conn = new Connection (false); conn.Open (addr); conn.Authenticate (); ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); string name = "org.freedesktop.DBus"; Bus bus = conn.GetObject<Bus> (name, opath); bus.NameAcquired += delegate (string acquired_name) { Console.WriteLine ("NameAcquired: " + acquired_name); }; bus.Hello (); //hack to process the NameAcquired signal synchronously conn.HandleSignal (conn.ReadMessage ()); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error)); //custom match rules if (args.Length > 1) for (int i = 1 ; i != args.Length ; i++) bus.AddMatch (args[i]); while (true) { Message msg = conn.ReadMessage (); Console.WriteLine ("Message:"); Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType); //foreach (HeaderField hf in msg.HeaderFields) // Console.WriteLine ("\t" + hf.Code + ": " + hf.Value); foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields) Console.WriteLine ("\t" + field.Key + ": " + field.Value); if (msg.Body != null) { Console.WriteLine ("\tBody:"); MessageReader reader = new MessageReader (msg); //TODO: this needs to be done more intelligently try { foreach (DType dtype in msg.Signature.Data) { if (dtype == DType.Invalid) continue; object arg; reader.GetValue (dtype, out arg); Console.WriteLine ("\t\t" + dtype + ": " + arg); } } catch { Console.WriteLine ("\t\tmonitor is too dumb to decode message body"); } } Console.WriteLine (); } } }
mit
C#
e799951641d1fe703f528c739d9fedac4e4339c5
Update ApprenticeshipBase.cs
SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments
src/CommitmentsV2/SFA.DAS.CommitmentsV2/Models/ApprenticeshipBase.cs
src/CommitmentsV2/SFA.DAS.CommitmentsV2/Models/ApprenticeshipBase.cs
using System; using System.Collections.Generic; using SFA.DAS.CommitmentsV2.Types; namespace SFA.DAS.CommitmentsV2.Models { public abstract class ApprenticeshipBase : Aggregate { public ApprenticeshipBase() { ApprenticeshipUpdate = new List<ApprenticeshipUpdate>(); } public bool IsApproved { get; set; } public virtual long Id { get; set; } public virtual long CommitmentId { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } public string Uln { get; set; } public ProgrammeType? ProgrammeType { get; set; } public string CourseCode { get; set; } public string CourseName { get; set; } public string TrainingCourseVersion { get; set; } public bool TrainingCourseVersionConfirmed { get; set; } public string TrainingCourseOption { get; set; } public string StandardUId { get; set; } public decimal? Cost { get; set; } public DateTime? StartDate { get; set; } public DateTime? EndDate { get; set; } public PaymentStatus PaymentStatus { get; set; } public DateTime? DateOfBirth { get; set; } public string NiNumber { get; set; } public string EmployerRef { get; set; } public string ProviderRef { get; set; } public DateTime? CreatedOn { get; set; } public DateTime? AgreedOn { get; set; } public string EpaOrgId { get; set; } public long? CloneOf { get; set; } public bool IsProviderSearch { get; set; } public Guid? ReservationId { get; set; } public long? ContinuationOfId { get; set; } public DateTime? OriginalStartDate { get; set; } public virtual Cohort Cohort { get; set; } public virtual AssessmentOrganisation EpaOrg { get; set; } public ApprenticeshipStatus ApprenticeshipStatus { get; set; } public virtual ICollection<ApprenticeshipUpdate> ApprenticeshipUpdate { get; set; } public bool IsContinuation => ContinuationOfId.HasValue; public virtual Apprenticeship PreviousApprenticeship { get; set; } } }
using System; using System.Collections.Generic; using SFA.DAS.CommitmentsV2.Types; namespace SFA.DAS.CommitmentsV2.Models { public abstract class ApprenticeshipBase : Aggregate { public bool IsApproved { get; set; } public virtual long Id { get; set; } public virtual long CommitmentId { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } public string Uln { get; set; } public ProgrammeType? ProgrammeType { get; set; } public string CourseCode { get; set; } public string CourseName { get; set; } public string TrainingCourseVersion { get; set; } public bool TrainingCourseVersionConfirmed { get; set; } public string TrainingCourseOption { get; set; } public string StandardUId { get; set; } public decimal? Cost { get; set; } public DateTime? StartDate { get; set; } public DateTime? EndDate { get; set; } public PaymentStatus PaymentStatus { get; set; } public DateTime? DateOfBirth { get; set; } public string NiNumber { get; set; } public string EmployerRef { get; set; } public string ProviderRef { get; set; } public DateTime? CreatedOn { get; set; } public DateTime? AgreedOn { get; set; } public string EpaOrgId { get; set; } public long? CloneOf { get; set; } public bool IsProviderSearch { get; set; } public Guid? ReservationId { get; set; } public long? ContinuationOfId { get; set; } public DateTime? OriginalStartDate { get; set; } public virtual Cohort Cohort { get; set; } public virtual AssessmentOrganisation EpaOrg { get; set; } public ApprenticeshipStatus ApprenticeshipStatus { get; set; } public virtual ICollection<ApprenticeshipUpdate> ApprenticeshipUpdate { get; set; } public bool IsContinuation => ContinuationOfId.HasValue; public virtual Apprenticeship PreviousApprenticeship { get; set; } } }
mit
C#
d7da5b57b5b8883307d2e7652ad06fa7a8091b54
Make sure config exists by checking steam credentials
thecocce/SteamDatabaseBackend,SteamDatabase/SteamDatabaseBackend,GoeGaming/SteamDatabaseBackend,agarbuno/SteamDatabaseBackend,SteamDatabase/SteamDatabaseBackend,SGColdSun/SteamDatabaseBackend,thecocce/SteamDatabaseBackend,SGColdSun/SteamDatabaseBackend,GoeGaming/SteamDatabaseBackend
Program.cs
Program.cs
/* * Copyright (c) 2013, SteamDB. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * * Future non-SteamKit stuff should go in this file. */ using System; using System.Configuration; using System.Threading; namespace PICSUpdater { class Program { static void Main(string[] args) { if (ConfigurationManager.AppSettings["steam-username"] == null || ConfigurationManager.AppSettings["steam-password"] == null) { Console.WriteLine("Is config missing? It should be in " + ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath); return; } //new Thread(new ThreadStart(Steam.Run)).Start(); Steam.Run(); } } }
/* * Copyright (c) 2013, SteamDB. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * * Future non-SteamKit stuff should go in this file. */ using System; using System.Threading; namespace PICSUpdater { class Program { static void Main(string[] args) { new Thread(new ThreadStart(Steam.Run)).Start(); //Steam.GetPICSChanges(); } } }
bsd-3-clause
C#
83483c536cd51c5f1501a921aba02c61ebe2df32
Add comment.
mavasani/roslyn,tannergooding/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,CaptainHayashi/roslyn,AnthonyDGreen/roslyn,heejaechang/roslyn,lorcanmooney/roslyn,abock/roslyn,abock/roslyn,jamesqo/roslyn,brettfo/roslyn,jkotas/roslyn,AlekseyTs/roslyn,shyamnamboodiripad/roslyn,Giftednewt/roslyn,kelltrick/roslyn,DustinCampbell/roslyn,orthoxerox/roslyn,lorcanmooney/roslyn,OmarTawfik/roslyn,KevinRansom/roslyn,CaptainHayashi/roslyn,davkean/roslyn,brettfo/roslyn,Hosch250/roslyn,AmadeusW/roslyn,pdelvo/roslyn,agocke/roslyn,VSadov/roslyn,davkean/roslyn,paulvanbrenk/roslyn,jmarolf/roslyn,eriawan/roslyn,orthoxerox/roslyn,reaction1989/roslyn,srivatsn/roslyn,panopticoncentral/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,panopticoncentral/roslyn,lorcanmooney/roslyn,reaction1989/roslyn,eriawan/roslyn,tvand7093/roslyn,jasonmalinowski/roslyn,AlekseyTs/roslyn,dpoeschl/roslyn,OmarTawfik/roslyn,mavasani/roslyn,gafter/roslyn,weltkante/roslyn,bartdesmet/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,xasx/roslyn,jkotas/roslyn,AmadeusW/roslyn,cston/roslyn,agocke/roslyn,genlu/roslyn,physhi/roslyn,mattscheffer/roslyn,Hosch250/roslyn,jamesqo/roslyn,AmadeusW/roslyn,weltkante/roslyn,mmitche/roslyn,stephentoub/roslyn,bkoelman/roslyn,eriawan/roslyn,VSadov/roslyn,diryboy/roslyn,kelltrick/roslyn,jcouv/roslyn,cston/roslyn,jmarolf/roslyn,khyperia/roslyn,tmat/roslyn,tvand7093/roslyn,mmitche/roslyn,MattWindsor91/roslyn,MattWindsor91/roslyn,MattWindsor91/roslyn,bartdesmet/roslyn,diryboy/roslyn,genlu/roslyn,bartdesmet/roslyn,genlu/roslyn,heejaechang/roslyn,paulvanbrenk/roslyn,reaction1989/roslyn,KevinRansom/roslyn,jkotas/roslyn,AnthonyDGreen/roslyn,kelltrick/roslyn,Giftednewt/roslyn,CyrusNajmabadi/roslyn,bkoelman/roslyn,robinsedlaczek/roslyn,heejaechang/roslyn,OmarTawfik/roslyn,pdelvo/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,Hosch250/roslyn,wvdd007/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,nguerrera/roslyn,mavasani/roslyn,nguerrera/roslyn,tvand7093/roslyn,dpoeschl/roslyn,DustinCampbell/roslyn,KirillOsenkov/roslyn,brettfo/roslyn,dotnet/roslyn,MichalStrehovsky/roslyn,tmeschter/roslyn,gafter/roslyn,tmeschter/roslyn,pdelvo/roslyn,mmitche/roslyn,sharwell/roslyn,sharwell/roslyn,mgoertz-msft/roslyn,ErikSchierboom/roslyn,xasx/roslyn,nguerrera/roslyn,MattWindsor91/roslyn,aelij/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,dotnet/roslyn,wvdd007/roslyn,swaroop-sridhar/roslyn,ErikSchierboom/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,stephentoub/roslyn,jmarolf/roslyn,shyamnamboodiripad/roslyn,orthoxerox/roslyn,weltkante/roslyn,jamesqo/roslyn,mattscheffer/roslyn,srivatsn/roslyn,KevinRansom/roslyn,abock/roslyn,agocke/roslyn,physhi/roslyn,gafter/roslyn,KirillOsenkov/roslyn,robinsedlaczek/roslyn,swaroop-sridhar/roslyn,srivatsn/roslyn,aelij/roslyn,xasx/roslyn,mattscheffer/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,khyperia/roslyn,Giftednewt/roslyn,tannergooding/roslyn,AnthonyDGreen/roslyn,aelij/roslyn,TyOverby/roslyn,CaptainHayashi/roslyn,paulvanbrenk/roslyn,jcouv/roslyn,jasonmalinowski/roslyn,TyOverby/roslyn,KirillOsenkov/roslyn,swaroop-sridhar/roslyn,ErikSchierboom/roslyn,MichalStrehovsky/roslyn,dpoeschl/roslyn,diryboy/roslyn,tmeschter/roslyn,tmat/roslyn,tannergooding/roslyn,bkoelman/roslyn,khyperia/roslyn,mgoertz-msft/roslyn,davkean/roslyn,tmat/roslyn,jcouv/roslyn,CyrusNajmabadi/roslyn,TyOverby/roslyn,MichalStrehovsky/roslyn,DustinCampbell/roslyn,cston/roslyn,robinsedlaczek/roslyn,physhi/roslyn,VSadov/roslyn
src/EditorFeatures/Core/Implementation/CommentSelection/CommentSelectionServiceProxy.cs
src/EditorFeatures/Core/Implementation/CommentSelection/CommentSelectionServiceProxy.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.Collections.Immutable; using System.Threading; using Microsoft.CodeAnalysis.CommentSelection; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Editor.Implementation.CommentSelection { /// <summary> /// Bridge between the new <see cref="ICommentSelectionService"/> and an existing /// language which only supplies the old <see cref="ICommentUncommentService"/> service. /// </summary> internal class CommentSelectionServiceProxy : ICommentSelectionService { #pragma warning disable CS0618 // Type or member is obsolete private readonly ICommentUncommentService _commentUncommentService; public CommentSelectionServiceProxy(ICommentUncommentService commentUncommentService) { _commentUncommentService = commentUncommentService; } #pragma warning restore CS0618 // Type or member is obsolete public CommentSelectionInfo GetInfo(SourceText sourceText, TextSpan textSpan) => new CommentSelectionInfo(true, _commentUncommentService.SupportsBlockComment, _commentUncommentService.SingleLineCommentString, _commentUncommentService.BlockCommentStartString, _commentUncommentService.BlockCommentEndString); public Document Format(Document document, ImmutableArray<TextSpan> changes, CancellationToken cancellationToken) => _commentUncommentService.Format(document, changes, cancellationToken); } }
// 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.Collections.Immutable; using System.Threading; using Microsoft.CodeAnalysis.CommentSelection; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Editor.Implementation.CommentSelection { internal class CommentSelectionServiceProxy : ICommentSelectionService { #pragma warning disable CS0618 // Type or member is obsolete private readonly ICommentUncommentService _commentUncommentService; public CommentSelectionServiceProxy(ICommentUncommentService commentUncommentService) { _commentUncommentService = commentUncommentService; } #pragma warning restore CS0618 // Type or member is obsolete public CommentSelectionInfo GetInfo(SourceText sourceText, TextSpan textSpan) => new CommentSelectionInfo(true, _commentUncommentService.SupportsBlockComment, _commentUncommentService.SingleLineCommentString, _commentUncommentService.BlockCommentStartString, _commentUncommentService.BlockCommentEndString); public Document Format(Document document, ImmutableArray<TextSpan> changes, CancellationToken cancellationToken) => _commentUncommentService.Format(document, changes, cancellationToken); } }
mit
C#
0f2184e710f4002866902afecaf7747bd1018b39
Remove unused notfound method
Yonom/WebNom
WebNom/Pages/Monitor.cs
WebNom/Pages/Monitor.cs
using System; using System.Net; using System.Text.RegularExpressions; using MuffinFramework.Muffins; using WebNom.Http; namespace WebNom.Pages { public abstract class Monitor : Muffin { private HttpPlatform _httpPlatform; protected override void Enable() { this._httpPlatform = this.PlatformLoader.Get<HttpPlatform>(); this._httpPlatform.Receive += this._httpPlatform_Receive; this._httpPlatform.ServerError += _httpPlatform_ServerError; } protected override void Dispose(bool disposing) { if (disposing) { this._httpPlatform.Receive -= this._httpPlatform_Receive; this._httpPlatform.ServerError -= _httpPlatform_ServerError; } base.Dispose(disposing); } void _httpPlatform_ServerError(HttpListenerContext context, Exception ex) { this.OnServerError(context, ex); } private void _httpPlatform_Receive(HttpListenerContext context, ref bool handled) { this.OnRequest(context); } protected abstract void OnRequest(HttpListenerContext context); protected abstract void OnServerError(HttpListenerContext context, Exception ex); } }
using System; using System.Net; using System.Text.RegularExpressions; using MuffinFramework.Muffins; using WebNom.Http; namespace WebNom.Pages { public abstract class Monitor : Muffin { private HttpPlatform _httpPlatform; protected override void Enable() { this._httpPlatform = this.PlatformLoader.Get<HttpPlatform>(); this._httpPlatform.Receive += this._httpPlatform_Receive; this._httpPlatform.ServerError += _httpPlatform_ServerError; } protected override void Dispose(bool disposing) { if (disposing) { this._httpPlatform.Receive -= this._httpPlatform_Receive; this._httpPlatform.ServerError -= _httpPlatform_ServerError; } base.Dispose(disposing); } void _httpPlatform_ServerError(HttpListenerContext context, Exception ex) { this.OnServerError(context, ex); } private void _httpPlatform_Receive(HttpListenerContext context, ref bool handled) { this.OnRequest(context); } protected abstract void OnRequest(HttpListenerContext context); protected abstract void OnServerError(HttpListenerContext context, Exception ex); protected abstract void OnNotFound(HttpListenerContext context); } }
mit
C#
9018f1c38add6da08ce2953534a60608fb950034
refactor SeleniumNotifier
OlegKleyman/AlphaDev,OlegKleyman/AlphaDev,OlegKleyman/AlphaDev
tests/integration/AlphaDev.Web.Tests.Integration/SeleniumNotifier.cs
tests/integration/AlphaDev.Web.Tests.Integration/SeleniumNotifier.cs
using System.IO; using System.Text.RegularExpressions; using LightBDD.Core.Metadata; using LightBDD.Core.Notification; using LightBDD.Core.Results; using OpenQA.Selenium; namespace AlphaDev.Web.Tests.Integration { public class SeleniumNotifier : IScenarioProgressNotifier { private readonly ITakesScreenshot _screenshotTaker; private string _scenarioName; private static readonly Regex NameCleanser = new Regex($@"[{string.Join(string.Empty, Path.GetInvalidFileNameChars())}|\s]", RegexOptions.Compiled); public SeleniumNotifier(ITakesScreenshot screenshotTaker) { _screenshotTaker = screenshotTaker; } public void NotifyScenarioStart(IScenarioInfo scenario) { _scenarioName = NameCleanser.Replace(scenario.Name.ToString(), string.Empty); } public void NotifyScenarioFinished(IScenarioResult scenario) { } public void NotifyStepStart(IStepInfo step) { TakeScreenshot(step, "1"); } public void NotifyStepFinished(IStepResult step) { TakeScreenshot(step.Info, "2"); } public void NotifyStepComment(IStepInfo step, string comment) { } private void TakeScreenshot(IStepInfo step, string suffix) { if (_screenshotTaker != null) { const string screenshotsDirectoryName = "sout"; if (!Directory.Exists(screenshotsDirectoryName)) { Directory.CreateDirectory(screenshotsDirectoryName); } var escapedStepFileName = NameCleanser.Replace(step.Name.ToString(), string.Empty); _screenshotTaker.GetScreenshot() ?.SaveAsFile( $@"{screenshotsDirectoryName}/{_scenarioName}{step.Number}{escapedStepFileName}{suffix}.png", ScreenshotImageFormat.Png); } } } }
using System.IO; using System.Text.RegularExpressions; using LightBDD.Core.Metadata; using LightBDD.Core.Notification; using LightBDD.Core.Results; using OpenQA.Selenium; namespace AlphaDev.Web.Tests.Integration { public class SeleniumNotifier : IScenarioProgressNotifier { private readonly ITakesScreenshot _screenshotTaker; private IScenarioInfo _scenario; public SeleniumNotifier(ITakesScreenshot screenshotTaker) { _screenshotTaker = screenshotTaker; } public void NotifyScenarioStart(IScenarioInfo scenario) { _scenario = scenario; } public void NotifyScenarioFinished(IScenarioResult scenario) { } public void NotifyStepStart(IStepInfo step) { TakeScreenshot(step, "1"); } public void NotifyStepFinished(IStepResult step) { TakeScreenshot(step.Info, "2"); } public void NotifyStepComment(IStepInfo step, string comment) { } private void TakeScreenshot(IStepInfo step, string suffix) { if (_screenshotTaker != null) { const string screenshotsDirectoryName = "sout"; if (!Directory.Exists(screenshotsDirectoryName)) { Directory.CreateDirectory(screenshotsDirectoryName); } var escapedStepFileName = Regex.Replace(step.Name.ToString(), $@"[{string.Join(string.Empty, Path.GetInvalidFileNameChars())}|\s]", string.Empty, RegexOptions.Compiled); _screenshotTaker.GetScreenshot() ?.SaveAsFile( $@"{screenshotsDirectoryName}/{_scenario.Name}{step.Number}{escapedStepFileName}{suffix}.png", ScreenshotImageFormat.Png); } } } }
unlicense
C#
1c83e565f7532cff0a66b7eb7bf86e6bdfe199ab
Fix race condition for some threading tests using GC.KeepAlive (#13351)
dpodder/coreclr,hseok-oh/coreclr,JonHanna/coreclr,JosephTremoulet/coreclr,AlexGhiondea/coreclr,mmitche/coreclr,mmitche/coreclr,dpodder/coreclr,rartemev/coreclr,dpodder/coreclr,poizan42/coreclr,parjong/coreclr,wtgodbe/coreclr,JonHanna/coreclr,botaberg/coreclr,hseok-oh/coreclr,yizhang82/coreclr,mskvortsov/coreclr,yizhang82/coreclr,wtgodbe/coreclr,kyulee1/coreclr,AlexGhiondea/coreclr,tijoytom/coreclr,parjong/coreclr,poizan42/coreclr,JosephTremoulet/coreclr,mmitche/coreclr,wtgodbe/coreclr,wateret/coreclr,JosephTremoulet/coreclr,poizan42/coreclr,JosephTremoulet/coreclr,botaberg/coreclr,cshung/coreclr,rartemev/coreclr,wtgodbe/coreclr,russellhadley/coreclr,hseok-oh/coreclr,botaberg/coreclr,botaberg/coreclr,ruben-ayrapetyan/coreclr,mskvortsov/coreclr,botaberg/coreclr,JonHanna/coreclr,mmitche/coreclr,dpodder/coreclr,parjong/coreclr,wateret/coreclr,dpodder/coreclr,JosephTremoulet/coreclr,ruben-ayrapetyan/coreclr,russellhadley/coreclr,cshung/coreclr,JonHanna/coreclr,AlexGhiondea/coreclr,mskvortsov/coreclr,tijoytom/coreclr,rartemev/coreclr,ruben-ayrapetyan/coreclr,cshung/coreclr,kyulee1/coreclr,kyulee1/coreclr,kyulee1/coreclr,wateret/coreclr,cshung/coreclr,rartemev/coreclr,mskvortsov/coreclr,wateret/coreclr,tijoytom/coreclr,JonHanna/coreclr,JosephTremoulet/coreclr,mmitche/coreclr,rartemev/coreclr,poizan42/coreclr,mmitche/coreclr,yizhang82/coreclr,ruben-ayrapetyan/coreclr,poizan42/coreclr,mskvortsov/coreclr,JonHanna/coreclr,russellhadley/coreclr,krk/coreclr,botaberg/coreclr,wtgodbe/coreclr,AlexGhiondea/coreclr,wateret/coreclr,ruben-ayrapetyan/coreclr,yizhang82/coreclr,krk/coreclr,krk/coreclr,cshung/coreclr,wtgodbe/coreclr,mskvortsov/coreclr,dpodder/coreclr,krk/coreclr,poizan42/coreclr,tijoytom/coreclr,wateret/coreclr,tijoytom/coreclr,parjong/coreclr,AlexGhiondea/coreclr,yizhang82/coreclr,hseok-oh/coreclr,AlexGhiondea/coreclr,russellhadley/coreclr,tijoytom/coreclr,hseok-oh/coreclr,kyulee1/coreclr,russellhadley/coreclr,parjong/coreclr,ruben-ayrapetyan/coreclr,rartemev/coreclr,parjong/coreclr,krk/coreclr,kyulee1/coreclr,russellhadley/coreclr,hseok-oh/coreclr,krk/coreclr,cshung/coreclr,yizhang82/coreclr
tests/src/baseservices/threading/mutex/openexisting/openmutexneg7.cs
tests/src/baseservices/threading/mutex/openexisting/openmutexneg7.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Threading; class OpenMutexNeg { public ManualResetEvent mre; public Mutex mut; public OpenMutexNeg() { mre = new ManualResetEvent(false); } public static int Main() { OpenMutexNeg omn = new OpenMutexNeg(); return omn.Run(); } private int Run() { int iRet = -1; string sName = Common.GetUniqueName(); // open a Mutex that has been abandoned mut = new Mutex(false, sName); Thread th = new Thread(new ParameterizedThreadStart(AbandonMutex)); th.Start(mut); mre.WaitOne(); try { Mutex mut1 = Mutex.OpenExisting(sName); mut1.WaitOne(); } catch (AbandonedMutexException) { //Expected iRet = 100; } catch (Exception e) { Console.WriteLine("Caught unexpected exception: " + e.ToString()); } GC.KeepAlive(mut); Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed"); return iRet; } private void AbandonMutex(Object o) { ((Mutex)o).WaitOne(); mre.Set(); Thread.Sleep(1000); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Threading; class OpenMutexNeg { public ManualResetEvent mre; public Mutex mut; public OpenMutexNeg() { mre = new ManualResetEvent(false); } public static int Main() { OpenMutexNeg omn = new OpenMutexNeg(); return omn.Run(); } private int Run() { int iRet = -1; string sName = Common.GetUniqueName(); // open a Mutex that has been abandoned mut = new Mutex(false, sName); Thread th = new Thread(new ParameterizedThreadStart(AbandonMutex)); th.Start(mut); mre.WaitOne(); try { Mutex mut1 = Mutex.OpenExisting(sName); mut1.WaitOne(); } catch (AbandonedMutexException) { //Expected iRet = 100; } catch (Exception e) { Console.WriteLine("Caught unexpected exception: " + e.ToString()); } Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed"); return iRet; } private void AbandonMutex(Object o) { ((Mutex)o).WaitOne(); mre.Set(); Thread.Sleep(1000); } }
mit
C#
593c557bb4839b66fce93a3682788c3fc6f04ce9
fix casing of API URL constant
NebulousConcept/b2-csharp-client
b2-csharp-client-test/B2.Client/TestEnvironment.cs
b2-csharp-client-test/B2.Client/TestEnvironment.cs
using System; using NUnit.Framework; namespace B2.Client.Test { internal static class TestEnvironment { internal const string B2ApiUrl = "https://api.backblazeb2.com"; internal static string GetTestConfiguration(string key) { var ret = Environment.GetEnvironmentVariable(key); if (ret == null) { Assert.Inconclusive(); } return ret; } internal static string GetTestAccountId() => GetTestConfiguration("B2_ACCOUNT_ID"); internal static string GetTestAccountKey() => GetTestConfiguration("B2_ACCOUNT_KEY"); } }
using System; using NUnit.Framework; namespace B2.Client.Test { internal static class TestEnvironment { internal const string B2_API_URL = "https://api.backblazeb2.com"; internal static string GetTestConfiguration(string key) { var ret = Environment.GetEnvironmentVariable(key); if (ret == null) { Assert.Inconclusive(); } return ret; } internal static string GetTestAccountId() => GetTestConfiguration("B2_ACCOUNT_ID"); internal static string GetTestAccountKey() => GetTestConfiguration("B2_ACCOUNT_KEY"); } }
mit
C#
a005f596c9e106727edb096d4be18c1b98370d6a
Fix date 2008 -> 2009
codingteam/codingteam.org.ru,codingteam/codingteam.org.ru
Views/Home/Index.cshtml
Views/Home/Index.cshtml
<p>Welcome! Codingteam is an open community of engineers and programmers.</p> <p>And here're today's conference logs:</p> <iframe class="logs" src="@ViewData["LogUrl"]"></iframe> <a href="/old-logs/codingteam@conference.jabber.ru/">Older logs (mostly actual in period 2009-08-22 — 2016-12-09)</a>
<p>Welcome! Codingteam is an open community of engineers and programmers.</p> <p>And here're today's conference logs:</p> <iframe class="logs" src="@ViewData["LogUrl"]"></iframe> <a href="/old-logs/codingteam@conference.jabber.ru/">Older logs (mostly actual in period 2008-08-22 — 2016-12-09)</a>
mit
C#
fe5b6d67c5cffcbf07c0ec72135fc2f4afc99aa7
Fix routing sample
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNet.Routing/RoutingServices.cs
src/Microsoft.AspNet.Routing/RoutingServices.cs
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Routing; namespace Microsoft.Framework.DependencyInjection { public static class RoutingServices { public static IServiceCollection AddRouting(this IServiceCollection services) { services.AddOptions(); services.TryAdd(ServiceDescriptor.Transient<IInlineConstraintResolver, DefaultInlineConstraintResolver>()); return services; } } }
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Routing; namespace Microsoft.Framework.DependencyInjection { public static class RoutingServices { public static IServiceCollection AddRouting(this IServiceCollection services) { services.TryAdd(ServiceDescriptor.Transient<IInlineConstraintResolver, DefaultInlineConstraintResolver>()); return services; } } }
apache-2.0
C#
3848da321e2ff0c2347e7c5955ddda4284a474db
Allow to specify which TraceEventType will cause DebuggerTraceListener to break
xecrets/nlight,slorion/nlight
src/NLight/Diagnostics/DebuggerTraceListener.cs
src/NLight/Diagnostics/DebuggerTraceListener.cs
// Author(s): Sébastien Lorion // inspired by https://github.com/akkadotnet/akka.net/pull/1424 using System.Diagnostics; namespace NLight.Diagnostics { /// <summary> /// A trace listener that will break in the debugger when the <see cref="TraceEventType"/> is equal or lower /// than the value specified by <see cref="BreakOnEventType"/> (by default <see cref="TraceEventType.Error"/>). /// </summary> public class DebuggerTraceListener : TraceListener { public bool BreakOnEventEnabled { get; set; } = true; public TraceEventType BreakOnEventType { get; set; } = TraceEventType.Error; public override void Write(string message) => Debug.Write(message); public override void WriteLine(string message) => Debug.WriteLine(message); public override void Fail(string message) { base.Fail(message); BreakOnEvent(TraceEventType.Error); } public override void Fail(string message, string detailMessage) { base.Fail(message, detailMessage); BreakOnEvent(TraceEventType.Error); } public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data) { base.TraceData(eventCache, source, eventType, id, data); BreakOnEvent(eventType); } public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, params object[] data) { base.TraceData(eventCache, source, eventType, id, data); BreakOnEvent(eventType); } public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id) { base.TraceEvent(eventCache, source, eventType, id); BreakOnEvent(eventType); } public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args) { base.TraceEvent(eventCache, source, eventType, id, format, args); BreakOnEvent(eventType); } public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message) { base.TraceEvent(eventCache, source, eventType, id, message); BreakOnEvent(eventType); } private void BreakOnEvent(TraceEventType eventType) { if (this.BreakOnEventEnabled && eventType <= this.BreakOnEventType && Debugger.IsAttached) Debugger.Break(); } } }
// Author(s): Sébastien Lorion // inspired by https://github.com/akkadotnet/akka.net/pull/1424 using System.Diagnostics; namespace NLight.Diagnostics { public class DebuggerTraceListener : TraceListener { public bool BreakOnErrorEnabled { get; set; } = true; public override void Write(string message) => Debug.Write(message); public override void WriteLine(string message) => Debug.WriteLine(message); public override void Fail(string message) { base.Fail(message); BreakOnError(TraceEventType.Error); } public override void Fail(string message, string detailMessage) { base.Fail(message, detailMessage); BreakOnError(TraceEventType.Error); } public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data) { base.TraceData(eventCache, source, eventType, id, data); BreakOnError(eventType); } public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, params object[] data) { base.TraceData(eventCache, source, eventType, id, data); BreakOnError(eventType); } public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id) { base.TraceEvent(eventCache, source, eventType, id); BreakOnError(eventType); } public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args) { base.TraceEvent(eventCache, source, eventType, id, format, args); BreakOnError(eventType); } public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message) { base.TraceEvent(eventCache, source, eventType, id, message); BreakOnError(eventType); } private void BreakOnError(TraceEventType eventType) { if (this.BreakOnErrorEnabled && Debugger.IsAttached) { if (eventType == TraceEventType.Critical || eventType == TraceEventType.Error) Debugger.Break(); } } } }
mit
C#
d31c18e128b9182e2292f2787876c1dcc3ced6af
Make string accessor returning a string
lunet-io/scriban,textamina/scriban
src/Scriban/Runtime/Accessors/StringAccessor.cs
src/Scriban/Runtime/Accessors/StringAccessor.cs
// Copyright (c) Alexandre Mutel. All rights reserved. // Licensed under the BSD-Clause 2 license. // See license.txt file in the project root for full license information. using System.Collections.Generic; using Scriban.Parsing; using Scriban.Syntax; namespace Scriban.Runtime.Accessors { public class StringAccessor : IListAccessor, IObjectAccessor { public static StringAccessor Default = new StringAccessor(); private StringAccessor() { } public int GetLength(TemplateContext context, SourceSpan span, object target) { return ((string)target).Length; } public object GetValue(TemplateContext context, SourceSpan span, object target, int index) { return ((string)target)[index].ToString(); } public void SetValue(TemplateContext context, SourceSpan span, object target, int index, object value) { throw new ScriptRuntimeException(span, "Cannot replace a character in a string"); } public int GetMemberCount(TemplateContext context, SourceSpan span, object target) { // size return 1; } public IEnumerable<string> GetMembers(TemplateContext context, SourceSpan span, object target) { yield return "size"; } public bool HasMember(TemplateContext context, SourceSpan span, object target, string member) { return member == "size"; } public bool TryGetValue(TemplateContext context, SourceSpan span, object target, string member, out object value) { if (member == "size") { value = GetLength(context, span, target); return true; } value = null; return false; } public bool TrySetValue(TemplateContext context, SourceSpan span, object target, string member, object value) { return false; } } }
// Copyright (c) Alexandre Mutel. All rights reserved. // Licensed under the BSD-Clause 2 license. // See license.txt file in the project root for full license information. using System.Collections.Generic; using Scriban.Parsing; using Scriban.Syntax; namespace Scriban.Runtime.Accessors { public class StringAccessor : IListAccessor, IObjectAccessor { public static StringAccessor Default = new StringAccessor(); private StringAccessor() { } public int GetLength(TemplateContext context, SourceSpan span, object target) { return ((string)target).Length; } public object GetValue(TemplateContext context, SourceSpan span, object target, int index) { return ((string)target)[index]; } public void SetValue(TemplateContext context, SourceSpan span, object target, int index, object value) { throw new ScriptRuntimeException(span, "Cannot replace a character in a string"); } public int GetMemberCount(TemplateContext context, SourceSpan span, object target) { // size return 1; } public IEnumerable<string> GetMembers(TemplateContext context, SourceSpan span, object target) { yield return "size"; } public bool HasMember(TemplateContext context, SourceSpan span, object target, string member) { return member == "size"; } public bool TryGetValue(TemplateContext context, SourceSpan span, object target, string member, out object value) { if (member == "size") { value = GetLength(context, span, target); return true; } value = null; return false; } public bool TrySetValue(TemplateContext context, SourceSpan span, object target, string member, object value) { return false; } } }
bsd-2-clause
C#
7640d7800ea449775893e040cb457776ce0d1693
Fix untranslatable query
ShadowNoire/NadekoBot
NadekoBot.Core/Services/Database/Repositories/Impl/QuoteRepository.cs
NadekoBot.Core/Services/Database/Repositories/Impl/QuoteRepository.cs
using NadekoBot.Core.Services.Database.Models; using NadekoBot.Extensions; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using NadekoBot.Common; namespace NadekoBot.Core.Services.Database.Repositories.Impl { public class QuoteRepository : Repository<Quote>, IQuoteRepository { public QuoteRepository(DbContext context) : base(context) { } public IEnumerable<Quote> GetGroup(ulong guildId, int page, OrderType order) { var q = _set.AsQueryable().Where(x => x.GuildId == guildId); if (order == OrderType.Keyword) q = q.OrderBy(x => x.Keyword); else q = q.OrderBy(x => x.Id); return q.Skip(15 * page).Take(15).ToArray(); } public Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword) { var rng = new NadekoRandom(); return _set.AsQueryable() .Where(q => q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rng.Next()) .FirstOrDefaultAsync(); } public async Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text) { var rngk = new NadekoRandom(); return (await _set.AsQueryable() .Where(q => q.Text.ContainsNoCase(text, StringComparison.OrdinalIgnoreCase) && q.GuildId == guildId && q.Keyword == keyword) .ToListAsync()) .OrderBy(q => rngk.Next()) .FirstOrDefault(); } public void RemoveAllByKeyword(ulong guildId, string keyword) { _set.RemoveRange(_set.AsQueryable().Where(x => x.GuildId == guildId && x.Keyword.ToUpperInvariant() == keyword)); } } }
using NadekoBot.Core.Services.Database.Models; using NadekoBot.Extensions; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using NadekoBot.Common; namespace NadekoBot.Core.Services.Database.Repositories.Impl { public class QuoteRepository : Repository<Quote>, IQuoteRepository { public QuoteRepository(DbContext context) : base(context) { } public IEnumerable<Quote> GetGroup(ulong guildId, int page, OrderType order) { var q = _set.AsQueryable().Where(x => x.GuildId == guildId); if (order == OrderType.Keyword) q = q.OrderBy(x => x.Keyword); else q = q.OrderBy(x => x.Id); return q.Skip(15 * page).Take(15).ToArray(); } public Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword) { var rng = new NadekoRandom(); return _set.AsQueryable() .Where(q => q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rng.Next()) .FirstOrDefaultAsync(); } public Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text) { var rngk = new NadekoRandom(); return _set.AsQueryable() .Where(q => q.Text.ContainsNoCase(text, StringComparison.OrdinalIgnoreCase) && q.GuildId == guildId && q.Keyword == keyword) .OrderBy(q => rngk.Next()) .FirstOrDefaultAsync(); } public void RemoveAllByKeyword(ulong guildId, string keyword) { _set.RemoveRange(_set.AsQueryable().Where(x => x.GuildId == guildId && x.Keyword.ToUpperInvariant() == keyword)); } } }
mit
C#
2edcf11ff676a930a72ab114e6b4c4a49ae8aa99
Use timestamp properly.
vcsjones/OpenVsixSignTool
src/OpenVsixSignTool.Core/Timestamp/TimestampBuilder.netcoreapp.cs
src/OpenVsixSignTool.Core/Timestamp/TimestampBuilder.netcoreapp.cs
using System; using System.Net; using System.Net.Http; using System.Security.Cryptography; using System.Security.Cryptography.Pkcs; using System.Threading.Tasks; namespace OpenVsixSignTool.Core.Timestamp { static partial class TimestampBuilder { private static async Task<(TimestampResult, byte[])> SubmitTimestampRequest(Uri timestampUri, Oid digestOid, TimestampNonce nonce, TimeSpan timeout, byte[] digest) { var timestampRequest = Rfc3161TimestampRequest.CreateFromHash(digest, digestOid, nonce: nonce.Nonce, requestSignerCertificates: true); var encodedRequest = timestampRequest.Encode(); var client = new HttpClient { Timeout = timeout }; var content = new ByteArrayContent(encodedRequest); content.Headers.Add("Content-Type", "application/timestamp-query"); var post = await client.PostAsync(timestampUri, content); if (post.StatusCode != HttpStatusCode.OK) { return (TimestampResult.Failed, null); } var responseBytes = await post.Content.ReadAsByteArrayAsync(); var token = timestampRequest.ProcessResponse(responseBytes, out _); var tokenInfo = token.AsSignedCms().Encode(); return (TimestampResult.Success, tokenInfo); } } }
using System; using System.Net; using System.Net.Http; using System.Security.Cryptography; using System.Security.Cryptography.Pkcs; using System.Threading.Tasks; namespace OpenVsixSignTool.Core.Timestamp { static partial class TimestampBuilder { private static async Task<(TimestampResult, byte[])> SubmitTimestampRequest(Uri timestampUri, Oid digestOid, TimestampNonce nonce, TimeSpan timeout, byte[] digest) { var timestampRequest = Rfc3161TimestampRequest.CreateFromHash(digest, digestOid, nonce: nonce.Nonce, requestSignerCertificates: true); var encodedRequest = timestampRequest.Encode(); var client = new HttpClient(); var content = new ByteArrayContent(encodedRequest); content.Headers.Add("Content-Type", "application/timestamp-query"); var post = await client.PostAsync(timestampUri, content); if (post.StatusCode != HttpStatusCode.OK) { return (TimestampResult.Failed, null); } var responseBytes = await post.Content.ReadAsByteArrayAsync(); var token = timestampRequest.ProcessResponse(responseBytes, out _); var tokenInfo = token.AsSignedCms().Encode(); return (TimestampResult.Success, tokenInfo); } } }
mit
C#
bd032ff4ead9da2aceff36807d07368e83cfe69d
Check all object for ispassable
fomalsd/unitystation,Necromunger/unitystation,krille90/unitystation,Necromunger/unitystation,Necromunger/unitystation,krille90/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,Necromunger/unitystation
UnityProject/Assets/Scripts/Tilemaps/Behaviours/Layers/ObjectLayer.cs
UnityProject/Assets/Scripts/Tilemaps/Behaviours/Layers/ObjectLayer.cs
using System.Collections.Generic; using System.Linq; using UnityEngine; [ExecuteInEditMode] public class ObjectLayer : Layer { private TileList _objects; public TileList Objects => _objects ?? (_objects = new TileList()); public override void SetTile(Vector3Int position, GenericTile tile, Matrix4x4 transformMatrix) { ObjectTile objectTile = tile as ObjectTile; if (objectTile) { if (!objectTile.IsItem) { tilemap.SetTile(position, null); } objectTile.SpawnObject(position, tilemap, transformMatrix); } else { base.SetTile(position, tile, transformMatrix); } } public override bool HasTile(Vector3Int position) { return Objects.Get(position).Count > 0 || base.HasTile(position); } public override void RemoveTile(Vector3Int position) { foreach (RegisterTile obj in Objects.Get(position).ToArray()) { DestroyImmediate(obj.gameObject); } base.RemoveTile(position); } public override bool IsPassableAt(Vector3Int origin, Vector3Int to) { List<RegisterTile> objectsTo = Objects.Get<RegisterTile>(to); if (!objectsTo.All(o => o.IsPassable(origin))) { return false; } List<RegisterTile> objectsOrigin = Objects.Get<RegisterTile>(origin); return objectsOrigin.All(o => o.IsPassable(origin)) && base.IsPassableAt(origin, to); } public override bool IsPassableAt(Vector3Int position) { List<RegisterTile> objects = Objects.Get<RegisterTile>(position); return objects.All(x => x.IsPassable()) && base.IsPassableAt(position); } public override bool IsAtmosPassableAt(Vector3Int position) { RegisterTile obj = Objects.GetFirst<RegisterTile>(position); return obj ? obj.IsAtmosPassable() : base.IsAtmosPassableAt(position); } public override bool IsSpaceAt(Vector3Int position) { return IsAtmosPassableAt(position) && base.IsSpaceAt(position); } public override void ClearAllTiles() { foreach (RegisterTile obj in Objects.AllObjects) { if (obj != null) { DestroyImmediate(obj.gameObject); } } base.ClearAllTiles(); } }
using System.Collections.Generic; using System.Linq; using UnityEngine; [ExecuteInEditMode] public class ObjectLayer : Layer { private TileList _objects; public TileList Objects => _objects ?? (_objects = new TileList()); public override void SetTile(Vector3Int position, GenericTile tile, Matrix4x4 transformMatrix) { ObjectTile objectTile = tile as ObjectTile; if (objectTile) { if (!objectTile.IsItem) { tilemap.SetTile(position, null); } objectTile.SpawnObject(position, tilemap, transformMatrix); } else { base.SetTile(position, tile, transformMatrix); } } public override bool HasTile(Vector3Int position) { return Objects.Get(position).Count > 0 || base.HasTile(position); } public override void RemoveTile(Vector3Int position) { foreach (RegisterTile obj in Objects.Get(position).ToArray()) { DestroyImmediate(obj.gameObject); } base.RemoveTile(position); } public override bool IsPassableAt(Vector3Int origin, Vector3Int to) { RegisterTile objTo = Objects.GetFirst<RegisterTile>(to); if (objTo && !objTo.IsPassable(origin)) { return false; } RegisterTile objOrigin = Objects.GetFirst<RegisterTile>(origin); if (objOrigin && !objOrigin.IsPassable(to)) { return false; } return base.IsPassableAt(origin, to); } public override bool IsPassableAt(Vector3Int position) { List<RegisterTile> objects = Objects.Get<RegisterTile>(position); return objects.All(x => x.IsPassable()) && base.IsPassableAt(position); } public override bool IsAtmosPassableAt(Vector3Int position) { RegisterTile obj = Objects.GetFirst<RegisterTile>(position); return obj ? obj.IsAtmosPassable() : base.IsAtmosPassableAt(position); } public override bool IsSpaceAt(Vector3Int position) { return IsAtmosPassableAt(position) && base.IsSpaceAt(position); } public override void ClearAllTiles() { foreach (RegisterTile obj in Objects.AllObjects) { if (obj != null) { DestroyImmediate(obj.gameObject); } } base.ClearAllTiles(); } }
agpl-3.0
C#
c48d32dbd8a998bf223cb3171a56186096f667d8
clean up interface... ooppss lol
justcoding121/Titanium-Web-Proxy,titanium007/Titanium,titanium007/Titanium-Web-Proxy
src/Titanium.Web.Proxy/Models/IExternalProxy.cs
src/Titanium.Web.Proxy/Models/IExternalProxy.cs
namespace Titanium.Web.Proxy.Models { public interface IExternalProxy { /// <summary> /// Use default windows credentials? /// </summary> bool UseDefaultCredentials { get; set; } /// <summary> /// Bypass this proxy for connections to localhost? /// </summary> bool BypassLocalhost { get; set; } /// <summary> /// Username. /// </summary> string? UserName { get; set; } /// <summary> /// Password. /// </summary> string? Password { get; set; } /// <summary> /// Host name. /// </summary> string HostName { get; set; } /// <summary> /// Port. /// </summary> int Port { get; set; } string ToString(); } }
namespace Titanium.Web.Proxy.Models { public interface IExternalProxy { /// <summary> /// Use default windows credentials? /// </summary> public bool UseDefaultCredentials { get; set; } /// <summary> /// Bypass this proxy for connections to localhost? /// </summary> public bool BypassLocalhost { get; set; } /// <summary> /// Username. /// </summary> public string? UserName { get; set; } /// <summary> /// Password. /// </summary> string? Password { get; set; } /// <summary> /// Host name. /// </summary> string HostName { get; set; } /// <summary> /// Port. /// </summary> int Port { get; set; } string ToString(); } }
mit
C#
d31978f23eb1faa82faee6b7eb5fd87cf161cef4
Update publish on InMemoryEventBus to return false if it fails to publish event
Elders/Cronus,Elders/Cronus
src/Cronus.Core/Eventing/InMemoryEventBus.cs
src/Cronus.Core/Eventing/InMemoryEventBus.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Threading.Tasks; namespace Cronus.Core.Eventing { /// <summary> /// Represents an in memory event messaging destribution /// </summary> public class InMemoryEventBus : AbstractEventBus { /// <summary> /// Publishes the given event to all registered event handlers /// </summary> /// <param name="event">An event instance</param> public override bool Publish(IEvent @event) { onPublishEvent(@event); foreach (var handleMethod in handlers[@event.GetType()]) { var result = handleMethod(@event); if (result == false) return result; } onEventPublished(@event); return true; } public override Task<bool> PublishAsync(IEvent @event) { return Threading.RunAsync(() => Publish(@event)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Threading.Tasks; namespace Cronus.Core.Eventing { /// <summary> /// Represents an in memory event messaging destribution /// </summary> public class InMemoryEventBus : AbstractEventBus { /// <summary> /// Publishes the given event to all registered event handlers /// </summary> /// <param name="event">An event instance</param> public override bool Publish(IEvent @event) { onPublishEvent(@event); foreach (var handleMethod in handlers[@event.GetType()]) { handleMethod(@event); } onEventPublished(@event); return true; } public override Task<bool> PublishAsync(IEvent @event) { return Threading.RunAsync(() => Publish(@event)); } } }
apache-2.0
C#
82d9f2b0e7126640f5e2911715bc273a12cc7146
tidy up formatting
WorldWideTelescope/wwt-website,WorldWideTelescope/wwt-website,WorldWideTelescope/wwt-website
src/WWTMVC5/Views/Shared/_ContentPage.cshtml
src/WWTMVC5/Views/Shared/_ContentPage.cshtml
@{ Layout = "~/Views/Shared/_Layout.cshtml"; } @section head{ @RenderSection("head", required: false) } <div class="row"> <div class="col-md-3"> <div class="bs-sidebar" id="cellLeftNav"> <ul class="nav bs-sidenav"> @RenderSection("leftnav", required: false) </ul> </div> </div> <div class="col-md-9"> <section class="content"> @RenderBody() </section> </div> </div>
 @{ Layout = "~/Views/Shared/_Layout.cshtml"; } @section head{ @RenderSection("head", required: false) } <div class="row"> <div class="col-md-3"> <div class="bs-sidebar" id="cellLeftNav"> <ul class="nav bs-sidenav"> @RenderSection("leftnav", required: false) </ul> </div> </div> <div class="col-md-9"> <section class="content"> @RenderBody() </section> </div> </div>
mit
C#
fe216025c92236fb1e6ccce31de4ebc646ccb893
Fix bugs with the querying from the AA lsl functions.
TechplexEngineer/Aurora-Sim,TechplexEngineer/Aurora-Sim,TechplexEngineer/Aurora-Sim,TechplexEngineer/Aurora-Sim
Aurora/Services/DataService/Connectors/Local/LocalAssetConnector.cs
Aurora/Services/DataService/Connectors/Local/LocalAssetConnector.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Aurora.DataManager; using Aurora.Framework; using OpenMetaverse; using Nini.Config; using OpenSim.Framework; using Aurora.Simulation.Base; using OpenSim.Services.Interfaces; namespace Aurora.Services.DataService { public class LocalAssetConnector : IAssetConnector { private IGenericData GD = null; public void Initialize(IGenericData GenericData, IConfigSource source, IRegistryCore simBase, string defaultConnectionString) { GD = GenericData; if (source.Configs[Name] != null) defaultConnectionString = source.Configs[Name].GetString("ConnectionString", defaultConnectionString); GD.ConnectToDatabase(defaultConnectionString, "Asset", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); DataManager.DataManager.RegisterPlugin(Name+"Local", this); if (source.Configs["AuroraConnectors"].GetString("AssetConnector", "LocalConnector") == "LocalConnector") { DataManager.DataManager.RegisterPlugin(Name, this); } } public string Name { get { return "IAssetConnector"; } } public void Dispose() { } public void UpdateLSLData(string token, string key, string value) { List<string> Test = GD.Query (new string[] { "Token", "KeySetting" }, new string[] { token, key }, "lslgenericdata", "*"); if (Test.Count == 0) { GD.Insert("lslgenericdata", new string[] { token, key, value }); } else { GD.Update ("lslgenericdata", new object[] { value }, new string[] { "ValueSetting" }, new string[] { "KeySetting" }, new object[] { key }); } } public List<string> FindLSLData(string token, string key) { return GD.Query (new string[] { "Token", "KeySetting" }, new string[] { token, key }, "lslgenericdata", "*"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Aurora.DataManager; using Aurora.Framework; using OpenMetaverse; using Nini.Config; using OpenSim.Framework; using Aurora.Simulation.Base; using OpenSim.Services.Interfaces; namespace Aurora.Services.DataService { public class LocalAssetConnector : IAssetConnector { private IGenericData GD = null; public void Initialize(IGenericData GenericData, IConfigSource source, IRegistryCore simBase, string defaultConnectionString) { GD = GenericData; if (source.Configs[Name] != null) defaultConnectionString = source.Configs[Name].GetString("ConnectionString", defaultConnectionString); GD.ConnectToDatabase(defaultConnectionString, "Asset", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); DataManager.DataManager.RegisterPlugin(Name+"Local", this); if (source.Configs["AuroraConnectors"].GetString("AssetConnector", "LocalConnector") == "LocalConnector") { DataManager.DataManager.RegisterPlugin(Name, this); } } public string Name { get { return "IAssetConnector"; } } public void Dispose() { } public void UpdateLSLData(string token, string key, string value) { List<string> Test = GD.Query(new string[] { "Token", "Key" }, new string[] { token, key }, "lslgenericdata", "*"); if (Test.Count == 0) { GD.Insert("lslgenericdata", new string[] { token, key, value }); } else { GD.Update("lslgenericdata", new string[] { "Value" }, new string[] { value }, new string[] { "key" }, new string[] { key }); } } public List<string> FindLSLData(string token, string key) { return GD.Query(new string[] { "Token", "Key" }, new string[] { token, key }, "lslgenericdata", "*"); } } }
bsd-3-clause
C#
cdfa29cce50fc3a11070c05d72c9239b3d8273a4
Remove TabTypeUtilities class.
GetTabster/Tabster.Core
Types/TabType.cs
Types/TabType.cs
namespace Tabster.Core.Types { public enum TabType { Guitar, Chords, Bass, Drum, Ukulele } public static class TabTypeExtensions { public static string ToFriendlyString(this TabType type) { switch (type) { case TabType.Guitar: return "Guitar Tab"; case TabType.Chords: return "Guitar Chords"; case TabType.Bass: return "Bass Tab"; case TabType.Drum: return "Drum Tab"; case TabType.Ukulele: return "Ukulele Tab"; } return null; } } }
#region using System; #endregion namespace Tabster.Core.Types { public enum TabType { Guitar, Chords, Bass, Drum, Ukulele } public static class TabTypeUtilities { internal static readonly string[] _typeStrings = new[] {"Guitar Tab", "Guitar Chords", "Bass Tab", "Drum Tab", "Ukulele Tab"}; public static string ToFriendlyString(this TabType type) { return _typeStrings[(int) type]; } public static string[] FriendlyStrings() { return _typeStrings; } public static TabType? FromFriendlyString(string str) { for (var i = 0; i < _typeStrings.Length; i++) { var typeString = _typeStrings[i]; if (typeString.Equals(str, StringComparison.InvariantCultureIgnoreCase)) { var type = (TabType) i; return type; } } return null; } } }
apache-2.0
C#
979c4a3f6be79fe94bb7e0b0a0129e159f93df99
Enforce single responsibility principle -- decorators can implement additional functionality.
brendanjbaker/Bakery
src/Bakery/Logging/ConsoleLog.cs
src/Bakery/Logging/ConsoleLog.cs
namespace Bakery.Logging { using System; public class ConsoleLog : ILog { public void Write(Level logLevel, String message) { var textWriter = logLevel >= Level.Warning ? Console.Error : Console.Out; textWriter.WriteLine(message); } } }
namespace Bakery.Logging { using System; using Time; public class ConsoleLog : ILog { private readonly IClock clock; public ConsoleLog(IClock clock) { this.clock = clock; } public void Write(Level logLevel, String message) { const String FORMAT = "{0}: [{1}] {2}"; var textWriter = logLevel >= Level.Warning ? Console.Error : Console.Out; textWriter.WriteLine( String.Format( FORMAT, clock.GetUniversalTime().ToString(), logLevel, message)); } } }
mit
C#
e68ce5643e815210d0b8f8b622eed3aae30e74dd
Revert "restore file."
wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,grokys/Perspex,Perspex/Perspex,Perspex/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,akrisiun/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia
src/Avalonia.OpenGL/Angle/AngleEglInterface.cs
src/Avalonia.OpenGL/Angle/AngleEglInterface.cs
using System; using System.Runtime.InteropServices; using Avalonia.Platform; using Avalonia.Platform.Interop; namespace Avalonia.OpenGL.Angle { public class AngleEglInterface : EglInterface { [DllImport("libglesv2.dll", CharSet = CharSet.Ansi)] static extern IntPtr EGL_GetProcAddress(string proc); public AngleEglInterface() : base(LoadAngle()) { } static Func<string, IntPtr> LoadAngle() { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) throw new PlatformNotSupportedException(); { var disp = EGL_GetProcAddress("eglGetPlatformDisplayEXT"); if (disp == IntPtr.Zero) throw new OpenGlException("libegl.dll doesn't have eglGetPlatformDisplayEXT entry point"); return EGL_GetProcAddress; } } } }
using System; using System.Runtime.InteropServices; using Avalonia.Platform; using Avalonia.Platform.Interop; namespace Avalonia.OpenGL.Angle { public class AngleEglInterface : EglInterface { [DllImport("libegl.dll", CharSet = CharSet.Ansi)] static extern IntPtr eglGetProcAddress(string proc); public AngleEglInterface() : base(LoadAngle()) { } static Func<string, IntPtr> LoadAngle() { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) throw new PlatformNotSupportedException(); { var disp = eglGetProcAddress("eglGetPlatformDisplayEXT"); if (disp == IntPtr.Zero) throw new OpenGlException("libegl.dll doesn't have eglGetPlatformDisplayEXT entry point"); return eglGetProcAddress; } } } }
mit
C#
d1b38302a66ca5d655944b969e35029483d0e287
fix #3678 Add a constructor in the Log4NetLoggerFactory to implement the reloadOnChange feature.
aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,carldai0106/aspnetboilerplate,verdentk/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,zclmoon/aspnetboilerplate,virtualcca/aspnetboilerplate,Nongzhsh/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,beratcarsi/aspnetboilerplate,beratcarsi/aspnetboilerplate,Nongzhsh/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,andmattia/aspnetboilerplate,ilyhacker/aspnetboilerplate,Nongzhsh/aspnetboilerplate,ryancyq/aspnetboilerplate,zclmoon/aspnetboilerplate,virtualcca/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate,andmattia/aspnetboilerplate,beratcarsi/aspnetboilerplate,zclmoon/aspnetboilerplate,virtualcca/aspnetboilerplate,carldai0106/aspnetboilerplate,luchaoshuai/aspnetboilerplate,andmattia/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate
src/Abp.Castle.Log4Net/Castle/Logging/Log4Net/Log4NetLoggerFactory.cs
src/Abp.Castle.Log4Net/Castle/Logging/Log4Net/Log4NetLoggerFactory.cs
using System; using System.IO; using System.Xml; using Abp.Reflection.Extensions; using Castle.Core.Logging; using log4net; using log4net.Config; using log4net.Repository; namespace Abp.Castle.Logging.Log4Net { public class Log4NetLoggerFactory : AbstractLoggerFactory { internal const string DefaultConfigFileName = "log4net.config"; private readonly ILoggerRepository _loggerRepository; public Log4NetLoggerFactory() : this(DefaultConfigFileName) { } public Log4NetLoggerFactory(string configFileName) { _loggerRepository = LogManager.CreateRepository( typeof(Log4NetLoggerFactory).GetAssembly(), typeof(log4net.Repository.Hierarchy.Hierarchy) ); var log4NetConfig = new XmlDocument(); log4NetConfig.Load(File.OpenRead(configFileName)); XmlConfigurator.Configure(_loggerRepository, log4NetConfig["log4net"]); } public Log4NetLoggerFactory(string configFileName, bool reloadOnChange) { _loggerRepository = LogManager.CreateRepository( typeof(Log4NetLoggerFactory).GetAssembly(), typeof(log4net.Repository.Hierarchy.Hierarchy) ); if (reloadOnChange) { XmlConfigurator.ConfigureAndWatch(_loggerRepository, new FileInfo(configFileName)); } else { var log4NetConfig = new XmlDocument(); log4NetConfig.Load(File.OpenRead(configFileName)); XmlConfigurator.Configure(_loggerRepository, log4NetConfig["log4net"]); } } public override ILogger Create(string name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } return new Log4NetLogger(LogManager.GetLogger(_loggerRepository.Name, name), this); } public override ILogger Create(string name, LoggerLevel level) { throw new NotSupportedException("Logger levels cannot be set at runtime. Please review your configuration file."); } } }
using System; using System.IO; using System.Xml; using Abp.Reflection.Extensions; using Castle.Core.Logging; using log4net; using log4net.Config; using log4net.Repository; namespace Abp.Castle.Logging.Log4Net { public class Log4NetLoggerFactory : AbstractLoggerFactory { internal const string DefaultConfigFileName = "log4net.config"; private readonly ILoggerRepository _loggerRepository; public Log4NetLoggerFactory() : this(DefaultConfigFileName) { } public Log4NetLoggerFactory(string configFileName, bool reloadOnChange = false) { _loggerRepository = LogManager.CreateRepository( typeof(Log4NetLoggerFactory).GetAssembly(), typeof(log4net.Repository.Hierarchy.Hierarchy) ); if (reloadOnChange) { XmlConfigurator.ConfigureAndWatch(_loggerRepository, new FileInfo(configFileName)); } else { var log4NetConfig = new XmlDocument(); log4NetConfig.Load(File.OpenRead(configFileName)); XmlConfigurator.Configure(_loggerRepository, log4NetConfig["log4net"]); } } public override ILogger Create(string name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } return new Log4NetLogger(LogManager.GetLogger(_loggerRepository.Name, name), this); } public override ILogger Create(string name, LoggerLevel level) { throw new NotSupportedException("Logger levels cannot be set at runtime. Please review your configuration file."); } } }
mit
C#
e81f89e3f0b49a6161da347321b4493dd496423c
Add note to change the version number for both VSIX files
ericstj/nuproj,PedroLamas/nuproj,nuproj/nuproj,faustoscardovi/nuproj,kovalikp/nuproj,AArnott/nuproj,zbrad/nuproj,oliver-feng/nuproj,NN---/nuproj
src/Common/CommonAssemblyInfo.cs
src/Common/CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyCompany("Immo Landwerth")] [assembly: AssemblyProduct("NuProj")] [assembly: AssemblyCopyright("Copyright © Immo Landwerth")] [assembly: AssemblyTrademark("")] [assembly : AssemblyMetadata("PreRelease", "Beta")] [assembly : AssemblyMetadata("ProjectUrl", "http://nuproj.net")] [assembly : AssemblyMetadata("LicenseUrl", "http://nuproj.net/LICENSE")] // NOTE: When updating the version, you also need to update the Identity/@Version // attribtute in: // // src\NuProj.ProjectSystem.12\source.extension.vsixmanifest // src\NuProj.ProjectSystem.14\source.extension.vsixmanifest [assembly: AssemblyVersion("0.10.0.0")] [assembly: AssemblyFileVersion("0.10.0.0")]
using System.Reflection; [assembly: AssemblyCompany("Immo Landwerth")] [assembly: AssemblyProduct("NuProj")] [assembly: AssemblyCopyright("Copyright © Immo Landwerth")] [assembly: AssemblyTrademark("")] [assembly : AssemblyMetadata("PreRelease", "Beta")] [assembly : AssemblyMetadata("ProjectUrl", "http://nuproj.net")] [assembly : AssemblyMetadata("LicenseUrl", "http://nuproj.net/LICENSE")] // NOTE: When updating the version, you also need to update the Identity/@Version // attribtute in src\NuProj.ProjectSystem.12\source.extension.vsixmanifest. [assembly: AssemblyVersion("0.10.0.0")] [assembly: AssemblyFileVersion("0.10.0.0")]
mit
C#
ef6a975d648137cad41050d11493a7820a28f93a
Add ProtocolAttribute.WrapperType and .Name.
mono/maccore
src/Foundation/ModelAttribute.cs
src/Foundation/ModelAttribute.cs
// // Copyright 2009-2010, Novell, Inc. // // 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 MonoMac.Foundation { [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface)] public sealed class ModelAttribute : Attribute { public ModelAttribute () {} } [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface)] public sealed class ProtocolAttribute : Attribute { public ProtocolAttribute () {} public Type WrapperType { get; set; } public string Name { get; set; } } }
// // Copyright 2009-2010, Novell, Inc. // // 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 MonoMac.Foundation { [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface)] public sealed class ModelAttribute : Attribute { public ModelAttribute () {} } [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface)] public sealed class ProtocolAttribute : Attribute { public ProtocolAttribute () {} } }
apache-2.0
C#
8b40dac983c618527bb9a357d18697624f199d37
Improve test coverage for Parsed<T> by mirroring the test coverage for Error<T>.
plioi/parsley
src/Parsley.Tests/ParsedTests.cs
src/Parsley.Tests/ParsedTests.cs
namespace Parsley.Tests; class ParsedTests { public void CanIndicateSuccessfullyParsedValueAtTheCurrentPosition() { var parsed = new Parsed<string>("parsed", new(12, 34)); parsed.Success.ShouldBe(true); parsed.Value.ShouldBe("parsed"); parsed.ErrorMessages.ShouldBe(ErrorMessageList.Empty); parsed.Position.ShouldBe(new(12, 34)); } public void CanIndicatePotentialErrorMessagesAtTheCurrentPosition() { var potentialErrors = ErrorMessageList.Empty .With(ErrorMessage.Expected("A")) .With(ErrorMessage.Expected("B")); var parsed = new Parsed<object>("parsed", new(12, 34), potentialErrors); parsed.Success.ShouldBe(true); parsed.Value.ShouldBe("parsed"); parsed.ErrorMessages.ShouldBe(potentialErrors); parsed.Position.ShouldBe(new(12, 34)); } }
namespace Parsley.Tests; class ParsedTests { public void HasAParsedValue() { new Parsed<string>("parsed", new(1, 1)).Value.ShouldBe("parsed"); } public void HasNoErrorMessageByDefault() { new Parsed<string>("x", new(1, 1)).ErrorMessages.ShouldBe(ErrorMessageList.Empty); } public void CanIndicatePotentialErrors() { var potentialErrors = ErrorMessageList.Empty .With(ErrorMessage.Expected("A")) .With(ErrorMessage.Expected("B")); new Parsed<object>("x", new(1, 1), potentialErrors).ErrorMessages.ShouldBe(potentialErrors); } public void HasRemainingUnparsedInput() { var parsed = new Parsed<string>("parsed", new(12, 34)); parsed.Position.ShouldBe(new (12, 34)); } public void ReportsNonerrorState() { new Parsed<string>("parsed", new(1, 1)).Success.ShouldBeTrue(); } }
mit
C#
8bdc4e8b64b6361d81aca8cba8e820e58b8633ac
Add internal constructor AllExistingOrderStatuses
bretgourdie/stockfighter
StockFighter/API/Responses/AllExistingOrderStatuses.cs
StockFighter/API/Responses/AllExistingOrderStatuses.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace StockFighter.API.Responses { /// <summary> /// Client-facing response from querying all existing orders. /// </summary> public class AllExistingOrderStatuses : Common.APIResponse { /// <summary> /// The venue of the orders. /// </summary> public string venue { get; set; } /// <summary> /// The status of each order. /// </summary> public List<ExistingOrderStatus> orders { get; set; } internal AllExistingOrderStatuses(_allExistingOrderStatuses existingOrderStatuses) { this.venue = existingOrderStatuses.venue; this.orders = new List<ExistingOrderStatus>(); foreach (var existingOrder in existingOrderStatuses.orders) { orders.Add(new ExistingOrderStatus(existingOrder)); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace StockFighter.API.Responses { /// <summary> /// Client-facing response from querying all existing orders. /// </summary> public class AllExistingOrderStatuses : Common.APIResponse { /// <summary> /// The venue of the orders. /// </summary> public string venue { get; set; } /// <summary> /// The status of each order. /// </summary> public List<ExistingOrderStatus> orders { get; set; } } }
mit
C#
64f74ccfd560132570b2958d9af7e936c3cc9c4a
Fix accidental type conversion breakage.
nemec/clipr
clipr/Utils/ObjectTypeConverter.cs
clipr/Utils/ObjectTypeConverter.cs
using System; using System.ComponentModel; using System.Globalization; using System.Linq; namespace clipr.Utils { /// <summary> /// <para> /// A TypeConverter that allows conversion of any object to System.Object. /// Does not actually perform a conversion, just passes the value on /// through. /// </para> /// <para> /// Must be registered before parsing. /// </para> /// </summary> internal class ObjectTypeConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(String) || base.CanConvertFrom(context, sourceType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return value is string ? value : base.ConvertFrom(context, culture, value); } public override bool IsValid(ITypeDescriptorContext context, object value) { return value is string || base.IsValid(context, value); } public static void Register() { var attr = new Attribute[] { new TypeConverterAttribute(typeof(ObjectTypeConverter)) }; //TypeDescriptor.AddAttributes(typeof(object), attr); //TODO this breaks most type conversion since we override object... } } }
using System; using System.ComponentModel; using System.Globalization; using System.Linq; namespace clipr.Utils { /// <summary> /// <para> /// A TypeConverter that allows conversion of any object to System.Object. /// Does not actually perform a conversion, just passes the value on /// through. /// </para> /// <para> /// Must be registered before parsing. /// </para> /// </summary> internal class ObjectTypeConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(String) || base.CanConvertFrom(context, sourceType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return value is string ? value : base.ConvertFrom(context, culture, value); } public override bool IsValid(ITypeDescriptorContext context, object value) { return value is string || base.IsValid(context, value); } public static void Register() { var attr = new Attribute[] { new TypeConverterAttribute(typeof(ObjectTypeConverter)) }; TypeDescriptor.AddAttributes(typeof(object), attr); } } }
mit
C#
dafe5a04a988d45357b7d0cbd5a44cd282fbcca5
remove alt text to be decorative
smbc-digital/iag-webapp,smbc-digital/iag-webapp,smbc-digital/iag-webapp
src/StockportWebapp/Views/healthystockport/Shared/SubItem-List.cshtml
src/StockportWebapp/Views/healthystockport/Shared/SubItem-List.cshtml
@model StockportWebapp.Models.SubItem <li class="article-list-item article-list-item-mobile grid-33 tablet-grid-50 mobile-grid-100 matchbox-item"> <a href="@Model.NavigationLink" class="article-list-item-block grid-45 tablet-grid-45"> @if (!string.IsNullOrEmpty(Model.Image)) { <div style="margin: 0 -10px 0 -10px;"> <img src="@Model.Image" alt="" /> </div> } <div class="article-list-container"> <div class="matchbox-child"> <h2>@Model.Title</h2> <p>@Model.Teaser</p> </div> </div> </a> </li>
@model StockportWebapp.Models.SubItem <li class="article-list-item article-list-item-mobile grid-33 tablet-grid-50 mobile-grid-100 matchbox-item"> <a href="@Model.NavigationLink" class="article-list-item-block grid-45 tablet-grid-45"> @if (!string.IsNullOrEmpty(Model.Image)) { <div style="margin: 0 -10px 0 -10px;"> <img src="@Model.Image" alt="@Model.Teaser" /> </div> } <div class="article-list-container"> <div class="matchbox-child"> <h2>@Model.Title</h2> <p>@Model.Teaser</p> </div> </div> </a> </li>
mit
C#
362e7312042d7a50f8eec2fb11593714858d15fe
Hide InternalParserConfig because it shouldn't be public.
nemec/clipr
clipr/Core/VerbParserConfig.cs
clipr/Core/VerbParserConfig.cs
 namespace clipr.Core { /// <summary> /// Parsing config for a verb, includes a way to "set" the resulting /// verb on the original options object. /// </summary> public interface IVerbParserConfig: IParserConfig { /// <summary> /// Store the verb on the options objcet. /// </summary> IValueStoreDefinition Store { get; } } internal class VerbParserConfig<TVerb> : ParserConfig<TVerb>, IVerbParserConfig where TVerb : class { public VerbParserConfig(IParserConfig internalParserConfig, IValueStoreDefinition store, ParserOptions options) : base(options, null) { InternalParserConfig = internalParserConfig; Store = store; LongNameArguments = InternalParserConfig.LongNameArguments; ShortNameArguments = InternalParserConfig.ShortNameArguments; PositionalArguments = InternalParserConfig.PositionalArguments; Verbs = InternalParserConfig.Verbs; PostParseMethods = InternalParserConfig.PostParseMethods; RequiredMutuallyExclusiveArguments = InternalParserConfig.RequiredMutuallyExclusiveArguments; RequiredNamedArguments = InternalParserConfig.RequiredNamedArguments; } public IValueStoreDefinition Store { get; set; } private IParserConfig InternalParserConfig { get; set; } } }
 namespace clipr.Core { /// <summary> /// Parsing config for a verb, includes a way to "set" the resulting /// verb on the original options object. /// </summary> public interface IVerbParserConfig: IParserConfig { /// <summary> /// Store the verb on the options objcet. /// </summary> IValueStoreDefinition Store { get; } } internal class VerbParserConfig<TVerb> : ParserConfig<TVerb>, IVerbParserConfig where TVerb : class { public VerbParserConfig(IParserConfig internalParserConfig, IValueStoreDefinition store, ParserOptions options) : base(options, null) { InternalParserConfig = internalParserConfig; Store = store; LongNameArguments = InternalParserConfig.LongNameArguments; ShortNameArguments = InternalParserConfig.ShortNameArguments; PositionalArguments = InternalParserConfig.PositionalArguments; Verbs = InternalParserConfig.Verbs; PostParseMethods = InternalParserConfig.PostParseMethods; RequiredMutuallyExclusiveArguments = InternalParserConfig.RequiredMutuallyExclusiveArguments; RequiredNamedArguments = InternalParserConfig.RequiredNamedArguments; } public IValueStoreDefinition Store { get; set; } public IParserConfig InternalParserConfig { get; set; } } }
mit
C#
3cdf9e78bec7545396e319f7ff92ae99092d82d1
update app version
aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template
aspnet-core/src/AbpCompanyName.AbpProjectName.Core/AppVersionHelper.cs
aspnet-core/src/AbpCompanyName.AbpProjectName.Core/AppVersionHelper.cs
using System; using System.IO; using Abp.Reflection.Extensions; namespace AbpCompanyName.AbpProjectName { /// <summary> /// Central point for application version. /// </summary> public class AppVersionHelper { /// <summary> /// Gets current version of the application. /// It's also shown in the web page. /// </summary> public const string Version = "5.5.0.0"; /// <summary> /// Gets release (last build) date of the application. /// It's shown in the web page. /// </summary> public static DateTime ReleaseDate => LzyReleaseDate.Value; private static readonly Lazy<DateTime> LzyReleaseDate = new Lazy<DateTime>(() => new FileInfo(typeof(AppVersionHelper).GetAssembly().Location).LastWriteTime); } }
using System; using System.IO; using Abp.Reflection.Extensions; namespace AbpCompanyName.AbpProjectName { /// <summary> /// Central point for application version. /// </summary> public class AppVersionHelper { /// <summary> /// Gets current version of the application. /// It's also shown in the web page. /// </summary> public const string Version = "5.1.0.0"; /// <summary> /// Gets release (last build) date of the application. /// It's shown in the web page. /// </summary> public static DateTime ReleaseDate => LzyReleaseDate.Value; private static readonly Lazy<DateTime> LzyReleaseDate = new Lazy<DateTime>(() => new FileInfo(typeof(AppVersionHelper).GetAssembly().Location).LastWriteTime); } }
mit
C#
32480909dd0b11b81257e8cf9f3ad8e0c2e03c1a
Add Progress set to TextAdvance
NitorInc/NitoriWare,Barleytree/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare
Assets/Scripts/UI/AdvancingText.cs
Assets/Scripts/UI/AdvancingText.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.Events; using TMPro; public class AdvancingText : MonoBehaviour { [SerializeField] private float advanceSpeed; [SerializeField] private UnityEvent onComplete; private bool isComplete; public bool IsComplete => isComplete; private TMP_Text textMeshProComponent; private float progress; public float Progress { get { return progress; } set { progress = value; updateChars(); } } void Awake() { textMeshProComponent = GetComponent<TMP_Text>(); } void Start () { resetAdvance(); } public void resetAdvance() { isComplete = false; progress = 0f; setVisibleChars(0); } void Update () { if (progress < getTotalVisibleChars(false)) updateText(); } void updateText() { var totalVisibleChars = getTotalVisibleChars(false); progress = Mathf.MoveTowards(progress, totalVisibleChars, Time.deltaTime * advanceSpeed); updateChars(); } void updateChars() { setVisibleChars((int)Mathf.Floor(progress)); if (progress >= getTotalVisibleChars(false)) { isComplete = true; onComplete.Invoke(); } } public float getAdvanceSpeed() { return advanceSpeed; } public void setAdvanceSpeed(float speed) { advanceSpeed = speed; } void setVisibleChars(int amount) { textMeshProComponent.maxVisibleCharacters = amount; } public int getVisibleChars() { return textMeshProComponent.maxVisibleCharacters; } public int getTotalVisibleChars(bool forceMeshUpdate = true) { if (forceMeshUpdate) textMeshProComponent.ForceMeshUpdate(); return textMeshProComponent.GetParsedText().Length; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.Events; using TMPro; public class AdvancingText : MonoBehaviour { [SerializeField] private float advanceSpeed; [SerializeField] private UnityEvent onComplete; private bool isComplete; public bool IsComplete => isComplete; private TMP_Text textMeshProComponent; private float progress; void Awake() { textMeshProComponent = GetComponent<TMP_Text>(); } void Start () { resetAdvance(); } public void resetAdvance() { isComplete = false; progress = 0f; setVisibleChars(0); } void Update () { if (progress < getTotalVisibleChars(false)) updateText(); } void updateText() { var totalVisibleChars = getTotalVisibleChars(false); progress = Mathf.MoveTowards(progress, totalVisibleChars, Time.deltaTime * advanceSpeed); setVisibleChars((int)Mathf.Floor(progress)); if (progress >= totalVisibleChars) { isComplete = true; onComplete.Invoke(); } } public float getAdvanceSpeed() { return advanceSpeed; } public void setAdvanceSpeed(float speed) { advanceSpeed = speed; } void setVisibleChars(int amount) { textMeshProComponent.maxVisibleCharacters = amount; } public float Progress => progress; public int getVisibleChars() { return textMeshProComponent.maxVisibleCharacters; } public int getTotalVisibleChars(bool forceMeshUpdate = true) { if (forceMeshUpdate) textMeshProComponent.ForceMeshUpdate(); return textMeshProComponent.GetParsedText().Length; } }
mit
C#
893ec687c0c712ee3aa2a0148b07558e6be039c1
fix test
quezlatch/Binky
Binky.Tests/old_values_in_cache.cs
Binky.Tests/old_values_in_cache.cs
using System; using System.Threading; using Xunit; namespace Binky.Tests { public class old_values_in_cache : IDisposable { readonly Cache<string, DateTime> _cache; int _count; public old_values_in_cache() { _cache = CacheBuilder .With<string, DateTime>(key => { _count++; return DateTime.Now; }) .RefreshEvery(TimeSpan.FromMilliseconds(200)) .EvictUnused() .Preload("a") .Build(); } [Fact] public void can_be_evicted_if_they_have_not_been_retrieved_since_the_last_refresh() { _cache.Get("a"); Thread.Sleep(1000); Assert.Equal(1, _count); } public void Dispose() { _cache.Dispose(); } } }
using System; using System.Threading; using Xunit; namespace Binky.Tests { public class old_values_in_cache : IDisposable { readonly Cache<string, DateTime> _cache; int _count; public old_values_in_cache() { _cache = CacheBuilder .With<string, DateTime>(key => { _count++; return DateTime.Now; }) .RefreshEvery(TimeSpan.FromMilliseconds(200)) .EvictUnused() .Preload("a", "b") .Build(); } [Fact] public void can_be_evicted_if_they_have_not_been_retrieved_since_the_last_refresh() { _cache.Get("a"); Thread.Sleep(1000); Assert.Equal(1, _count); } public void Dispose() { _cache.Dispose(); } } }
mit
C#
7217db50f343d4ccd8d14debb507b322117103da
Fix ICommandDispatcher
Vtek/Bartender
src/Bartender/ICommandDispatcher.cs
src/Bartender/ICommandDispatcher.cs
namespace Bartender { /// <summary> /// Define a command dispatcher /// </summary> public interface ICommandDispatcher { /// <summary> /// Dispatch a command /// </summary> /// <param name="command">Command to dispatch</param> /// <returns>Result</returns> TResult Dispatch<TCommand, TResult>(TCommand command) where TCommand : ICommand; /// <summary> /// Dispatch the specified command. /// </summary> /// <param name="command">Command.</param> void Dispatch<TCommand>(TCommand command) where TCommand : ICommand; } }
namespace Cheers.Cqrs.Write { /// <summary> /// Define a command dispatcher /// </summary> public interface ICommandDispatcher { /// <summary> /// Dispatch a command /// </summary> /// <param name="command">Command to dispatch</param> /// <returns>Result</returns> TResult Dispatch<TCommand, TResult>(TCommand command) where TCommand : ICommand where TResult : IResult; /// <summary> /// Dispatch the specified command. /// </summary> /// <param name="command">Command.</param> void Dispatch<TCommand>(TCommand command) where TCommand : ICommand; } }
mit
C#
4f181bae5dbc4a6841fb2f89bd3a1c45058b5500
Add missing 'else'
sean-gilliam/msbuild,AndyGerlicher/msbuild,AndyGerlicher/msbuild,rainersigwald/msbuild,sean-gilliam/msbuild,sean-gilliam/msbuild,rainersigwald/msbuild,rainersigwald/msbuild,rainersigwald/msbuild,AndyGerlicher/msbuild,sean-gilliam/msbuild,AndyGerlicher/msbuild
src/Build/Globbing/CompositeGlob.cs
src/Build/Globbing/CompositeGlob.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; namespace Microsoft.Build.Globbing { /// <summary> /// A Composite glob /// </summary> public class CompositeGlob : IMSBuildGlob { /// <summary> /// The direct children of this composite /// </summary> public IEnumerable<IMSBuildGlob> Globs { get; } /// <summary> /// Constructor /// </summary> /// <param name="globs">Children globs. Input gets shallow cloned</param> public CompositeGlob(IEnumerable<IMSBuildGlob> globs) { // ImmutableArray also does this check, but copied it here just in case they remove it if (globs is ImmutableArray<IMSBuildGlob> immutableGlobs) { Globs = immutableGlobs; } else { Globs = globs.ToImmutableArray(); } } /// <summary> /// Constructor /// </summary> /// <param name="globs">Children globs. Input gets shallow cloned</param> public CompositeGlob(params IMSBuildGlob[] globs) : this(globs.ToImmutableArray()) {} /// <inheritdoc /> public bool IsMatch(string stringToMatch) { // Threadpools are a scarce resource in Visual Studio, do not use them. //return Globs.AsParallel().Any(g => g.IsMatch(stringToMatch)); return Globs.Any(g => g.IsMatch(stringToMatch)); } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; namespace Microsoft.Build.Globbing { /// <summary> /// A Composite glob /// </summary> public class CompositeGlob : IMSBuildGlob { /// <summary> /// The direct children of this composite /// </summary> public IEnumerable<IMSBuildGlob> Globs { get; } /// <summary> /// Constructor /// </summary> /// <param name="globs">Children globs. Input gets shallow cloned</param> public CompositeGlob(IEnumerable<IMSBuildGlob> globs) { // ImmutableArray also does this check, but copied it here just in case they remove it if (globs is ImmutableArray<IMSBuildGlob> immutableGlobs) { Globs = immutableGlobs; } Globs = globs.ToImmutableArray(); } /// <summary> /// Constructor /// </summary> /// <param name="globs">Children globs. Input gets shallow cloned</param> public CompositeGlob(params IMSBuildGlob[] globs) : this(globs.ToImmutableArray()) {} /// <inheritdoc /> public bool IsMatch(string stringToMatch) { // Threadpools are a scarce resource in Visual Studio, do not use them. //return Globs.AsParallel().Any(g => g.IsMatch(stringToMatch)); return Globs.Any(g => g.IsMatch(stringToMatch)); } } }
mit
C#
3c7b03ca7a2c68785e5ece20c3d882e71d7de71e
Fix LanguageDepotProject credentials to match MongoDB
sillsdev/LfMerge,ermshiperete/LfMerge,ermshiperete/LfMerge,ermshiperete/LfMerge,sillsdev/LfMerge,sillsdev/LfMerge
src/LfMerge/LanguageDepotProject.cs
src/LfMerge/LanguageDepotProject.cs
// Copyright (c) 2015 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Linq; using MongoDB.Bson; using MongoDB.Driver; namespace LfMerge { public class LanguageDepotProject: ILanguageDepotProject { private ILfMergeSettings Settings { get; set; } // TODO: Need to grab a MongoConnection as well public LanguageDepotProject(ILfMergeSettings settings) { Settings = settings; } public void Initialize(string lfProjectCode) { // TODO: This should use the MongoConnection class instead MongoClient client = new MongoClient("mongodb://" + Settings.MongoDbHostNameAndPort); IMongoDatabase database = client.GetDatabase("scriptureforge"); IMongoCollection<BsonDocument> projectCollection = database.GetCollection<BsonDocument>("projects"); //var userCollection = database.GetCollection<BsonDocument>("users"); var projectFilter = new BsonDocument("projectCode", lfProjectCode); var list = projectCollection.Find(projectFilter).ToList(); var project = list.FirstOrDefault(); if (project == null) throw new ArgumentException("Can't find project code", "lfProjectCode"); BsonValue value, srProjectValue; if (project.TryGetValue("sendReceiveProject", out srProjectValue) && (srProjectValue.AsBsonDocument.TryGetValue("identifier", out value))) ProjectCode = value.AsString; // TODO: need to get S/R server (language depot public, language depot private, custom, etc). if (project.TryGetValue("sendReceiveUsername", out value)) Username = value.AsString; if (project.TryGetValue("sendReceivePassword", out value)) Password = value.AsString; } public string Username { get; private set; } public string Password { get; private set; } public string ProjectCode { get; private set; } } }
// Copyright (c) 2015 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Linq; using MongoDB.Bson; using MongoDB.Driver; namespace LfMerge { public class LanguageDepotProject: ILanguageDepotProject { private ILfMergeSettings Settings { get; set; } // TODO: Need to grab a MongoConnection as well public LanguageDepotProject(ILfMergeSettings settings) { Settings = settings; } public void Initialize(string lfProjectCode) { // TODO: This should use the MongoConnection class instead MongoClient client = new MongoClient("mongodb://" + Settings.MongoDbHostNameAndPort); IMongoDatabase database = client.GetDatabase("scriptureforge"); IMongoCollection<BsonDocument> projectCollection = database.GetCollection<BsonDocument>("projects"); //var userCollection = database.GetCollection<BsonDocument>("users"); var projectFilter = new BsonDocument("projectCode", lfProjectCode); var list = projectCollection.Find(projectFilter).ToList(); var project = list.FirstOrDefault(); if (project == null) throw new ArgumentException("Can't find project code", "lfProjectCode"); BsonValue value; if (project.TryGetValue("ldProjectCode", out value)) ProjectCode = value.AsString; // TODO: need to get S/R server (language depot public, language depot private, custom, etc). // TODO: ldUsername and ldPassword should come from the users collection if (project.TryGetValue("ldUsername", out value)) Username = value.AsString; if (project.TryGetValue("ldPassword", out value)) Password = value.AsString; } public string Username { get; private set; } public string Password { get; private set; } public string ProjectCode { get; private set; } } }
mit
C#
03576d389de874c000d9893968f49bc48f28fab2
Update IRouteResolver.cs
joebuschmann/Nancy,grumpydev/Nancy,daniellor/Nancy,xt0rted/Nancy,dbabox/Nancy,AlexPuiu/Nancy,charleypeng/Nancy,tparnell8/Nancy,daniellor/Nancy,nicklv/Nancy,SaveTrees/Nancy,SaveTrees/Nancy,adamhathcock/Nancy,tsdl2013/Nancy,sroylance/Nancy,Worthaboutapig/Nancy,danbarua/Nancy,murador/Nancy,guodf/Nancy,phillip-haydon/Nancy,anton-gogolev/Nancy,duszekmestre/Nancy,malikdiarra/Nancy,MetSystem/Nancy,daniellor/Nancy,Novakov/Nancy,malikdiarra/Nancy,AlexPuiu/Nancy,phillip-haydon/Nancy,ccellar/Nancy,sloncho/Nancy,charleypeng/Nancy,sadiqhirani/Nancy,EIrwin/Nancy,Worthaboutapig/Nancy,tparnell8/Nancy,adamhathcock/Nancy,malikdiarra/Nancy,duszekmestre/Nancy,albertjan/Nancy,jongleur1983/Nancy,NancyFx/Nancy,sroylance/Nancy,horsdal/Nancy,jmptrader/Nancy,duszekmestre/Nancy,vladlopes/Nancy,dbolkensteyn/Nancy,lijunle/Nancy,rudygt/Nancy,tsdl2013/Nancy,anton-gogolev/Nancy,VQComms/Nancy,albertjan/Nancy,thecodejunkie/Nancy,grumpydev/Nancy,damianh/Nancy,cgourlay/Nancy,hitesh97/Nancy,horsdal/Nancy,wtilton/Nancy,dbabox/Nancy,EliotJones/NancyTest,AcklenAvenue/Nancy,jongleur1983/Nancy,Crisfole/Nancy,tsdl2013/Nancy,fly19890211/Nancy,EliotJones/NancyTest,tareq-s/Nancy,ccellar/Nancy,rudygt/Nancy,jeff-pang/Nancy,AcklenAvenue/Nancy,guodf/Nancy,jeff-pang/Nancy,ayoung/Nancy,duszekmestre/Nancy,Novakov/Nancy,sadiqhirani/Nancy,nicklv/Nancy,MetSystem/Nancy,thecodejunkie/Nancy,nicklv/Nancy,horsdal/Nancy,charleypeng/Nancy,jonathanfoster/Nancy,vladlopes/Nancy,sroylance/Nancy,jchannon/Nancy,ayoung/Nancy,malikdiarra/Nancy,felipeleusin/Nancy,danbarua/Nancy,tparnell8/Nancy,wtilton/Nancy,phillip-haydon/Nancy,khellang/Nancy,Novakov/Nancy,jongleur1983/Nancy,davidallyoung/Nancy,AIexandr/Nancy,asbjornu/Nancy,horsdal/Nancy,AlexPuiu/Nancy,tareq-s/Nancy,lijunle/Nancy,sloncho/Nancy,guodf/Nancy,Crisfole/Nancy,dbolkensteyn/Nancy,ayoung/Nancy,rudygt/Nancy,AIexandr/Nancy,jonathanfoster/Nancy,EIrwin/Nancy,albertjan/Nancy,jmptrader/Nancy,nicklv/Nancy,daniellor/Nancy,NancyFx/Nancy,VQComms/Nancy,rudygt/Nancy,sroylance/Nancy,vladlopes/Nancy,davidallyoung/Nancy,MetSystem/Nancy,adamhathcock/Nancy,dbabox/Nancy,jchannon/Nancy,blairconrad/Nancy,ccellar/Nancy,SaveTrees/Nancy,adamhathcock/Nancy,sadiqhirani/Nancy,damianh/Nancy,dbolkensteyn/Nancy,guodf/Nancy,jeff-pang/Nancy,SaveTrees/Nancy,jchannon/Nancy,tareq-s/Nancy,jmptrader/Nancy,felipeleusin/Nancy,damianh/Nancy,EliotJones/NancyTest,asbjornu/Nancy,cgourlay/Nancy,EIrwin/Nancy,JoeStead/Nancy,wtilton/Nancy,asbjornu/Nancy,VQComms/Nancy,cgourlay/Nancy,grumpydev/Nancy,asbjornu/Nancy,murador/Nancy,Crisfole/Nancy,NancyFx/Nancy,NancyFx/Nancy,jmptrader/Nancy,wtilton/Nancy,davidallyoung/Nancy,charleypeng/Nancy,tparnell8/Nancy,felipeleusin/Nancy,jchannon/Nancy,AcklenAvenue/Nancy,dbabox/Nancy,danbarua/Nancy,ayoung/Nancy,JoeStead/Nancy,jonathanfoster/Nancy,AIexandr/Nancy,jongleur1983/Nancy,joebuschmann/Nancy,dbolkensteyn/Nancy,Worthaboutapig/Nancy,davidallyoung/Nancy,AIexandr/Nancy,tareq-s/Nancy,khellang/Nancy,felipeleusin/Nancy,lijunle/Nancy,fly19890211/Nancy,cgourlay/Nancy,thecodejunkie/Nancy,AlexPuiu/Nancy,tsdl2013/Nancy,EliotJones/NancyTest,blairconrad/Nancy,sadiqhirani/Nancy,anton-gogolev/Nancy,jeff-pang/Nancy,danbarua/Nancy,albertjan/Nancy,charleypeng/Nancy,hitesh97/Nancy,xt0rted/Nancy,fly19890211/Nancy,jchannon/Nancy,murador/Nancy,phillip-haydon/Nancy,khellang/Nancy,JoeStead/Nancy,Worthaboutapig/Nancy,jonathanfoster/Nancy,AIexandr/Nancy,fly19890211/Nancy,hitesh97/Nancy,AcklenAvenue/Nancy,grumpydev/Nancy,blairconrad/Nancy,VQComms/Nancy,joebuschmann/Nancy,vladlopes/Nancy,asbjornu/Nancy,ccellar/Nancy,sloncho/Nancy,joebuschmann/Nancy,murador/Nancy,davidallyoung/Nancy,blairconrad/Nancy,xt0rted/Nancy,VQComms/Nancy,khellang/Nancy,xt0rted/Nancy,lijunle/Nancy,Novakov/Nancy,thecodejunkie/Nancy,sloncho/Nancy,hitesh97/Nancy,MetSystem/Nancy,anton-gogolev/Nancy,JoeStead/Nancy,EIrwin/Nancy
src/Nancy/Routing/IRouteResolver.cs
src/Nancy/Routing/IRouteResolver.cs
namespace Nancy.Routing { /// <summary> /// Returns a route that matches the request /// </summary> public interface IRouteResolver { /// <summary> /// Gets the route, and the corresponding parameter dictionary from the URL /// </summary> /// <param name="context">Current context</param> /// <returns>A <see cref="ResolveResult"> containing the resolved route information.</returns> ResolveResult Resolve(NancyContext context); } }
namespace Nancy.Routing { /// <summary> /// Returns a route that matches the request /// </summary> public interface IRouteResolver { /// <summary> /// Gets the route, and the corresponding parameter dictionary from the URL /// </summary> /// <param name="context">Current context</param> /// <returns>Tuple - Item1 being the Route, Item2 being the parameters dictionary, Item3 being the prereq, Item4 being the postreq, Item5 being the error handler</returns> ResolveResult Resolve(NancyContext context); } }
mit
C#